insert line break fix again
[gnulib.git] / m4 / mktime.m4
index c0fcf19..94468ee 100644 (file)
@@ -1,56 +1,25 @@
-dnl From Jim Meyering.
-dnl FIXME: this should migrate into libit.
-
-AC_DEFUN(AM_FUNC_MKTIME,
-[AC_REQUIRE([AC_HEADER_TIME])dnl
- AC_CHECK_HEADERS(sys/time.h)
- AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime,
-  [AC_TRY_RUN([/* Test program from Paul Eggert (eggert@twinsun.com)
-   and Tony Leneis (tony@plaza.ds.adp.com).  */
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-
-static time_t time_t_max;
+# mktime.m4 serial 1
+dnl Copyright (C) 2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
 
-static void
-mktime_test (now)
-     time_t now;
-{
-  if (mktime (localtime (&now)) != now)
-    exit (1);
-  now = time_t_max - now;
-  if (mktime (localtime (&now)) != now)
-    exit (1);
-}
+dnl From Jim Meyering.
 
-int
-main ()
-{
-  time_t t, delta;
-  for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
-    continue;
-  time_t_max--;
-  delta = time_t_max / 997; /* a suitable prime number */
-  for (t = 0; t <= time_t_max - delta; t += delta)
-    mktime_test (t);
-  mktime_test ((time_t) 60 * 60);
-  mktime_test ((time_t) 60 * 60 * 24);
-  exit (0);
-}
-             ],
-            am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no,
-            dnl When crosscompiling, assume mktime is missing or broken.
-            am_cv_func_working_mktime=no)
-  ])
-  if test $am_cv_func_working_mktime = no; then
-    LIBOBJS="$LIBOBJS mktime.o"
+AC_DEFUN([gl_FUNC_MKTIME],
+[
+  AC_REQUIRE([AC_FUNC_MKTIME])
+  if test $ac_cv_func_working_mktime = no; then
+    AC_DEFINE(mktime, rpl_mktime,
+      [Define to rpl_mktime if the replacement function should be used.])
+    gl_PREREQ_MKTIME
   fi
 ])
+
+# Prerequisites of lib/mktime.c.
+AC_DEFUN([gl_PREREQ_MKTIME], [
+  AC_REQUIRE([AC_HEADER_STDC])
+  AC_CHECK_HEADERS_ONCE(limits.h)
+])