summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-09-13 11:06:09 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-09-17 13:16:46 -0700
commit3acc18fcf7c38e7060e43e2de59f09392aa8fdea (patch)
treef2766ca27c17e1b48bf9a3bc479be6f82947c1b2 /configure.ac
parent60d0c0d062b543b85a354e5266aa974fcdc36290 (diff)
move pthread_setaffinity_np check to the build system
Rather than trying to encode all of the rules in a header, lets just put them in the build system where they belong. This fixes the build on FreeBSD, which does have pthraed_setaffinity_np, but it's in a pthread_np.h, not behind _GNU_SOURCE. FreeBSD also implements cpu_set slightly differently, so additional changes would be required to get it working right there anyway. v2: - fix #define in autotools Fixes: 9f1bbbdbbd77d346c74c7abbb31f399151a85713 ("util: try to fix the Android and MacOS build") Cc: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac16
1 files changed, 16 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index f8bb131cb6..7583a375ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -968,6 +968,22 @@ if test "x$pthread_stubs_possible" = xyes; then
PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs >= 0.4)
fi
+save_LIBS="$LIBS"
+LIBS="$PTHREAD_LIBS"
+AC_MSG_CHECKING(whether pthread_setaffinity_np is supported)
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
+ #define _GNU_SOURCE
+ #include <pthread.h>
+ int main() {
+ void *a = (void*) &pthread_setaffinity_np;
+ long b = (long) a;
+ return (int) b;
+ }]])],
+ [DEFINES="$DEFINES -DHAVE_PTHREAD_SETAFFINITY"];
+ AC_MSG_RESULT([yes]),
+ AC_MSG_RESULT([no]))
+LIBS="$save_LIBS"
+
dnl Check for futex for fast inline simple_mtx_t.
AC_CHECK_HEADER([linux/futex.h], [DEFINES="$DEFINES -DHAVE_LINUX_FUTEX_H"])