1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 16:18:48 -05:00

Improved configure detection of number of arguments for getservbyport_r

This commit is contained in:
Yang Tse 2008-07-16 12:26:09 +00:00
parent 21ee1c2d01
commit 2cfb8a2bf0
3 changed files with 101 additions and 48 deletions

View File

@ -1,5 +1,9 @@
Changelog for the c-ares project Changelog for the c-ares project
* Jul 16 2008 (Yang Tse)
- Improved configure detection of number of arguments for getservbyport_r.
Detection is now based on compilation checks instead of linker ones.
* Jul 15 2008 (Yang Tse) * Jul 15 2008 (Yang Tse)
- Introduce definition of _REENTRANT symbol in setup.h to improve library - Introduce definition of _REENTRANT symbol in setup.h to improve library
usability. Previously the configure process only used the AC_SYS_LARGEFILE usability. Previously the configure process only used the AC_SYS_LARGEFILE

View File

@ -7,6 +7,7 @@ This is what's new and changed in the c-ares 1.5.3 release:
o allow --enable-largefile and --disable-largefile configurations o allow --enable-largefile and --disable-largefile configurations
o configure process no longer needs nor checks size of curl_off_t o configure process no longer needs nor checks size of curl_off_t
o library will now be built with _REENTRANT symbol defined o library will now be built with _REENTRANT symbol defined
o Improved configure detection of number of arguments for getservbyport_r
Thanks go to these friendly people for their efforts and contributions: Thanks go to these friendly people for their efforts and contributions:

View File

@ -1803,12 +1803,47 @@ dnl Test if the getservbyport_r function is available,
dnl and find out how many parameters it takes. 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_CHECK_HEADERS(sys/types.h netdb.h)
ac_func_getservbyport_r="unknown" #
AC_MSG_CHECKING([for getservbyport_r])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([getservbyport_r])
],[
AC_MSG_RESULT([yes])
cares_cv_getservbyport_r="yes"
],[
AC_MSG_RESULT([no])
cares_cv_getservbyport_r="no"
])
#
if test "$cares_cv_getservbyport_r" != "yes"; then
AC_MSG_CHECKING([deeper for getservbyport_r])
AC_LINK_IFELSE([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
]],[[
getservbyport_r();
]])
],[
AC_MSG_RESULT([yes])
cares_cv_getservbyport_r="yes"
],[
AC_MSG_RESULT([but still no])
cares_cv_getservbyport_r="no"
])
fi
#
if test "$cares_cv_getservbyport_r" = "yes"; then
AC_MSG_CHECKING([how many arguments getservbyport_r takes])
cares_cv_getservbyport_r_nargs="unknown"
#
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h> #include <netdb.h>
#endif
]],[[ ]],[[
int p1, p5; int p1, p5;
char *p2, p4[4096]; char *p2, p4[4096];
@ -1816,13 +1851,18 @@ AC_DEFUN([CARES_CHECK_GETSERVBYPORT_R], [
getservbyport_r(p1, p2, p3, p4, p5, &p6); getservbyport_r(p1, p2, p3, p4, p5, &p6);
]]) ]])
],[ ],[
ac_func_getservbyport_r="6" cares_cv_getservbyport_r_nargs="6"
]) ])
#
if test "$ac_func_getservbyport_r" = "unknown"; then if test "$cares_cv_getservbyport_r_nargs" = "unknown"; then
AC_LINK_IFELSE([ AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h> #include <netdb.h>
#endif
]],[[ ]],[[
int p1, p5; int p1, p5;
char *p2, p4[4096]; char *p2, p4[4096];
@ -1830,14 +1870,19 @@ AC_DEFUN([CARES_CHECK_GETSERVBYPORT_R], [
getservbyport_r(p1, p2, p3, p4, p5); getservbyport_r(p1, p2, p3, p4, p5);
]]) ]])
],[ ],[
ac_func_getservbyport_r="5" cares_cv_getservbyport_r_nargs="5"
]) ])
fi fi
#
if test "$ac_func_getservbyport_r" = "unknown"; then if test "$cares_cv_getservbyport_r_nargs" = "unknown"; then
AC_LINK_IFELSE([ AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h> #include <netdb.h>
#endif
]],[[ ]],[[
int p1; int p1;
char *p2; char *p2;
@ -1846,19 +1891,20 @@ AC_DEFUN([CARES_CHECK_GETSERVBYPORT_R], [
getservbyport_r(p1, p2, p3, &p4); getservbyport_r(p1, p2, p3, &p4);
]]) ]])
],[ ],[
ac_func_getservbyport_r="4" cares_cv_getservbyport_r_nargs="4"
]) ])
fi fi
#
if test "$ac_func_getservbyport_r" = "unknown"; then AC_MSG_RESULT([$cares_cv_getservbyport_r_nargs])
AC_MSG_RESULT([not found]) #
if test "$cares_cv_getservbyport_r_nargs" = "unknown"; then
AC_MSG_WARN([HAVE_GETSERVBYPORT_R will not be defined])
else else
AC_MSG_RESULT($ac_func_getservbyport_r)
AC_DEFINE(HAVE_GETSERVBYPORT_R, 1, AC_DEFINE(HAVE_GETSERVBYPORT_R, 1,
[Specifies whether getservbyport_r is present]) [Specifies whether getservbyport_r is present])
AC_DEFINE_UNQUOTED(GETSERVBYPORT_R_ARGS, $ac_func_getservbyport_r, AC_DEFINE_UNQUOTED(GETSERVBYPORT_R_ARGS, $cares_cv_getservbyport_r_nargs,
[Specifies the number of arguments to getservbyport_r]) [Specifies the number of arguments to getservbyport_r])
if test "$ac_func_getservbyport_r" = "4" ; then if test "$cares_cv_getservbyport_r_nargs" = "4" ; then
AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, sizeof(struct servent_data), AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, sizeof(struct servent_data),
[Specifies the size of the buffer to pass to getservbyport_r]) [Specifies the size of the buffer to pass to getservbyport_r])
else else
@ -1866,5 +1912,7 @@ AC_DEFUN([CARES_CHECK_GETSERVBYPORT_R], [
[Specifies the size of the buffer to pass to getservbyport_r]) [Specifies the size of the buffer to pass to getservbyport_r])
fi fi
fi fi
#
fi
]) ])