2 dnl Copyright (C) 2002-2003, 2005-2006, 2008-2020 Free Software Foundation,
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>
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.])
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],,,
39 # include <sys/param.h>
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])