Do the Windows oldnames workaround through the C++ GNULIB_NAMESPACE.
[gnulib.git] / m4 / physmem.m4
blob7d6ebabb7aa1915f4864414f32af38b2753ec7c1
1 # physmem.m4 serial 12
2 dnl Copyright (C) 2002-2003, 2005-2006, 2008-2020 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.
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])])
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   ]
29 AC_DEFUN([gl_PHYSMEM],
31   # Prerequisites of lib/physmem.c.
32   AC_CHECK_HEADERS([sys/pstat.h sys/sysmp.h sys/sysinfo.h \
33     machine/hal_sysinfo.h sys/table.h sys/param.h sys/systemcfg.h],,,
34     [AC_INCLUDES_DEFAULT])
35   dnl <sys/sysctl.h> requires <sys/param.h> on OpenBSD 4.0.
36   AC_CHECK_HEADERS([sys/sysctl.h],,,
37     [AC_INCLUDES_DEFAULT
38      #if HAVE_SYS_PARAM_H
39      # include <sys/param.h>
40      #endif
41     ])
43   AC_CHECK_FUNCS([pstat_getstatic pstat_getdynamic sysmp getsysinfo sysctl table sysinfo])
44   AC_CHECK_MEMBERS([struct sysinfo.mem_unit],,, [[#include <sys/sysinfo.h>]])
45   AC_REQUIRE([gl_SYS__SYSTEM_CONFIGURATION])