On 06/16/2008 12:46 AM, Bojan Smojver wrote:
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?
I tested this patch and I adjusted it to the patch supplied:
1. There was an issue with the Solaris test that I missed before:
It fails to detect the Solaris style correctly because we need
to have
struct servent *tmp = getservbyname_r((const char *) 0, (const char *) 0,
instead of
struct servent tmp = getservbyname_r((const char *) 0, (const char *) 0,
(so tmp must be a pointer).
2. The repeated call to AC_CACHE_CHECK leads to multiple output lines in the
case that one of the previous tests fails. With the bug above I got three
identical lines that said that the style was none. IMHO this is not what
we want. We want to see the final result of these tests (glibc2, Solaris,
...).
So my patch calls AC_CACHE_CHECK once and puts in all checks as 3rd
parameter.
I also removed all AC_CACHE_VAL checks that were in the original code. When
AC_CACHE_CHECK executes the code in the third argument we already know that
there is no cached result and we need to all three checks (modulo the if
statements
in between) anyway.
I tested this patch with Solaris 8, 9, 10 (32 bit), RHEL 3(32Bit), RHEL 4(64
Bit) and
all worked fine.
Regards
RĂ¼diger
--- apr-1.3.1.orig/build/apr_network.m4 2008-06-03 02:20:24.000000000 +0200
+++ apr-1.3.1/build/apr_network.m4 2008-06-16 13:24:51.040150678 +0200
@@ -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])