* ChangeLog: Fix misspelling
[gnulib.git] / m4 / physmem.m4
blobf3284dac2fa9eccced7dabf3ebbd70a3ea5fb797
1 # physmem.m4
2 # serial 12
3 dnl Copyright (C) 2002-2003, 2005-2006, 2008-2024 Free Software Foundation,
4 dnl Inc.
5 dnl This file is free software; the Free Software Foundation
6 dnl gives unlimited permission to copy and/or distribute it,
7 dnl with or without modifications, as long as this notice is preserved.
9 # Check for the external symbol, _system_configuration,
10 # a struct with member 'physmem'.
11 AC_DEFUN([gl_SYS__SYSTEM_CONFIGURATION],
12   [AC_CACHE_CHECK([for external symbol _system_configuration],
13                   [gl_cv_var__system_configuration],
14     [AC_LINK_IFELSE([AC_LANG_PROGRAM(
15                       [[#include <sys/systemcfg.h>
16                       ]],
17                       [[double x = _system_configuration.physmem;
18                         if (x > 0.0) return 0;]])],
19       [gl_cv_var__system_configuration=yes],
20       [gl_cv_var__system_configuration=no])])
22     if test $gl_cv_var__system_configuration = yes; then
23       AC_DEFINE([HAVE__SYSTEM_CONFIGURATION], [1],
24                 [Define to 1 if you have the external variable,
25                 _system_configuration with a member named physmem.])
26     fi
27   ]
30 AC_DEFUN([gl_PHYSMEM],
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/systemcfg.h],,,
35     [AC_INCLUDES_DEFAULT])
36   dnl <sys/sysctl.h> requires <sys/param.h> on OpenBSD 4.0.
37   AC_CHECK_HEADERS([sys/sysctl.h],,,
38     [AC_INCLUDES_DEFAULT
39      #if HAVE_SYS_PARAM_H
40      # include <sys/param.h>
41      #endif
42     ])
44   AC_CHECK_FUNCS([pstat_getstatic pstat_getdynamic sysmp getsysinfo sysctl table sysinfo])
45   AC_CHECK_MEMBERS([struct sysinfo.mem_unit],,, [[#include <sys/sysinfo.h>]])
46   AC_REQUIRE([gl_SYS__SYSTEM_CONFIGURATION])