[pacman-dev] [PATCH 4/4] Fix build error when SIGPOLL is not available
Mark Weiman
mark.weiman at markzz.com
Fri Apr 16 19:42:09 UTC 2021
On Linux, SIGPOLL is a valid signal, but on systems like FreeBSD, it is
not. This patch adds a detection within meson.build to check if it's
available, and if not, make sure it's not included.
Signed-off-by: Mark Weiman <mark.weiman at markzz.com>
---
lib/libalpm/util.c | 6 +++++-
meson.build | 13 +++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index d2a688a2..db07502a 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -561,7 +561,11 @@ static void _alpm_reset_signals(void)
int *i, signals[] = {
SIGABRT, SIGALRM, SIGBUS, SIGCHLD, SIGCONT, SIGFPE, SIGHUP, SIGILL,
SIGINT, SIGKILL, SIGPIPE, SIGQUIT, SIGSEGV, SIGSTOP, SIGTERM, SIGTSTP,
- SIGTTIN, SIGTTOU, SIGUSR1, SIGUSR2, SIGPOLL, SIGPROF, SIGSYS, SIGTRAP,
+ SIGTTIN, SIGTTOU, SIGUSR1, SIGUSR2,
+#if defined(HAVE_SIGPOLL)
+ SIGPOLL,
+#endif
+ SIGPROF, SIGSYS, SIGTRAP,
SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ,
0
};
diff --git a/meson.build b/meson.build
index 0dc0d612..359e7f05 100644
--- a/meson.build
+++ b/meson.build
@@ -193,8 +193,21 @@ signal_code = '''void foo() { int sig = SIGINT; }'''
signal_test = cc.compiles(signal_code, name : 'test if signal.h is not needed')
if not signal_test
conf.set('INCLUDE_SIGNAL_H', true)
+ include_signal = '''#include <signal.h>'''
+else
+ include_signal = ''
endif
+foreach sig : [
+ 'SIGPOLL',
+ ]
+ if cc.compiles(include_signal + '''
+ void foo() { int sig = ''' +
+ sig + '''; }''', name : 'test for ' + sig)
+ conf.set('HAVE_' + sig, true)
+ endif
+endforeach
+
if get_option('debug')
extra_cflags = [
'-Wcast-align',
--
2.31.1
More information about the pacman-dev
mailing list