From a23f1c800d69286c9c85007cef42760c42786117 Mon Sep 17 00:00:00 2001 From: James Laird Date: Tue, 10 Aug 2004 11:53:26 -0500 Subject: [svn-r9056] Purpose: Bug fix Description: Fixed gettimeofday configure test to use cache values Platforms tested: copper, arabica, verbena, sleipnir Misc. update: --- configure | 41 +++++++++++++++++++++++------------------ configure.in | 35 ++++++++++++++++++----------------- 2 files changed, 41 insertions(+), 35 deletions(-) diff --git a/configure b/configure index 17f0b35..beb5b00 100755 --- a/configure +++ b/configure @@ -30305,7 +30305,10 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$have_gettime" = "yes" -a "$have_struct_tz" = "yes"; then echo "$as_me:$LINENO: checking whether gettimeofday() gives timezone" >&5 echo $ECHO_N "checking whether gettimeofday() gives timezone... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then + if test "${hdf5_cv_gettimeofday_tz+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } @@ -30314,20 +30317,20 @@ else #line $LINENO "configure" #include "confdefs.h" - #include - #include - int main(void) - { - struct timeval tv; - struct timezone tz; - tz.tz_minuteswest = 7777; /* Initialize to an unreasonable number */ - tz.tz_dsttime = 7; - gettimeofday(&tv, &tz); - /* Check whether the function returned any value at all */ - if(tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7) - exit(1); - else exit (0); - } + #include + #include + int main(void) + { + struct timeval tv; + struct timezone tz; + tz.tz_minuteswest = 7777; /* Initialize to an unreasonable number */ + tz.tz_dsttime = 7; + gettimeofday(&tv, &tz); + /* Check whether the function returned any value at all */ + if(tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7) + exit(1); + else exit (0); + } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 @@ -30340,18 +30343,20 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - hdf5_use_tz="yes" + hdf5_cv_gettimeofday_tz=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ( exit $ac_status ) -hdf5_use_tz="no" +hdf5_cv_gettimeofday_tz=no fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi +fi + - if test "$hdf5_use_tz" = "yes"; then + if test ${hdf5_cv_gettimeofday_tz} = "yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 diff --git a/configure.in b/configure.in index c456eca..252d5e3 100644 --- a/configure.in +++ b/configure.in @@ -1635,23 +1635,24 @@ dnl If gettimeofday() is going to be used, make sure it uses the timezone struct if test "$have_gettime" = "yes" -a "$have_struct_tz" = "yes"; then AC_MSG_CHECKING(whether gettimeofday() gives timezone) - AC_TRY_RUN([ - #include - #include - int main(void) - { - struct timeval tv; - struct timezone tz; - tz.tz_minuteswest = 7777; /* Initialize to an unreasonable number */ - tz.tz_dsttime = 7; - gettimeofday(&tv, &tz); - /* Check whether the function returned any value at all */ - if(tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7) - exit(1); - else exit (0); - }], [hdf5_use_tz="yes"], [hdf5_use_tz="no"],) - - if test "$hdf5_use_tz" = "yes"; then + AC_CACHE_VAL([hdf5_cv_gettimeofday_tz], + [AC_TRY_RUN([ + #include + #include + int main(void) + { + struct timeval tv; + struct timezone tz; + tz.tz_minuteswest = 7777; /* Initialize to an unreasonable number */ + tz.tz_dsttime = 7; + gettimeofday(&tv, &tz); + /* Check whether the function returned any value at all */ + if(tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7) + exit(1); + else exit (0); + }], [hdf5_cv_gettimeofday_tz=yes], [hdf5_cv_gettimeofday_tz=no],)]) + + if test ${hdf5_cv_gettimeofday_tz} = "yes"; then AC_MSG_RESULT([yes]) AC_DEFINE([GETTIMEOFDAY_GIVES_TZ], [1], [Define if gettimeofday() populates the tz pointer passed in]) -- cgit v0.12