summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2016-06-13 19:24:18 +1000
committerErik de Castro Lopo <erikd@mega-nerd.com>2016-06-13 19:24:19 +1000
commit2bb6ba62b8d0e9c79b59e39e225758cf999eff83 (patch)
treea4ca5693274b43dc0e6250c71028406c42343d02 /configure.ac
parent29e1464319f40fe30fd63d8648f0d0a05541abe0 (diff)
downloadhaskell-2bb6ba62b8d0e9c79b59e39e225758cf999eff83.tar.gz
rts: Fix NUMA when cross compiling
The NUMA code was enabled whenever numa.h and numaif.h are detected. Unfortunately, the hosts' header files were being detected even then cross compiling in the absence of a target libnuma. Fix that by relying on the the presence of libnuma instead of the presence of the header files. The test for libnuma does `AC_TRY_LINK` which will fail if the test program (compiled for the target) can't be linked against libnuma. Test Plan: Build on x86_64/linux and make sure NUMA works and cross compile to armhf/linux. Reviewers: austin, bgamari, hvr, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2329
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac9
1 files changed, 6 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 070bae54d9..664deb4de6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1105,10 +1105,13 @@ AC_DEFINE_UNQUOTED([USE_LIBDW], [$USE_LIBDW], [Set to 1 to use libdw])
dnl ** Have libnuma?
dnl --------------------------------------------------------------
+HaveLibNuma=0
AC_CHECK_HEADERS([numa.h numaif.h])
-AC_CHECK_LIB(numa, numa_available,
- [AC_DEFINE([HAVE_LIBNUMA], [1], [Define to 1 if you have libnuma.])]
- [])
+
+if test "$ac_cv_header_numa_h$ac_cv_header_numaif_h" = "yesyes" ; then
+ AC_CHECK_LIB(numa, numa_available,HaveLibNuma=1)
+fi
+AC_DEFINE_UNQUOTED([USE_LIBNUMA], [$HaveLibNuma], [Define to 1 if you have libnuma])
dnl ** Documentation
dnl --------------------------------------------------------------