From 86430b117e9ad520716f6f50e74b7f75234fd074 Mon Sep 17 00:00:00 2001 From: Fish <> Date: Tue, 1 Jun 2004 07:29:40 +0000 Subject: [PATCH] fix up socklet_t compile bug as posted on http://www.neostats.net/boards/viewtopic.php?t=1363 --- ChangeLog | 1 + aclocal.m4 | 14 ++++++++++++ configure | 61 +++++++++++++++++++++++++++++++++++++++++++++++++- configure.in | 9 ++++---- modconfig.h.in | 32 ++++++++++++-------------- 5 files changed, 94 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0169bf0..02a1e11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ Open Proxy Scanning Bot Module for NeoStats Changelog. - SET interface for nick/user/host/realname added (M) - Ported to core command processor (M) - Add verbose option so we can turn off some messages from OPSB (M) + - Fixed socklen_t compile problems on older bsd's (F) * Version 2.1 * 24/01/2004 * Fish (F) - Sync up libopm with blitzed version to fix a Socks 5 bug (F) diff --git a/aclocal.m4 b/aclocal.m4 index 261ddae..d9c4cd5 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -130,3 +130,17 @@ ac_cv_socket_libs, [ AC_SUBST(ETR_SOCKET_LIBS) ]) dnl ETR_SOCKET_NSL +AC_DEFUN([TYPE_SOCKLEN_T], +[AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t, +[ + AC_TRY_COMPILE( + [#include + #include ], + [socklen_t len = 42; return 0;], + ac_cv_type_socklen_t=yes, + ac_cv_type_socklen_t=no) +]) + if test $ac_cv_type_socklen_t != yes; then + AC_DEFINE(socklen_t, int, "have socklet_t defined?") + fi +]) diff --git a/configure b/configure index 3cfb41a..f13bf03 100755 --- a/configure +++ b/configure @@ -1268,14 +1268,17 @@ PACKAGE=OPSB MODULE_MAJOR=2 MODULE_MINOR=1 VERSION=$MODULE_MAJOR.$MODULE_MINOR + cat >>confdefs.h <<_ACEOF #define MODULE_VERSION "$VERSION" _ACEOF + cat >>confdefs.h <<_ACEOF #define MODULE_MAJOR "$MODULE_MAJOR" _ACEOF + cat >>confdefs.h <<_ACEOF #define MODULE_MINOR "$MODULE_MINOR" _ACEOF @@ -3351,6 +3354,61 @@ _ACEOF fi +echo "$as_me:$LINENO: checking for socklen_t" >&5 +echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 +if test "${ac_cv_type_socklen_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + #include +int +main () +{ +socklen_t len = 42; return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_socklen_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_socklen_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 +echo "${ECHO_T}$ac_cv_type_socklen_t" >&6 + if test $ac_cv_type_socklen_t != yes; then + +cat >>confdefs.h <<\_ACEOF +#define socklen_t int +_ACEOF + + fi + echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then @@ -4335,7 +4393,8 @@ if test "${enable_debug+set}" = set; then case "$enableval" in yes) CFLAGS="$CFLAGS -ggdb" - cat >>confdefs.h <<\_ACEOF + +cat >>confdefs.h <<\_ACEOF #define DEBUG 1 _ACEOF diff --git a/configure.in b/configure.in index 97d339f..745a335 100644 --- a/configure.in +++ b/configure.in @@ -5,9 +5,9 @@ PACKAGE=OPSB MODULE_MAJOR=2 MODULE_MINOR=1 VERSION=$MODULE_MAJOR.$MODULE_MINOR -AC_DEFINE_UNQUOTED(MODULE_VERSION, "$VERSION") -AC_DEFINE_UNQUOTED(MODULE_MAJOR, "$MODULE_MAJOR") -AC_DEFINE_UNQUOTED(MODULE_MINOR, "$MODULE_MINOR") +AC_DEFINE_UNQUOTED(MODULE_VERSION, "$VERSION", "Module Version") +AC_DEFINE_UNQUOTED(MODULE_MAJOR, "$MODULE_MAJOR", "Major Version") +AC_DEFINE_UNQUOTED(MODULE_MINOR, "$MODULE_MINOR", "Minor Version" ) DIRINST=~/NeoStats/ AC_PREFIX_DEFAULT(~/NeoStats/) CFLAGS="$CFLAGS -O2 -Wall" @@ -27,6 +27,7 @@ AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h strings.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T +TYPE_SOCKLEN_T AC_HEADER_TIME AC_FUNC_SNPRINTF @@ -106,7 +107,7 @@ AC_ARG_ENABLE(debug, [ case "$enableval" in yes) CFLAGS="$CFLAGS -ggdb" - AC_DEFINE(DEBUG,1) + AC_DEFINE(DEBUG,1, Enable Debugging) AC_MSG_RESULT(yes - Watch your Log Files) ;; *) diff --git a/modconfig.h.in b/modconfig.h.in index 7ec6c81..c39a1d3 100644 --- a/modconfig.h.in +++ b/modconfig.h.in @@ -1,18 +1,8 @@ -/* define this to enable debug code for this module */ +/* modconfig.h.in. Generated from configure.in by autoheader. */ + +/* Enable Debugging */ #undef DEBUG -/* Version number of package */ -#undef MODULE_VERSION - -/* Major Version */ -#undef MODULE_MAJOR - -/* Minor Version */ -#undef MODULE_MINOR - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H @@ -70,8 +60,14 @@ /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF -/* Name of package */ -#undef PACKAGE +/* "Major Version" */ +#undef MODULE_MAJOR + +/* "Minor Version" */ +#undef MODULE_MINOR + +/* "Module Version" */ +#undef MODULE_VERSION /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT @@ -97,9 +93,6 @@ /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME -/* Version number of package */ -#undef VERSION - /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN @@ -109,3 +102,6 @@ /* Define to `unsigned' if does not define. */ #undef size_t + +/* "have socklet_t defined?" */ +#undef socklen_t