From 89ab341084cad5fcf22ccc4db2b865d12ecda257 Mon Sep 17 00:00:00 2001 From: upstream svn Date: Tue, 31 Mar 2009 02:00:35 +0200 Subject: [PATCH] Upstream tarball 9546 --- .svn-revision | 2 +- configure | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ docs/Changelog | 1 + m4/GeoIP.m4 | 25 ++++++++++++++++--- 4 files changed, 93 insertions(+), 12 deletions(-) diff --git a/.svn-revision b/.svn-revision index 1841b47d..6ea05ed5 100644 --- a/.svn-revision +++ b/.svn-revision @@ -1 +1 @@ -9545 +9546 diff --git a/configure b/configure index 7b51fa02..25ae0f5c 100755 --- a/configure +++ b/configure @@ -6870,11 +6870,6 @@ fi; mule_backup_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $GEOIP_LDFLAGS" - if test x$SYS = xwin32; then - OTHERLIBS="-lws2_32" -fi - - if test "${ac_cv_header_GeoIP_h+set}" = set; then echo "$as_me:$LINENO: checking for GeoIP.h" >&5 echo $ECHO_N "checking for GeoIP.h... $ECHO_C" >&6 @@ -7014,13 +7009,81 @@ echo "${ECHO_T}$ac_cv_header_GeoIP_h" >&6 fi if test $ac_cv_header_GeoIP_h = yes; then + if test x$SYS = xwin32; then + + echo "$as_me:$LINENO: checking for WinSock library needed by GeoIP" >&5 +echo $ECHO_N "checking for WinSock library needed by GeoIP... $ECHO_C" >&6 + # Actually, we might not need any if GeoIP is linked as a .dll + # - but that's even harder to check for + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include + #ifdef _WINSOCK2_H + I do know it's not the best approach, but at least works with MinGW stock headers. + (tested with w32api-3.12) + #endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + + GEOIP_WINSOCK_LIB="-lwsock32" + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + GEOIP_WINSOCK_LIB="-lws2_32" + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $GEOIP_WINSOCK_LIB" >&5 +echo "${ECHO_T}$GEOIP_WINSOCK_LIB" >&6 + +fi + echo "$as_me:$LINENO: checking for GeoIP_open in -lGeoIP" >&5 echo $ECHO_N "checking for GeoIP_open in -lGeoIP... $ECHO_C" >&6 if test "${ac_cv_lib_GeoIP_GeoIP_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lGeoIP ${OTHERLIBS:-} $LIBS" +LIBS="-lGeoIP ${GEOIP_WINSOCK_LIB:-} $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7087,7 +7150,7 @@ _ACEOF GEOIP_LIBS="-lGeoIP" if test x$SYS = xwin32; then - GEOIP_LIBS="$GEOIP_LIBS -lws2_32" + GEOIP_LIBS="$GEOIP_LIBS $GEOIP_WINSOCK_LIB" fi GEOIP_CPPFLAGS="$GEOIP_CPPFLAGS -DENABLE_IP2COUNTRY=1" diff --git a/docs/Changelog b/docs/Changelog index 536353cb..9deadafb 100644 --- a/docs/Changelog +++ b/docs/Changelog @@ -126,6 +126,7 @@ Version 2.2.4 - The "don't know yet if there will be another 2.2" version. * Fixed detection of crypto++ library for versions >= 5.6.0. * Fixed saving wrong window position when exiting while minimized. * Fixed rare case when we tried to connect to a LowID client. + * MSW: detect WinSock API version needed by GeoIP. iz0bbz: * Fixed static linking with GeoIP on MinGW/MSYS. diff --git a/m4/GeoIP.m4 b/m4/GeoIP.m4 index 14cbe4b0..c76f1306 100644 --- a/m4/GeoIP.m4 +++ b/m4/GeoIP.m4 @@ -47,13 +47,30 @@ AC_DEFUN([MULE_CHECK_GEOIP], MULE_BACKUP([LDFLAGS]) MULE_APPEND([LDFLAGS], [$GEOIP_LDFLAGS]) - AS_IF([test x$SYS = xwin32], [OTHERLIBS="-lws2_32"]) - AC_CHECK_HEADER([GeoIP.h], [ + AS_IF([test x$SYS = xwin32], [ + AC_MSG_CHECKING([for WinSock library needed by GeoIP]) + # Actually, we might not need any if GeoIP is linked as a .dll + # - but that's even harder to check for + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + #include + #ifdef _WINSOCK2_H + I do know it's not the best approach, but at least works with MinGW stock headers. + (tested with w32api-3.12) + #endif + ]]) + ], [ + GEOIP_WINSOCK_LIB="-lwsock32" + ], [ + GEOIP_WINSOCK_LIB="-lws2_32" + ]) + AC_MSG_RESULT([$GEOIP_WINSOCK_LIB]) + ]) AC_CHECK_LIB([GeoIP], [GeoIP_open], [ AC_DEFINE([SUPPORT_GEOIP], [1], [Define if you want GeoIP support.]) GEOIP_LIBS="-lGeoIP" - AS_IF([test x$SYS = xwin32], [MULE_APPEND([GEOIP_LIBS], [-lws2_32])]) + AS_IF([test x$SYS = xwin32], [MULE_APPEND([GEOIP_LIBS], [$GEOIP_WINSOCK_LIB])]) MULE_APPEND([GEOIP_CPPFLAGS], [-DENABLE_IP2COUNTRY=1]) AC_ARG_WITH([geoip-static], AS_HELP_STRING([--with-geoip-static], [Explicitly link GeoIP statically (default=no)]), [ @@ -77,7 +94,7 @@ AC_DEFUN([MULE_CHECK_GEOIP], ], [ ENABLE_IP2COUNTRY=disabled MULE_WARNING([GeoIP support has been disabled because the GeoIP libraries were not found]) - ], [${OTHERLIBS:-}]) + ], [${GEOIP_WINSOCK_LIB:-}]) ], [ ENABLE_IP2COUNTRY=disabled MULE_WARNING([GeoIP support has been disabled because the GeoIP header files were not found]) -- 2.11.4.GIT