bug 1128029 - Add configure test for getprotobyname_r. r=ted
☠☠ backed out by c5cb94657138 ☠ ☠
authorFelix Janda <felix.janda@posteo.de>
Fri, 30 Jan 2015 21:04:57 +0100
changeset 4624 dc84f20b2ac6a850f74995b62c369e0b580ad256
parent 4623 a5e5f6d79e2452ab5950fe6936dc58eeff0e5cbf
child 4625 c5cb946571388f1643ab0fb04b3bfacd93cf818e
push id161
push usertmielczarek@mozilla.com
push dateMon, 20 Apr 2015 17:30:44 +0000
reviewersted
bugs1128029
bug 1128029 - Add configure test for getprotobyname_r. r=ted
configure
configure.in
pr/src/misc/prnetdb.c
--- a/configure
+++ b/configure
@@ -7923,17 +7923,17 @@ fi
 $as_echo "$ac_cv_prog_gcc_traditional" >&6; }
   if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
   fi
 fi
 
 _SAVE_LIBS="$LIBS"
 LIBS="$LIBS $OS_LIBS"
-for ac_func in dladdr gettid lchown setpriority strerror syscall
+for ac_func in dladdr gettid lchown setpriority strerror syscall getprotobyname_r
 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"
 if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
--- a/configure.in
+++ b/configure.in
@@ -2577,17 +2577,17 @@ dnl Check for typedefs and structs
 dnl ========================================================
 
 dnl ========================================================
 dnl Checks for library functions.
 dnl ========================================================
 AC_PROG_GCC_TRADITIONAL
 _SAVE_LIBS="$LIBS"
 LIBS="$LIBS $OS_LIBS"
-AC_CHECK_FUNCS(dladdr gettid lchown setpriority strerror syscall)
+AC_CHECK_FUNCS(dladdr gettid lchown setpriority strerror syscall getprotobyname_r)
 LIBS="$_SAVE_LIBS"
 
 dnl ========================================================
 dnl Check options
 dnl ========================================================
 
 dnl ======================================================
 dnl = Enable compiling with ccache
--- a/pr/src/misc/prnetdb.c
+++ b/pr/src/misc/prnetdb.c
@@ -43,58 +43,55 @@ extern int h_errno;
 #define LOCK_DNS()
 #define UNLOCK_DNS()
 #else
 PRLock *_pr_dnsLock = NULL;
 #define LOCK_DNS() PR_Lock(_pr_dnsLock)
 #define UNLOCK_DNS() PR_Unlock(_pr_dnsLock)
 #endif  /* defined(_PR_NO_DNS_LOCK) */
 
+#if defined(HAVE_GETPROTOBYNAME_R)
+#define _PR_HAVE_GETPROTO_R
 /*
  * Some platforms have the reentrant getprotobyname_r() and
  * getprotobynumber_r().  However, they come in three flavors.
  * Some return a pointer to struct protoent, others return
  * an int, and glibc's flavor takes five arguments.
  */
 #if defined(XP_BEOS) && defined(BONE_VERSION)
 #include <arpa/inet.h>  /* pick up define for inet_addr */
 #include <sys/socket.h>
-#define _PR_HAVE_GETPROTO_R
 #define _PR_HAVE_GETPROTO_R_POINTER
 #endif
 
 #if defined(SOLARIS) || (defined(BSDI) && defined(_REENTRANT)) \
 	|| (defined(LINUX) && defined(_REENTRANT) \
         && !(defined(__GLIBC__) && __GLIBC__ >= 2) \
         && !defined(ANDROID))
-#define _PR_HAVE_GETPROTO_R
 #define _PR_HAVE_GETPROTO_R_POINTER
 #endif
 
 #if defined(OSF1) \
         || defined(AIX4_3_PLUS) || (defined(AIX) && defined(_THREAD_SAFE)) \
 	|| (defined(HPUX10_10) && defined(_REENTRANT)) \
         || (defined(HPUX10_20) && defined(_REENTRANT)) \
         || defined(OPENBSD)
-#define _PR_HAVE_GETPROTO_R
 #define _PR_HAVE_GETPROTO_R_INT
 #endif
 
 #if __FreeBSD_version >= 602000
-#define _PR_HAVE_GETPROTO_R
 #define _PR_HAVE_5_ARG_GETPROTO_R
 #endif
 
 /* BeOS has glibc but not the glibc-style getprotobyxxx_r functions. */
 #if (defined(__GLIBC__) && __GLIBC__ >= 2 && !defined(XP_BEOS))
-#define _PR_HAVE_GETPROTO_R
 #define _PR_HAVE_5_ARG_GETPROTO_R
 #endif
 
-#if !defined(_PR_HAVE_GETPROTO_R)
+#else /* !defined(HAVE_GETPROTOBYNAME_R) */
 PRLock* _getproto_lock = NULL;
 #endif
 
 #if defined(_PR_INET6_PROBE)
 extern PRBool _pr_ipv6_is_present(void);
 #endif
 
 #define _PR_IN6_IS_ADDR_UNSPECIFIED(a)				\