summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-07-17 10:47:46 +0000
committerJim Meyering <jim@meyering.net>2002-07-17 10:47:46 +0000
commit15b923a271eb54b7b07864b301a31d26f851f10b (patch)
tree7b516b56c66204e8399b14f2d51bff90cad930fc
parent6080be67012dd10f6373edbf53f14309506e8448 (diff)
downloadcoreutils-15b923a271eb54b7b07864b301a31d26f851f10b.tar.xz
New file. Extracted from sh-utils' configure.ac
and extended to work also with *BSD systems.
-rw-r--r--m4/boottime.m437
1 files changed, 37 insertions, 0 deletions
diff --git a/m4/boottime.m4 b/m4/boottime.m4
new file mode 100644
index 000000000..e4f405483
--- /dev/null
+++ b/m4/boottime.m4
@@ -0,0 +1,37 @@
+# Determine whether this system has infrastructure for obtaining the boot time.
+
+# GNULIB_BOOT_TIME([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+* ----------------------------------------------------------
+AC_DEFUN([GNULIB_BOOT_TIME],
+[
+ AC_CHECK_FUNCS(sysctl)
+ AC_CHECK_HEADERS(sys/sysctl.h)
+ AC_CACHE_CHECK(
+ [whether we can get the system boot time],
+ [gnulib_cv_have_boot_time],
+ [
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+[AC_INCLUDES_DEFAULT
+#if HAVE_SYSCTL && HAVE_SYS_SYSCTL_H
+# include <sys/param.h> /* needed for OpenBSD 3.0 */
+# include <sys/sysctl.h>
+#endif
+#ifdef HAVE_UTMPX_H
+# include <utmpx.h>
+#else
+# include <utmp.h>
+#endif
+],
+[[
+#if defined BOOT_TIME || (defined CTL_KERN && defined KERN_BOOTTIME)
+/* your system *does* have the infrastructure to determine boot time */
+#else
+please_tell_us_how_to_determine_boot_time_on_your_system
+#endif
+]])],
+ gnulib_cv_have_boot_time=yes,
+ gnulib_cv_have_boot_time=no)
+ ])
+ AS_IF([test $gnulib_cv_have_boot_time = yes], [$1], [$2])
+])