diff options
-rw-r--r-- | acinclude.m4 | 564 | ||||
-rw-r--r-- | ares/acinclude.m4 | 180 | ||||
-rw-r--r-- | ares/configure.ac | 81 | ||||
-rw-r--r-- | configure.ac | 122 |
4 files changed, 571 insertions, 376 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index c495cf637..4b0cee340 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1652,20 +1652,20 @@ dnl dnl There are two known platforms (AIX 3.x and SunOS 4.1.x) where the dnl O_NONBLOCK define is found but does not work. This condition is attempted dnl to get caught in this script by using an excessive number of #ifdefs... -dnl -AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], -[ - AC_MSG_CHECKING([non-blocking sockets style]) - AC_TRY_COMPILE([ +AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], [ + AC_MSG_CHECKING([non-blocking sockets style]) + nonblock="unknown" + # + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ /* headers for O_NONBLOCK test */ #include <sys/types.h> #include <unistd.h> #include <fcntl.h> -],[ -/* try to compile O_NONBLOCK */ - -#if defined(sun) || defined(__sun__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) +/* */ +#if defined(sun) || defined(__sun__) || \ + defined(__SUNPRO_C) || defined(__SUNPRO_CC) # if defined(__SVR4) || defined(__srv4__) # define PLATFORM_SOLARIS # else @@ -1675,36 +1675,44 @@ AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], #if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41) # define PLATFORM_AIX_V3 #endif - +/* */ #if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__) #error "O_NONBLOCK does not work on this platform" #endif - int socket; - int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK); -],[ -dnl the O_NONBLOCK test was fine -nonblock="O_NONBLOCK" -AC_DEFINE(HAVE_O_NONBLOCK, 1, [use O_NONBLOCK for non-blocking sockets]) -],[ -dnl the code was bad, try a different program now, test 2 - - AC_TRY_COMPILE([ + ]],[[ + /* O_NONBLOCK source test */ + int socket; + int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK); + ]]) + ],[ + dnl the O_NONBLOCK test was fine + nonblock="O_NONBLOCK" + AC_DEFINE(HAVE_O_NONBLOCK, 1, + [use O_NONBLOCK for non-blocking sockets]) + ]) + # + if test "$nonblock" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ /* headers for FIONBIO test */ #include <unistd.h> #include <stropts.h> -],[ -/* FIONBIO source test (old-style unix) */ - int socket; - int flags = ioctl(socket, FIONBIO, &flags); -],[ -dnl FIONBIO test was good -nonblock="FIONBIO" -AC_DEFINE(HAVE_FIONBIO, 1, [use FIONBIO for non-blocking sockets]) -],[ -dnl FIONBIO test was also bad -dnl the code was bad, try a different program now, test 3 - - AC_TRY_COMPILE([ + ]],[[ + /* FIONBIO source test (old-style unix) */ + int socket; + int flags = ioctl(socket, FIONBIO, &flags); + ]]) + ],[ + dnl FIONBIO test was good + nonblock="FIONBIO" + AC_DEFINE(HAVE_FIONBIO, 1, + [use FIONBIO for non-blocking sockets]) + ]) + fi + # + if test "$nonblock" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ /* headers for ioctlsocket test (Windows) */ #undef inline #ifdef HAVE_WINDOWS_H @@ -1720,65 +1728,63 @@ dnl the code was bad, try a different program now, test 3 #endif #endif #endif -],[ -/* ioctlsocket source code */ - SOCKET sd; - unsigned long flags = 0; - sd = socket(0, 0, 0); - ioctlsocket(sd, FIONBIO, &flags); -],[ -dnl ioctlsocket test was good -nonblock="ioctlsocket" -AC_DEFINE(HAVE_IOCTLSOCKET, 1, [use ioctlsocket() for non-blocking sockets]) -],[ -dnl ioctlsocket didnt compile!, go to test 4 - - AC_TRY_LINK([ + ]],[[ + /* ioctlsocket source code (Windows) */ + SOCKET sd; + unsigned long flags = 0; + sd = socket(0, 0, 0); + ioctlsocket(sd, FIONBIO, &flags); + ]]) + ],[ + dnl ioctlsocket test was good + nonblock="ioctlsocket" + AC_DEFINE(HAVE_IOCTLSOCKET, 1, + [use ioctlsocket() for non-blocking sockets]) + ]) + fi + # + if test "$nonblock" = "unknown"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ /* headers for IoctlSocket test (Amiga?) */ #include <sys/ioctl.h> -],[ -/* IoctlSocket source code */ - int socket; - int flags = IoctlSocket(socket, FIONBIO, (long)1); -],[ -dnl ioctlsocket test was good -nonblock="IoctlSocket" -AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1, [use Ioctlsocket() for non-blocking sockets]) -],[ -dnl Ioctlsocket didnt compile, do test 5! - AC_TRY_COMPILE([ + ]],[[ + /* IoctlSocket source code (Amiga?) */ + int socket; + int flags = IoctlSocket(socket, FIONBIO, (long)1); + ]]) + ],[ + dnl Ioctlsocket test was good + nonblock="IoctlSocket" + AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1, + [use Ioctlsocket() for non-blocking sockets]) + ]) + fi + # + if test "$nonblock" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ /* headers for SO_NONBLOCK test (BeOS) */ #include <socket.h> -],[ -/* SO_NONBLOCK source code */ - long b = 1; - int socket; - int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); -],[ -dnl the SO_NONBLOCK test was good -nonblock="SO_NONBLOCK" -AC_DEFINE(HAVE_SO_NONBLOCK, 1, [use SO_NONBLOCK for non-blocking sockets]) -],[ -dnl test 5 didnt compile! -nonblock="nada" -AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1, [disabled non-blocking sockets]) -]) -dnl end of fifth test - -]) -dnl end of forth test - -]) -dnl end of third test - -]) -dnl end of second test - -]) -dnl end of non-blocking try-compile test + ]],[[ + /* SO_NONBLOCK source code (BeOS) */ + long b = 1; + int socket; + int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); + ]]) + ],[ + dnl the SO_NONBLOCK test was good + nonblock="SO_NONBLOCK" + AC_DEFINE(HAVE_SO_NONBLOCK, 1, + [use SO_NONBLOCK for non-blocking sockets]) + ]) + fi + # AC_MSG_RESULT($nonblock) - - if test "$nonblock" = "nada"; then + # + if test "$nonblock" = "unknown"; then + AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1, + [disabled non-blocking sockets]) AC_MSG_WARN([non-block sockets disabled]) fi ]) @@ -2407,165 +2413,301 @@ AC_DEFUN([CURL_CHECK_INET_NTOA_R], AC_MSG_RESULT(no))])]) ]) -AC_DEFUN([CURL_CHECK_GETHOSTBYADDR_R], -[ - dnl check for number of arguments to gethostbyaddr_r. it might take - dnl either 5, 7, or 8 arguments. - AC_CHECK_FUNCS(gethostbyaddr_r,[ - AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments) - AC_TRY_COMPILE([ + +dnl CURL_CHECK_GETHOSTBYADDR_R +dnl ------------------------------------------------- +dnl check number of arguments for gethostbyaddr_r, it +dnl might take either 5, 7, or 8 arguments. + +AC_DEFUN([CURL_CHECK_GETHOSTBYADDR_R], [ + # + AC_MSG_CHECKING([for gethostbyaddr_r]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([gethostbyaddr_r]) + ],[ + AC_MSG_RESULT([yes]) + tmp_cv_gethostbyaddr_r="yes" + ],[ + AC_MSG_RESULT([no]) + tmp_cv_gethostbyaddr_r="no" + ]) + # + if test "$tmp_cv_gethostbyaddr_r" != "yes"; then + AC_MSG_CHECKING([deeper for gethostbyaddr_r]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + gethostbyaddr_r(); + ]]) + ],[ + AC_MSG_RESULT([yes]) + tmp_cv_gethostbyaddr_r="yes" + ],[ + AC_MSG_RESULT([no]) + tmp_cv_gethostbyaddr_r="no" + ]) + fi + # + if test "$tmp_cv_gethostbyaddr_r" = "yes"; then + + ac_cv_gethostbyaddr_r_args="unknown" + + AC_MSG_CHECKING([if gethostbyaddr_r takes 5 arguments]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ #include <sys/types.h> -#include <netdb.h>],[ -char * address; -int length; -int type; -struct hostent h; -struct hostent_data hdata; -int rc; -rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[ - AC_MSG_RESULT(yes) +#include <netdb.h> + ]],[[ + char * address; + int length; + int type; + struct hostent h; + struct hostent_data hdata; + int rc; + rc = gethostbyaddr_r(address, length, type, &h, &hdata); + ]]) + ],[ + AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args]) - ac_cv_gethostbyaddr_args=5],[ - AC_MSG_RESULT(no) - AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments) - AC_TRY_COMPILE([ + ac_cv_gethostbyaddr_r_args="5" + ],[ + AC_MSG_RESULT([no]) + ]) + + if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then + AC_MSG_CHECKING([if gethostbyaddr_r with -D_REENTRANT takes 5 arguments]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ #define _REENTRANT #include <sys/types.h> -#include <netdb.h>],[ -char * address; -int length; -int type; -struct hostent h; -struct hostent_data hdata; -int rc; -rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args]) +#include <netdb.h> + ]],[[ + char * address; + int length; + int type; + struct hostent h; + struct hostent_data hdata; + int rc; + rc = gethostbyaddr_r(address, length, type, &h, &hdata); + ]]) + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args]) AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT]) - ac_cv_gethostbyaddr_args=5],[ - AC_MSG_RESULT(no) - AC_MSG_CHECKING(if gethostbyaddr_r takes 7 arguments) - AC_TRY_COMPILE([ + ac_cv_gethostbyaddr_r_args="5" + ],[ + AC_MSG_RESULT([no]) + ]) + fi + + if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then + AC_MSG_CHECKING([if gethostbyaddr_r takes 7 arguments]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ #include <sys/types.h> -#include <netdb.h>],[ -char * address; -int length; -int type; -struct hostent h; -char buffer[8192]; -int h_errnop; -struct hostent * hp; - -hp = gethostbyaddr_r(address, length, type, &h, - buffer, 8192, &h_errnop);],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1, [gethostbyaddr_r() takes 7 args] ) - ac_cv_gethostbyaddr_args=7],[ - AC_MSG_RESULT(no) - AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments) - AC_TRY_COMPILE([ +#include <netdb.h> + ]],[[ + char * address; + int length; + int type; + struct hostent h; + char buffer[8192]; + int h_errnop; + struct hostent * hp; + hp = gethostbyaddr_r(address, length, type, &h, + buffer, 8192, &h_errnop); + ]]) + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1, [gethostbyaddr_r() takes 7 args]) + ac_cv_gethostbyaddr_r_args="7" + ],[ + AC_MSG_RESULT([no]) + ]) + fi + + if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then + AC_MSG_CHECKING([if gethostbyaddr_r takes 8 arguments]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ #include <sys/types.h> -#include <netdb.h>],[ -char * address; -int length; -int type; -struct hostent h; -char buffer[8192]; -int h_errnop; -struct hostent * hp; -int rc; - -rc = gethostbyaddr_r(address, length, type, &h, - buffer, 8192, &hp, &h_errnop);],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1, [gethostbyaddr_r() takes 8 args]) - ac_cv_gethostbyaddr_args=8],[ - AC_MSG_RESULT(no) - have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])]) +#include <netdb.h> + ]],[[ + char * address; + int length; + int type; + struct hostent h; + char buffer[8192]; + int h_errnop; + struct hostent * hp; + int rc; + rc = gethostbyaddr_r(address, length, type, &h, + buffer, 8192, &hp, &h_errnop); + ]]) + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1, [gethostbyaddr_r() takes 8 args]) + ac_cv_gethostbyaddr_r_args="8" + ],[ + AC_MSG_RESULT([no]) + ]) + fi + + if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then + AC_MSG_ERROR([couldn't figure out how to use gethostbyaddr_r()]) + else + AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYADDR_R, 1, + [Define to 1 if you have the gethostbyaddr_r function.]) + ac_cv_func_gethostbyaddr_r="yes" + fi + + fi ]) -AC_DEFUN([CURL_CHECK_GETHOSTBYNAME_R], -[ - dnl check for number of arguments to gethostbyname_r. it might take - dnl either 3, 5, or 6 arguments. - AC_CHECK_FUNCS(gethostbyname_r,[ + +dnl CURL_CHECK_GETHOSTBYNAME_R +dnl ------------------------------------------------- +dnl check number of arguments for gethostbyname_r, it +dnl might take either 3, 5, or 6 arguments. + +AC_DEFUN([CURL_CHECK_GETHOSTBYNAME_R], [ + # + AC_MSG_CHECKING([for gethostbyname_r]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([gethostbyname_r]) + ],[ + AC_MSG_RESULT([yes]) + tmp_cv_gethostbyname_r="yes" + ],[ + AC_MSG_RESULT([no]) + tmp_cv_gethostbyname_r="no" + ]) + # + if test "$tmp_cv_gethostbyname_r" != "yes"; then + AC_MSG_CHECKING([deeper for gethostbyname_r]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + gethostbyname_r(); + ]]) + ],[ + AC_MSG_RESULT([yes]) + tmp_cv_gethostbyname_r="yes" + ],[ + AC_MSG_RESULT([no]) + tmp_cv_gethostbyname_r="no" + ]) + fi + # + if test "$tmp_cv_gethostbyname_r" = "yes"; then + + ac_cv_gethostbyname_r_args="unknown" + AC_MSG_CHECKING([if gethostbyname_r takes 3 arguments]) - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ #include <string.h> #include <sys/types.h> #include <netdb.h> #undef NULL #define NULL (void *)0 - -int -gethostbyname_r(const char *, struct hostent *, struct hostent_data *);],[ -struct hostent_data data; -gethostbyname_r(NULL, NULL, NULL);],[ - AC_MSG_RESULT(yes) + int + gethostbyname_r(const char *, struct hostent *, + struct hostent_data *); + ]],[[ + struct hostent_data data; + gethostbyname_r(NULL, NULL, NULL); + ]]) + ],[ + AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args]) - ac_cv_gethostbyname_args=3],[ - AC_MSG_RESULT(no) + ac_cv_gethostbyname_r_args="3" + ],[ + AC_MSG_RESULT([no]) + ]) + + if test "$ac_cv_gethostbyname_r_args" = "unknown"; then AC_MSG_CHECKING([if gethostbyname_r with -D_REENTRANT takes 3 arguments]) - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ #define _REENTRANT - #include <string.h> #include <sys/types.h> #include <netdb.h> #undef NULL #define NULL (void *)0 + int + gethostbyname_r(const char *, struct hostent *, + struct hostent_data *); + ]],[[ + struct hostent_data data; + gethostbyname_r(NULL, NULL, NULL); + ]]) + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args]) + AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT]) + ac_cv_gethostbyname_r_args="3" + ],[ + AC_MSG_RESULT([no]) + ]) + fi -int -gethostbyname_r(const char *,struct hostent *, struct hostent_data *);],[ -struct hostent_data data; -gethostbyname_r(NULL, NULL, NULL);],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args]) - AC_DEFINE(NEED_REENTRANT, 1, [needs REENTRANT]) - ac_cv_gethostbyname_args=3],[ - AC_MSG_RESULT(no) - AC_MSG_CHECKING([if gethostbyname_r takes 5 arguments]) - AC_TRY_COMPILE([ + if test "$ac_cv_gethostbyname_r_args" = "unknown"; then + AC_MSG_CHECKING([if gethostbyname_r takes 5 arguments]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ #include <sys/types.h> #include <netdb.h> #undef NULL #define NULL (void *)0 + struct hostent * + gethostbyname_r(const char *, struct hostent *, + char *, int, int *); + ]],[[ + gethostbyname_r(NULL, NULL, NULL, 0, NULL); + ]]) + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args]) + ac_cv_gethostbyname_r_args="5" + ],[ + AC_MSG_RESULT([no]) + ]) + fi -struct hostent * -gethostbyname_r(const char *, struct hostent *, char *, int, int *);],[ -gethostbyname_r(NULL, NULL, NULL, 0, NULL);],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args]) - ac_cv_gethostbyname_args=5],[ - AC_MSG_RESULT(no) - AC_MSG_CHECKING([if gethostbyname_r takes 6 arguments]) - AC_TRY_COMPILE([ + if test "$ac_cv_gethostbyname_r_args" = "unknown"; then + AC_MSG_CHECKING([if gethostbyname_r takes 6 arguments]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ #include <sys/types.h> #include <netdb.h> #undef NULL #define NULL (void *)0 + int + gethostbyname_r(const char *, struct hostent *, + char *, size_t, struct hostent **, int *); + ]],[[ + gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL); + ]]) + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args]) + ac_cv_gethostbyname_r_args="6" + ],[ + AC_MSG_RESULT([no]) + ]) + fi + + if test "$ac_cv_gethostbyname_r_args" = "unknown"; then + AC_MSG_ERROR([couldn't figure out how to use gethostbyname_r()]) + else + AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME_R, 1, + [Define to 1 if you have the gethostbyname_r function.]) + ac_cv_func_gethostbyname_r="yes" + fi -int -gethostbyname_r(const char *, struct hostent *, char *, size_t, -struct hostent **, int *);],[ -gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL);],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args]) - ac_cv_gethostbyname_args=6],[ - AC_MSG_RESULT(no) - have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r"], - [ac_cv_gethostbyname_args=0])], - [ac_cv_gethostbyname_args=0])], - [ac_cv_gethostbyname_args=0])], - [ac_cv_gethostbyname_args=0])]) - -if test "$ac_cv_func_gethostbyname_r" = "yes"; then - if test "$ac_cv_gethostbyname_args" = "0"; then - dnl there's a gethostbyname_r() function, but we don't know how - dnl many arguments it wants! - AC_MSG_ERROR([couldn't figure out how to use gethostbyname_r()]) fi -fi ]) diff --git a/ares/acinclude.m4 b/ares/acinclude.m4 index 310469f6d..d8d703738 100644 --- a/ares/acinclude.m4 +++ b/ares/acinclude.m4 @@ -1121,20 +1121,20 @@ dnl dnl There are two known platforms (AIX 3.x and SunOS 4.1.x) where the dnl O_NONBLOCK define is found but does not work. This condition is attempted dnl to get caught in this script by using an excessive number of #ifdefs... -dnl -AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], -[ - AC_MSG_CHECKING([non-blocking sockets style]) - AC_TRY_COMPILE([ +AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], [ + AC_MSG_CHECKING([non-blocking sockets style]) + nonblock="unknown" + # + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ /* headers for O_NONBLOCK test */ #include <sys/types.h> #include <unistd.h> #include <fcntl.h> -],[ -/* try to compile O_NONBLOCK */ - -#if defined(sun) || defined(__sun__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) +/* */ +#if defined(sun) || defined(__sun__) || \ + defined(__SUNPRO_C) || defined(__SUNPRO_CC) # if defined(__SVR4) || defined(__srv4__) # define PLATFORM_SOLARIS # else @@ -1144,36 +1144,44 @@ AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], #if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41) # define PLATFORM_AIX_V3 #endif - +/* */ #if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__) #error "O_NONBLOCK does not work on this platform" #endif - int socket; - int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK); -],[ -dnl the O_NONBLOCK test was fine -nonblock="O_NONBLOCK" -AC_DEFINE(HAVE_O_NONBLOCK, 1, [use O_NONBLOCK for non-blocking sockets]) -],[ -dnl the code was bad, try a different program now, test 2 - - AC_TRY_COMPILE([ + ]],[[ + /* O_NONBLOCK source test */ + int socket; + int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK); + ]]) + ],[ + dnl the O_NONBLOCK test was fine + nonblock="O_NONBLOCK" + AC_DEFINE(HAVE_O_NONBLOCK, 1, + [use O_NONBLOCK for non-blocking sockets]) + ]) + # + if test "$nonblock" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ /* headers for FIONBIO test */ #include <unistd.h> #include <stropts.h> -],[ -/* FIONBIO source test (old-style unix) */ - int socket; - int flags = ioctl(socket, FIONBIO, &flags); -],[ -dnl FIONBIO test was good -nonblock="FIONBIO" -AC_DEFINE(HAVE_FIONBIO, 1, [use FIONBIO for non-blocking sockets]) -],[ -dnl FIONBIO test was also bad -dnl the code was bad, try a different program now, test 3 - - AC_TRY_COMPILE([ + ]],[[ + /* FIONBIO source test (old-style unix) */ + int socket; + int flags = ioctl(socket, FIONBIO, &flags); + ]]) + ],[ + dnl FIONBIO test was good + nonblock="FIONBIO" + AC_DEFINE(HAVE_FIONBIO, 1, + [use FIONBIO for non-blocking sockets]) + ]) + fi + # + if test "$nonblock" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ /* headers for ioctlsocket test (Windows) */ #undef inline #ifdef HAVE_WINDOWS_H @@ -1189,65 +1197,63 @@ dnl the code was bad, try a different program now, test 3 #endif #endif #endif -],[ -/* ioctlsocket source code */ - SOCKET sd; - unsigned long flags = 0; - sd = socket(0, 0, 0); - ioctlsocket(sd, FIONBIO, &flags); -],[ -dnl ioctlsocket test was good -nonblock="ioctlsocket" -AC_DEFINE(HAVE_IOCTLSOCKET, 1, [use ioctlsocket() for non-blocking sockets]) -],[ -dnl ioctlsocket didnt compile!, go to test 4 - - AC_TRY_LINK([ + ]],[[ + /* ioctlsocket source code (Windows) */ + SOCKET sd; + unsigned long flags = 0; + sd = socket(0, 0, 0); + ioctlsocket(sd, FIONBIO, &flags); + ]]) + ],[ + dnl ioctlsocket test was good + nonblock="ioctlsocket" + AC_DEFINE(HAVE_IOCTLSOCKET, 1, + [use ioctlsocket() for non-blocking sockets]) + ]) + fi + # + if test "$nonblock" = "unknown"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ /* headers for IoctlSocket test (Amiga?) */ #include <sys/ioctl.h> -],[ -/* IoctlSocket source code */ - int socket; - int flags = IoctlSocket(socket, FIONBIO, (long)1); -],[ -dnl ioctlsocket test was good -nonblock="IoctlSocket" -AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1, [use Ioctlsocket() for non-blocking sockets]) -],[ -dnl Ioctlsocket didnt compile, do test 5! - AC_TRY_COMPILE([ + ]],[[ + /* IoctlSocket source code (Amiga?) */ + int socket; + int flags = IoctlSocket(socket, FIONBIO, (long)1); + ]]) + ],[ + dnl Ioctlsocket test was good + nonblock="IoctlSocket" + AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1, + [use Ioctlsocket() for non-blocking sockets]) + ]) + fi + # + if test "$nonblock" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ /* headers for SO_NONBLOCK test (BeOS) */ #include <socket.h> -],[ -/* SO_NONBLOCK source code */ - long b = 1; - int socket; - int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); -],[ -dnl the SO_NONBLOCK test was good -nonblock="SO_NONBLOCK" -AC_DEFINE(HAVE_SO_NONBLOCK, 1, [use SO_NONBLOCK for non-blocking sockets]) -],[ -dnl test 5 didnt compile! -nonblock="nada" -AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1, [disabled non-blocking sockets]) -]) -dnl end of fifth test - -]) -dnl end of forth test - -]) -dnl end of third test - -]) -dnl end of second test - -]) -dnl end of non-blocking try-compile test + ]],[[ + /* SO_NONBLOCK source code (BeOS) */ + long b = 1; + int socket; + int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); + ]]) + ],[ + dnl the SO_NONBLOCK test was good + nonblock="SO_NONBLOCK" + AC_DEFINE(HAVE_SO_NONBLOCK, 1, + [use SO_NONBLOCK for non-blocking sockets]) + ]) + fi + # AC_MSG_RESULT($nonblock) - - if test "$nonblock" = "nada"; then + # + if test "$nonblock" = "unknown"; then + AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1, + [disabled non-blocking sockets]) AC_MSG_WARN([non-block sockets disabled]) fi ]) diff --git a/ares/configure.ac b/ares/configure.ac index 9653a2a7e..d3304ae01 100644 --- a/ares/configure.ac +++ b/ares/configure.ac @@ -212,16 +212,18 @@ then AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs]) my_ac_save_LIBS=$LIBS LIBS="-lnsl -lsocket $LIBS" - AC_TRY_LINK( , - [gethostbyname();], - [ dnl found it! - HAVE_GETHOSTBYNAME="1" - AC_MSG_RESULT([yes])], - [ dnl failed! - AC_MSG_RESULT([no]) - dnl restore LIBS - LIBS=$my_ac_save_LIBS] - ) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + gethostbyname(); + ]]) + ],[ + AC_MSG_RESULT([yes]) + HAVE_GETHOSTBYNAME="1" + ],[ + AC_MSG_RESULT([no]) + LIBS=$my_ac_save_LIBS + ]) fi if test "$HAVE_GETHOSTBYNAME" != "1" @@ -245,7 +247,8 @@ then my_ac_save_LIBS=$LIBS LIBS="$winsock_LIB $LIBS" AC_MSG_CHECKING([for gethostbyname in $winsock_LIB]) - AC_TRY_LINK([ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ #ifdef HAVE_WINDOWS_H #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN @@ -259,15 +262,16 @@ then #endif #endif #endif - ],[ + ]],[[ gethostbyname("www.dummysite.com"); - ],[ - AC_MSG_RESULT([yes]) - HAVE_GETHOSTBYNAME="1" - ],[ - AC_MSG_RESULT([no]) - winsock_LIB="" - LIBS=$my_ac_save_LIBS + ]]) + ],[ + AC_MSG_RESULT([yes]) + HAVE_GETHOSTBYNAME="1" + ],[ + AC_MSG_RESULT([no]) + winsock_LIB="" + LIBS=$my_ac_save_LIBS ]) fi fi @@ -275,17 +279,40 @@ fi if test "$HAVE_GETHOSTBYNAME" != "1" then + dnl This is for Minix 3.1 + AC_MSG_CHECKING([for gethostbyname for Minix 3]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +/* Older Minix versions may need <net/gen/netdb.h> here instead */ +#include <netdb.h> + ]],[[ + gethostbyname("www.dummysite.com"); + ]]) + ],[ + AC_MSG_RESULT([yes]) + HAVE_GETHOSTBYNAME="1" + ],[ + AC_MSG_RESULT([no]) + ]) +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then dnl This is for eCos with a stubbed DNS implementation AC_MSG_CHECKING([for gethostbyname for eCos]) - AC_TRY_LINK([ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ #include <stdio.h> -#include <netdb.h>], - [gethostbyname("www.dummysite.com");], - [ dnl worked! - AC_MSG_RESULT([yes]) - HAVE_GETHOSTBYNAME="1"], - AC_MSG_RESULT(no) - ) +#include <netdb.h> + ]],[[ + gethostbyname("www.dummysite.com"); + ]]) + ],[ + AC_MSG_RESULT([yes]) + HAVE_GETHOSTBYNAME="1" + ],[ + AC_MSG_RESULT([no]) + ]) fi if test "$HAVE_GETHOSTBYNAME" != "1" diff --git a/configure.ac b/configure.ac index 0dcd3648b..081fb6d6d 100644 --- a/configure.ac +++ b/configure.ac @@ -489,16 +489,18 @@ then AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs]) my_ac_save_LIBS=$LIBS LIBS="-lnsl -lsocket $LIBS" - AC_TRY_LINK( , - [gethostbyname();], - [ dnl found it! - HAVE_GETHOSTBYNAME="1" - AC_MSG_RESULT([yes])], - [ dnl failed! - AC_MSG_RESULT([no]) - dnl restore LIBS - LIBS=$my_ac_save_LIBS] - ) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + gethostbyname(); + ]]) + ],[ + AC_MSG_RESULT([yes]) + HAVE_GETHOSTBYNAME="1" + ],[ + AC_MSG_RESULT([no]) + LIBS=$my_ac_save_LIBS + ]) fi if test "$HAVE_GETHOSTBYNAME" != "1" @@ -522,7 +524,8 @@ then my_ac_save_LIBS=$LIBS LIBS="$winsock_LIB $LIBS" AC_MSG_CHECKING([for gethostbyname in $winsock_LIB]) - AC_TRY_LINK([ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ #ifdef HAVE_WINDOWS_H #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN @@ -536,15 +539,16 @@ then #endif #endif #endif - ],[ + ]],[[ gethostbyname("www.dummysite.com"); - ],[ - AC_MSG_RESULT([yes]) - HAVE_GETHOSTBYNAME="1" - ],[ - AC_MSG_RESULT([no]) - winsock_LIB="" - LIBS=$my_ac_save_LIBS + ]]) + ],[ + AC_MSG_RESULT([yes]) + HAVE_GETHOSTBYNAME="1" + ],[ + AC_MSG_RESULT([no]) + winsock_LIB="" + LIBS=$my_ac_save_LIBS ]) fi fi @@ -554,30 +558,38 @@ if test "$HAVE_GETHOSTBYNAME" != "1" then dnl This is for Minix 3.1 AC_MSG_CHECKING([for gethostbyname for Minix 3]) - AC_TRY_LINK([ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ /* Older Minix versions may need <net/gen/netdb.h> here instead */ -#include <netdb.h>], - [gethostbyname("www.dummysite.com");], - [ dnl worked! - AC_MSG_RESULT([yes]) - HAVE_GETHOSTBYNAME="1"], - AC_MSG_RESULT(no) - ) +#include <netdb.h> + ]],[[ + gethostbyname("www.dummysite.com"); + ]]) + ],[ + AC_MSG_RESULT([yes]) + HAVE_GETHOSTBYNAME="1" + ],[ + AC_MSG_RESULT([no]) + ]) fi if test "$HAVE_GETHOSTBYNAME" != "1" then dnl This is for eCos with a stubbed DNS implementation AC_MSG_CHECKING([for gethostbyname for eCos]) - AC_TRY_LINK([ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ #include <stdio.h> -#include <netdb.h>], - [gethostbyname("www.dummysite.com");], - [ dnl worked! - AC_MSG_RESULT([yes]) - HAVE_GETHOSTBYNAME="1"], - AC_MSG_RESULT(no) - ) +#include <netdb.h> + ]],[[ + gethostbyname("www.dummysite.com"); + ]]) + ],[ + AC_MSG_RESULT([yes]) + HAVE_GETHOSTBYNAME="1" + ],[ + AC_MSG_RESULT([no]) + ]) fi if test "$HAVE_GETHOSTBYNAME" != "1" @@ -1280,21 +1292,23 @@ if test X"$OPT_SSL" != Xno; then dnl and acting like OpenSSL. AC_MSG_CHECKING([for yaSSL using OpenSSL compatibility mode]) - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ #include <openssl/ssl.h> - ],[ + ]],[[ #if defined(YASSL_VERSION) && defined(OPENSSL_VERSION_NUMBER) int dummy = SSL_ERROR_NONE; #else Not the yaSSL OpenSSL compatibility header. #endif - ],[ - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(USE_YASSLEMUL, 1, - [Define to 1 if using yaSSL in OpenSSL compatibility mode.]) - curl_ssl_msg="enabled (OpenSSL emulation by yaSSL)" - ],[ - AC_MSG_RESULT([no]) + ]]) + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(USE_YASSLEMUL, 1, + [Define to 1 if using yaSSL in OpenSSL compatibility mode.]) + curl_ssl_msg="enabled (OpenSSL emulation by yaSSL)" + ],[ + AC_MSG_RESULT([no]) ]) fi @@ -2070,13 +2084,19 @@ dnl sigsetjmp() might be a macro and no function so if it isn't found already dnl we make an extra check here! if test "$ac_cv_func_sigsetjmp" != "yes"; then AC_MSG_CHECKING([for sigsetjmp defined as macro]) - AC_TRY_LINK( [#include <setjmp.h>], - [sigjmp_buf jmpenv; - sigsetjmp(jmpenv, 1);], - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SIGSETJMP, 1, [If you have sigsetjmp]), - AC_MSG_RESULT(no) - ) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#include <setjmp.h> + ]],[[ + sigjmp_buf jmpenv; + sigsetjmp(jmpenv, 1); + ]]) + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_SIGSETJMP, 1, [If you have sigsetjmp]) + ],[ + AC_MSG_RESULT([no]) + ]) fi AC_CHECK_DECL(basename, , |