Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame^] | 1 | From 66e6adc138eef1367d7492fb79ae4da84ed62934 Mon Sep 17 00:00:00 2001 |
| 2 | From: Neil Horman <nhorman@gmail.com> |
| 3 | Date: Thu, 15 Jul 2021 08:43:01 -0400 |
| 4 | Subject: [PATCH] Adding ability to detect non-posix extensions for pthreads |
| 5 | |
| 6 | Theres a desire to build rngd with musl, which doesn't have all the gnu |
| 7 | extensions (but it has some). So test for those. Note, this requires |
| 8 | the addition of the USE_EXTENSIONS macro to enable -d_GNU_SOURCE |
| 9 | |
| 10 | Upstream-Status: Backport |
| 11 | Signed-off-by: Neil Horman <nhorman@tuxdriver.com> |
| 12 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> |
| 13 | --- |
| 14 | configure.ac | 7 +++++++ |
| 15 | 1 file changed, 7 insertions(+) |
| 16 | |
| 17 | diff --git a/configure.ac b/configure.ac |
| 18 | index 9df633d..d0c2179 100644 |
| 19 | --- a/configure.ac |
| 20 | +++ b/configure.ac |
| 21 | @@ -25,6 +25,7 @@ AC_CANONICAL_TARGET dnl required for broken AX_PTHREAD |
| 22 | AM_INIT_AUTOMAKE([foreign]) |
| 23 | AC_CONFIG_HEADERS([rng-tools-config.h]) |
| 24 | AC_CONFIG_MACRO_DIRS([m4]) |
| 25 | +AC_USE_SYSTEM_EXTENSIONS |
| 26 | |
| 27 | dnl Parse options |
| 28 | |
| 29 | @@ -100,6 +101,12 @@ AS_IF( |
| 30 | ], [AC_MSG_NOTICE([Disabling JITTER entropy source])] |
| 31 | ) |
| 32 | |
| 33 | +AC_CHECK_DECL(pthread_attr_setaffinity_np, |
| 34 | + [AC_DEFINE([HAVE_PTHREAD_ATTR_SETAFFINITY], 1,[Set ATTR_SETAFFINITY])], |
| 35 | + [ AC_CHECK_DECL(pthread_setaffinity_np, |
| 36 | + [AC_DEFINE([HAVE_PTHREAD_SETAFFINITY],1, [Set PTHREAD_SETAFFINITY])], [ AC_MSG_ERROR([Neither pthread_setaffinity_np nor pthread_attr_setaffinity_np found])],[[#include <pthread.h>]]) |
| 37 | + ], [[#include <pthread.h>]]) |
| 38 | + |
| 39 | AS_IF( |
| 40 | [ test "x$with_nistbeacon" != "xno"], |
| 41 | [ |