From: Tobias Oetiker Date: Wed, 14 Jan 2015 12:52:01 +0000 (+0100) Subject: be more careful when checking for sigwaitinfo and sigwait presence X-Git-Tag: v1.5.0-rc2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00bc333fd05e9480fff11670387b8e2b37cdc852;p=thirdparty%2Frrdtool-1.x.git be more careful when checking for sigwaitinfo and sigwait presence --- diff --git a/configure b/configure index 938b81d8..72ddd2a2 100755 --- a/configure +++ b/configure @@ -14726,7 +14726,7 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h -for ac_func in sigwait sigwaitinfo nl_langinfo tzset fsync mbstowcs opendir readdir chdir chroot getgid getuid setgid setuid strndup strerror snprintf vsnprintf vasprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday getpwnam getgrnam +for ac_func in nl_langinfo tzset fsync mbstowcs opendir readdir chdir chroot getgid getuid setgid setuid strndup strerror snprintf vsnprintf vasprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday getpwnam getgrnam do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -18227,9 +18227,11 @@ $as_echo "#define HAVE_TIMEZONE 1" >>confdefs.h ac_fn_c_check_func "$LINENO" "sigwaitinfo" "ac_cv_func_sigwaitinfo" if test "x$ac_cv_func_sigwaitinfo" = xyes; then : + $as_echo "#define HAVE_SIGWAITINFO 1" >>confdefs.h else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigwaitinfo in -lrt" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigwaitinfo in -lrt" >&5 $as_echo_n "checking for sigwaitinfo in -lrt... " >&6; } if ${ac_cv_lib_rt_sigwaitinfo+:} false; then : $as_echo_n "(cached) " >&6 @@ -18266,15 +18268,53 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sigwaitinfo" >&5 $as_echo "$ac_cv_lib_rt_sigwaitinfo" >&6; } if test "x$ac_cv_lib_rt_sigwaitinfo" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBRT 1 + + +$as_echo "#define HAVE_SIGWAITINFO 1" >>confdefs.h + + +fi + + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sigwait has 2 arguments" >&5 +$as_echo_n "checking whether sigwait has 2 arguments... " >&6; } +if ${ac_cv_libc_sigwait+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define _POSIX_PTHREAD_SEMANTICS + #include + #include +int +main () +{ +sigset_t sigs; int signo; sigwait(&sigs, &signo); + ; + return 0; +} _ACEOF +if ac_fn_c_try_compile "$LINENO"; then : - LIBS="-lrt $LIBS" +$as_echo "#define HAVE_SIGWAIT 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libc_sigwait" >&5 +$as_echo "$ac_cv_libc_sigwait" >&6; } diff --git a/configure.ac b/configure.ac index 9db5f59d..76e5802c 100644 --- a/configure.ac +++ b/configure.ac @@ -251,7 +251,7 @@ AC_C_BIGENDIAN dnl for each function found we get a definition in config.h dnl of the form HAVE_FUNCTION -AC_CHECK_FUNCS(sigwait sigwaitinfo nl_langinfo tzset fsync mbstowcs opendir readdir chdir chroot getgid getuid setgid setuid strndup strerror snprintf vsnprintf vasprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday getpwnam getgrnam) +AC_CHECK_FUNCS(nl_langinfo tzset fsync mbstowcs opendir readdir chdir chroot getgid getuid setgid setuid strndup strerror snprintf vsnprintf vasprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday getpwnam getgrnam) AC_FUNC_STRERROR_R @@ -391,7 +391,26 @@ CONFIGURE_PART(Resolve Portability Issues) GC_TIMEZONE() dnl Solaris has sigwaitinfo in librt -AC_CHECK_FUNC(sigwaitinfo, , AC_CHECK_LIB(rt, sigwaitinfo)) +AC_CHECK_FUNC(sigwaitinfo, AC_DEFINE(HAVE_SIGWAITINFO),[ + AC_CHECK_LIB(rt, sigwaitinfo, [ + AC_DEFINE(HAVE_SIGWAITINFO,[1],[have sigwaitinfo in librt]) + ]) +]) + +AC_CACHE_CHECK(whether sigwait has 2 arguments, + ac_cv_libc_sigwait, + AC_TRY_COMPILE([ + #define _POSIX_PTHREAD_SEMANTICS + #include + #include ], + [sigset_t sigs; int signo; sigwait(&sigs, &signo);], + AC_DEFINE(HAVE_SIGWAIT,1,[have two argument posix sigwait]) + AC_MSG_RESULT(yes) + , + AC_MSG_RESULT(no) + ) +) + CHECK_FOR_WORKING_MS_ASYNC diff --git a/src/rrd_config.h.in b/src/rrd_config.h.in index d02f7606..66f2f376 100644 --- a/src/rrd_config.h.in +++ b/src/rrd_config.h.in @@ -189,9 +189,6 @@ /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM -/* Define to 1 if you have the `rt' library (-lrt). */ -#undef HAVE_LIBRT - /* have got libwrap installed */ #undef HAVE_LIBWRAP @@ -288,10 +285,10 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SIGNAL_H -/* Define to 1 if you have the `sigwait' function. */ +/* have two argument posix sigwait */ #undef HAVE_SIGWAIT -/* Define to 1 if you have the `sigwaitinfo' function. */ +/* have sigwaitinfo in librt */ #undef HAVE_SIGWAITINFO /* Define to 1 if you have the `snprintf' function. */ diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c index 9d2d0b8c..8335b4c9 100644 --- a/src/rrd_daemon.c +++ b/src/rrd_daemon.c @@ -340,14 +340,17 @@ static void* signal_receiver (void UNUSED(*args)) while (1) { -#ifdef HAVE_SIGWAITINFO +#if defined(HAVE_SIGWAITINFO) status = sigwaitinfo(&signal_set, &signal_info); -#else +#elif defined(HAVE_SIGWAIT) status = -1; if (sigwait(signal_set, &status) < 0 ){ status = -1; } +#else +#error "we need sigwaitinfo or sigwait to compile rrd_daemon" #endif + switch(status) { case -1: