mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Added checks for number of parameters to the functions gethostbyname_r()
and gethostbyaddr_r()
This commit is contained in:
parent
5d39dde961
commit
95ddb16768
99
configure.in
99
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 <gomez@cthulhu.engr.sgi.com>
|
||||
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 <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#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 <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#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 <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#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 <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#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 )
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user