build-sys: Build atomic-test only if pthread_setaffinity_np() is available
authorTanu Kaskinen <tanuk@iki.fi>
Tue, 4 Aug 2020 11:42:59 +0000 (14:42 +0300)
committerTanu Kaskinen <tanuk@iki.fi>
Tue, 4 Aug 2020 12:09:33 +0000 (15:09 +0300)
The function seems to be essential to the test, so the test has to be
disabled entirely if pthread_setaffinity_np() is not available.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/850
configure.ac
src/Makefile.am

index a30772ac67cfbc66e0795fe502b7d74fa1f08de6..a708d6d5b83024d71369e1e468d7422e8cde9920 100644 (file)
@@ -561,10 +561,12 @@ AC_FUNC_GETGROUPS
 AC_CHECK_FUNCS_ONCE([chmod chown fstat fchown fchmod clock_gettime getaddrinfo getgrgid_r getgrnam_r \
     getpwnam_r getpwuid_r gettimeofday getuid mlock nanosleep \
     pipe posix_fadvise posix_madvise posix_memalign setpgid setsid shm_open \
-    sigaction sleep symlink sysconf uname pthread_setaffinity_np pthread_getname_np pthread_setname_np])
+    sigaction sleep symlink sysconf uname pthread_getname_np pthread_setname_np])
 AC_CHECK_FUNCS([mkfifo], [HAVE_MKFIFO=1], [HAVE_MKFIFO=0])
 AC_SUBST(HAVE_MKFIFO)
 AM_CONDITIONAL(HAVE_MKFIFO, test "x$HAVE_MKFIFO" = "x1")
+AC_CHECK_FUNCS([pthread_setaffinity_np], [HAVE_PTHREAD_SETAFFINITY_NP=1], [HAVE_PTHREAD_SETAFFINITY_NP=0])
+AM_CONDITIONAL(HAVE_PTHREAD_SETAFFINITY_NP, test "x$HAVE_PTHREAD_SETAFFINITY_NP" = "x1")
 
 # X/OPEN
 AC_CHECK_FUNCS_ONCE([readlink])
index 5b0186b9e989995f487da125162df233031d2465..1ee8997898409694bdc7e9cc31c195972460ccb8 100644 (file)
@@ -296,8 +296,7 @@ TESTS_norun = \
                sig2str-test \
                stripnul \
                echo-cancel-test \
-               lo-latency-test \
-               atomic-test
+               lo-latency-test
 
 # These tests need a running pulseaudio daemon
 TESTS_daemon = \
@@ -316,6 +315,11 @@ TESTS_default += \
                usergroup-test
 endif
 
+if HAVE_PTHREAD_SETAFFINITY_NP
+TESTS_norun += \
+               atomic-test
+endif
+
 if HAVE_SYS_EVENTFD_H
 TESTS_default += \
                srbchannel-test