Use AC_LIBSOURCES and AC_LIBOBJ to indicate source and object files.
[gnulib.git] / m4 / physmem.m4
1 # physmem.m4 serial 4
2 dnl Copyright (C) 2002, 2003, 2005 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       [gl_cv_var__system_configuration=yes],
17       [gl_cv_var__system_configuration=no])])
18
19     if test $gl_cv_var__system_configuration = yes; then
20       AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1,
21                 [Define to 1 if you have the external variable,
22                 _system_configuration with a member named physmem.])
23     fi
24   ]
25 )
26
27 AC_DEFUN([gl_PHYSMEM],
28 [
29   AC_LIBSOURCES([physmem.c, physmem.h])
30   AC_LIBOBJ([physmem])
31
32   # Prerequisites of lib/physmem.c.
33   AC_CHECK_HEADERS_ONCE(unistd.h)
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/sysctl.h \
36     sys/systemcfg.h],,, [AC_INCLUDES_DEFAULT])
37
38   AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic sysmp getsysinfo sysctl table)
39   AC_REQUIRE([gl_SYS__SYSTEM_CONFIGURATION])
40 ])