From: Francesco Chemolli Date: Mon, 2 Aug 2010 12:42:17 +0000 (+0200) Subject: Refactored winsock lib checks into os-deps.m4 X-Git-Tag: take1~402^2~2^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0c0d381b5867b83d00d8be122d1cdda95658a4ca;p=thirdparty%2Fsquid.git Refactored winsock lib checks into os-deps.m4 --- diff --git a/acinclude/os-deps.m4 b/acinclude/os-deps.m4 index f34e529f82..7ad895c1c0 100644 --- a/acinclude/os-deps.m4 +++ b/acinclude/os-deps.m4 @@ -768,3 +768,28 @@ fi ]) +dnl checks the winsock library to use (ws2_32 or wsock32) +dnl may set ac_cv_func_select as a side effect +AC_DEFUN([SQUID_CHECK_WINSOCK_LIB],[ + SQUID_STATE_SAVE(winsock) + AC_SEARCH_LIBS([closesocket],[ws2_32 wsock32]) + AC_MSG_CHECKING([for winsock library]) + case "$ac_cv_search_closesocket" in + "no") + AC_MSG_RESULT([winsock library not found]) + ;; + "none required") + AC_MSG_RESULT([winsock library already in LIBS]) + ;; + "-lws2_32") + AC_MSG_RESULT([winsock2]) + ac_cv_func_select='yes' + ;; + "-lwsock32") + AC_MSG_RESULT([winsock]) + ac_cv_func_select='yes' + ;; + esac + AC_CHECK_HEADERS(winsock2.h winsock.h) + SQUID_STATE_ROLLBACK(winsock) +]) diff --git a/configure.in b/configure.in index 0bbdaa650d..9d0dcda860 100644 --- a/configure.in +++ b/configure.in @@ -1344,7 +1344,7 @@ if test "x$squid_opt_enable_large_files" = "xyes" -a "x$buildmodel" = "x"; then AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64]) fi fi -if "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"; then +if test "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"; then if test "x$squid_opt_enable_large_files" = "xyes" ; then AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64]) CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS" @@ -2179,7 +2179,7 @@ AC_CHECK_HEADERS( \ CHECK_STRUCT_PAM_CONV AC_CHECK_HEADERS( - linux/netfilter_ipv4.h + linux/netfilter_ipv4.h ,,, SQUID_DEFAULT_INCLUDES #if HAVE_LIMITS_H @@ -2194,22 +2194,22 @@ SQUID_DEFAULT_INCLUDES dnl *BSD dont include the depenencies for all their net/ and netinet/ files dnl We must include a few basic type headers for them to work. AC_CHECK_HEADERS( \ - net/if.h \ - netinet/if_ether.h\ - netinet/icmp6.h \ - netinet/in.h \ - netinet/ip.h \ - netinet/ip6.h \ - netinet/ip_compat.h\ - netinet/ip_fil_compat.h\ - netinet/ip_fil.h\ - netinet/ip_icmp.h \ - netinet/ipl.h \ - netinet/ip_nat.h\ - net/pf/pfvar.h \ - net/pfvar.h \ - sys/mount.h\ - resolv.h \ + net/if.h \ + netinet/if_ether.h\ + netinet/icmp6.h \ + netinet/in.h \ + netinet/ip.h \ + netinet/ip6.h \ + netinet/ip_compat.h\ + netinet/ip_fil_compat.h\ + netinet/ip_fil.h\ + netinet/ip_icmp.h \ + netinet/ipl.h \ + netinet/ip_nat.h\ + net/pf/pfvar.h \ + net/pfvar.h \ + sys/mount.h\ + resolv.h \ ,,, SQUID_BSDNET_INCLUDES) @@ -2359,32 +2359,9 @@ AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack]) AC_SEARCH_LIBS([strlcpy], [bsd]) AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus]) dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API -case "$host_os" in - mingw|mingw32) - AC_MSG_CHECKING(for winsock) - save_LIBS="$LIBS" - for curlib in ws2_32 wsock32; do - LIBS="$LIBS -l$curlib" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ - socket(0,0,0); - select(0,NULL,NULL,NULL,NULL); - closesocket(0); - gethostname(NULL,0); - ]])],[have_winsock=yes],[have_winsock=no]) - - if test "x$have_winsock" = "xyes"; then - ac_cv_func_select='yes' - if test "x$curlib" = "xws2_32"; then - have_winsock=winsock2 - fi - break - fi - LIBS="$save_LIBS" - done - AC_MSG_RESULT($have_winsock) - AC_CHECK_HEADERS(winsock2.h winsock.h) - ;; -esac +if test "x$squid_host_os" = "xmingw" ; then + SQUID_CHECK_WINSOCK_LIB +fi # check that we have unix sockets SQUID_CHECK_UNIX_SOCKET