Hi, On Sun, Mar 29, 2009 at 11:32, Joseph S. Myers <jos...@codesourcery.com> wrote: > I can confirm that PPL now builds successfully for i686-mingw32 host. The > next problem is that CLooG (the tarball in the infrastructure directory) > doesn't appear portable to this system (in the secondary platforms list > for 4.4 and 4.5); I get: > > source/program.c:42:27: error: sys/resource.h: No such file or directory > ... > source/program.c:674: error: 'RUSAGE_SELF' undeclared (first use in this > function) > ... > > This does not appear to be a cross build problem; it appears this file > uses this header, not available on MinGW, unconditionally with no > configure checks. >
I committed the attached fix to the cloog-ppl repo, and I will prepare a new tar.gz for the gcc infrastructure. Sebastian Pop -- AMD - GNU Tools
diff --git a/configure.in b/configure.in index 03f280a..6c27749 100644 --- a/configure.in +++ b/configure.in @@ -103,6 +103,8 @@ AC_HEADER_STDC dnl Checks for library functions. AC_CHECK_FUNCS(strtol) +AC_CHECK_HEADER(sys/resource.h,[AC_DEFINE(HAS_SYS_RESOURCE_H)], + [AC_MSG_RESULT([no])]) dnl /************************************************************************** dnl * Option setting * diff --git a/include/cloog/cloog-config.h.in b/include/cloog/cloog-config.h.in index ba2c92c..01429f4 100644 --- a/include/cloog/cloog-config.h.in +++ b/include/cloog/cloog-config.h.in @@ -1,2 +1,3 @@ #undef LINEAR_VALUE_IS_MP #undef CLOOG_PPL_BACKEND +#undef HAS_SYS_RESOURCE_H diff --git a/source/program.c b/source/program.c index 7814fa1..0587308 100644 --- a/source/program.c +++ b/source/program.c @@ -39,7 +39,6 @@ # include <sys/types.h> # include <sys/time.h> -# include <sys/resource.h> #include <stdarg.h> # include <stdlib.h> # include <stdio.h> @@ -47,6 +46,9 @@ # include <ctype.h> # include <unistd.h> # include "../include/cloog/cloog.h" +#ifdef HAS_SYS_RESOURCE_H +# include <sys/resource.h> +#endif /****************************************************************************** @@ -614,7 +616,9 @@ CloogProgram * cloog_program_malloc (void) */ CloogProgram * cloog_program_generate(CloogProgram *program, CloogOptions *options) { float time ; +#ifdef HAS_SYS_RESOURCE_H struct rusage start, end ; +#endif CloogLoop * loop ; #ifdef CLOOG_MEMORY char status_path[MAX_STRING_VAL] ; @@ -671,7 +675,10 @@ CloogProgram * cloog_program_generate(CloogProgram *program, CloogOptions *optio } } +#ifdef HAS_SYS_RESOURCE_H getrusage(RUSAGE_SELF, &start) ; +#endif + if (cloog_program_loop (program)) { loop = cloog_program_loop (program) ; @@ -699,12 +706,14 @@ CloogProgram * cloog_program_generate(CloogProgram *program, CloogOptions *optio cloog_program_set_loop (program, loop); } +#ifdef HAS_SYS_RESOURCE_H getrusage(RUSAGE_SELF, &end) ; /* We calculate the time spent in code generation. */ time = (end.ru_utime.tv_usec - start.ru_utime.tv_usec)/(float)(MEGA) ; time += (float)(end.ru_utime.tv_sec - start.ru_utime.tv_sec) ; options->time = time ; - +#endif + return program ; }