Imported Upstream version 3.2.0
[debian/amanda] / config / gnulib / physmem.m4
1 # physmem.m4 serial 10
2 dnl Copyright (C) 2002-2003, 2005-2006, 2008-2010 Free Software Foundation,
3 dnl Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 # Check for the external symbol, _system_configuration,
9 # a struct with member `physmem'.
10 AC_DEFUN([gl_SYS__SYSTEM_CONFIGURATION],
11   [AC_CACHE_CHECK([for external symbol _system_configuration],
12                   gl_cv_var__system_configuration,
13     [AC_LINK_IFELSE([AC_LANG_PROGRAM(
14                       [[#include <sys/systemcfg.h>
15                       ]],
16                       [[double x = _system_configuration.physmem;
17                         if (x > 0.0) return 0;]])],
18       [gl_cv_var__system_configuration=yes],
19       [gl_cv_var__system_configuration=no])])
20
21     if test $gl_cv_var__system_configuration = yes; then
22       AC_DEFINE([HAVE__SYSTEM_CONFIGURATION], [1],
23                 [Define to 1 if you have the external variable,
24                 _system_configuration with a member named physmem.])
25     fi
26   ]
27 )
28
29 AC_DEFUN([gl_PHYSMEM],
30 [
31   AC_LIBOBJ([physmem])
32
33   # Prerequisites of lib/physmem.c.
34   AC_CHECK_HEADERS([sys/pstat.h sys/sysmp.h sys/sysinfo.h \
35     machine/hal_sysinfo.h sys/table.h sys/param.h sys/systemcfg.h],,,
36     [AC_INCLUDES_DEFAULT])
37   dnl <sys/sysctl.h> requires <sys/param.h> on OpenBSD 4.0.
38   AC_CHECK_HEADERS([sys/sysctl.h],,,
39     [AC_INCLUDES_DEFAULT
40      #if HAVE_SYS_PARAM_H
41      # include <sys/param.h>
42      #endif
43     ])
44
45   AC_CHECK_FUNCS([pstat_getstatic pstat_getdynamic sysmp getsysinfo sysctl table])
46   AC_REQUIRE([gl_SYS__SYSTEM_CONFIGURATION])
47 ])