]> git.saurik.com Git - wxWidgets.git/commitdiff
don't declare pthread_mutexattr_settype() ourselves if the system already does it...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 25 Sep 2005 22:48:06 +0000 (22:48 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 25 Sep 2005 22:48:06 +0000 (22:48 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35702 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

configure
configure.in
setup.h.in
setup.h_vms
src/unix/threadpsx.cpp

index 23c7f536905a7b9e4ecc5f9282b0f645b15040ce..cf9ac1eca3ceb8a0c852532c7e5a2f43acdd323e 100755 (executable)
--- a/configure
+++ b/configure
@@ -37064,16 +37064,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-
-               wx_cv_type_pthread_mutexattr_t=yes
-
+  wx_cv_type_pthread_mutexattr_t=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-
-               wx_cv_type_pthread_mutexattr_t=no
-
+wx_cv_type_pthread_mutexattr_t=no
 
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -37087,6 +37083,71 @@ echo "${ECHO_T}$wx_cv_type_pthread_mutexattr_t" >&6
 #define HAVE_PTHREAD_MUTEXATTR_T 1
 _ACEOF
 
+
+                        echo "$as_me:$LINENO: checking for pthread_mutexattr_settype declaration" >&5
+echo $ECHO_N "checking for pthread_mutexattr_settype declaration... $ECHO_C" >&6
+if test "${wx_cv_func_pthread_mutexattr_settype_decl+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+                       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <pthread.h>
+int
+main ()
+{
+
+                               pthread_mutexattr_t attr;
+                               pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  wx_cv_func_pthread_mutexattr_settype_decl=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+wx_cv_func_pthread_mutexattr_settype_decl=no
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:$LINENO: result: $wx_cv_func_pthread_mutexattr_settype_decl" >&5
+echo "${ECHO_T}$wx_cv_func_pthread_mutexattr_settype_decl" >&6
+        if test "$wx_cv_func_pthread_mutexattr_settype_decl" = "yes"; then
+            cat >>confdefs.h <<\_ACEOF
+#define HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL 1
+_ACEOF
+
+        fi
       else
                 echo "$as_me:$LINENO: checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER" >&5
 echo $ECHO_N "checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER... $ECHO_C" >&6
index 5673ec1cb9e4eb55f098423b2910d3f4ff201e69..5b21d7585a08ed2abe86ebee685dd7d03d4f6acd 100644 (file)
@@ -4842,16 +4842,31 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
             [
                pthread_mutexattr_t attr;
                pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-            ], [
-               wx_cv_type_pthread_mutexattr_t=yes
-            ], [
-               wx_cv_type_pthread_mutexattr_t=no
-            ]
+            ],
+            wx_cv_type_pthread_mutexattr_t=yes,
+            wx_cv_type_pthread_mutexattr_t=no
         )
       ])
 
       if test "$wx_cv_type_pthread_mutexattr_t" = "yes"; then
         AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_T)
+
+        dnl check if we already have the declaration we need, it is not
+        dnl present in some systems' headers
+        AC_CACHE_CHECK([for pthread_mutexattr_settype declaration],
+                       wx_cv_func_pthread_mutexattr_settype_decl, [
+                       AC_TRY_COMPILE([#include <pthread.h>],
+                           [
+                               pthread_mutexattr_t attr;
+                               pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+                           ],
+                           wx_cv_func_pthread_mutexattr_settype_decl=yes,
+                           wx_cv_func_pthread_mutexattr_settype_decl=no
+                       )
+        ])
+        if test "$wx_cv_func_pthread_mutexattr_settype_decl" = "yes"; then
+            AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL)
+        fi
       else
         dnl don't despair, there may be another way to do it
         AC_CACHE_CHECK([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER],
index 7cca609a4a2b089cd76d23fe3ef8d71a4931c9f9..dd47c3140472e5717c78d843a1f9f22ffb6f0720 100644 (file)
 /* Define if you have pthread_mutexattr_t and functions to work with it */
 #undef HAVE_PTHREAD_MUTEXATTR_T
 
+/* Define if you have pthread_mutexattr_settype() declaration */
+#undef HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL
+
 /* Define if you have PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP */
 #undef HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER
 
index 92cc838cc5e976cd8d72eb187a5bc74265a65315..6ab41669140627978def00b898fc1b2b8487889d 100644 (file)
 /* Define if you have pthread_mutexattr_t and functions to work with it */
 #undef HAVE_PTHREAD_MUTEXATTR_T
 
+/* Define if you have pthread_mutexattr_settype() declaration */
+#undef HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL
+
 /* Define if you have PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP */
 #undef HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER
 
index 94c3b21af2ab8e510897aabd45eeb3c044f541b4..1a9aaf6cfd0a12d644de79ff3e53a258e3159829 100644 (file)
@@ -170,7 +170,8 @@ private:
     friend class wxConditionInternal;
 };
 
-#ifdef HAVE_PTHREAD_MUTEXATTR_T
+#if defined(HAVE_PTHREAD_MUTEXATTR_T) && \
+        wxUSE_UNIX && !defined(HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL)
 // on some systems pthread_mutexattr_settype() is not in the headers (but it is
 // in the library, otherwise we wouldn't compile this code at all)
 extern "C" int pthread_mutexattr_settype(pthread_mutexattr_t *, int);