update several macros using AC_TRY_LINK with AC_LINK_IFELSE

This commit is contained in:
Yang Tse
2008-05-20 01:03:45 +00:00
parent b006c31b7b
commit d70f33748c
3 changed files with 213 additions and 164 deletions

View File

@@ -888,9 +888,11 @@ AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
# #
if test "$curl_cv_getnameinfo" != "yes"; then if test "$curl_cv_getnameinfo" != "yes"; then
AC_MSG_CHECKING([deeper for getnameinfo]) AC_MSG_CHECKING([deeper for getnameinfo])
AC_TRY_LINK([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([
],[ ],[
getnameinfo(); getnameinfo();
])
],[ ],[
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
curl_cv_getnameinfo="yes" curl_cv_getnameinfo="yes"
@@ -902,7 +904,8 @@ AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
# #
if test "$curl_cv_getnameinfo" != "yes"; then if test "$curl_cv_getnameinfo" != "yes"; then
AC_MSG_CHECKING([deeper and deeper for getnameinfo]) AC_MSG_CHECKING([deeper and deeper for getnameinfo])
AC_TRY_LINK([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
@@ -928,6 +931,7 @@ AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
#endif #endif
],[ ],[
getnameinfo(0, 0, 0, 0, 0, 0, 0); getnameinfo(0, 0, 0, 0, 0, 0, 0);
])
],[ ],[
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
curl_cv_getnameinfo="yes" curl_cv_getnameinfo="yes"
@@ -1207,7 +1211,8 @@ AC_DEFUN([CURL_CHECK_FUNC_RECV], [
AC_CHECK_HEADERS(sys/types.h sys/socket.h) AC_CHECK_HEADERS(sys/types.h sys/socket.h)
# #
AC_MSG_CHECKING([for recv]) AC_MSG_CHECKING([for recv])
AC_TRY_LINK([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
@@ -1231,6 +1236,7 @@ AC_DEFUN([CURL_CHECK_FUNC_RECV], [
#endif #endif
],[ ],[
recv(0, 0, 0, 0); recv(0, 0, 0, 0);
])
],[ ],[
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
curl_cv_recv="yes" curl_cv_recv="yes"
@@ -1337,7 +1343,8 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
AC_CHECK_HEADERS(sys/types.h sys/socket.h) AC_CHECK_HEADERS(sys/types.h sys/socket.h)
# #
AC_MSG_CHECKING([for send]) AC_MSG_CHECKING([for send])
AC_TRY_LINK([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
@@ -1361,6 +1368,7 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
#endif #endif
],[ ],[
send(0, 0, 0, 0); send(0, 0, 0, 0);
])
],[ ],[
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
curl_cv_send="yes" curl_cv_send="yes"
@@ -1609,12 +1617,14 @@ AC_DEFUN([TYPE_SIG_ATOMIC_T], [
yes) yes)
# #
AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile]) 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 #ifdef HAVE_SIGNAL_H
#include <signal.h> #include <signal.h>
#endif #endif
],[ ],[
static volatile sig_atomic_t dummy = 0; static volatile sig_atomic_t dummy = 0;
])
],[ ],[
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
ac_cv_sig_atomic_t_volatile="no" ac_cv_sig_atomic_t_volatile="no"
@@ -1786,7 +1796,8 @@ AC_DEFUN([TYPE_IN_ADDR_T],
[ [
curl_cv_in_addr_t_equiv= curl_cv_in_addr_t_equiv=
for t in "unsigned long" int size_t unsigned long; do for t in "unsigned long" int size_t unsigned long; do
AC_TRY_COMPILE([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
@@ -1816,6 +1827,7 @@ AC_DEFUN([TYPE_IN_ADDR_T],
#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" curl_cv_in_addr_t_equiv="$t"
break break
@@ -1996,7 +2008,8 @@ AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
AC_CHECK_HEADERS(sys/select.h sys/socket.h) AC_CHECK_HEADERS(sys/select.h sys/socket.h)
# #
AC_MSG_CHECKING([for select]) AC_MSG_CHECKING([for select])
AC_TRY_LINK([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
@@ -2034,6 +2047,7 @@ AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
#endif #endif
],[ ],[
select(0, 0, 0, 0, 0); select(0, 0, 0, 0, 0);
])
],[ ],[
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
curl_cv_select="yes" curl_cv_select="yes"

View File

@@ -357,9 +357,11 @@ AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
# #
if test "$curl_cv_getnameinfo" != "yes"; then if test "$curl_cv_getnameinfo" != "yes"; then
AC_MSG_CHECKING([deeper for getnameinfo]) AC_MSG_CHECKING([deeper for getnameinfo])
AC_TRY_LINK([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([
],[ ],[
getnameinfo(); getnameinfo();
])
],[ ],[
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
curl_cv_getnameinfo="yes" curl_cv_getnameinfo="yes"
@@ -371,7 +373,8 @@ AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
# #
if test "$curl_cv_getnameinfo" != "yes"; then if test "$curl_cv_getnameinfo" != "yes"; then
AC_MSG_CHECKING([deeper and deeper for getnameinfo]) AC_MSG_CHECKING([deeper and deeper for getnameinfo])
AC_TRY_LINK([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
@@ -397,6 +400,7 @@ AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
#endif #endif
],[ ],[
getnameinfo(0, 0, 0, 0, 0, 0, 0); getnameinfo(0, 0, 0, 0, 0, 0, 0);
])
],[ ],[
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
curl_cv_getnameinfo="yes" curl_cv_getnameinfo="yes"
@@ -676,7 +680,8 @@ AC_DEFUN([CURL_CHECK_FUNC_RECV], [
AC_CHECK_HEADERS(sys/types.h sys/socket.h) AC_CHECK_HEADERS(sys/types.h sys/socket.h)
# #
AC_MSG_CHECKING([for recv]) AC_MSG_CHECKING([for recv])
AC_TRY_LINK([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
@@ -700,6 +705,7 @@ AC_DEFUN([CURL_CHECK_FUNC_RECV], [
#endif #endif
],[ ],[
recv(0, 0, 0, 0); recv(0, 0, 0, 0);
])
],[ ],[
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
curl_cv_recv="yes" curl_cv_recv="yes"
@@ -806,7 +812,8 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
AC_CHECK_HEADERS(sys/types.h sys/socket.h) AC_CHECK_HEADERS(sys/types.h sys/socket.h)
# #
AC_MSG_CHECKING([for send]) AC_MSG_CHECKING([for send])
AC_TRY_LINK([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
@@ -830,6 +837,7 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
#endif #endif
],[ ],[
send(0, 0, 0, 0); send(0, 0, 0, 0);
])
],[ ],[
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
curl_cv_send="yes" curl_cv_send="yes"
@@ -1078,12 +1086,14 @@ AC_DEFUN([TYPE_SIG_ATOMIC_T], [
yes) yes)
# #
AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile]) 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 #ifdef HAVE_SIGNAL_H
#include <signal.h> #include <signal.h>
#endif #endif
],[ ],[
static volatile sig_atomic_t dummy = 0; static volatile sig_atomic_t dummy = 0;
])
],[ ],[
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
ac_cv_sig_atomic_t_volatile="no" ac_cv_sig_atomic_t_volatile="no"
@@ -1255,7 +1265,8 @@ AC_DEFUN([TYPE_IN_ADDR_T],
[ [
curl_cv_in_addr_t_equiv= curl_cv_in_addr_t_equiv=
for t in "unsigned long" int size_t unsigned long; do for t in "unsigned long" int size_t unsigned long; do
AC_TRY_COMPILE([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
@@ -1285,6 +1296,7 @@ AC_DEFUN([TYPE_IN_ADDR_T],
#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" curl_cv_in_addr_t_equiv="$t"
break break
@@ -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_DEFUN([CARES_CHECK_GETSERVBYPORT_R], [
AC_MSG_CHECKING([how many arguments getservbyport_r takes]) AC_MSG_CHECKING([how many arguments getservbyport_r takes])
AC_TRY_LINK( ac_func_getservbyport_r="unknown"
[#include <netdb.h>],
[ AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#include <netdb.h>
],[
int p1, p5; int p1, p5;
char *p2, p4[4096]; char *p2, p4[4096];
struct servent *p3, *p6; struct servent *p3, *p6;
getservbyport_r(p1, p2, p3, p4, p5, &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; int p1, p5;
char *p2, p4[4096]; char *p2, p4[4096];
struct servent *p3; struct servent *p3;
getservbyport_r(p1, p2, p3, p4, p5); getservbyport_r(p1, p2, p3, p4, p5);
], ac_func_getservbyport_r=5, ])
[AC_TRY_LINK( ],[
[#include <netdb.h>], 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; int p1;
char *p2; char *p2;
struct servent *p3; struct servent *p3;
struct servent_data p4; struct servent_data p4;
getservbyport_r(p1, p2, p3, &p4); getservbyport_r(p1, p2, p3, &p4);
], ac_func_getservbyport_r=4, ac_func_getservbyport_r=0 ])
)] ],[
)] ac_func_getservbyport_r="4"
) ])
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])
else
AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, 4096, [Specifies the size of the buffer to pass to getservbyport_r])
fi fi
else
if test "$ac_func_getservbyport_r" = "unknown"; then
AC_MSG_RESULT([not found]) AC_MSG_RESULT([not found])
else
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 fi
]) ])

View File

@@ -25,7 +25,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57) AC_PREREQ(2.57)
dnl We don't know the version number "statically" so we use a dash here dnl We don't know the version number "statically" so we use a dash here
AC_INIT(curl, [-], [a suitable curl mailing list => http://curl.haxx.se/mail/]) AC_INIT([curl], [-], [a suitable curl mailing list => http://curl.haxx.se/mail/])
dnl configure script copyright dnl configure script copyright
AC_COPYRIGHT([Copyright (c) 1998 - 2008 Daniel Stenberg, <daniel@haxx.se> AC_COPYRIGHT([Copyright (c) 1998 - 2008 Daniel Stenberg, <daniel@haxx.se>
@@ -2251,26 +2251,25 @@ AC_HELP_STRING([--disable-ares],[Disable c-ares for name lookups]),
dnl check it because it might not have been built yet) dnl check it because it might not have been built yet)
AC_MSG_CHECKING([that c-ares is good and recent enough]) AC_MSG_CHECKING([that c-ares is good and recent enough])
AC_LINK_IFELSE([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#include <ares.h> #include <ares.h>
/* provide a set of dummy functions in case c-ares was built with debug */ /* set of dummy functions in case c-ares was built with debug */
void curl_dofree() { } void curl_dofree() { }
void curl_sclose() { } void curl_sclose() { }
void curl_domalloc() { } void curl_domalloc() { }
void curl_docalloc() { } void curl_docalloc() { }
void curl_socket() { } void curl_socket() { }
],[
int main(void)
{
ares_channel channel; ares_channel channel;
ares_cancel(channel); /* added in 1.2.0 */ ares_cancel(channel); /* added in 1.2.0 */
ares_process_fd(channel, 0, 0); /* added in 1.4.0 */ ares_process_fd(channel, 0, 0); /* added in 1.4.0 */
return 0; ])
} ],[
], AC_MSG_RESULT([yes])
AC_MSG_RESULT(yes), ],[
AC_MSG_RESULT(no) AC_MSG_RESULT([no])
AC_MSG_ERROR([c-ares library defective or too old]) AC_MSG_ERROR([c-ares library defective or too old])
) ])
fi fi
;; ;;
esac ], esac ],