diff options
author | Yang Tse <yangsita@gmail.com> | 2008-05-20 15:55:31 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2008-05-20 15:55:31 +0000 |
commit | d3bad80eddf745e2f92cc2d24abce9de28336c8d (patch) | |
tree | b71070bdb4e9c823dd1720d2fc66cff7a56d430d /configure.ac | |
parent | 6783b294322eaa562155d250094cdd982196ef24 (diff) | |
download | c-ares-d3bad80eddf745e2f92cc2d24abce9de28336c8d.tar.gz c-ares-d3bad80eddf745e2f92cc2d24abce9de28336c8d.tar.bz2 c-ares-d3bad80eddf745e2f92cc2d24abce9de28336c8d.zip |
update several macros using AC_TRY_LINK with AC_LINK_IFELSE
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 81 |
1 files changed, 54 insertions, 27 deletions
diff --git a/configure.ac b/configure.ac index 9653a2a..d3304ae 100644 --- a/configure.ac +++ b/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" |