diff options
author | Yang Tse <yangsita@gmail.com> | 2008-05-20 01:03:45 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2008-05-20 01:03:45 +0000 |
commit | d70f33748cc3913e46df34f163191d73b3c897f9 (patch) | |
tree | 750c7adad2c72fde7939d749e7b602be84c8a013 /ares | |
parent | b006c31b7b504b35e373ad2e054efdc10d9b49a5 (diff) |
update several macros using AC_TRY_LINK with AC_LINK_IFELSE
Diffstat (limited to 'ares')
-rw-r--r-- | ares/acinclude.m4 | 200 |
1 files changed, 118 insertions, 82 deletions
diff --git a/ares/acinclude.m4 b/ares/acinclude.m4 index 90e90a6e9..ce37a38ef 100644 --- a/ares/acinclude.m4 +++ b/ares/acinclude.m4 @@ -346,32 +346,35 @@ AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [ # AC_MSG_CHECKING([for getnameinfo]) AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([getnameinfo]) - ],[ - AC_MSG_RESULT([yes]) - curl_cv_getnameinfo="yes" - ],[ - AC_MSG_RESULT([no]) - curl_cv_getnameinfo="no" + AC_LANG_FUNC_LINK_TRY([getnameinfo]) + ],[ + AC_MSG_RESULT([yes]) + curl_cv_getnameinfo="yes" + ],[ + AC_MSG_RESULT([no]) + curl_cv_getnameinfo="no" ]) # if test "$curl_cv_getnameinfo" != "yes"; then AC_MSG_CHECKING([deeper for getnameinfo]) - AC_TRY_LINK([ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ ],[ getnameinfo(); - ],[ - AC_MSG_RESULT([yes]) - curl_cv_getnameinfo="yes" - ],[ - AC_MSG_RESULT([but still no]) - curl_cv_getnameinfo="no" + ]) + ],[ + AC_MSG_RESULT([yes]) + curl_cv_getnameinfo="yes" + ],[ + AC_MSG_RESULT([but still no]) + curl_cv_getnameinfo="no" ]) fi # if test "$curl_cv_getnameinfo" != "yes"; then AC_MSG_CHECKING([deeper and deeper for getnameinfo]) - AC_TRY_LINK([ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ #undef inline #ifdef HAVE_WINDOWS_H #ifndef WIN32_LEAN_AND_MEAN @@ -397,12 +400,13 @@ AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [ #endif ],[ getnameinfo(0, 0, 0, 0, 0, 0, 0); - ],[ - AC_MSG_RESULT([yes]) - curl_cv_getnameinfo="yes" - ],[ - AC_MSG_RESULT([but still no]) - curl_cv_getnameinfo="no" + ]) + ],[ + AC_MSG_RESULT([yes]) + curl_cv_getnameinfo="yes" + ],[ + AC_MSG_RESULT([but still no]) + curl_cv_getnameinfo="no" ]) fi # @@ -676,7 +680,8 @@ AC_DEFUN([CURL_CHECK_FUNC_RECV], [ AC_CHECK_HEADERS(sys/types.h sys/socket.h) # AC_MSG_CHECKING([for recv]) - AC_TRY_LINK([ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ #undef inline #ifdef HAVE_WINDOWS_H #ifndef WIN32_LEAN_AND_MEAN @@ -700,12 +705,13 @@ AC_DEFUN([CURL_CHECK_FUNC_RECV], [ #endif ],[ recv(0, 0, 0, 0); - ],[ - AC_MSG_RESULT([yes]) - curl_cv_recv="yes" - ],[ - AC_MSG_RESULT([no]) - curl_cv_recv="no" + ]) + ],[ + AC_MSG_RESULT([yes]) + curl_cv_recv="yes" + ],[ + AC_MSG_RESULT([no]) + curl_cv_recv="no" ]) # if test "$curl_cv_recv" = "yes"; then @@ -806,7 +812,8 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [ AC_CHECK_HEADERS(sys/types.h sys/socket.h) # AC_MSG_CHECKING([for send]) - AC_TRY_LINK([ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ #undef inline #ifdef HAVE_WINDOWS_H #ifndef WIN32_LEAN_AND_MEAN @@ -830,12 +837,13 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [ #endif ],[ send(0, 0, 0, 0); - ],[ - AC_MSG_RESULT([yes]) - curl_cv_send="yes" - ],[ - AC_MSG_RESULT([no]) - curl_cv_send="no" + ]) + ],[ + AC_MSG_RESULT([yes]) + curl_cv_send="yes" + ],[ + AC_MSG_RESULT([no]) + curl_cv_send="no" ]) # if test "$curl_cv_send" = "yes"; then @@ -1078,18 +1086,20 @@ AC_DEFUN([TYPE_SIG_ATOMIC_T], [ yes) # AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile]) - AC_TRY_LINK([ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ #ifdef HAVE_SIGNAL_H #include <signal.h> #endif ],[ static volatile sig_atomic_t dummy = 0; - ],[ - AC_MSG_RESULT([no]) - ac_cv_sig_atomic_t_volatile="no" - ],[ - AC_MSG_RESULT([yes]) - ac_cv_sig_atomic_t_volatile="yes" + ]) + ],[ + AC_MSG_RESULT([no]) + ac_cv_sig_atomic_t_volatile="no" + ],[ + AC_MSG_RESULT([yes]) + ac_cv_sig_atomic_t_volatile="yes" ]) # if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then @@ -1255,7 +1265,8 @@ AC_DEFUN([TYPE_IN_ADDR_T], [ curl_cv_in_addr_t_equiv= for t in "unsigned long" int size_t unsigned long; do - AC_TRY_COMPILE([ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ #undef inline #ifdef HAVE_WINDOWS_H #ifndef WIN32_LEAN_AND_MEAN @@ -1283,11 +1294,12 @@ AC_DEFUN([TYPE_IN_ADDR_T], #include <arpa/inet.h> #endif #endif + ],[ + $t data = inet_addr ("1.2.3.4"); + ]) ],[ - $t data = inet_addr ("1.2.3.4"); - ],[ - curl_cv_in_addr_t_equiv="$t" - break + curl_cv_in_addr_t_equiv="$t" + break ]) done @@ -1408,8 +1420,8 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [ (void)clock_gettime(CLOCK_MONOTONIC, &ts); ]) ],[ - curl_cv_gclk_LIBS="$x_xlibs" - break + curl_cv_gclk_LIBS="$x_xlibs" + break ]) done # @@ -1647,50 +1659,74 @@ AC_DEFUN([CARES_CHECK_CONSTANT], [ ]) -dnl This macro determines how many parameters getservbyport_r takes +dnl CARES_CHECK_GETSERVBYPORT_R +dnl ------------------------------------------------- +dnl Test if the getservbyport_r function is available, +dnl and find out how many parameters it takes. + AC_DEFUN([CARES_CHECK_GETSERVBYPORT_R], [ AC_MSG_CHECKING([how many arguments getservbyport_r takes]) - AC_TRY_LINK( - [#include <netdb.h>], - [ + ac_func_getservbyport_r="unknown" + + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +#include <netdb.h> + ],[ int p1, p5; char *p2, p4[4096]; struct servent *p3, *p6; getservbyport_r(p1, p2, p3, p4, p5, &p6); - ], ac_func_getservbyport_r=6, - [AC_TRY_LINK( - [#include <netdb.h>], - [ + ]) + ],[ + ac_func_getservbyport_r="6" + ]) + + if test "$ac_func_getservbyport_r" = "unknown"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +#include <netdb.h> + ],[ int p1, p5; char *p2, p4[4096]; struct servent *p3; getservbyport_r(p1, p2, p3, p4, p5); - ], ac_func_getservbyport_r=5, - [AC_TRY_LINK( - [#include <netdb.h>], - [ - int p1; - char *p2; - struct servent *p3; - struct servent_data p4; - getservbyport_r(p1, p2, p3, &p4); - ], ac_func_getservbyport_r=4, ac_func_getservbyport_r=0 - )] - )] - ) -if test $ac_func_getservbyport_r != "0" ; then - AC_MSG_RESULT($ac_func_getservbyport_r) - AC_DEFINE(HAVE_GETSERVBYPORT_R, 1, [Specifies whether getservbyport_r is present]) - AC_DEFINE_UNQUOTED(GETSERVBYPORT_R_ARGS, $ac_func_getservbyport_r, [Specifies the number of arguments to -getservbyport_r]) - if test $ac_func_getservbyport_r = "4" ; then - AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, sizeof(struct servent_data), [Specifies the size of the buffer to pass to -getservbyport_r]) + ]) + ],[ + ac_func_getservbyport_r="5" + ]) + fi + + if test "$ac_func_getservbyport_r" = "unknown"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +#include <netdb.h> + ],[ + int p1; + char *p2; + struct servent *p3; + struct servent_data p4; + getservbyport_r(p1, p2, p3, &p4); + ]) + ],[ + ac_func_getservbyport_r="4" + ]) + fi + + if test "$ac_func_getservbyport_r" = "unknown"; then + AC_MSG_RESULT([not found]) else - AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, 4096, [Specifies the size of the buffer to pass to getservbyport_r]) + AC_MSG_RESULT($ac_func_getservbyport_r) + AC_DEFINE(HAVE_GETSERVBYPORT_R, 1, + [Specifies whether getservbyport_r is present]) + AC_DEFINE_UNQUOTED(GETSERVBYPORT_R_ARGS, $ac_func_getservbyport_r, + [Specifies the number of arguments to getservbyport_r]) + if test "$ac_func_getservbyport_r" = "4" ; then + AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, sizeof(struct servent_data), + [Specifies the size of the buffer to pass to getservbyport_r]) + else + AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, 4096, + [Specifies the size of the buffer to pass to getservbyport_r]) + fi fi -else - AC_MSG_RESULT([not found]) -fi ]) |