summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2004-07-23 17:24:59 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2004-07-23 17:24:59 (GMT)
commit8d843938ba8275f8a52f32a26b5f6829830e3a8a (patch)
tree5db430aecc45fc1c7cd7783eab72ad0f1806c10d /configure.in
parent12ee450f700800de37600494353e39e8be59e928 (diff)
downloadhdf5-8d843938ba8275f8a52f32a26b5f6829830e3a8a.zip
hdf5-8d843938ba8275f8a52f32a26b5f6829830e3a8a.tar.gz
hdf5-8d843938ba8275f8a52f32a26b5f6829830e3a8a.tar.bz2
[svn-r8937]
Purpose: Bug fix Description: Modification time test (mtime) would die silently on some systems. This is because the code is very system-dependant (it relies on getting the current time and the timezone from the OS). Solution: mtime test now uses TEST_ERROR macro to print "FAILED" and to output where the failure occurred. Configure script is a little smarter about whether gettimeofday() function returns the timezone correctly. Further bugs will need to be addressed on a system-by-system basis. Platforms tested: sleipnir, arabica, verbena, copper, windows (VC7)
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in33
1 files changed, 32 insertions, 1 deletions
diff --git a/configure.in b/configure.in
index a0a6c2f..8d736d0 100644
--- a/configure.in
+++ b/configure.in
@@ -537,7 +537,8 @@ dnl ----------------------------------------------------------------------
dnl Check for these two functions before <sys/time.h> is checked for, otherwise
dnl they are not detected correctly on Solaris [2.6].
dnl
-AC_CHECK_FUNCS(difftime gettimeofday)
+AC_CHECK_FUNCS(difftime)
+AC_CHECK_FUNCS([gettimeofday], [have_gettime="yes"], [have_gettime="no"])
dnl Unix
AC_CHECK_HEADERS([sys/resource.h sys/time.h unistd.h sys/ioctl.h sys/stat.h])
@@ -1495,9 +1496,39 @@ AC_TRY_COMPILE([
#include <time.h>],[struct timezone tz; tz.tz_minuteswest=0;],
AC_DEFINE(HAVE_STRUCT_TIMEZONE, 1,
[Define if \`struct timezone' is defined])
+have_struct_tz="yes"
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
+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 <time.h>
+ #include <sys/time.h>
+ 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_MSG_RESULT([yes])
+ AC_DEFINE([GETTIMEOFDAY_GIVES_TZ], [1],
+ [Define if gettimeofday() populates the tz pointer passed in])
+ else
+ AC_MSG_RESULT([no])
+ fi
+fi
+
dnl ----------------------------------------------------------------------
dnl Does the struct stat have the st_blocks field? This field is not Posix.
dnl