]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
be more careful when checking for sigwaitinfo and sigwait presence
authorTobias Oetiker <tobi@oetiker.ch>
Wed, 14 Jan 2015 12:52:01 +0000 (13:52 +0100)
committerTobias Oetiker <tobi@oetiker.ch>
Wed, 14 Jan 2015 12:52:01 +0000 (13:52 +0100)
configure
configure.ac
src/rrd_config.h.in
src/rrd_daemon.c

index 938b81d849e3eb9e2c69f01f9e15de9e0c8a6b18..72ddd2a23eea31c8b72119a7c3d27ece5efffdee 100755 (executable)
--- 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
 { $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 <stdio.h>
+        #include <signal.h>
+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; }
 
 
 
index 9db5f59d96e6dc7670343f1707a7279948ea6226..76e5802cf9f875fbc3ce0f12fa0826c0871b72a7 100644 (file)
@@ -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 <stdio.h>
+        #include <signal.h>],
+        [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
 
index d02f76064751c4cc18e7528945ec70574af6a625..66f2f3762ff337951b4fbfcbe8755c7479b85496 100644 (file)
 /* 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
 
 /* Define to 1 if you have the <signal.h> 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. */
index 9d2d0b8c1186342ed95ff3fe5d0732d074dd01a6..8335b4c99ab3546502c566e408effd8a3db169a5 100644 (file)
@@ -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: