Janne Blomqvist wrote: > * io/unix.c (set_close_on_exec): New function.
Since this patch, most Fortran tests fail on spu-elf since the system libraries do not support fcntl on the SPU. The patch below fixes this by using an autoconf check to verify fcntl is present before using it, as is already done for many other routines in io/unix.c. Tested on spu-elf, fixes the Fortran problems there. Also verified on an older powerpc64-linux build that we still use fcntl there. OK for mainline? Bye, Ulrich ChangeLog: * configure.ac: Check for presence of fcntl. * configure: Regenerate. * config.h.in: Regenerate. * io/unix.c (set_close_on_exec): Check for HAVE_FCNTL. Index: libgfortran/io/unix.c =================================================================== *** libgfortran/io/unix.c (revision 208613) --- libgfortran/io/unix.c (working copy) *************** static void __attribute__ ((unused)) *** 1077,1083 **** set_close_on_exec (int fd __attribute__ ((unused))) { /* Mingw does not define F_SETFD. */ ! #if defined(F_SETFD) && defined(FD_CLOEXEC) if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC); #endif --- 1077,1083 ---- set_close_on_exec (int fd __attribute__ ((unused))) { /* Mingw does not define F_SETFD. */ ! #if defined(HAVE_FCNTL) && defined(F_SETFD) && defined(FD_CLOEXEC) if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC); #endif Index: libgfortran/configure.ac =================================================================== *** libgfortran/configure.ac (revision 208613) --- libgfortran/configure.ac (working copy) *************** if test "x${with_newlib}" = "xyes"; then *** 282,288 **** else AC_CHECK_FUNCS_ONCE(getrusage times mkstemp strtof strtold snprintf \ ftruncate chsize chdir getlogin gethostname kill link symlink sleep ttyname \ ! alarm access fork execl wait setmode execve pipe dup2 close \ strcasestr getrlimit gettimeofday stat fstat lstat getpwuid vsnprintf dup \ getcwd localtime_r gmtime_r getpwuid_r ttyname_r clock_gettime \ readlink getgid getpid getppid getuid geteuid umask getegid \ --- 282,288 ---- else AC_CHECK_FUNCS_ONCE(getrusage times mkstemp strtof strtold snprintf \ ftruncate chsize chdir getlogin gethostname kill link symlink sleep ttyname \ ! alarm access fork execl wait setmode execve pipe dup2 close fcntl \ strcasestr getrlimit gettimeofday stat fstat lstat getpwuid vsnprintf dup \ getcwd localtime_r gmtime_r getpwuid_r ttyname_r clock_gettime \ readlink getgid getpid getppid getuid geteuid umask getegid \ Index: libgfortran/config.h.in =================================================================== *** libgfortran/config.h.in (revision 208613) --- libgfortran/config.h.in (working copy) *************** *** 360,365 **** --- 360,368 ---- /* Define to 1 if you have the `fabsl' function. */ #undef HAVE_FABSL + /* Define to 1 if you have the `fcntl' function. */ + #undef HAVE_FCNTL + /* libm includes feenableexcept */ #undef HAVE_FEENABLEEXCEPT Index: libgfortran/configure =================================================================== *** libgfortran/configure (revision 208613) --- libgfortran/configure (working copy) *************** as_fn_append ac_func_list " execve" *** 2572,2577 **** --- 2572,2578 ---- as_fn_append ac_func_list " pipe" as_fn_append ac_func_list " dup2" as_fn_append ac_func_list " close" + as_fn_append ac_func_list " fcntl" as_fn_append ac_func_list " strcasestr" as_fn_append ac_func_list " getrlimit" as_fn_append ac_func_list " gettimeofday" *************** else *** 12342,12348 **** lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF ! #line 12345 "configure" #include "confdefs.h" #if HAVE_DLFCN_H --- 12343,12349 ---- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF ! #line 12346 "configure" #include "confdefs.h" #if HAVE_DLFCN_H *************** else *** 12448,12454 **** lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF ! #line 12451 "configure" #include "confdefs.h" #if HAVE_DLFCN_H --- 12449,12455 ---- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF ! #line 12452 "configure" #include "confdefs.h" #if HAVE_DLFCN_H *************** done *** 16602,16607 **** --- 16603,16610 ---- + + fi # Check strerror_r, cannot be above as versions with two and three arguments exist -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain ulrich.weig...@de.ibm.com