Added an in_addr_t check

This commit is contained in:
Daniel Stenberg 2001-11-28 13:16:56 +00:00
parent 10fdb1d743
commit d09b436937
2 changed files with 40 additions and 1 deletions

View File

@ -143,6 +143,45 @@ AC_DEFUN([TYPE_SOCKLEN_T],
#include <sys/socket.h>])
])
dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
dnl and a few other things. If not found, we set it to unsigned int, as even
dnl 64-bit implementations use to set it to a 32-bit type.
AC_DEFUN([TYPE_IN_ADDR_T],
[
AC_CHECK_TYPE([in_addr_t], ,[
AC_MSG_CHECKING([for in_addr_t equivalent])
AC_CACHE_VAL([curl_cv_in_addr_t_equiv],
[
# Systems have either "struct sockaddr *" or
# "void *" as the second argument to getpeername
curl_cv_in_addr_t_equiv=
for arg2 in "struct sockaddr" void; do
for t in int size_t unsigned long "unsigned long"; do
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
],[
$arg data = inet_addr ("1.2.3.4");
],[
curl_cv_in_addr_t_equiv="$t"
break
])
done
done
if test "x$curl_cv_in_addr_t_equiv" = x; then
AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
fi
])
AC_MSG_RESULT($curl_cv_in_addr_t_equiv)
AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
[type to use in place of in_addr_t if not defined])],
[#include <sys/types.h>
#include <sys/socket.h>,
#include <arpa/inet.h>])
])
dnl ************************************************************
dnl check for "localhost", if it doesn't exist, we can't do the
dnl gethostbyname_r tests!

View File

@ -492,7 +492,6 @@ AC_CHECK_HEADERS( \
sys/stat.h \
sys/types.h \
sys/time.h \
getopt.h \
sys/param.h \
termios.h \
termio.h \
@ -527,6 +526,7 @@ AC_CHECK_SIZEOF(long long, 4)
AC_CHECK_TYPE(ssize_t, int)
TYPE_SOCKLEN_T
TYPE_IN_ADDR_T
dnl Checks for library functions.
dnl AC_PROG_GCC_TRADITIONAL