From e75ab79bdbf4888e5c7042527b02bf849afc4355 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 18 Feb 2004 09:07:50 +0000 Subject: The --enable-debug option really requires this to be built as part of curl. When using it, we now set the include path to better find the devel curl headers, and we check for the socklen_t type since the curl memdebug stuff needs it. --- ares/configure.ac | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) (limited to 'ares') diff --git a/ares/configure.ac b/ares/configure.ac index 362370d67..334bb1e47 100644 --- a/ares/configure.ac +++ b/ares/configure.ac @@ -15,8 +15,55 @@ esac AC_SEARCH_LIBS(gethostbyname, nsl) AC_SEARCH_LIBS(socket, socket) +dnl Check for socklen_t: historically on BSD it is an int, and in +dnl POSIX 1g it is a type of its own, but some platforms use different +dnl types for the argument to getsockopt, getpeername, etc. So we +dnl have to test to find something that will work. +AC_DEFUN([TYPE_SOCKLEN_T], +[ + AC_CHECK_TYPE([socklen_t], ,[ + AC_MSG_CHECKING([for socklen_t equivalent]) + AC_CACHE_VAL([curl_cv_socklen_t_equiv], + [ + # Systems have either "struct sockaddr *" or + # "void *" as the second argument to getpeername + curl_cv_socklen_t_equiv= + for arg2 in "struct sockaddr" void; do + for t in int size_t unsigned long "unsigned long"; do + AC_TRY_COMPILE([ + #ifdef HAVE_SYS_TYPES_H + #include + #endif + #ifdef HAVE_SYS_SOCKET_H + #include + #endif + + int getpeername (int, $arg2 *, $t *); + ],[ + $t len; + getpeername(0,0,&len); + ],[ + curl_cv_socklen_t_equiv="$t" + break + ]) + done + done + + if test "x$curl_cv_socklen_t_equiv" = x; then + AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) + fi + ]) + AC_MSG_RESULT($curl_cv_socklen_t_equiv) + AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv, + [type to use in place of socklen_t if not defined])], + [#include +#include ]) +]) + dnl ************************************************************ -dnl lame option to switch on debug options +dnl Option to switch on debug options. This makes an assumption that +dnl this is built as an 'ares' subdir in the curl source tree. Subject for +dnl improval in the future! dnl AC_MSG_CHECKING([whether to enable debug options]) AC_ARG_ENABLE(debug, @@ -28,7 +75,10 @@ AC_HELP_STRING([--disable-debug],[Disable debug options]), ;; *) AC_MSG_RESULT(yes) - CPPFLAGS="$CPPFLAGS -DCURLDEBUG" + dnl we need the socklen_t type when we built with the curl memdebug stuff + TYPE_SOCKLEN_T + + CPPFLAGS="$CPPFLAGS -DCURLDEBUG -I../include" CFLAGS="$CFLAGS -g" if test "$GCC" = "yes"; then dnl these work for gcc 2.95 -- cgit v1.2.3