gettimeofday: port recent C++ fix to Emacs
[gnulib.git] / m4 / time_h.m4
index 8675dd9..3fefb01 100644 (file)
@@ -2,7 +2,7 @@
 
 # Copyright (C) 2000-2001, 2003-2007, 2009-2013 Free Software Foundation, Inc.
 
-# serial 7
+# serial 8
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -96,18 +96,23 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
   GNULIB_TIME_R=0;                       AC_SUBST([GNULIB_TIME_R])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_DECL_LOCALTIME_R=1;               AC_SUBST([HAVE_DECL_LOCALTIME_R])
-  HAVE_GMTIME=1;                         AC_SUBST([HAVE_GMTIME])
-  HAVE_LOCALTIME=1;                      AC_SUBST([HAVE_LOCALTIME])
   HAVE_NANOSLEEP=1;                      AC_SUBST([HAVE_NANOSLEEP])
   HAVE_STRPTIME=1;                       AC_SUBST([HAVE_STRPTIME])
   HAVE_TIMEGM=1;                         AC_SUBST([HAVE_TIMEGM])
   dnl If another module says to replace or to not replace, do that.
   dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
   dnl this lets maintainers check for portability.
-  REPLACE_GMTIME=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_GMTIME])
-  REPLACE_LOCALTIME=GNULIB_PORTCHECK;    AC_SUBST([REPLACE_LOCALTIME])
   REPLACE_LOCALTIME_R=GNULIB_PORTCHECK;  AC_SUBST([REPLACE_LOCALTIME_R])
   REPLACE_MKTIME=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_MKTIME])
   REPLACE_NANOSLEEP=GNULIB_PORTCHECK;    AC_SUBST([REPLACE_NANOSLEEP])
   REPLACE_TIMEGM=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_TIMEGM])
+
+  dnl Hack so that the time module doesn't depend on the sys_time module.
+  dnl First, default GNULIB_GETTIMEOFDAY to 0 if sys_time is absent.
+  : ${GNULIB_GETTIMEOFDAY=0};            AC_SUBST([GNULIB_GETTIMEOFDAY])
+  dnl Second, it's OK to not use GNULIB_PORTCHECK for REPLACE_GMTIME
+  dnl and REPLACE_LOCALTIME, as portability to Solaris 2.6 and earlier
+  dnl is no longer a big deal.
+  REPLACE_GMTIME=0;                      AC_SUBST([REPLACE_GMTIME])
+  REPLACE_LOCALTIME=0;                   AC_SUBST([REPLACE_LOCALTIME])
 ])