From 95ddb16768ad86e5b66d18fb5b10dc7d67148dd1 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 30 May 2000 22:26:26 +0000 Subject: [PATCH] Added checks for number of parameters to the functions gethostbyname_r() and gethostbyaddr_r() --- configure.in | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/configure.in b/configure.in index 1163e9080..32ad325ee 100644 --- a/configure.in +++ b/configure.in @@ -10,6 +10,84 @@ dnl The install stuff has already been taken care of by the automake stuff dnl AC_PROG_INSTALL AC_PROG_MAKE_SET +dnl The following checks for the amount of arguments that gethostbyname_r() +dnl and gethostbyaddr_r() want is shamelessly stolen from a posting I found +dnl in the OpenLDAP mailing list archive, posted by +dnl Juan Carlos Gomez +dnl ==================================================================== +dnl check no of arguments for gethostbyname_r +AC_DEFUN(OL_FUNC_GETHOSTBYNAME_R_NARGS, + [AC_CACHE_CHECK(number of arguments of gethostbyname_r, ol_cv_func_gethostbyname_r_nargs, + [AC_TRY_COMPILE([#include + #include + #include + #include + #define BUFSIZE (sizeof(struct hostent)+10)], + [struct hostent hent; char buffer[BUFSIZE]; + int bufsize=BUFSIZE;int h_errno; + (void)gethostbyname_r( "segovia.cs.purdue.edu", &hent, buffer, bufsize, &h_errno); + return 0;], + ol_cv_func_gethostbyname_r_nargs=5, ol_cv_func_gethostbyname_r_nargs=0) + if test $ol_cv_func_gethostbyname_r_nargs = 0 ; then + AC_TRY_COMPILE([#include + #include + #include + #include + #define BUFSIZE (sizeof(struct hostent)+10)], + [struct hostent hent;struct hostent *rhent; + char buffer[BUFSIZE]; + int bufsize=BUFSIZE;int h_errno; + (void)gethostbyname_r( "segovia.cs.purdue.edu", +&hent, buffer, bufsize, &rhent, &h_errno); + return 0;], + ol_cv_func_gethostbyname_r_nargs=6, ol_cv_func_gethostbyname_r_nargs=0) + fi + ]) + if test $ol_cv_func_gethostbyname_r_nargs -gt 1 ; then + AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_NARGS, $ol_cv_func_gethostbyname_r_nargs) + fi +])dnl +dnl check no of arguments for gethostbyaddr_r +AC_DEFUN(OL_FUNC_GETHOSTBYADDR_R_NARGS, + [AC_CACHE_CHECK(number of arguments of gethostbyaddr_r, ol_cv_func_gethostbyaddr_r_nargs, + [AC_TRY_COMPILE([#include + #include + #include + #include + #define BUFSIZE (sizeof(struct hostent)+10)], + [struct hostent hent; char buffer[BUFSIZE]; + struct in_addr add={0x70707070}; + size_t alen=sizeof(struct in_addr); + int bufsize=BUFSIZE;int h_errno; + (void)gethostbyaddr_r( (void *)&(add.s_addr), + alen, AF_INET, &hent, buffer, bufsize, &h_errno); + return 0;], + ol_cv_func_gethostbyaddr_r_nargs=7, + ol_cv_func_gethostbyaddr_r_nargs=0) + if test $ol_cv_func_gethostbyaddr_r_nargs = 0 ; then + AC_TRY_COMPILE([#include + #include + #include + #include + #define BUFSIZE (sizeof(struct hostent)+10)], + [struct hostent hent; struct hostent *rhent; char buffer[BUFSIZE]; + struct in_addr add={0x70707070}; + size_t alen=sizeof(struct in_addr); + int bufsize=BUFSIZE;int h_errno; + (void)gethostbyaddr_r( (void *)&(add.s_addr), + alen, AF_INET, &hent, buffer, bufsize, + &rhent, &h_errno); + return 0;], + ol_cv_func_gethostbyaddr_r_nargs=8, + ol_cv_func_gethostbyaddr_r_nargs=0) + fi + ]) + if test $ol_cv_func_gethostbyaddr_r_nargs -gt 1 ; then + AC_DEFINE_UNQUOTED(GETHOSTBYADDR_R_NARGS, $ol_cv_func_gethostbyaddr_r_nargs) + fi +])dnl + + dnl Check for AIX weirdos AC_AIX @@ -196,6 +274,24 @@ AC_CHECK_FUNCS( socket \ RAND_screen ) +# +# The *_r functions below can have a different amount of parameters depending +# on various systems. Let's check how many this system wants! +# +if test "$ac_cv_func_gethostbyname_r" = yes ; then + OL_FUNC_GETHOSTBYNAME_R_NARGS +else + ol_cv_func_gethostbyname_r=0 +fi + +if test "$ac_cv_func_gethostbyaddr_r" = yes ; then + OL_FUNC_GETHOSTBYADDR_R_NARGS +else + ol_cv_func_gethostbyaddr_r=0 +fi + + + AC_PATH_PROG( PERL, perl, , $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin ) AC_SUBST(PERL) @@ -218,3 +314,6 @@ dnl perl/checklinks.pl \ dnl perl/getlinks.pl \ dnl perl/formfind.pl \ dnl perl/recursiveftpget.pl ) + + +