diff options
author | Bojan Smojver <bojan@apache.org> | 2008-06-16 21:15:24 +0000 |
---|---|---|
committer | Bojan Smojver <bojan@apache.org> | 2008-06-16 21:15:24 +0000 |
commit | 8e2879fd2accdc77c1ce5bd671d4ccff11f189db (patch) | |
tree | 27061b387acd00732e80bc38eb18cd93d405699c /build/apr_network.m4 | |
parent | 4ad44a8d707a2e3653a88076abb96c35085dab04 (diff) | |
download | apr-8e2879fd2accdc77c1ce5bd671d4ccff11f189db.tar.gz |
Fix getservbyname_r() detection.
Patch by rpluem.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@668315 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'build/apr_network.m4')
-rw-r--r-- | build/apr_network.m4 | 109 |
1 files changed, 56 insertions, 53 deletions
diff --git a/build/apr_network.m4 b/build/apr_network.m4 index e864d8712..4d479a45a 100644 --- a/build/apr_network.m4 +++ b/build/apr_network.m4 @@ -292,7 +292,7 @@ AC_DEFUN([APR_CHECK_GETSERVBYNAME_R_STYLE], [ 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 @@ int tmp = getservbyname_r((const char *) 0, (const char *) 0, (struct servent **) 0); /* use tmp to suppress the warning */ tmp=0; -], ac_cv_getservbyname_r_style=glibc2, [ - -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, [ +], ac_cv_getservbyname_r_style=glibc2, 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 -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 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]) |