summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorKyle J. McKay <mackyle@gmail.com>2015-03-08 07:14:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-03-10 22:13:25 (GMT)
commit9529080de253b89474402f323e10470656764b3a (patch)
tree7154b4495465156ceab9d7595d03492e0a8a3d50 /configure.ac
parent9874fca7122563e28d699a911404fc49d2a24f1c (diff)
downloadgit-9529080de253b89474402f323e10470656764b3a.zip
git-9529080de253b89474402f323e10470656764b3a.tar.gz
git-9529080de253b89474402f323e10470656764b3a.tar.bz2
configure: support HAVE_BSD_SYSCTL option
On BSD-compatible systems some information such as the number of available CPUs may only be available via the sysctl function. Add support for a HAVE_BSD_SYSCTL option complete with autoconf support and include the sys/syctl.h header when the option is enabled to make the sysctl function available. Signed-off-by: Kyle J. McKay <mackyle@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac23
1 files changed, 23 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 55e5a9b..bbdde85 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1046,6 +1046,29 @@ GIT_CONF_SUBST([NO_INITGROUPS])
#
# Define NO_ICONV if your libc does not properly support iconv.
+AC_DEFUN([BSD_SYSCTL_SRC], [
+AC_LANG_PROGRAM([[
+#include <stddef.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+]],[[
+int val, mib[2];
+size_t len;
+mib[0] = CTL_HW;
+mib[1] = 1;
+len = sizeof(val);
+return sysctl(mib, 2, &val, &len, NULL, 0) ? 1 : 0;
+]])])
+
+#
+# Define HAVE_BSD_SYSCTL=YesPlease if a BSD-compatible sysctl function is available.
+AC_MSG_CHECKING([for BSD sysctl])
+AC_COMPILE_IFELSE([BSD_SYSCTL_SRC],
+ [AC_MSG_RESULT([yes])
+ HAVE_BSD_SYSCTL=YesPlease],
+ [AC_MSG_RESULT([no])
+ HAVE_BSD_SYSCTL=])
+GIT_CONF_SUBST([HAVE_BSD_SYSCTL])
## Other checks.
# Define USE_PIC if you need the main git objects to be built with -fPIC