On 4/16/21 3:42 PM, Mark Weiman wrote:
> 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.

I have seen this brought up before...

It solves one of the two problems brought up in
https://lists.archlinux.org/pipermail/pacman-dev/2020-September/024525.html

And it does so without keying off of #ifndef __APPLE__

:D

> Signed-off-by: Mark Weiman <[email protected]>
> ---
>  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',
> 


-- 
Eli Schwartz
Bug Wrangler and Trusted User

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to