Update tuklib_cpucores.m4 and tuklib_physmem.m4 from tuklib,
which now use AC_CACHE_CHECK. Using the cache variable, configure now warns if there is no method to detect the amount of RAM and recommends using --enable-assume-ram.
This commit is contained in:
parent
d315ca4930
commit
c74c132f7f
16
configure.ac
16
configure.ac
|
@ -681,3 +681,19 @@ AC_CONFIG_FILES([
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
|
# Some warnings
|
||||||
|
if test x$tuklib_cv_physmem_method = xunknown; then
|
||||||
|
echo
|
||||||
|
echo "WARNING:"
|
||||||
|
echo "No supported method to detect the amount of RAM."
|
||||||
|
echo "Consider using --enable-assume-ram (if you didn't already)"
|
||||||
|
echo "or make a patch to add support for this operating system."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Not threading yet so don't warn.
|
||||||
|
#if test x$tuklib_cv_cpucores_method = xunknown; then
|
||||||
|
# echo
|
||||||
|
# echo "WARNING:"
|
||||||
|
# echo "No supported method to detect the number of CPU cores."
|
||||||
|
#fi
|
||||||
|
|
|
@ -25,7 +25,8 @@ AC_REQUIRE([TUKLIB_COMMON])
|
||||||
# sys/param.h might be needed by sys/sysctl.h.
|
# sys/param.h might be needed by sys/sysctl.h.
|
||||||
AC_CHECK_HEADERS([sys/param.h])
|
AC_CHECK_HEADERS([sys/param.h])
|
||||||
|
|
||||||
AC_MSG_CHECKING([how to detect the number of available CPU cores])
|
AC_CACHE_CHECK([how to detect the number of available CPU cores],
|
||||||
|
[tuklib_cv_cpucores_method], [
|
||||||
|
|
||||||
# Look for sysctl() solution first, because on OS/2, both sysconf()
|
# Look for sysctl() solution first, because on OS/2, both sysconf()
|
||||||
# and sysctl() pass the tests in this file, but only sysctl()
|
# and sysctl() pass the tests in this file, but only sysctl()
|
||||||
|
@ -45,12 +46,7 @@ main(void)
|
||||||
sysctl(name, 2, &cpus, &cpus_size, NULL, 0);
|
sysctl(name, 2, &cpus, &cpus_size, NULL, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
]])], [
|
]])], [tuklib_cv_cpucores_method=sysctl], [
|
||||||
AC_DEFINE([TUKLIB_CPUCORES_SYSCTL], [1],
|
|
||||||
[Define to 1 if the number of available CPU cores can be
|
|
||||||
detected with sysctl().])
|
|
||||||
AC_MSG_RESULT([sysctl])
|
|
||||||
], [
|
|
||||||
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -62,11 +58,20 @@ main(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
]])], [
|
]])], [
|
||||||
AC_DEFINE([TUKLIB_CPUCORES_SYSCONF], [1],
|
tuklib_cv_cpucores_method=sysconf
|
||||||
[Define to 1 if the number of available CPU cores can be
|
|
||||||
detected with sysconf(_SC_NPROCESSORS_ONLN).])
|
|
||||||
AC_MSG_RESULT([sysconf])
|
|
||||||
], [
|
], [
|
||||||
AC_MSG_RESULT([unknown])
|
tuklib_cv_cpucores_method=unknown
|
||||||
])])
|
])])])
|
||||||
|
case $tuklib_cv_cpucores_method in
|
||||||
|
sysctl)
|
||||||
|
AC_DEFINE([TUKLIB_CPUCORES_SYSCTL], [1],
|
||||||
|
[Define to 1 if the number of available CPU cores
|
||||||
|
can be detected with sysctl().])
|
||||||
|
;;
|
||||||
|
sysconf)
|
||||||
|
AC_DEFINE([TUKLIB_CPUCORES_SYSCONF], [1],
|
||||||
|
[Define to 1 if the number of available CPU cores
|
||||||
|
can be detected with sysconf(_SC_NPROCESSORS_ONLN).])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
])dnl
|
])dnl
|
||||||
|
|
|
@ -35,7 +35,8 @@ AC_REQUIRE([TUKLIB_COMMON])
|
||||||
# sys/param.h might be needed by sys/sysctl.h.
|
# sys/param.h might be needed by sys/sysctl.h.
|
||||||
AC_CHECK_HEADERS([sys/param.h])
|
AC_CHECK_HEADERS([sys/param.h])
|
||||||
|
|
||||||
AC_MSG_CHECKING([how to detect the amount of physical memory])
|
AC_CACHE_CHECK([how to detect the amount of physical memory],
|
||||||
|
[tuklib_cv_physmem_method], [
|
||||||
|
|
||||||
# Maybe checking $host_os would be enough but this matches what
|
# Maybe checking $host_os would be enough but this matches what
|
||||||
# tuklib_physmem.c does.
|
# tuklib_physmem.c does.
|
||||||
|
@ -46,9 +47,7 @@ int main(void) { return 0; }
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
#endif
|
#endif
|
||||||
]])], [
|
]])], [tuklib_cv_physmem_method=special], [
|
||||||
AC_MSG_RESULT([special])
|
|
||||||
], [
|
|
||||||
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -60,12 +59,7 @@ main(void)
|
||||||
i = sysconf(_SC_PHYS_PAGES);
|
i = sysconf(_SC_PHYS_PAGES);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
]])], [
|
]])], [tuklib_cv_physmem_method=sysconf], [
|
||||||
AC_DEFINE([TUKLIB_PHYSMEM_SYSCONF], [1],
|
|
||||||
[Define to 1 if the amount of physical memory can be detected
|
|
||||||
with sysconf(_SC_PAGESIZE) and sysconf(_SC_PHYS_PAGES).])
|
|
||||||
AC_MSG_RESULT([sysconf])
|
|
||||||
], [
|
|
||||||
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -82,12 +76,7 @@ main(void)
|
||||||
sysctl(name, 2, &mem, &mem_ptr_size, NULL, 0);
|
sysctl(name, 2, &mem, &mem_ptr_size, NULL, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
]])], [
|
]])], [tuklib_cv_physmem_method=sysctl], [
|
||||||
AC_DEFINE([TUKLIB_PHYSMEM_SYSCTL], [1],
|
|
||||||
[Define to 1 if the amount of physical memory can be detected
|
|
||||||
with sysctl().])
|
|
||||||
AC_MSG_RESULT([sysctl])
|
|
||||||
], [
|
|
||||||
|
|
||||||
# This version of sysinfo() is Linux-specific. Some non-Linux systems have
|
# This version of sysinfo() is Linux-specific. Some non-Linux systems have
|
||||||
# different sysinfo() so we must check $host_os.
|
# different sysinfo() so we must check $host_os.
|
||||||
|
@ -103,17 +92,32 @@ main(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
]])], [
|
]])], [
|
||||||
AC_DEFINE([TUKLIB_PHYSMEM_SYSINFO], [1],
|
tuklib_cv_physmem_method=sysinfo
|
||||||
[Define to 1 if the amount of physical memory
|
|
||||||
can be detected with Linux sysinfo().])
|
|
||||||
AC_MSG_RESULT([sysinfo])
|
|
||||||
], [
|
], [
|
||||||
AC_MSG_RESULT([unknown])
|
tuklib_cv_physmem_method=unknown
|
||||||
])
|
])
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
AC_MSG_RESULT([unknown])
|
tuklib_cv_physmem_method=unknown
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
])])])])
|
||||||
|
case $tuklib_cv_physmem_method in
|
||||||
|
sysconf)
|
||||||
|
AC_DEFINE([TUKLIB_PHYSMEM_SYSCONF], [1],
|
||||||
|
[Define to 1 if the amount of physical memory can
|
||||||
|
be detected with sysconf(_SC_PAGESIZE) and
|
||||||
|
sysconf(_SC_PHYS_PAGES).])
|
||||||
|
;;
|
||||||
|
sysctl)
|
||||||
|
AC_DEFINE([TUKLIB_PHYSMEM_SYSCTL], [1],
|
||||||
|
[Define to 1 if the amount of physical memory can
|
||||||
|
be detected with sysctl().])
|
||||||
|
;;
|
||||||
|
sysinfo)
|
||||||
|
AC_DEFINE([TUKLIB_PHYSMEM_SYSINFO], [1],
|
||||||
|
[Define to 1 if the amount of physical memory
|
||||||
|
can be detected with Linux sysinfo().])
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
])])])
|
|
||||||
])dnl
|
])dnl
|
||||||
|
|
Loading…
Reference in New Issue