Test for Linux-specific sysinfo() only on Linux systems.

Some other systems have sysinfo() with different semantics.
This commit is contained in:
Lasse Collin 2009-03-01 09:03:08 +02:00
parent cf751edfde
commit 0df9299e24
1 changed files with 19 additions and 9 deletions

View File

@ -54,6 +54,10 @@ main(void)
with sysctl().]) with sysctl().])
AC_MSG_RESULT([sysctl]) AC_MSG_RESULT([sysctl])
], [ ], [
dnl sysinfo() is Linux-specific. Some non-Linux systems have
dnl incompatible sysinfo() so we must check $host_os.
case $host_os in
linux*)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
int int
@ -65,10 +69,16 @@ main(void)
} }
]])], [ ]])], [
AC_DEFINE([HAVE_PHYSMEM_SYSINFO], [1], AC_DEFINE([HAVE_PHYSMEM_SYSINFO], [1],
[Define to 1 if the amount of physical memory can be detected [Define to 1 if the amount of physical memory
with sysinfo().]) can be detected with Linux sysinfo().])
AC_MSG_RESULT([sysinfo]) AC_MSG_RESULT([sysinfo])
], [ ], [
AC_MSG_RESULT([unknown]) AC_MSG_RESULT([unknown])
])])]) ])
;;
*)
AC_MSG_RESULT([unknown])
;;
esac
])])
])dnl lc_PHYSMEM ])dnl lc_PHYSMEM