gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37698 - libmicrohttpd


From: gnunet
Subject: [GNUnet-SVN] r37698 - libmicrohttpd
Date: Thu, 11 Aug 2016 17:42:28 +0200

Author: Karlson2k
Date: 2016-08-11 17:42:28 +0200 (Thu, 11 Aug 2016)
New Revision: 37698

Modified:
   libmicrohttpd/configure.ac
Log:
configure.ac: fixed checking for thread name function

Modified: libmicrohttpd/configure.ac
===================================================================
--- libmicrohttpd/configure.ac  2016-08-11 15:42:25 UTC (rev 37697)
+++ libmicrohttpd/configure.ac  2016-08-11 15:42:28 UTC (rev 37698)
@@ -307,7 +307,8 @@
    [], [enable_thread_names='auto'])
 
 if test "x$enable_thread_names" != "xno" && test "x$USE_THREADS" = "xposix"; 
then
-  # Check for pthread_setname_np()
+  # Check for thread name function
+  HAVE_THREAD_NAME_FUNC="no"
   SAVE_LIBS="$LIBS"
   SAVE_CFLAGS="$CFLAGS"
   LIBS="$PTHREAD_LIBS $LIBS"
@@ -314,19 +315,33 @@
   CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
   AC_CHECK_HEADERS([pthread_np.h])
 
-  AC_MSG_CHECKING([[for pthread_setname_np(3) in NetBSD or OSF1 form]])
-  AC_LINK_IFELSE(
-    [AC_LANG_PROGRAM([[
+  # If pthread_setname_np(3) is not declared, it's not possible to detect
+  # form of pthread_setname_np(3) due to C "feature" "implicit declaration".
+  AC_CHECK_DECL([[pthread_setname_np]],[],[],[[
 #include <pthread.h>
 #ifdef HAVE_PTHREAD_NP_H
 #include <pthread_np.h>
 #endif
+]])
+
+  AS_IF([[test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"]],
+    [AC_MSG_CHECKING([[for pthread_setname_np(3) in NetBSD or OSF1 form]])
+     AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM([[
+#include <pthread.h>
+#ifdef HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
 ]], [[int res = pthread_setname_np(pthread_self(), "name", 0);]])],
-    [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_NETBSD]], [[1]], [Define if you have 
NetBSD form (or OSF1 form) of pthread_setname_np(3) function.])
-     AC_MSG_RESULT([[yes]])],
-    [AC_MSG_RESULT([[no]])
+        [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_NETBSD]], [[1]], [Define if you 
have NetBSD form (or OSF1 form) of pthread_setname_np(3) function.])
+         HAVE_THREAD_NAME_FUNC="yes"
+         AC_MSG_RESULT([[yes]])],
+        [AC_MSG_RESULT([[no]])]
+        )
+    ])
 
-     AC_MSG_CHECKING([[for pthread_setname_np(3) in GNU/Linux form]])
+  AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test 
"x$ac_cv_have_decl_pthread_setname_np" = "xyes"]],
+    [AC_MSG_CHECKING([[for pthread_setname_np(3) in GNU/Linux form]])
      AC_LINK_IFELSE(
        [AC_LANG_PROGRAM([[
 #include <pthread.h>
@@ -335,32 +350,53 @@
 #endif
 ]], [[int res = pthread_setname_np(pthread_self(), "name");]])],
         [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_GNU]], [[1]], [Define if you have 
GNU/Linux form of pthread_setname_np(3) function.])
+         HAVE_THREAD_NAME_FUNC="yes"
          AC_MSG_RESULT([[yes]])],
-        [AC_MSG_RESULT([[no]])
+        [AC_MSG_RESULT([[no]])]
+        )
+    ])
 
-         AC_MSG_CHECKING([[for pthread_setname_np(3) in Darwin form]])
-         AC_LINK_IFELSE(
-           [AC_LANG_PROGRAM([[
+  AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test 
"x$ac_cv_have_decl_pthread_setname_np" = "xyes"]],
+    [AC_MSG_CHECKING([[for pthread_setname_np(3) in Darwin form]])
+     AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM([[
 #include <pthread.h>
 #ifdef HAVE_PTHREAD_NP_H
 #include <pthread_np.h>
 #endif
 ]], [[int res = pthread_setname_np("name");]])],
-           [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_DARWIN]], [[1]], [Define if 
you have Darwin form of pthread_setname_np(3) function.])
-            AC_MSG_RESULT([[yes]])],
-           [AC_MSG_RESULT([[no]])
+        [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_DARWIN]], [[1]], [Define if you 
have Darwin form of pthread_setname_np(3) function.])
+         HAVE_THREAD_NAME_FUNC="yes"
+         AC_MSG_RESULT([[yes]])],
+        [AC_MSG_RESULT([[no]])]
+        )
+    ])
 
-            AC_MSG_CHECKING([[for pthread_setname_np(3) in FreeBSD form]])
-            AC_LINK_IFELSE(
-              [AC_LANG_PROGRAM([[
+  AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes"]],
+    [
+     AC_CHECK_DECL([[pthread_setname_np]],
+       [
+        AC_MSG_CHECKING([[for pthread_set_name_np(3) in FreeBSD form]])
+        AC_LINK_IFELSE(
+          [AC_LANG_PROGRAM([[
 #include <pthread.h>
 #ifdef HAVE_PTHREAD_NP_H
 #include <pthread_np.h>
 #endif
 ]], [[pthread_set_name_np(pthread_self(), "name");]])],
-              [AC_DEFINE([[HAVE_PTHREAD_SET_NAME_NP_FREEBSD]], [[1]], [Define 
if you have FreeBSD form of pthread_set_name_np(3) function.])
-               AC_MSG_RESULT([[yes]])],
-              [AC_MSG_RESULT([[no]])] ) ]) ]) ])
+          [AC_DEFINE([[HAVE_PTHREAD_SET_NAME_NP_FREEBSD]], [[1]], [Define if 
you have FreeBSD form of pthread_set_name_np(3) function.])
+           HAVE_THREAD_NAME_FUNC="yes"
+           AC_MSG_RESULT([[yes]])],
+          [AC_MSG_RESULT([[no]])]
+          )
+       ],[],[[
+#include <pthread.h>
+#ifdef HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
+       ]]
+     )
+    ])
 
   LIBS="$SAVE_LIBS"
   CFLAGS="$SAVE_CFLAGS"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]