aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2011-11-09 20:25:58 +0200
committerJanne Blomqvist <jb@gcc.gnu.org>2011-11-09 20:25:58 +0200
commit745443787599147145baf2c0cdfe8ef463944a9c (patch)
tree8b9c2e9bcc9e893681a7abd25852a18d141f8f6d /libgfortran
parent4b6245331eca422062484f2f92f3bd8b4f868804 (diff)
downloadgcc-745443787599147145baf2c0cdfe8ef463944a9c.zip
gcc-745443787599147145baf2c0cdfe8ef463944a9c.tar.gz
gcc-745443787599147145baf2c0cdfe8ef463944a9c.tar.bz2
Configure cleanup.
2011-11-09 Janne Blomqvist <jb@gcc.gnu.org> * configure.ac (AC_STDC_HEADERS): Remove. (AC_HEADER_TIME): Remove. (AC_HAVE_HEADERS, AC_CHECK_HEADERS): Move into a single invocation of AC_CHECK_HEADERS_ONCE, don't check for presence of C89 headers. (AC_CHECK_MEMBERS): Use single invocation. (AC_CHECK_FUNCS): Move into single invocation of AC_CHEC_FUNCS_ONCE, don't check for presence of C89 functions. * config.h.in: Regenerate. * configure: Regenerate. * intrinsics/clock.c: Include time.h. (mclock): Assume clock() is present. (mclock8): Likewise. * intrinsics/ctime.c (strctime): Assume strftime is present. (fdate): Assume time() is present. (fdate_sub): Likewise. (ctime): Likewise. * intrinsics/date_and_time.c: Don't provide abs macro. (HAVE_NO_DATE_TIME): Remove code related to macro which is never set. * intrinsics/execute_command_line.c: Assume stdlib.h is present. * intrinsics/exit.c: Likewise. * intrinsics/extends_type_of.c: Likewise. * intrinsics/gerror.c: Assume strerror() is present. * intrinsics/kill.c: Assume signal.h is present. * intrinsics/malloc.c: Assume stdlib.h is present. * intrinsics/move_alloc.c: Likewise. * intrinsics/perror.c: Assume perror() is present. * intrinsics/signal.c: Assume signal.h is present. * intrinsics/stat.c: Assume stdlib.h is present. * intrinsics/system.c: Likewise. * intrinsics/time.c: Include time.h, assume time() is present. * intrinsics/time_1.h: Conditionally include sys/time.h, unconditionally time.h. (gf_cputime): Do division in double, fallback using clock(). (gf_gettime): Assume time() is present. * intrinsics/umask.c: Assume stdlib.h is present. * runtime/backtrace.c: Likewise. * runtime/compile_options.c: Assume signal.h is present, assume C89 signals are present. * runtime/error.c: Assume signal.h and stdlib.h are present. From-SVN: r181227
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog43
-rw-r--r--libgfortran/config.h.in48
-rwxr-xr-xlibgfortran/configure600
-rw-r--r--libgfortran/configure.ac37
-rw-r--r--libgfortran/intrinsics/clock.c26
-rw-r--r--libgfortran/intrinsics/ctime.c20
-rw-r--r--libgfortran/intrinsics/date_and_time.c28
-rw-r--r--libgfortran/intrinsics/execute_command_line.c6
-rw-r--r--libgfortran/intrinsics/exit.c8
-rw-r--r--libgfortran/intrinsics/extends_type_of.c7
-rw-r--r--libgfortran/intrinsics/gerror.c6
-rw-r--r--libgfortran/intrinsics/kill.c8
-rw-r--r--libgfortran/intrinsics/malloc.c8
-rw-r--r--libgfortran/intrinsics/move_alloc.c8
-rw-r--r--libgfortran/intrinsics/perror.c6
-rw-r--r--libgfortran/intrinsics/signal.c26
-rw-r--r--libgfortran/intrinsics/stat.c7
-rw-r--r--libgfortran/intrinsics/system.c7
-rw-r--r--libgfortran/intrinsics/time.c20
-rw-r--r--libgfortran/intrinsics/time_1.h39
-rw-r--r--libgfortran/intrinsics/umask.c7
-rw-r--r--libgfortran/io/intrinsics.c5
-rw-r--r--libgfortran/runtime/backtrace.c1
-rw-r--r--libgfortran/runtime/compile_options.c24
-rw-r--r--libgfortran/runtime/error.c7
25 files changed, 265 insertions, 737 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 6d1f1cd8..f299ccb 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,5 +1,48 @@
2011-11-09 Janne Blomqvist <jb@gcc.gnu.org>
+ * configure.ac (AC_STDC_HEADERS): Remove.
+ (AC_HEADER_TIME): Remove.
+ (AC_HAVE_HEADERS, AC_CHECK_HEADERS): Move into a single invocation
+ of AC_CHECK_HEADERS_ONCE, don't check for presence of C89 headers.
+ (AC_CHECK_MEMBERS): Use single invocation.
+ (AC_CHECK_FUNCS): Move into single invocation of
+ AC_CHEC_FUNCS_ONCE, don't check for presence of C89 functions.
+ * config.h.in: Regenerate.
+ * configure: Regenerate.
+ * intrinsics/clock.c: Include time.h.
+ (mclock): Assume clock() is present.
+ (mclock8): Likewise.
+ * intrinsics/ctime.c (strctime): Assume strftime is present.
+ (fdate): Assume time() is present.
+ (fdate_sub): Likewise.
+ (ctime): Likewise.
+ * intrinsics/date_and_time.c: Don't provide abs macro.
+ (HAVE_NO_DATE_TIME): Remove code related to macro which is never
+ set.
+ * intrinsics/execute_command_line.c: Assume stdlib.h is present.
+ * intrinsics/exit.c: Likewise.
+ * intrinsics/extends_type_of.c: Likewise.
+ * intrinsics/gerror.c: Assume strerror() is present.
+ * intrinsics/kill.c: Assume signal.h is present.
+ * intrinsics/malloc.c: Assume stdlib.h is present.
+ * intrinsics/move_alloc.c: Likewise.
+ * intrinsics/perror.c: Assume perror() is present.
+ * intrinsics/signal.c: Assume signal.h is present.
+ * intrinsics/stat.c: Assume stdlib.h is present.
+ * intrinsics/system.c: Likewise.
+ * intrinsics/time.c: Include time.h, assume time() is present.
+ * intrinsics/time_1.h: Conditionally include sys/time.h,
+ unconditionally time.h.
+ (gf_cputime): Do division in double, fallback using clock().
+ (gf_gettime): Assume time() is present.
+ * intrinsics/umask.c: Assume stdlib.h is present.
+ * runtime/backtrace.c: Likewise.
+ * runtime/compile_options.c: Assume signal.h is present, assume
+ C89 signals are present.
+ * runtime/error.c: Assume signal.h and stdlib.h are present.
+
+2011-11-09 Janne Blomqvist <jb@gcc.gnu.org>
+
PR fortran/46686
* runtime/backtrace.c (show_backtrace): Fix incorrect comment.
diff --git a/libgfortran/config.h.in b/libgfortran/config.h.in
index 9333f64..81a4a7f 100644
--- a/libgfortran/config.h.in
+++ b/libgfortran/config.h.in
@@ -198,9 +198,6 @@
/* Define to 1 if you have the `chsize' function. */
#undef HAVE_CHSIZE
-/* Define to 1 if you have the `clock' function. */
-#undef HAVE_CLOCK
-
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
@@ -228,7 +225,7 @@
/* Define to 1 if you have the `close' function. */
#undef HAVE_CLOSE
-/* complex.h exists */
+/* Define to 1 if you have the <complex.h> header file. */
#undef HAVE_COMPLEX_H
/* libm includes copysign */
@@ -381,9 +378,6 @@
/* Define to 1 if you have the <floatingpoint.h> header file. */
#undef HAVE_FLOATINGPOINT_H
-/* Define to 1 if you have the <float.h> header file. */
-#undef HAVE_FLOAT_H
-
/* libm includes floor */
#undef HAVE_FLOOR
@@ -435,10 +429,10 @@
/* Define to 1 if you have the `getcwd' function. */
#undef HAVE_GETCWD
-/* libc includes geteuid */
+/* Define to 1 if you have the `geteuid' function. */
#undef HAVE_GETEUID
-/* libc includes getgid */
+/* Define to 1 if you have the `getgid' function. */
#undef HAVE_GETGID
/* Define to 1 if you have the `gethostname' function. */
@@ -450,10 +444,10 @@
/* Define to 1 if you have the `getlogin' function. */
#undef HAVE_GETLOGIN
-/* libc includes getpid */
+/* Define to 1 if you have the `getpid' function. */
#undef HAVE_GETPID
-/* libc includes getppid */
+/* Define to 1 if you have the `getppid' function. */
#undef HAVE_GETPPID
/* Define to 1 if you have the `getpwuid' function. */
@@ -471,7 +465,7 @@
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
-/* libc includes getuid */
+/* Define to 1 if you have the `getuid' function. */
#undef HAVE_GETUID
/* Define to 1 if you have the `gmtime_r' function. */
@@ -606,9 +600,6 @@
/* libm includes nextafterl */
#undef HAVE_NEXTAFTERL
-/* Define to 1 if you have the `perror' function. */
-#undef HAVE_PERROR
-
/* Define to 1 if you have the `pipe' function. */
#undef HAVE_PIPE
@@ -654,12 +645,6 @@
/* Define to 1 if you have the `setmode' function. */
#undef HAVE_SETMODE
-/* Define to 1 if you have the `signal' function. */
-#undef HAVE_SIGNAL
-
-/* Define to 1 if you have the <signal.h> header file. */
-#undef HAVE_SIGNAL_H
-
/* libm includes sin */
#undef HAVE_SIN
@@ -696,30 +681,18 @@
/* Define to 1 if you have the `stat' function. */
#undef HAVE_STAT
-/* Define to 1 if you have the <stdarg.h> header file. */
-#undef HAVE_STDARG_H
-
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
-/* Define to 1 if you have the <stdio.h> header file. */
-#undef HAVE_STDIO_H
-
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strcasestr' function. */
#undef HAVE_STRCASESTR
-/* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
-
/* Define to 1 if you have the `strerror_r' function. */
#undef HAVE_STRERROR_R
-/* Define to 1 if you have the `strftime' function. */
-#undef HAVE_STRFTIME
-
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
@@ -792,15 +765,9 @@
/* libm includes tgammal */
#undef HAVE_TGAMMAL
-/* Define to 1 if you have the `time' function. */
-#undef HAVE_TIME
-
/* Define to 1 if you have the `times' function. */
#undef HAVE_TIMES
-/* Define to 1 if you have the <time.h> header file. */
-#undef HAVE_TIME_H
-
/* libm includes trunc */
#undef HAVE_TRUNC
@@ -907,9 +874,6 @@
/* Define to 1 if the target supports #pragma weak */
#undef SUPPORTS_WEAK
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
diff --git a/libgfortran/configure b/libgfortran/configure
index a8ac99a..c39b003 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -597,6 +597,8 @@ ac_includes_default="\
# include <unistd.h>
#endif"
+ac_header_list=
+ac_func_list=
ac_c_werror_flag=
ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
@@ -2528,6 +2530,68 @@ $as_echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
+as_fn_append ac_header_list " unistd.h"
+as_fn_append ac_header_list " sys/time.h"
+as_fn_append ac_header_list " sys/times.h"
+as_fn_append ac_header_list " sys/resource.h"
+as_fn_append ac_header_list " sys/types.h"
+as_fn_append ac_header_list " sys/stat.h"
+as_fn_append ac_header_list " sys/wait.h"
+as_fn_append ac_header_list " floatingpoint.h"
+as_fn_append ac_header_list " ieeefp.h"
+as_fn_append ac_header_list " fenv.h"
+as_fn_append ac_header_list " fptrap.h"
+as_fn_append ac_header_list " pwd.h"
+as_fn_append ac_header_list " complex.h"
+as_fn_append ac_func_list " getrusage"
+as_fn_append ac_func_list " times"
+as_fn_append ac_func_list " mkstemp"
+as_fn_append ac_func_list " strtof"
+as_fn_append ac_func_list " strtold"
+as_fn_append ac_func_list " snprintf"
+as_fn_append ac_func_list " ftruncate"
+as_fn_append ac_func_list " chsize"
+as_fn_append ac_func_list " chdir"
+as_fn_append ac_func_list " getlogin"
+as_fn_append ac_func_list " gethostname"
+as_fn_append ac_func_list " kill"
+as_fn_append ac_func_list " link"
+as_fn_append ac_func_list " symlink"
+as_fn_append ac_func_list " sleep"
+as_fn_append ac_func_list " ttyname"
+as_fn_append ac_func_list " alarm"
+as_fn_append ac_func_list " access"
+as_fn_append ac_func_list " fork"
+as_fn_append ac_func_list " execl"
+as_fn_append ac_func_list " wait"
+as_fn_append ac_func_list " setmode"
+as_fn_append ac_func_list " execve"
+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 " fdopen"
+as_fn_append ac_func_list " strcasestr"
+as_fn_append ac_func_list " getrlimit"
+as_fn_append ac_func_list " gettimeofday"
+as_fn_append ac_func_list " stat"
+as_fn_append ac_func_list " fstat"
+as_fn_append ac_func_list " lstat"
+as_fn_append ac_func_list " getpwuid"
+as_fn_append ac_func_list " vsnprintf"
+as_fn_append ac_func_list " dup"
+as_fn_append ac_func_list " getcwd"
+as_fn_append ac_func_list " localtime_r"
+as_fn_append ac_func_list " gmtime_r"
+as_fn_append ac_func_list " strerror_r"
+as_fn_append ac_func_list " getpwuid_r"
+as_fn_append ac_func_list " ttyname_r"
+as_fn_append ac_func_list " clock_gettime"
+as_fn_append ac_func_list " readlink"
+as_fn_append ac_func_list " getgid"
+as_fn_append ac_func_list " getpid"
+as_fn_append ac_func_list " getppid"
+as_fn_append ac_func_list " getuid"
+as_fn_append ac_func_list " geteuid"
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
@@ -12254,7 +12318,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12257 "configure"
+#line 12321 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12360,7 +12424,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12363 "configure"
+#line 12427 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15871,216 +15935,51 @@ _ACEOF
fi
-# check header files
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
+# check header files (we assume C89 is available, so don't check for that)
-int
-main ()
-{
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_header_stdc=yes
-else
- ac_cv_header_stdc=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <string.h>
+ for ac_header in $ac_header_list
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+eval as_val=\$$as_ac_Header
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then :
-else
- ac_cv_header_stdc=no
fi
-rm -f conftest*
-fi
+done
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-fi
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then :
- :
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- return 2;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-else
- ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
-$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
-if test "${ac_cv_header_time+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-int
-main ()
-{
-if ((struct tm *) 0)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_header_time=yes
-else
- ac_cv_header_time=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
-$as_echo "$ac_cv_header_time" >&6; }
-if test $ac_cv_header_time = yes; then
-$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
-fi
-for ac_header in stdio.h stdlib.h string.h unistd.h signal.h stdarg.h
-do :
- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-fi
-done
-for ac_header in time.h sys/time.h sys/times.h sys/resource.h
-do :
- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-fi
-done
-for ac_header in sys/types.h sys/stat.h sys/wait.h floatingpoint.h ieeefp.h
-do :
- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-fi
-done
-for ac_header in fenv.h fptrap.h float.h pwd.h
-do :
- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-fi
-done
-ac_fn_c_check_header_mongrel "$LINENO" "complex.h" "ac_cv_header_complex_h" "$ac_includes_default"
-if test "x$ac_cv_header_complex_h" = x""yes; then :
-
-$as_echo "#define HAVE_COMPLEX_H 1" >>confdefs.h
-
-fi
@@ -16499,7 +16398,6 @@ _ACEOF
fi
-
ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default"
if test "x$ac_cv_member_struct_stat_st_blocks" = x""yes; then :
@@ -16509,7 +16407,6 @@ _ACEOF
fi
-
ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default"
if test "x$ac_cv_member_struct_stat_st_rdev" = x""yes; then :
@@ -16522,20 +16419,10 @@ fi
# Check for library functions.
-for ac_func in getrusage times mkstemp strtof strtold snprintf ftruncate chsize
-do :
- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
- if test "x$as_val" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-fi
-done
-for ac_func in chdir strerror getlogin gethostname kill link symlink perror
+
+ for ac_func in $ac_func_list
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -16548,297 +16435,104 @@ _ACEOF
fi
done
-for ac_func in sleep time ttyname signal alarm clock access fork execl
-do :
- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
- if test "x$as_val" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-fi
-done
-for ac_func in wait setmode execve pipe dup2 close fdopen strcasestr getrlimit
-do :
- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
- if test "x$as_val" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-fi
-done
-for ac_func in gettimeofday stat fstat lstat getpwuid vsnprintf dup getcwd
-do :
- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
- if test "x$as_val" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-fi
-done
-for ac_func in localtime_r gmtime_r strerror_r getpwuid_r ttyname_r
-do :
- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
- if test "x$as_val" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-fi
-done
-for ac_func in clock_gettime strftime readlink
-do :
- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
- if test "x$as_val" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-fi
-done
-# Check libc for getgid, getpid, getuid
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getgid in -lc" >&5
-$as_echo_n "checking for getgid in -lc... " >&6; }
-if test "${ac_cv_lib_c_getgid+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $LIBS"
-if test x$gcc_no_link = xyes; then
- as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char getgid ();
-int
-main ()
-{
-return getgid ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_c_getgid=yes
-else
- ac_cv_lib_c_getgid=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_getgid" >&5
-$as_echo "$ac_cv_lib_c_getgid" >&6; }
-if test "x$ac_cv_lib_c_getgid" = x""yes; then :
-$as_echo "#define HAVE_GETGID 1" >>confdefs.h
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpid in -lc" >&5
-$as_echo_n "checking for getpid in -lc... " >&6; }
-if test "${ac_cv_lib_c_getpid+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $LIBS"
-if test x$gcc_no_link = xyes; then
- as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char getpid ();
-int
-main ()
-{
-return getpid ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_c_getpid=yes
-else
- ac_cv_lib_c_getpid=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_getpid" >&5
-$as_echo "$ac_cv_lib_c_getpid" >&6; }
-if test "x$ac_cv_lib_c_getpid" = x""yes; then :
-$as_echo "#define HAVE_GETPID 1" >>confdefs.h
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getppid in -lc" >&5
-$as_echo_n "checking for getppid in -lc... " >&6; }
-if test "${ac_cv_lib_c_getppid+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $LIBS"
-if test x$gcc_no_link = xyes; then
- as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char getppid ();
-int
-main ()
-{
-return getppid ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_c_getppid=yes
-else
- ac_cv_lib_c_getppid=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_getppid" >&5
-$as_echo "$ac_cv_lib_c_getppid" >&6; }
-if test "x$ac_cv_lib_c_getppid" = x""yes; then :
-$as_echo "#define HAVE_GETPPID 1" >>confdefs.h
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getuid in -lc" >&5
-$as_echo_n "checking for getuid in -lc... " >&6; }
-if test "${ac_cv_lib_c_getuid+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $LIBS"
-if test x$gcc_no_link = xyes; then
- as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char getuid ();
-int
-main ()
-{
-return getuid ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_c_getuid=yes
-else
- ac_cv_lib_c_getuid=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_getuid" >&5
-$as_echo "$ac_cv_lib_c_getuid" >&6; }
-if test "x$ac_cv_lib_c_getuid" = x""yes; then :
-$as_echo "#define HAVE_GETUID 1" >>confdefs.h
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for geteuid in -lc" >&5
-$as_echo_n "checking for geteuid in -lc... " >&6; }
-if test "${ac_cv_lib_c_geteuid+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $LIBS"
-if test x$gcc_no_link = xyes; then
- as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char geteuid ();
-int
-main ()
-{
-return geteuid ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_c_geteuid=yes
-else
- ac_cv_lib_c_geteuid=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_geteuid" >&5
-$as_echo "$ac_cv_lib_c_geteuid" >&6; }
-if test "x$ac_cv_lib_c_geteuid" = x""yes; then :
-$as_echo "#define HAVE_GETEUID 1" >>confdefs.h
-fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# Check for C99 (and other IEEE) math functions
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index a8b944d..74fe0c2 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -251,35 +251,22 @@ AC_TYPE_INTPTR_T
AC_TYPE_UINTPTR_T
AC_CHECK_TYPES([ptrdiff_t])
-# check header files
-AC_STDC_HEADERS
-AC_HEADER_TIME
-AC_HAVE_HEADERS(stdio.h stdlib.h string.h unistd.h signal.h stdarg.h)
-AC_CHECK_HEADERS(time.h sys/time.h sys/times.h sys/resource.h)
-AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/wait.h floatingpoint.h ieeefp.h)
-AC_CHECK_HEADERS(fenv.h fptrap.h float.h pwd.h)
-AC_CHECK_HEADER([complex.h],[AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h exists])])
+# check header files (we assume C89 is available, so don't check for that)
+AC_CHECK_HEADERS_ONCE(unistd.h sys/time.h sys/times.h sys/resource.h \
+sys/types.h sys/stat.h sys/wait.h floatingpoint.h ieeefp.h fenv.h fptrap.h \
+pwd.h complex.h)
+
GCC_HEADER_STDINT(gstdint.h)
-AC_CHECK_MEMBERS([struct stat.st_blksize])
-AC_CHECK_MEMBERS([struct stat.st_blocks])
-AC_CHECK_MEMBERS([struct stat.st_rdev])
+AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev])
# Check for library functions.
-AC_CHECK_FUNCS(getrusage times mkstemp strtof strtold snprintf ftruncate chsize)
-AC_CHECK_FUNCS(chdir strerror getlogin gethostname kill link symlink perror)
-AC_CHECK_FUNCS(sleep time ttyname signal alarm clock access fork execl)
-AC_CHECK_FUNCS(wait setmode execve pipe dup2 close fdopen strcasestr getrlimit)
-AC_CHECK_FUNCS(gettimeofday stat fstat lstat getpwuid vsnprintf dup getcwd)
-AC_CHECK_FUNCS(localtime_r gmtime_r strerror_r getpwuid_r ttyname_r)
-AC_CHECK_FUNCS(clock_gettime strftime readlink)
-
-# Check libc for getgid, getpid, getuid
-AC_CHECK_LIB([c],[getgid],[AC_DEFINE([HAVE_GETGID],[1],[libc includes getgid])])
-AC_CHECK_LIB([c],[getpid],[AC_DEFINE([HAVE_GETPID],[1],[libc includes getpid])])
-AC_CHECK_LIB([c],[getppid],[AC_DEFINE([HAVE_GETPPID],[1],[libc includes getppid])])
-AC_CHECK_LIB([c],[getuid],[AC_DEFINE([HAVE_GETUID],[1],[libc includes getuid])])
-AC_CHECK_LIB([c],[geteuid],[AC_DEFINE([HAVE_GETEUID],[1],[libc includes geteuid])])
+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 fdopen \
+strcasestr getrlimit gettimeofday stat fstat lstat getpwuid vsnprintf dup \
+getcwd localtime_r gmtime_r strerror_r getpwuid_r ttyname_r clock_gettime \
+readlink getgid getpid getppid getuid geteuid)
# Check for C99 (and other IEEE) math functions
AC_CHECK_LIB([m],[acosf],[AC_DEFINE([HAVE_ACOSF],[1],[libm includes acosf])])
diff --git a/libgfortran/intrinsics/clock.c b/libgfortran/intrinsics/clock.c
index b1d61d8..29ccc15 100644
--- a/libgfortran/intrinsics/clock.c
+++ b/libgfortran/intrinsics/clock.c
@@ -1,8 +1,8 @@
/* Implementation of the MCLOCK and MCLOCK8 g77 intrinsics.
- Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2009, 2011 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -24,19 +24,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "libgfortran.h"
-
-#ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# ifdef HAVE_TIME_H
-# include <time.h>
-# endif
-# endif
-#endif
+#include <time.h>
/* INTEGER(KIND=4) FUNCTION MCLOCK() */
@@ -47,11 +35,7 @@ export_proto(mclock);
GFC_INTEGER_4
mclock (void)
{
-#ifdef HAVE_CLOCK
return (GFC_INTEGER_4) clock ();
-#else
- return (GFC_INTEGER_4) -1;
-#endif
}
@@ -63,10 +47,6 @@ export_proto(mclock8);
GFC_INTEGER_8
mclock8 (void)
{
-#ifdef HAVE_CLOCK
return (GFC_INTEGER_8) clock ();
-#else
- return (GFC_INTEGER_8) -1;
-#endif
}
diff --git a/libgfortran/intrinsics/ctime.c b/libgfortran/intrinsics/ctime.c
index 1c924a1..05bf31f 100644
--- a/libgfortran/intrinsics/ctime.c
+++ b/libgfortran/intrinsics/ctime.c
@@ -39,7 +39,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
static size_t
strctime (char *s, size_t max, const time_t *timep)
{
-#ifdef HAVE_STRFTIME
struct tm ltm;
int failed;
/* Some targets provide a localtime_r based on a draft of the POSIX
@@ -52,9 +51,6 @@ strctime (char *s, size_t max, const time_t *timep)
if (failed)
return 0;
return strftime (s, max, "%c", &ltm);
-#else
- return 0;
-#endif
}
/* In the default locale, the date and time representation fits in 26
@@ -67,15 +63,9 @@ export_proto(fdate);
void
fdate (char ** date, gfc_charlen_type * date_len)
{
-#if defined(HAVE_TIME)
time_t now = time(NULL);
*date = get_mem (CSZ);
*date_len = strctime (*date, CSZ, &now);
-#else
-
- *date = NULL;
- *date_len = 0;
-#endif
}
@@ -85,15 +75,11 @@ export_proto(fdate_sub);
void
fdate_sub (char * date, gfc_charlen_type date_len)
{
-#if defined(HAVE_TIME)
time_t now = time(NULL);
char *s = get_mem (date_len + 1);
size_t n = strctime (s, date_len + 1, &now);
fstrcpy (date, date_len, s, n);
free (s);
-#else
- memset (date, ' ', date_len);
-#endif
}
@@ -104,15 +90,9 @@ export_proto_np(PREFIX(ctime));
void
PREFIX(ctime) (char ** date, gfc_charlen_type * date_len, GFC_INTEGER_8 t)
{
-#if defined(HAVE_TIME)
time_t now = t;
*date = get_mem (CSZ);
*date_len = strctime (*date, CSZ, &now);
-#else
-
- *date = NULL;
- *date_len = 0;
-#endif
}
diff --git a/libgfortran/intrinsics/date_and_time.c b/libgfortran/intrinsics/date_and_time.c
index fa51d5f..3c38636 100644
--- a/libgfortran/intrinsics/date_and_time.c
+++ b/libgfortran/intrinsics/date_and_time.c
@@ -31,10 +31,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "time_1.h"
-#ifndef abs
-#define abs(x) ((x)>=0 ? (x) : -(x))
-#endif
-
/* If the re-entrant version of gmtime is not available, provide a
fallback implementation. On some targets where the _r version is
@@ -143,7 +139,6 @@ date_and_time (char *__date, char *__time, char *__zone,
char zone[ZONE_LEN + 1];
GFC_INTEGER_4 values[VALUES_SIZE];
-#ifndef HAVE_NO_DATE_TIME
time_t lt;
struct tm local_time;
struct tm UTC_time;
@@ -193,21 +188,6 @@ date_and_time (char *__date, char *__time, char *__zone,
for (i = 0; i < VALUES_SIZE; i++)
values[i] = - GFC_INTEGER_4_HUGE;
}
-#else /* if defined HAVE_NO_DATE_TIME */
- /* We really have *nothing* to return, so return blanks and HUGE(0). */
-
- memset (date, ' ', DATE_LEN);
- date[DATE_LEN] = '\0';
-
- memset (timec, ' ', TIME_LEN);
- timec[TIME_LEN] = '\0';
-
- memset (zone, ' ', ZONE_LEN);
- zone[ZONE_LEN] = '\0';
-
- for (i = 0; i < VALUES_SIZE; i++)
- values[i] = - GFC_INTEGER_4_HUGE;
-#endif /* HAVE_NO_DATE_TIME */
/* Copy the values into the arguments. */
if (__values)
@@ -321,7 +301,6 @@ secnds (GFC_REAL_4 *x)
static void
itime0 (int x[3])
{
-#ifndef HAVE_NO_DATE_TIME
time_t lt;
struct tm local_time;
@@ -335,9 +314,6 @@ itime0 (int x[3])
x[1] = local_time.tm_min;
x[2] = local_time.tm_sec;
}
-#else
- x[0] = x[1] = x[2] = -1;
-#endif
}
extern void itime_i4 (gfc_array_i4 *);
@@ -403,7 +379,6 @@ itime_i8 (gfc_array_i8 *__values)
static void
idate0 (int x[3])
{
-#ifndef HAVE_NO_DATE_TIME
time_t lt;
struct tm local_time;
@@ -417,9 +392,6 @@ idate0 (int x[3])
x[1] = 1 + local_time.tm_mon;
x[2] = 1900 + local_time.tm_year;
}
-#else
- x[0] = x[1] = x[2] = -1;
-#endif
}
extern void idate_i4 (gfc_array_i4 *);
diff --git a/libgfortran/intrinsics/execute_command_line.c b/libgfortran/intrinsics/execute_command_line.c
index d0b79a4..25eb4a3 100644
--- a/libgfortran/intrinsics/execute_command_line.c
+++ b/libgfortran/intrinsics/execute_command_line.c
@@ -1,5 +1,5 @@
/* Implementation of the EXECUTE_COMMAND_LINE intrinsic.
- Copyright (C) 2009 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2011 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert.
This file is part of the GNU Fortran runtime library (libgfortran).
@@ -26,10 +26,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include <string.h>
#include <stdbool.h>
-
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
diff --git a/libgfortran/intrinsics/exit.c b/libgfortran/intrinsics/exit.c
index 7787581..c7da497 100644
--- a/libgfortran/intrinsics/exit.c
+++ b/libgfortran/intrinsics/exit.c
@@ -1,8 +1,8 @@
/* Implementation of the EXIT intrinsic.
- Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007, 2009, 2011 Free Software Foundation, Inc.
Contributed by Steven G. Kargl <kargls@comcast.net>.
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -25,10 +25,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
-
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
+
/* SUBROUTINE EXIT(STATUS)
INTEGER, INTENT(IN), OPTIONAL :: STATUS */
diff --git a/libgfortran/intrinsics/extends_type_of.c b/libgfortran/intrinsics/extends_type_of.c
index 2fd149c..2234234 100644
--- a/libgfortran/intrinsics/extends_type_of.c
+++ b/libgfortran/intrinsics/extends_type_of.c
@@ -1,8 +1,8 @@
/* Implementation of the EXTENDS_TYPE_OF intrinsic.
- Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007, 2009, 2011 Free Software Foundation, Inc.
Contributed by Janus Weil <janus@gcc.gnu.org>.
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -25,10 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
-
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
typedef struct vtype
diff --git a/libgfortran/intrinsics/gerror.c b/libgfortran/intrinsics/gerror.c
index 6feadc9..492f7af 100644
--- a/libgfortran/intrinsics/gerror.c
+++ b/libgfortran/intrinsics/gerror.c
@@ -1,8 +1,8 @@
/* Implementation of the GERROR g77 intrinsic.
- Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -33,7 +33,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
message corresponding to the last system error (C errno).
CHARACTER(len=*), INTENT(OUT) :: MESSAGE */
-#ifdef HAVE_STRERROR
void PREFIX(gerror) (char *, gfc_charlen_type);
export_proto_np(PREFIX(gerror));
@@ -56,4 +55,3 @@ PREFIX(gerror) (char * msg, gfc_charlen_type msg_len)
if (msg_len > p_len)
memset (&msg[p_len], ' ', msg_len - p_len);
}
-#endif
diff --git a/libgfortran/intrinsics/kill.c b/libgfortran/intrinsics/kill.c
index 83e8b283..be36b00 100644
--- a/libgfortran/intrinsics/kill.c
+++ b/libgfortran/intrinsics/kill.c
@@ -1,8 +1,8 @@
/* Implementation of the KILL g77 intrinsic.
- Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -25,10 +25,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include <errno.h>
-
-#ifdef HAVE_SIGNAL_H
#include <signal.h>
-#endif
+
/* SUBROUTINE KILL(PID, SIGNAL, STATUS)
INTEGER, INTENT(IN) :: PID, SIGNAL
diff --git a/libgfortran/intrinsics/malloc.c b/libgfortran/intrinsics/malloc.c
index 19001ae..5edc1be 100644
--- a/libgfortran/intrinsics/malloc.c
+++ b/libgfortran/intrinsics/malloc.c
@@ -1,8 +1,8 @@
/* Implementation of the MALLOC and FREE intrinsics
- Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -24,10 +24,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "libgfortran.h"
-
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
+
extern void PREFIX(free) (void **);
export_proto_np(PREFIX(free));
diff --git a/libgfortran/intrinsics/move_alloc.c b/libgfortran/intrinsics/move_alloc.c
index f76c20c..7b489ad 100644
--- a/libgfortran/intrinsics/move_alloc.c
+++ b/libgfortran/intrinsics/move_alloc.c
@@ -1,8 +1,8 @@
/* Generic implementation of the MOVE_ALLOC intrinsic
- Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2009, 2011 Free Software Foundation, Inc.
Contributed by Paul Thomas
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -24,10 +24,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "libgfortran.h"
-
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
+
extern void move_alloc (gfc_array_char *, gfc_array_char *);
export_proto(move_alloc);
diff --git a/libgfortran/intrinsics/perror.c b/libgfortran/intrinsics/perror.c
index 10348bd..bb203c4 100644
--- a/libgfortran/intrinsics/perror.c
+++ b/libgfortran/intrinsics/perror.c
@@ -1,8 +1,8 @@
/* Implementation of the PERROR intrinsic.
- Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -31,7 +31,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* SUBROUTINE PERROR(STRING)
CHARACTER(len=*), INTENT(IN) :: STRING */
-#ifdef HAVE_PERROR
extern void perror_sub (char *, gfc_charlen_type);
iexport_proto(perror_sub);
@@ -52,4 +51,3 @@ perror_sub (char *string, gfc_charlen_type string_len)
perror (str);
}
iexport(perror_sub);
-#endif
diff --git a/libgfortran/intrinsics/signal.c b/libgfortran/intrinsics/signal.c
index 66e54f3..85179ee 100644
--- a/libgfortran/intrinsics/signal.c
+++ b/libgfortran/intrinsics/signal.c
@@ -1,8 +1,8 @@
/* Implementation of the SIGNAL and ALARM g77 intrinsics
- Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -29,9 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <unistd.h>
#endif
-#ifdef HAVE_SIGNAL_H
#include <signal.h>
-#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
@@ -46,7 +44,6 @@ iexport_proto(signal_sub);
void
signal_sub (int *number, void (*handler)(int), int *status)
{
-#ifdef HAVE_SIGNAL
intptr_t ret;
if (status != NULL)
@@ -56,11 +53,6 @@ signal_sub (int *number, void (*handler)(int), int *status)
}
else
signal (*number, handler);
-#else
- errno = ENOSYS;
- if (status != NULL)
- *status = -1;
-#endif
}
iexport(signal_sub);
@@ -72,7 +64,6 @@ iexport_proto(signal_sub_int);
void
signal_sub_int (int *number, int *handler, int *status)
{
-#ifdef HAVE_SIGNAL
intptr_t ptr = *handler, ret;
if (status != NULL)
@@ -82,11 +73,6 @@ signal_sub_int (int *number, int *handler, int *status)
}
else
signal (*number, (void (*)(int)) ptr);
-#else
- errno = ENOSYS;
- if (status != NULL)
- *status = -1;
-#endif
}
iexport(signal_sub_int);
@@ -129,7 +115,7 @@ alarm_sub_i4 (int * seconds __attribute__ ((unused)),
void (*handler)(int) __attribute__ ((unused)),
GFC_INTEGER_4 *status)
{
-#if defined (SIGALRM) && defined (HAVE_ALARM) && defined (HAVE_SIGNAL)
+#if defined (SIGALRM) && defined (HAVE_ALARM)
if (status != NULL)
{
if (signal (SIGALRM, handler) == SIG_ERR)
@@ -159,7 +145,7 @@ alarm_sub_i8 (int *seconds __attribute__ ((unused)),
void (*handler)(int) __attribute__ ((unused)),
GFC_INTEGER_8 *status)
{
-#if defined (SIGALRM) && defined (HAVE_ALARM) && defined (HAVE_SIGNAL)
+#if defined (SIGALRM) && defined (HAVE_ALARM)
if (status != NULL)
{
if (signal (SIGALRM, handler) == SIG_ERR)
@@ -190,7 +176,7 @@ alarm_sub_int_i4 (int *seconds __attribute__ ((unused)),
int *handler __attribute__ ((unused)),
GFC_INTEGER_4 *status)
{
-#if defined (SIGALRM) && defined (HAVE_ALARM) && defined (HAVE_SIGNAL)
+#if defined (SIGALRM) && defined (HAVE_ALARM)
if (status != NULL)
{
if (signal (SIGALRM, (void (*)(int)) (intptr_t) *handler) == SIG_ERR)
@@ -220,7 +206,7 @@ alarm_sub_int_i8 (int *seconds __attribute__ ((unused)),
int *handler __attribute__ ((unused)),
GFC_INTEGER_8 *status)
{
-#if defined (SIGALRM) && defined (HAVE_ALARM) && defined (HAVE_SIGNAL)
+#if defined (SIGALRM) && defined (HAVE_ALARM)
if (status != NULL)
{
if (signal (SIGALRM, (void (*)(int)) (intptr_t) *handler) == SIG_ERR)
diff --git a/libgfortran/intrinsics/stat.c b/libgfortran/intrinsics/stat.c
index 22d4f79..28821f1 100644
--- a/libgfortran/intrinsics/stat.c
+++ b/libgfortran/intrinsics/stat.c
@@ -1,8 +1,9 @@
/* Implementation of the STAT and FSTAT intrinsics.
- Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006, 2007, 2009, 2011
+ Free Software Foundation, Inc.
Contributed by Steven G. Kargl <kargls@comcast.net>.
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -32,9 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <sys/stat.h>
#endif
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
#ifdef HAVE_STAT
diff --git a/libgfortran/intrinsics/system.c b/libgfortran/intrinsics/system.c
index 831823f..5bc083a 100644
--- a/libgfortran/intrinsics/system.c
+++ b/libgfortran/intrinsics/system.c
@@ -1,8 +1,8 @@
/* Implementation of the SYSTEM intrinsic.
- Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007, 2009, 2011 Free Software Foundation, Inc.
Contributed by Tobias Schlüter.
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
@@ -25,10 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include <string.h>
-
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
extern void system_sub (const char *fcmd, GFC_INTEGER_4 * status,
gfc_charlen_type cmd_len);
diff --git a/libgfortran/intrinsics/time.c b/libgfortran/intrinsics/time.c
index d046e87..151466a 100644
--- a/libgfortran/intrinsics/time.c
+++ b/libgfortran/intrinsics/time.c
@@ -1,8 +1,8 @@
/* Implementation of the TIME and TIME8 g77 intrinsics.
- Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -24,24 +24,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "libgfortran.h"
-
-#ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# ifdef HAVE_TIME_H
-# include <time.h>
-# endif
-# endif
-#endif
+#include <time.h>
/* INTEGER(KIND=4) FUNCTION TIME() */
-#ifdef HAVE_TIME
extern GFC_INTEGER_4 time_func (void);
export_proto(time_func);
@@ -61,4 +48,3 @@ time8_func (void)
{
return (GFC_INTEGER_8) time (NULL);
}
-#endif
diff --git a/libgfortran/intrinsics/time_1.h b/libgfortran/intrinsics/time_1.h
index 12d79eb..73977cb 100644
--- a/libgfortran/intrinsics/time_1.h
+++ b/libgfortran/intrinsics/time_1.h
@@ -40,19 +40,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
As usual with UNIX systems, unfortunately no single way is
available for all systems. */
-#ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# ifdef HAVE_TIME_H
-# include <time.h>
-# endif
-# endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
#endif
+#include <time.h>
+
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
@@ -174,20 +167,21 @@ gf_cputime (long *user_sec, long *user_usec, long *system_sec, long *system_usec
clock_t err;
err = times (&buf);
*user_sec = buf.tms_utime / HZ;
- *user_usec = buf.tms_utime % HZ * (1000000 / HZ);
+ *user_usec = buf.tms_utime % HZ * (1000000. / HZ);
*system_sec = buf.tms_stime / HZ;
- *system_usec = buf.tms_stime % HZ * (1000000 / HZ);
+ *system_usec = buf.tms_stime % HZ * (1000000. / HZ);
if ((err == (clock_t) -1) && errno != 0)
return -1;
return 0;
#else
-
- /* We have nothing to go on. Return -1. */
- *user_sec = *system_sec = 0;
- *user_usec = *system_usec = 0;
- errno = ENOSYS;
- return -1;
+ clock_t c = clock ();
+ *user_sec = c / CLOCKS_PER_SEC;
+ *user_usec = c % CLOCKS_PER_SEC * (1000000. / CLOCKS_PER_SEC);
+ *system_sec = *system_usec = 0;
+ if (c == (clock_t) -1)
+ return -1;
+ return 0;
#endif
}
@@ -218,7 +212,7 @@ gf_gettime (time_t * secs, long * usecs)
*secs = tv.tv_sec;
*usecs = tv.tv_usec;
return err;
-#elif HAVE_TIME
+#else
time_t t, t2;
t = time (&t2);
*secs = t2;
@@ -226,11 +220,6 @@ gf_gettime (time_t * secs, long * usecs)
if (t == ((time_t)-1))
return -1;
return 0;
-#else
- *secs = 0;
- *usecs = 0;
- errno = ENOSYS;
- return -1;
#endif
}
diff --git a/libgfortran/intrinsics/umask.c b/libgfortran/intrinsics/umask.c
index 9df684b..d939e5d 100644
--- a/libgfortran/intrinsics/umask.c
+++ b/libgfortran/intrinsics/umask.c
@@ -1,8 +1,8 @@
/* Implementation of the UMASK intrinsic.
- Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007, 2009, 2011 Free Software Foundation, Inc.
Contributed by Steven G. Kargl <kargls@comcast.net>.
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -25,10 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
-
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
diff --git a/libgfortran/io/intrinsics.c b/libgfortran/io/intrinsics.c
index c1287d4..22150e7 100644
--- a/libgfortran/io/intrinsics.c
+++ b/libgfortran/io/intrinsics.c
@@ -27,13 +27,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "io.h"
#include "fbuf.h"
#include "unix.h"
-
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-
#include <string.h>
+
static const int five = 5;
static const int six = 6;
diff --git a/libgfortran/runtime/backtrace.c b/libgfortran/runtime/backtrace.c
index 606dd34..e28bdcb 100644
--- a/libgfortran/runtime/backtrace.c
+++ b/libgfortran/runtime/backtrace.c
@@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include <string.h>
+#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
diff --git a/libgfortran/runtime/compile_options.c b/libgfortran/runtime/compile_options.c
index c3e64de..0c139a2 100644
--- a/libgfortran/runtime/compile_options.c
+++ b/libgfortran/runtime/compile_options.c
@@ -1,5 +1,5 @@
/* Handling of compile-time options that influence the library.
- Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
This file is part of the GNU Fortran runtime library (libgfortran).
@@ -23,10 +23,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "libgfortran.h"
-
-#ifdef HAVE_SIGNAL_H
#include <signal.h>
-#endif
/* Useful compile-time options will be stored in here. */
@@ -94,32 +91,17 @@ set_options (int num, int options[])
/* If backtrace is required, we set signal handlers on the POSIX
2001 signals with core action. */
-#if defined(HAVE_SIGNAL) && (defined(SIGQUIT) || defined(SIGILL) \
- || defined(SIGABRT) || defined(SIGFPE) \
- || defined(SIGSEGV) || defined(SIGBUS) \
- || defined(SIGSYS) || defined(SIGTRAP) \
- || defined(SIGXCPU) || defined(SIGXFSZ))
if (compile_options.backtrace)
{
#if defined(SIGQUIT)
signal (SIGQUIT, backtrace_handler);
#endif
-#if defined(SIGILL)
+ /* The following 4 signals are defined by C89. */
signal (SIGILL, backtrace_handler);
-#endif
-
-#if defined(SIGABRT)
signal (SIGABRT, backtrace_handler);
-#endif
-
-#if defined(SIGFPE)
signal (SIGFPE, backtrace_handler);
-#endif
-
-#if defined(SIGSEGV)
signal (SIGSEGV, backtrace_handler);
-#endif
#if defined(SIGBUS)
signal (SIGBUS, backtrace_handler);
@@ -143,8 +125,6 @@ set_options (int num, int options[])
maybe_find_addr2line ();
}
-#endif
-
}
diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c
index cb06429..7e523bc 100644
--- a/libgfortran/runtime/error.c
+++ b/libgfortran/runtime/error.c
@@ -28,18 +28,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <assert.h>
#include <string.h>
#include <errno.h>
-
-#ifdef HAVE_SIGNAL_H
#include <signal.h>
-#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
@@ -172,9 +167,7 @@ sys_abort (void)
|| (options.backtrace == -1 && compile_options.backtrace == 1))
{
show_backtrace ();
-#if defined(HAVE_SIGNAL) && defined(SIGABRT)
signal (SIGABRT, SIG_DFL);
-#endif
}
abort();