On Mon, 2008-06-16 at 08:02 +1000, Bojan Smojver wrote:

> The AC_CACHE_VAL should be changed to AC_CACHE_CHECK, which then
> provides pretty printing of messages for non-nested version of checks.

Could you check if this works on Solaris?

-- 
Bojan
Index: build/apr_network.m4
===================================================================
--- build/apr_network.m4	(revision 668012)
+++ build/apr_network.m4	(working copy)
@@ -315,60 +315,68 @@
                           (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, [
+if test "$ac_cv_getservbyname_r_style" = "none"; then
+    unset ac_cv_getservbyname_r_style
 
-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))]))]))
+    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_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>
+    #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
+    unset ac_cv_getservbyname_r_style
+
+    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_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>
+    #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])
 elif test "$ac_cv_getservbyname_r_style" = "solaris"; then

Reply via email to