Use autoconf logic to determine the presence of PTHREAD_RECURSIVE_MUTEX_INITIALIZER_N...
authorJoshua Colp <jcolp@digium.com>
Sat, 17 Nov 2007 23:03:16 +0000 (23:03 +0000)
committerJoshua Colp <jcolp@digium.com>
Sat, 17 Nov 2007 23:03:16 +0000 (23:03 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89394 65c4cc65-6c06-0410-ace0-fbb531ad65f3

configure
configure.ac
include/asterisk/autoconfig.h.in
include/asterisk/lock.h
include/asterisk/network.h

index 6830a08..6057e17 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 89361 .
+# From configure.ac Revision: 89380 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61.
 #
@@ -12403,11 +12403,13 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <stdio.h>
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
 int
 main ()
 {
-return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
   ;
   return 0;
 }
@@ -12447,11 +12449,13 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #define _LARGEFILE_SOURCE 1
-#include <stdio.h>
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
 int
 main ()
 {
-return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
   ;
   return 0;
 }
 done
 
 
+
+for ac_func in inet_aton
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+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.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
 # check if we have IP_PKTINFO constant defined
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -16228,6 +16327,144 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     fi
 
 
+    if test "x${PBX_PTHREAD_MUTEX_RECURSIVE_NP}" != "x1" -a "${USE_PTHREAD_MUTEX_RECURSIVE_NP}" != "no"; then
+       { echo "$as_me:$LINENO: checking for PTHREAD_MUTEX_RECURSIVE_NP in pthread.h" >&5
+echo $ECHO_N "checking for PTHREAD_MUTEX_RECURSIVE_NP in pthread.h... $ECHO_C" >&6; }
+       saved_cppflags="${CPPFLAGS}"
+       if test "x${PTHREAD_MUTEX_RECURSIVE_NP_DIR}" != "x"; then
+           PTHREAD_MUTEX_RECURSIVE_NP_INCLUDE="-I${PTHREAD_MUTEX_RECURSIVE_NP_DIR}/include"
+       fi
+       CPPFLAGS="${CPPFLAGS} ${PTHREAD_MUTEX_RECURSIVE_NP_INCLUDE}"
+
+       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 ()
+{
+int foo = PTHREAD_MUTEX_RECURSIVE_NP;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+     { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+               PBX_PTHREAD_MUTEX_RECURSIVE_NP=1
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_PTHREAD_MUTEX_RECURSIVE_NP 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_PTHREAD_MUTEX_RECURSIVE_NP_VERSION
+_ACEOF
+
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+              { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       CPPFLAGS="${saved_cppflags}"
+    fi
+
+
+    if test "x${PBX_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP}" != "x1" -a "${USE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP}" != "no"; then
+       { echo "$as_me:$LINENO: checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP in pthread.h" >&5
+echo $ECHO_N "checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP in pthread.h... $ECHO_C" >&6; }
+       saved_cppflags="${CPPFLAGS}"
+       if test "x${PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP_DIR}" != "x"; then
+           PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP_INCLUDE="-I${PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP_DIR}/include"
+       fi
+       CPPFLAGS="${CPPFLAGS} ${PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP_INCLUDE}"
+
+       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 ()
+{
+int foo = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+     { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+               PBX_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP=1
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP_VERSION
+_ACEOF
+
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+              { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       CPPFLAGS="${saved_cppflags}"
+    fi
+
+
 if test "${cross_compiling}" = "no";
 then
 { echo "$as_me:$LINENO: checking for working epoll support" >&5
index b092d7a..10865e7 100644 (file)
@@ -364,6 +364,8 @@ fi
 
 AST_C_DEFINE_CHECK([PTHREAD_RWLOCK_INITIALIZER], [PTHREAD_RWLOCK_INITIALIZER], [pthread.h])
 AST_C_DEFINE_CHECK([PTHREAD_RWLOCK_PREFER_WRITER_NP], [PTHREAD_RWLOCK_PREFER_WRITER_NP], [pthread.h])
+AST_C_DEFINE_CHECK([PTHREAD_MUTEX_RECURSIVE_NP], [PTHREAD_MUTEX_RECURSIVE_NP], [pthread.h])
+AST_C_DEFINE_CHECK([PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], [PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], [pthread.h])
 
 if test "${cross_compiling}" = "no";
 then
index 5be612e..00dbd9f 100644 (file)
 /* Define if you have POSIX threads libraries and header files. */
 #undef HAVE_PTHREAD
 
+/* Define if your system has the PTHREAD_MUTEX_RECURSIVE_NP headers. */
+#undef HAVE_PTHREAD_MUTEX_RECURSIVE_NP
+
+/* Define PTHREAD_MUTEX_RECURSIVE_NP headers version */
+#undef HAVE_PTHREAD_MUTEX_RECURSIVE_NP_VERSION
+
+/* Define if your system has the PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+   headers. */
+#undef HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+
+/* Define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP headers version */
+#undef HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP_VERSION
+
 /* Define if your system has the PTHREAD_RWLOCK_INITIALIZER headers. */
 #undef HAVE_PTHREAD_RWLOCK_INITIALIZER
 
index f22911d..16ce5bb 100644 (file)
@@ -81,7 +81,7 @@
 
 /* Asterisk REQUIRES recursive (not error checking) mutexes
    and will not run without them. */
-#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) && defined(PTHREAD_MUTEX_RECURSIVE_NP)
+#if defined(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) && defined(HAVE_PTHREAD_MUTEX_RECURSIVE_NP)
 #define PTHREAD_MUTEX_INIT_VALUE       PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
 #define AST_MUTEX_KIND                 PTHREAD_MUTEX_RECURSIVE_NP
 #else
index bc7962b..23778ad 100644 (file)
@@ -52,7 +52,7 @@ typedef int socklen_t;
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #else
-#error don't know how to handle network functions here.
+#error "don't know how to handle network functions here."
 #endif
 
 #ifndef HAVE_INET_ATON