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