summaryrefslogtreecommitdiff
path: root/m4/mktime.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/mktime.m4')
-rw-r--r--m4/mktime.m434
1 files changed, 34 insertions, 0 deletions
diff --git a/m4/mktime.m4 b/m4/mktime.m4
new file mode 100644
index 000000000..3f03b1e0c
--- /dev/null
+++ b/m4/mktime.m4
@@ -0,0 +1,34 @@
+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 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
+int
+main ()
+{
+ time_t today = time (0);
+ struct tm *local = localtime (&today);
+ exit (mktime (local) != today);
+}
+ ],
+ 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"
+ fi
+])