ls: --color now highlights hard linked files, too
[coreutils/bo.git] / m4 / boottime.m4
blob863eb02c335f5ad310a707e16a93bbcff241e010
1 # boottime.m4 serial 3
2 # Determine whether this system has infrastructure for obtaining the boot time.
4 # Copyright (C) 1996, 2000, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 # GNULIB_BOOT_TIME([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
20 * ----------------------------------------------------------
21 AC_DEFUN([GNULIB_BOOT_TIME],
23   AC_CHECK_FUNCS(sysctl)
24   AC_CHECK_HEADERS_ONCE(sys/param.h)
25   AC_CHECK_HEADERS(sys/sysctl.h, [], [],
26     [AC_INCLUDES_DEFAULT
27      [#if HAVE_SYS_PARAM_H
28        #include <sys/param.h>
29       #endif]])
30   AC_CHECK_HEADERS_ONCE(utmp.h utmpx.h OS.h)
31   AC_CACHE_CHECK(
32     [whether we can get the system boot time],
33     [gnulib_cv_have_boot_time],
34     [
35       AC_COMPILE_IFELSE(
36        [AC_LANG_PROGRAM(
37 [AC_INCLUDES_DEFAULT
38 #if HAVE_SYSCTL && HAVE_SYS_SYSCTL_H
39 # if HAVE_SYS_PARAM_H
40 #  include <sys/param.h> /* needed for OpenBSD 3.0 */
41 # endif
42 # include <sys/sysctl.h>
43 #endif
44 #if HAVE_UTMPX_H
45 # include <utmpx.h>
46 #elif HAVE_UTMP_H
47 # include <utmp.h>
48 #endif
49 #if HAVE_OS_H
50 # include <OS.h>
51 #endif
54 #if defined BOOT_TIME || (defined CTL_KERN && defined KERN_BOOTTIME) || HAVE_OS_H
55 /* your system *does* have the infrastructure to determine boot time */
56 #else
57 please_tell_us_how_to_determine_boot_time_on_your_system
58 #endif
59 ]])],
60        gnulib_cv_have_boot_time=yes,
61        gnulib_cv_have_boot_time=no)
62     ])
63   AS_IF([test $gnulib_cv_have_boot_time = yes], [$1], [$2])