From c1800ec88e53d47792c9b01672d4feabba209a3c Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Fri, 20 Apr 2001 23:06:55 +0000 Subject: [PATCH] configure.in: Probe for times, clock, struct tms, and clock_t. * configure.in: Probe for times, clock, struct tms, and clock_t. * configure, config.in: Regenerate. * timevar.c: Replace ifdef forest in get_time with (relatively) straightforward series of checks based on autoconf's probes. From-SVN: r41471 --- gcc/ChangeLog | 7 ++ gcc/config.in | 18 +++ gcc/configure | 316 ++++++++++++++++++++++++++++++++++------------- gcc/configure.in | 38 +++++- gcc/timevar.c | 160 +++++++++++++----------- 5 files changed, 377 insertions(+), 162 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 99e7b9b865c..63b5496929b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2001-04-20 Zack Weinberg + + * configure.in: Probe for times, clock, struct tms, and clock_t. + * configure, config.in: Regenerate. + * timevar.c: Replace ifdef forest in get_time with (relatively) + straightforward series of checks based on autoconf's probes. + Fri Apr 20 12:24:50 2001 Jeffrey A Law (law@cygnus.com) * config/pa/som.h (NM_FLAGS): Define. diff --git a/gcc/config.in b/gcc/config.in index 4d03b5b031e..72ede3d78f3 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -101,6 +101,9 @@ /* Define if you have the bsearch function. */ #undef HAVE_BSEARCH +/* Define if you have the clock function. */ +#undef HAVE_CLOCK + /* Define if you have the dcgettext function. */ #undef HAVE_DCGETTEXT @@ -188,6 +191,9 @@ /* Define if you have the sysconf function. */ #undef HAVE_SYSCONF +/* Define if you have the times function. */ +#undef HAVE_TIMES + /* Define if you have the header file. */ #undef HAVE_ARGZ_H @@ -416,6 +422,9 @@ /* Define to 1 if we found this declaration otherwise define to 0. */ #undef HAVE_DECL_GETOPT +/* Define to 1 if we found this declaration otherwise define to 0. */ +#undef HAVE_DECL_CLOCK + /* Define to 1 if we found this declaration otherwise define to 0. */ #undef HAVE_DECL_GETRLIMIT @@ -425,6 +434,15 @@ /* Define to 1 if we found this declaration otherwise define to 0. */ #undef HAVE_DECL_GETRUSAGE +/* Define to 1 if we found this declaration otherwise define to 0. */ +#undef HAVE_DECL_TIMES + +/* Define if defines struct tms. */ +#undef HAVE_STRUCT_TMS + +/* Define if defines clock_t. */ +#undef HAVE_CLOCK_T + /* Define if host mkdir takes a single argument. */ #undef MKDIR_TAKES_ONE_ARG diff --git a/gcc/configure b/gcc/configure index 270b7a85a1d..67af3a391c5 100755 --- a/gcc/configure +++ b/gcc/configure @@ -3099,7 +3099,7 @@ EOF fi -for ac_func in strtoul bsearch popen \ +for ac_func in strtoul bsearch popen times clock \ strchr strrchr kill getrlimit setrlimit atoll atoq \ sysconf isascii gettimeofday strsignal putc_unlocked fputc_unlocked \ fputs_unlocked getrusage iconv nl_langinfo lstat @@ -4257,7 +4257,7 @@ saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include" for ac_func in getenv atol sbrk abort atof getcwd getwd \ strsignal putc_unlocked fputs_unlocked strstr environ errno \ - malloc realloc calloc free basename getopt + malloc realloc calloc free basename getopt clock do ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` echo $ac_n "checking whether $ac_func is declared""... $ac_c" 1>&6 @@ -4364,6 +4364,9 @@ EOF EOF cat >> confdefs.h <> confdefs.h <&6 -echo "configure:4376: checking whether $ac_func is declared" >&5 +echo "configure:4379: checking whether $ac_func is declared" >&5 if eval "test \"`echo '$''{'gcc_cv_have_decl_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4402: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "gcc_cv_have_decl_$ac_func=yes" else @@ -4433,17 +4436,156 @@ EOF fi +for ac_func in times +do + ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` +echo $ac_n "checking whether $ac_func is declared""... $ac_c" 1>&6 +echo "configure:4444: checking whether $ac_func is declared" >&5 +if eval "test \"`echo '$''{'gcc_cv_have_decl_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#endif + + +int main() { +#ifndef $ac_func +char *(*pfn) = (char *(*)) $ac_func ; +#endif +; return 0; } +EOF +if { (eval echo configure:4467: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + eval "gcc_cv_have_decl_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "gcc_cv_have_decl_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$gcc_cv_have_decl_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 ; cat >> confdefs.h <&6 ; cat >> confdefs.h <> confdefs.h <&6 +echo "configure:4501: checking for struct tms" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_tms'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +cat > conftest.$ac_ext < +#endif + +int main() { +struct tms tms; +; return 0; } +EOF +if { (eval echo configure:4520: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_tms=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_tms=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_tms" 1>&6 +if test $ac_cv_struct_tms = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_STRUCT_TMS 1 +EOF + +fi + +# use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE. +# revisit after autoconf 2.50. +echo $ac_n "checking for clock_t""... $ac_c" 1>&6 +echo "configure:4543: checking for clock_t" >&5 +if eval "test \"`echo '$''{'gcc_cv_type_clock_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + gcc_cv_type_clock_t=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gcc_cv_type_clock_t=no +fi +rm -f conftest* +fi + +echo "$ac_t""$gcc_cv_type_clock_t" 1>&6 +if test $gcc_cv_type_clock_t = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_CLOCK_T 1 +EOF + +fi + # Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests. CFLAGS="$saved_CFLAGS" # mkdir takes a single argument on some systems. echo $ac_n "checking if mkdir takes one argument""... $ac_c" 1>&6 -echo "configure:4442: checking if mkdir takes one argument" >&5 +echo "configure:4584: checking if mkdir takes one argument" >&5 if eval "test \"`echo '$''{'gcc_cv_mkdir_takes_one_arg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4460,7 +4602,7 @@ int main() { mkdir ("foo", 0); ; return 0; } EOF -if { (eval echo configure:4464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4606: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_mkdir_takes_one_arg=no else @@ -4739,7 +4881,7 @@ fi echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6 -echo "configure:4743: checking for strerror in -lcposix" >&5 +echo "configure:4885: checking for strerror in -lcposix" >&5 ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4747,7 +4889,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4781,12 +4923,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:4785: checking for working const" >&5 +echo "configure:4927: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4981: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -4856,12 +4998,12 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:4860: checking for off_t" >&5 +echo "configure:5002: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -4889,12 +5031,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:4893: checking for size_t" >&5 +echo "configure:5035: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -4927,17 +5069,17 @@ unistd.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4931: checking for $ac_hdr" >&5 +echo "configure:5073: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4941: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5083: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4967,12 +5109,12 @@ done strdup __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4971: checking for $ac_func" >&5 +echo "configure:5113: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5024,12 +5166,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5028: checking for $ac_func" >&5 +echo "configure:5170: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5198: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5086,19 +5228,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:5090: checking for LC_MESSAGES" >&5 +echo "configure:5232: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:5102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -5119,7 +5261,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:5123: checking whether NLS is requested" >&5 +echo "configure:5265: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -5139,7 +5281,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:5143: checking whether included gettext is requested" >&5 +echo "configure:5285: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -5158,17 +5300,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:5162: checking for libintl.h" >&5 +echo "configure:5304: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5314: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5185,19 +5327,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:5189: checking for gettext in libc" >&5 +echo "configure:5331: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:5201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -5213,7 +5355,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:5217: checking for bindtextdomain in -lintl" >&5 +echo "configure:5359: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5221,7 +5363,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5378: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5248,12 +5390,12 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:5252: checking for gettext in libintl" >&5 +echo "configure:5394: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6 -echo "configure:5257: checking for gettext in -lintl" >&5 +echo "configure:5399: checking for gettext in -lintl" >&5 ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5261,7 +5403,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5315,7 +5457,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5319: checking for $ac_word" >&5 +echo "configure:5461: checking for $ac_word" >&5 if eval "test \"`echo '$''{'gcc_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5349,12 +5491,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5353: checking for $ac_func" >&5 +echo "configure:5495: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5404,7 +5546,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5408: checking for $ac_word" >&5 +echo "configure:5550: checking for $ac_word" >&5 if eval "test \"`echo '$''{'gcc_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5440,7 +5582,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5444: checking for $ac_word" >&5 +echo "configure:5586: checking for $ac_word" >&5 if eval "test \"`echo '$''{'gcc_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5472,7 +5614,7 @@ else fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -5505,7 +5647,7 @@ fi if test "$CATOBJEXT" = "NONE"; then echo $ac_n "checking whether catgets can be used""... $ac_c" 1>&6 -echo "configure:5509: checking whether catgets can be used" >&5 +echo "configure:5651: checking whether catgets can be used" >&5 # Check whether --with-catgets or --without-catgets was given. if test "${with_catgets+set}" = set; then withval="$with_catgets" @@ -5518,7 +5660,7 @@ fi if test "$nls_cv_use_catgets" = "yes"; then echo $ac_n "checking for main in -li""... $ac_c" 1>&6 -echo "configure:5522: checking for main in -li" >&5 +echo "configure:5664: checking for main in -li" >&5 ac_lib_var=`echo i'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5526,14 +5668,14 @@ else ac_save_LIBS="$LIBS" LIBS="-li $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5561,12 +5703,12 @@ else fi echo $ac_n "checking for catgets""... $ac_c" 1>&6 -echo "configure:5565: checking for catgets" >&5 +echo "configure:5707: checking for catgets" >&5 if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_catgets=yes" else @@ -5611,7 +5753,7 @@ EOF # Extract the first word of "gencat", so it can be a program name with args. set dummy gencat; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5615: checking for $ac_word" >&5 +echo "configure:5757: checking for $ac_word" >&5 if eval "test \"`echo '$''{'gcc_cv_path_GENCAT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5647,7 +5789,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5651: checking for $ac_word" >&5 +echo "configure:5793: checking for $ac_word" >&5 if eval "test \"`echo '$''{'gcc_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5684,7 +5826,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5688: checking for $ac_word" >&5 +echo "configure:5830: checking for $ac_word" >&5 if eval "test \"`echo '$''{'gcc_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5722,7 +5864,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5726: checking for $ac_word" >&5 +echo "configure:5868: checking for $ac_word" >&5 if eval "test \"`echo '$''{'gcc_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5780,7 +5922,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5784: checking for $ac_word" >&5 +echo "configure:5926: checking for $ac_word" >&5 if eval "test \"`echo '$''{'gcc_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5814,7 +5956,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5818: checking for $ac_word" >&5 +echo "configure:5960: checking for $ac_word" >&5 if eval "test \"`echo '$''{'gcc_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5853,7 +5995,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5857: checking for $ac_word" >&5 +echo "configure:5999: checking for $ac_word" >&5 if eval "test \"`echo '$''{'gcc_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5952,7 +6094,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:5956: checking for catalogs to be installed" >&5 +echo "configure:6098: checking for catalogs to be installed" >&5 if test "x$LINGUAS" = "x"; then LINGUAS=$ALL_LINGUAS else @@ -5984,17 +6126,17 @@ echo "configure:5956: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:5988: checking for linux/version.h" >&5 +echo "configure:6130: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5998: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6140: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6069,7 +6211,7 @@ fi echo $ac_n "checking whether windows registry support is requested""... $ac_c" 1>&6 -echo "configure:6073: checking whether windows registry support is requested" >&5 +echo "configure:6215: checking whether windows registry support is requested" >&5 if test x$enable_win32_registry != xno; then cat >> confdefs.h <<\EOF #define ENABLE_WIN32_REGISTRY 1 @@ -6098,7 +6240,7 @@ esac if test x$enable_win32_registry != xno; then echo $ac_n "checking registry key on windows hosts""... $ac_c" 1>&6 -echo "configure:6102: checking registry key on windows hosts" >&5 +echo "configure:6244: checking registry key on windows hosts" >&5 cat >> confdefs.h <&6 -echo "configure:6293: checking what assembler to use" >&5 +echo "configure:6435: checking what assembler to use" >&5 gcc_cv_as= gcc_cv_gas_major_version= gcc_cv_gas_minor_version= @@ -6374,7 +6516,7 @@ fi # Figure out what nm we will be using. echo $ac_n "checking what nm to use""... $ac_c" 1>&6 -echo "configure:6378: checking what nm to use" >&5 +echo "configure:6520: checking what nm to use" >&5 if test -x nm$host_exeext; then gcc_cv_nm=./nm$host_exeext elif test x$host = x$target; then @@ -6385,7 +6527,7 @@ echo "$ac_t""$gcc_cv_nm" 1>&6 # Figure out what assembler alignment features are present. echo $ac_n "checking assembler alignment features""... $ac_c" 1>&6 -echo "configure:6389: checking assembler alignment features" >&5 +echo "configure:6531: checking assembler alignment features" >&5 gcc_cv_as_alignment_features=none if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then # Gas version 2.6 and later support for .balign and .p2align. @@ -6433,7 +6575,7 @@ fi echo "$ac_t""$gcc_cv_as_alignment_features" 1>&6 echo $ac_n "checking assembler subsection support""... $ac_c" 1>&6 -echo "configure:6437: checking assembler subsection support" >&5 +echo "configure:6579: checking assembler subsection support" >&5 gcc_cv_as_subsections=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then @@ -6473,7 +6615,7 @@ fi echo "$ac_t""$gcc_cv_as_subsections" 1>&6 echo $ac_n "checking assembler weak support""... $ac_c" 1>&6 -echo "configure:6477: checking assembler weak support" >&5 +echo "configure:6619: checking assembler weak support" >&5 gcc_cv_as_weak=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 2 -o "$gcc_cv_gas_major_version" -gt 2; then @@ -6496,7 +6638,7 @@ fi echo "$ac_t""$gcc_cv_as_weak" 1>&6 echo $ac_n "checking assembler hidden support""... $ac_c" 1>&6 -echo "configure:6500: checking assembler hidden support" >&5 +echo "configure:6642: checking assembler hidden support" >&5 gcc_cv_as_hidden=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 10 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then @@ -6520,7 +6662,7 @@ fi echo "$ac_t""$gcc_cv_as_hidden" 1>&6 echo $ac_n "checking assembler leb128 support""... $ac_c" 1>&6 -echo "configure:6524: checking assembler leb128 support" >&5 +echo "configure:6666: checking assembler leb128 support" >&5 gcc_cv_as_leb128=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 11 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then @@ -6567,7 +6709,7 @@ echo "$ac_t""$gcc_cv_as_leb128" 1>&6 case "$target" in sparc*-*-*) echo $ac_n "checking assembler .register pseudo-op support""... $ac_c" 1>&6 -echo "configure:6571: checking assembler .register pseudo-op support" >&5 +echo "configure:6713: checking assembler .register pseudo-op support" >&5 if eval "test \"`echo '$''{'gcc_cv_as_register_pseudo_op'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6595,7 +6737,7 @@ EOF fi echo $ac_n "checking assembler supports -relax""... $ac_c" 1>&6 -echo "configure:6599: checking assembler supports -relax" >&5 +echo "configure:6741: checking assembler supports -relax" >&5 if eval "test \"`echo '$''{'gcc_cv_as_relax_opt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6625,7 +6767,7 @@ EOF case "$tm_file" in *64*) echo $ac_n "checking for 64 bit support in assembler ($gcc_cv_as)""... $ac_c" 1>&6 -echo "configure:6629: checking for 64 bit support in assembler ($gcc_cv_as)" >&5 +echo "configure:6771: checking for 64 bit support in assembler ($gcc_cv_as)" >&5 if eval "test \"`echo '$''{'gcc_cv_as_flags64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6670,7 +6812,7 @@ EOF if test "x$gcc_cv_as_flags64" != xno; then echo $ac_n "checking for assembler offsetable %lo() support""... $ac_c" 1>&6 -echo "configure:6674: checking for assembler offsetable %lo() support" >&5 +echo "configure:6816: checking for assembler offsetable %lo() support" >&5 if eval "test \"`echo '$''{'gcc_cv_as_offsetable_lo10'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6709,7 +6851,7 @@ EOF i[34567]86-*-*) echo $ac_n "checking assembler instructions""... $ac_c" 1>&6 -echo "configure:6713: checking assembler instructions" >&5 +echo "configure:6855: checking assembler instructions" >&5 gcc_cv_as_instructions= if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2; then @@ -6738,7 +6880,7 @@ EOF esac echo $ac_n "checking assembler dwarf2 debug_line support""... $ac_c" 1>&6 -echo "configure:6742: checking assembler dwarf2 debug_line support" >&5 +echo "configure:6884: checking assembler dwarf2 debug_line support" >&5 gcc_cv_as_dwarf2_debug_line=no # ??? Not all targets support dwarf2 debug_line, even within a version # of gas. Moreover, we need to emit a valid instruction to trigger any @@ -6928,7 +7070,7 @@ EOF echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:6932: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:7074: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" diff --git a/gcc/configure.in b/gcc/configure.in index 433a5bf7191..f8abfd4b66d 100644 --- a/gcc/configure.in +++ b/gcc/configure.in @@ -544,7 +544,7 @@ fi dnl Disabled until we have a complete test for buggy enum bitfields. dnl gcc_AC_C_ENUM_BF_UNSIGNED -AC_CHECK_FUNCS(strtoul bsearch popen \ +AC_CHECK_FUNCS(strtoul bsearch popen times clock \ strchr strrchr kill getrlimit setrlimit atoll atoq \ sysconf isascii gettimeofday strsignal putc_unlocked fputc_unlocked \ fputs_unlocked getrusage iconv nl_langinfo lstat) @@ -591,7 +591,7 @@ saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include" gcc_AC_CHECK_DECLS(getenv atol sbrk abort atof getcwd getwd \ strsignal putc_unlocked fputs_unlocked strstr environ errno \ - malloc realloc calloc free basename getopt, , ,[ + malloc realloc calloc free basename getopt clock, , ,[ #include "ansidecl.h" #include "system.h"]) @@ -603,6 +603,40 @@ gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[ #endif ]) +gcc_AC_CHECK_DECLS(times, , ,[ +#include "ansidecl.h" +#include "system.h" +#ifdef HAVE_SYS_TIMES_H +#include +#endif +]) + +# More time-related stuff. +AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [ +AC_TRY_COMPILE([ +#include "ansidecl.h" +#include "system.h" +#ifdef HAVE_SYS_TIMES_H +#include +#endif +], [struct tms tms;], ac_cv_struct_tms=yes, ac_cv_struct_tms=no)]) +if test $ac_cv_struct_tms = yes; then + AC_DEFINE(HAVE_STRUCT_TMS, 1, + [Define if defines struct tms.]) +fi + +# use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE. +# revisit after autoconf 2.50. +AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [ +AC_TRY_COMPILE([ +#include "ansidecl.h" +#include "system.h" +], [clock_t x;], gcc_cv_type_clock_t=yes, gcc_cv_type_clock_t=no)]) +if test $gcc_cv_type_clock_t = yes; then + AC_DEFINE(HAVE_CLOCK_T, 1, + [Define if defines clock_t.]) +fi + # Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests. CFLAGS="$saved_CFLAGS" diff --git a/gcc/timevar.c b/gcc/timevar.c index fd0f76cf2b9..def57b55cd7 100644 --- a/gcc/timevar.c +++ b/gcc/timevar.c @@ -26,13 +26,76 @@ #ifdef HAVE_SYS_TIMES_H # include #endif - #ifdef HAVE_SYS_RESOURCE_H #include #endif -#ifdef NEED_DECLARATION_GETRUSAGE + +#ifndef HAVE_CLOCK_T +typedef int clock_t; +#endif + +#ifndef HAVE_STRUCT_TMS +struct tms +{ + clock_t tms_utime; + clock_t tms_stime; + clock_t tms_cutime; + clock_t tms_cstime; +}; +#endif + +#if defined HAVE_DECL_GETRUSAGE && !HAVE_DECL_GETRUSAGE extern int getrusage PARAMS ((int, struct rusage *)); #endif +#if defined HAVE_DECL_TIMES && !HAVE_DECL_TIMES +extern clock_t times PARAMS ((struct tms *)); +#endif +#if defined HAVE_DECL_CLOCK && !HAVE_DECL_CLOCK +extern clock_t clock PARAMS ((void)); +#endif + +#ifndef RUSAGE_SELF +# define RUSAGE_SELF 0 +#endif + +/* Calculation of scale factor to convert ticks to microseconds. + We mustn't use CLOCKS_PER_SEC except with clock(). */ +#if HAVE_SYSCONF && defined _SC_CLK_TCK +# define TICKS_PER_SECOND sysconf (_SC_CLK_TCK) /* POSIX 1003.1-1996 */ +#else +# ifdef CLK_TCK +# define TICKS_PER_SECOND CLK_TCK /* POSIX 1003.1-1988; obsolescent */ +# else +# ifdef HZ +# define TICKS_PER_SECOND HZ /* traditional UNIX */ +# else +# define TICKS_PER_SECOND 100 /* often the correct value */ +# endif +# endif +#endif + +#define TICKS_TO_USEC (1000000 / TICKS_PER_SECOND) +#define CLOCKS_TO_USEC (1000000 / CLOCKS_PER_SEC) + +/* Prefer times to getrusage to clock (each gives successively less + information). */ +#ifdef HAVE_TIMES +# define USE_TIMES +# define HAVE_USER_TIME +# define HAVE_SYS_TIME +# define HAVE_WALL_TIME +#else +#ifdef HAVE_GETRUSAGE +# define USE_GETRUSAGE +# define HAVE_USER_TIME +# define HAVE_SYS_TIME +#else +#ifdef HAVE_CLOCK +# define USE_CLOCK +# define HAVE_USER_TIME +#endif +#endif +#endif #include "flags.h" #include "timevar.h" @@ -114,86 +177,37 @@ get_time (now) if (!TIMEVAR_ENABLE) return; -#ifdef __BEOS__ - /* Nothing. */ -#else /* not BeOS */ -#if defined (_WIN32) && !defined (__CYGWIN__) - if (clock () >= 0) - now->user = clock () * 1000; -#define HAVE_USER_TIME - -#else /* not _WIN32 */ -#ifdef _SC_CLK_TCK - { - static int tick; - struct tms tms; - if (tick == 0) - tick = 1000000 / sysconf (_SC_CLK_TCK); - now->wall = times (&tms) * tick; - now->user = tms.tms_utime * tick; - now->sys = tms.tms_stime * tick; - } -#define HAVE_USER_TIME -#define HAVE_SYS_TIME -#define HAVE_WALL_TIME - -#else -#ifdef USG { +#ifdef USE_TIMES + /* libc is very likely to have snuck a call to sysconf() into one + of the underlying constants, and that can make system calls, so + we have to precompute the value. Whose wonderful idea was it + to make all those _constants_ variable at run time, anyway? */ + static int ticks_to_usec; struct tms tms; -# if HAVE_SYSCONF && defined _SC_CLK_TCK -# define TICKS_PER_SECOND sysconf (_SC_CLK_TCK) /* POSIX 1003.1-1996 */ -# else -# ifdef CLK_TCK -# define TICKS_PER_SECOND CLK_TCK /* POSIX 1003.1-1988; obsolescent */ -# else -# define TICKS_PER_SECOND HZ /* traditional UNIX */ -# endif -# endif - now->wall = times (&tms) * (1000000 / TICKS_PER_SECOND); - now->user = tms.tms_utime * (1000000 / TICKS_PER_SECOND); - now->sys = tms.tms_stime * (1000000 / TICKS_PER_SECOND); - } -#define HAVE_USER_TIME -#define HAVE_SYS_TIME -#define HAVE_WALL_TIME + if (ticks_to_usec == 0) + ticks_to_usec = TICKS_TO_USEC; -#else -#ifndef VMS - { + now->wall = times (&tms) * ticks_to_usec; + now->user = tms.tms_utime * ticks_to_usec; + now->sys = tms.tms_stime * ticks_to_usec; +#endif +#ifdef USE_GETRUSAGE struct rusage rusage; - getrusage (0, &rusage); + getrusage (RUSAGE_SELF, &rusage); now->user = rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec; now->sys = rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec; +#endif +#ifdef USE_CLOCK + static int clocks_to_usec; + if (clocks_to_usec == 0) + clocks_to_usec = CLOCKS_TO_USEC; + now->user = clock () * clocks_to_usec; +#endif } -#define HAVE_USER_TIME -#define HAVE_SYS_TIME - -#else /* VMS */ - { - struct - { - int proc_user_time; - int proc_system_time; - int child_user_time; - int child_system_time; - } vms_times; - now->wall = times ((void *) &vms_times) * 10000; - now->user = vms_times.proc_user_time * 10000; - now->sys = vms_times.proc_system_time * 10000; - } -#define HAVE_USER_TIME -#define HAVE_SYS_TIME -#define HAVE_WALL_TIME - -#endif /* VMS */ -#endif /* USG */ -#endif /* _SC_CLK_TCK */ -#endif /* _WIN32 */ -#endif /* __BEOS__ */ -} +} /* Add the difference between STOP_TIME and START_TIME to TIMER. */ -- 2.30.2