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