diff options
-rw-r--r-- | acinclude.m4 | 39 | ||||
-rw-r--r-- | configure.in | 2 |
2 files changed, 40 insertions, 1 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 2aea0f562..c7f92f7a2 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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! diff --git a/configure.in b/configure.in index 17a6da0e8..197132c9a 100644 --- a/configure.in +++ b/configure.in @@ -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 |