From b0426caeb9ef91efb9a623216d4fcb028feebafb Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Wed, 11 Oct 2000 23:39:43 +0000 Subject: [PATCH] patch for socklen_t detection by Albert Chin-A-Young Daniel --- ChangeLog | 6 ++++++ config.h.in | 2 ++ configure.in | 34 +++++++++++++++++++++++++++++++--- include/libxml/xmlversion.h.in | 10 ---------- nanoftp.c | 6 +----- nanohttp.c | 6 +----- xmlversion.h.in | 10 ---------- 7 files changed, 41 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2448a50c..93403a84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Oct 12 01:37:53 CEST 2000 Daniel Veillard + + * config.h.in configure.in nanoftp.c nanohttp.c xmlversion.h.in : + patch for socklen_t detection by + Albert Chin-A-Young + Wed Oct 11 17:53:57 CEST 2000 Daniel Veillard * tree.c valid.c xmllint.c: Fixed a few postvalidation bugs diff --git a/config.h.in b/config.h.in index 01bb4756..5a956408 100644 --- a/config.h.in +++ b/config.h.in @@ -153,3 +153,5 @@ /* Define if compiler has function prototypes */ #undef PROTOTYPES +/* Type of socket length (socklen_t) */ +#undef SOCKLEN_T diff --git a/configure.in b/configure.in index ede84f5c..032d8f24 100644 --- a/configure.in +++ b/configure.in @@ -87,7 +87,8 @@ fi AC_SUBST(HTML_DIR) -AC_ARG_ENABLE(corba, [ --enable-corba Add Corba support (default)]) +AC_ARG_ENABLE(corba, +[ --enable-corba Add Corba support (default)]) dnl dnl Corba is enabled by default @@ -108,6 +109,32 @@ AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent)) AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt)) AC_CHECK_FUNC(connect, , AC_CHECK_LIB(inet, connect)) +dnl Determine what socket length (socklen_t) data type is +AC_MSG_CHECKING([for type of socket length (socklen_t)]) +AC_TRY_COMPILE2([ +#include +#include +#include ],[ +(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[ + AC_MSG_RESULT(socklen_t *) + SOCKLEN_T=socklen_t],[ + AC_TRY_COMPILE2([ +#include +#include +#include ],[ +(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[ + AC_MSG_RESULT(size_t *) + SOCKLEN_T=size_t],[ + AC_TRY_COMPILE2([ +#include +#include +#include ],[ +(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[ + AC_MSG_RESULT(int *) + SOCKLEN_T=int],[ + AC_MSG_WARN(could not determine)])])]) +AC_DEFINE_UNQUOTED(SOCKLEN_T, $SOCKLEN_T) + dnl Checks for isnan in libm if not in libc AC_CHECK_FUNC(isnan, , AC_CHECK_LIB(m, isnan, [M_LIBS="-lm"; AC_DEFINE(HAVE_ISNAN)])) @@ -135,13 +162,14 @@ if test "${GCC}" != "yes" ; then ;; esac fi -case $host in -*-*-solaris*) +case ${host} in + *-*-solaris*) XML_LIBDIR="${XML_LIBDIR} -R${libdir}" ;; esac + dnl dnl Use buffers for content dnl diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in index ed1c43fd..74484b46 100644 --- a/include/libxml/xmlversion.h.in +++ b/include/libxml/xmlversion.h.in @@ -22,16 +22,6 @@ extern void xmlCheckVersion(int version); #define LIBXML_VERSION_STRING "@LIBXML_VERSION_NUMBER@" #define LIBXML_TEST_VERSION xmlCheckVersion(@LIBXML_VERSION_NUMBER@); -/* - * a few extra config stuff which may not be handled easily in configure - */ - -#ifndef HAVE_SOCKLEN_T -#if defined(__osf__) || defined(__Linux__) -#define HAVE_SOCKLEN_T -#endif -#endif - /* * Whether the FTP support is configured in */ diff --git a/nanoftp.c b/nanoftp.c index b70dfebb..33e8fed2 100644 --- a/nanoftp.c +++ b/nanoftp.c @@ -1244,11 +1244,7 @@ xmlNanoFTPGetConnection(void *ctx) { unsigned char ad[6], *adp, *portp; unsigned int temp[6]; struct sockaddr_in dataAddr; -#ifdef HAVE_SOCKLEN_T - socklen_t dataAddrLen; -#else - unsigned int dataAddrLen; -#endif + SOCKLEN_T dataAddrLen; ctxt->dataFd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); if (ctxt->dataFd < 0) { diff --git a/nanohttp.c b/nanohttp.c index df717cba..82cf1611 100644 --- a/nanohttp.c +++ b/nanohttp.c @@ -678,11 +678,7 @@ xmlNanoHTTPConnectAttempt(struct in_addr ia, int port) } if ( FD_ISSET(s, &wfd) ) { -#ifdef HAVE_SOCKLEN_T - socklen_t len; -#else - unsigned int len; -#endif + SOCKLEN_T len; len = sizeof(status); if (getsockopt(s, SOL_SOCKET, SO_ERROR, &status, &len) < 0 ) { /* Solaris error code */ diff --git a/xmlversion.h.in b/xmlversion.h.in index ed1c43fd..74484b46 100644 --- a/xmlversion.h.in +++ b/xmlversion.h.in @@ -22,16 +22,6 @@ extern void xmlCheckVersion(int version); #define LIBXML_VERSION_STRING "@LIBXML_VERSION_NUMBER@" #define LIBXML_TEST_VERSION xmlCheckVersion(@LIBXML_VERSION_NUMBER@); -/* - * a few extra config stuff which may not be handled easily in configure - */ - -#ifndef HAVE_SOCKLEN_T -#if defined(__osf__) || defined(__Linux__) -#define HAVE_SOCKLEN_T -#endif -#endif - /* * Whether the FTP support is configured in */