summaryrefslogtreecommitdiff
path: root/m4/mktime.m4
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1996-12-21 01:56:50 +0000
committerJim Meyering <jim@meyering.net>1996-12-21 01:56:50 +0000
commit58dfd6b4420c1d0d9136dfa98829ccd17853b064 (patch)
treeb10ebcf306455a04b25fd831347552f3736adec1 /m4/mktime.m4
parent5fc47138b1f01f5ec8d449585bd19abea4da7960 (diff)
downloadcoreutils-58dfd6b4420c1d0d9136dfa98829ccd17853b064.tar.xz
copied from automake-1.1l
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
+])