You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bo...@apache.org on 2008/06/16 23:15:25 UTC

svn commit: r668315 - /apr/apr/trunk/build/apr_network.m4

Author: bojan
Date: Mon Jun 16 14:15:24 2008
New Revision: 668315

URL: http://svn.apache.org/viewvc?rev=668315&view=rev
Log:
Fix getservbyname_r() detection.
Patch by rpluem.

Modified:
    apr/apr/trunk/build/apr_network.m4

Modified: apr/apr/trunk/build/apr_network.m4
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/apr_network.m4?rev=668315&r1=668314&r2=668315&view=diff
==============================================================================
--- apr/apr/trunk/build/apr_network.m4 (original)
+++ apr/apr/trunk/build/apr_network.m4 Mon Jun 16 14:15:24 2008
@@ -292,7 +292,7 @@
 
 dnl Try and compile a glibc2 getservbyname_r piece of code, and set the
 dnl style of the routines to glibc2 on success
-AC_CACHE_CHECK([style of getservbyname_r routine], ac_cv_getservbyname_r_style,
+AC_CACHE_CHECK([style of getservbyname_r routine], ac_cv_getservbyname_r_style, [
 APR_TRY_COMPILE_NO_WARNING([
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -315,59 +315,62 @@
                           (struct servent **) 0);
 /* use tmp to suppress the warning */
 tmp=0;
-], ac_cv_getservbyname_r_style=glibc2, [
+], ac_cv_getservbyname_r_style=glibc2, ac_cv_getservbyname_r_style=none)
 
-dnl Try and compile a Solaris getservbyname_r piece of code, and set the
-dnl style of the routines to solaris on success
-AC_CACHE_VAL(ac_cv_getservbyname_r_style,
-APR_TRY_COMPILE_NO_WARNING([
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-],[
-struct servent tmp = getservbyname_r((const char *) 0, (const char *) 0,
-                                     (struct servent *) 0, (char *) 0, 0);
-/* use tmp to suppress the warning */
-tmp=NULL;
-], ac_cv_getservbyname_r_style=solaris, [
-
-dnl Try and compile a OSF/1 getservbyname_r piece of code, and set the
-dnl style of the routines to osf1 on success
-AC_CACHE_VAL( ac_cv_getservbyname_r_style,
-APR_TRY_COMPILE_NO_WARNING([
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-],[
-int tmp = getservbyname_r((const char *) 0, (const char *) 0,
-                          (struct servent *) 0, (struct servent_data *) 0);
-/* use tmp to suppress the warning */
-tmp=0;
-], ac_cv_getservbyname_r_style=osf1, ac_cv_getservbyname_r_style=none))]))]))
+if test "$ac_cv_getservbyname_r_style" = "none"; then
+    dnl Try and compile a Solaris getservbyname_r piece of code, and set the
+    dnl style of the routines to solaris on success
+    APR_TRY_COMPILE_NO_WARNING([
+    #ifdef HAVE_SYS_TYPES_H
+    #include <sys/types.h>
+    #endif
+    #ifdef HAVE_NETINET_IN_H
+    #include <netinet/in.h>
+    #endif
+    #ifdef HAVE_ARPA_INET_H
+    #include <arpa/inet.h>
+    #endif
+    #ifdef HAVE_NETDB_H
+    #include <netdb.h>
+    #endif
+    #ifdef HAVE_STDLIB_H
+    #include <stdlib.h>
+    #endif
+    ],[
+    struct servent *tmp = getservbyname_r((const char *) 0, (const char *) 0,
+                                          (struct servent *) 0, (char *) 0, 0);
+    /* use tmp to suppress the warning */
+    tmp=NULL;
+    ], ac_cv_getservbyname_r_style=solaris, ac_cv_getservbyname_r_style=none)
+fi
+
+if test "$ac_cv_getservbyname_r_style" = "none"; then
+    dnl Try and compile a OSF/1 getservbyname_r piece of code, and set the
+    dnl style of the routines to osf1 on success
+    APR_TRY_COMPILE_NO_WARNING([
+    #ifdef HAVE_SYS_TYPES_H
+    #include <sys/types.h>
+    #endif
+    #ifdef HAVE_NETINET_IN_H
+    #include <netinet/in.h>
+    #endif
+    #ifdef HAVE_ARPA_INET_H
+    #include <arpa/inet.h>
+    #endif
+    #ifdef HAVE_NETDB_H
+    #include <netdb.h>
+    #endif
+    #ifdef HAVE_STDLIB_H
+    #include <stdlib.h>
+    #endif
+    ],[
+    int tmp = getservbyname_r((const char *) 0, (const char *) 0,
+                              (struct servent *) 0, (struct servent_data *) 0);
+    /* use tmp to suppress the warning */
+    tmp=0;
+    ], ac_cv_getservbyname_r_style=osf1, ac_cv_getservbyname_r_style=none)
+fi
+])
 
 if test "$ac_cv_getservbyname_r_style" = "glibc2"; then
     AC_DEFINE(GETSERVBYNAME_R_GLIBC2, 1, [Define if getservbyname_r has the glibc style])