summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-02-22 14:26:16 +0100
committerJeremy Allison <jra@samba.org>2013-03-01 11:58:49 -0800
commitd5f92571083c82347f58a415db828b064e377522 (patch)
tree7b8940fce6c8744c76ec94f75ddd7592527e84a6
parent602cd7f6c6744c2468fb3350eb80ac15f5b9400c (diff)
downloadsamba-d5f92571083c82347f58a415db828b064e377522.tar.gz
samba-d5f92571083c82347f58a415db828b064e377522.tar.bz2
samba-d5f92571083c82347f58a415db828b064e377522.zip
tevent: define TEVENT_NUM_SIGNALS based on configure checks
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--lib/tevent/libtevent.m429
-rw-r--r--lib/tevent/tevent_signal.c2
-rwxr-xr-xlib/tevent/wscript17
3 files changed, 46 insertions, 2 deletions
diff --git a/lib/tevent/libtevent.m4 b/lib/tevent/libtevent.m4
index 5c5969b0df..4d4fd2bd77 100644
--- a/lib/tevent/libtevent.m4
+++ b/lib/tevent/libtevent.m4
@@ -39,6 +39,35 @@ if test x"$ac_cv_header_sys_epoll_h" = x"yes" -a x"$ac_cv_func_epoll_create" = x
AC_DEFINE(HAVE_EPOLL, 1, [Whether epoll available])
fi
+tevent_num_signals_includes="$ac_includes_default
+#include <signal.h>
+"
+tevent_num_signals=64
+AC_CHECK_VALUEOF(NSIG, [$tevent_num_signals_includes])
+v=$ac_cv_valueof_NSIG
+test -n "$v" && test "$v" -gt "$tevent_num_signals" && {
+ tevent_num_signals=$v
+}
+AC_CHECK_VALUEOF(_NSIG, [$tevent_num_signals_includes])
+v=$ac_cv_valueof__NSIG
+test -n "$v" && test "$v" -gt "$tevent_num_signals" && {
+ tevent_num_signals=$v
+}
+AC_CHECK_VALUEOF(SIGRTMAX, [$tevent_num_signals_includes])
+v=$ac_cv_valueof_SIGRTMAX
+test -n "$v" && test "$v" -gt "$tevent_num_signals" && {
+ tevent_num_signals=$v
+}
+AC_CHECK_VALUEOF(SIGRTMIN, [$tevent_num_signals_includes])
+v=$ac_cv_valueof_SIGRTMIN
+test -n "$v" && {
+ v=`expr $v + $v`
+}
+test -n "$v" && test "$v" -gt "$tevent_num_signals" && {
+ tevent_num_signals=$v
+}
+AC_DEFINE_UNQUOTED(TEVENT_NUM_SIGNALS, $tevent_num_signals, [Max signal number value])
+
if test x"$VERSIONSCRIPT" != "x"; then
EXPORTSFILE=tevent.exports
AC_SUBST(EXPORTSFILE)
diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c
index 9582f6e7ac..b5a56ef03a 100644
--- a/lib/tevent/tevent_signal.c
+++ b/lib/tevent/tevent_signal.c
@@ -30,8 +30,6 @@
#include "tevent_internal.h"
#include "tevent_util.h"
-#define TEVENT_NUM_SIGNALS 64
-
/* maximum number of SA_SIGINFO signals to hold in the queue.
NB. This *MUST* be a power of 2, in order for the ring buffer
wrap to work correctly. Thanks to Petr Vandrovec <petr@vandrovec.name>
diff --git a/lib/tevent/wscript b/lib/tevent/wscript
index 684286d8c4..c62c3de317 100755
--- a/lib/tevent/wscript
+++ b/lib/tevent/wscript
@@ -44,6 +44,23 @@ def configure(conf):
if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'):
conf.DEFINE('HAVE_EPOLL', 1)
+ tevent_num_signals = 64
+ v = conf.CHECK_VALUEOF('NSIG', headers='signal.h')
+ if v is not None:
+ tevent_num_signals = max(tevent_num_signals, v)
+ v = conf.CHECK_VALUEOF('_NSIG', headers='signal.h')
+ if v is not None:
+ tevent_num_signals = max(tevent_num_signals, v)
+ v = conf.CHECK_VALUEOF('SIGRTMAX', headers='signal.h')
+ if v is not None:
+ tevent_num_signals = max(tevent_num_signals, v)
+ v = conf.CHECK_VALUEOF('SIGRTMIN', headers='signal.h')
+ if v is not None:
+ tevent_num_signals = max(tevent_num_signals, v*2)
+
+ if not conf.CONFIG_SET('USING_SYSTEM_TEVENT'):
+ conf.DEFINE('TEVENT_NUM_SIGNALS', tevent_num_signals)
+
conf.env.disable_python = getattr(Options.options, 'disable_python', False)
if not conf.env.disable_python: