]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
First step of MinGw configure support.
authorserassio <>
Fri, 3 Jun 2005 18:59:06 +0000 (18:59 +0000)
committerserassio <>
Fri, 3 Jun 2005 18:59:06 +0000 (18:59 +0000)
Changes:

- MinGW environment identification
- Windows PSAPI.DLL support
- Support for Windows native port of OpenSSL
- Winsock support detection
- Identification of maximum FDs number
- Windows native resolver identification

configure.in

index 77d36476888055dfffd8c845041ae0dbf89ffb50..6c2c456480bbda5466bba4fc94ea98736e7d1a71 100644 (file)
@@ -3,7 +3,7 @@ dnl  Configuration input file for Squid
 dnl
 dnl  Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
 dnl
-dnl  $Id: configure.in,v 1.374 2005/04/25 12:03:34 serassio Exp $
+dnl  $Id: configure.in,v 1.375 2005/06/03 12:59:06 serassio Exp $
 dnl
 dnl
 dnl
@@ -13,7 +13,7 @@ AC_CONFIG_SRCDIR([src/main.cc])
 AC_CONFIG_AUX_DIR(cfgaux)
 AM_INIT_AUTOMAKE(squid, 3.0-PRE3-CVS)
 AM_CONFIG_HEADER(include/autoconf.h)
-AC_REVISION($Revision: 1.374 $)dnl
+AC_REVISION($Revision: 1.375 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AM_MAINTAINER_MODE
 
@@ -53,7 +53,7 @@ AC_SUBST(CGIEXT)
 dnl this should be expanded to a list of platform sensible support requirements.
 dnl (adding an option like --enable-cygwin-support doesn't make sense :]) - R Collins 2001
 case "$host_os" in
-cygwin|cygwin32)
+mingw|mingw32|cygwin|cygwin32)
         AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, true)
        ;;
 *)
@@ -61,6 +61,21 @@ cygwin|cygwin32)
        ;;
 esac
 
+case "$host_os" in
+mingw|mingw32)
+       AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none)
+       CFLAGS="$CFLAGS -mthreads"
+       CXXFLAGS="$CXXFLAGS -mthreads"
+       if test "$ac_cv_path_WIN32_PSAPI" = "none"; then
+               echo "PSAPI.DLL is recommended to run Squid on Windows NT Platform"
+               echo "Please see PSAPI.DLL section on doc/win32-relnotes.html."
+       else
+               AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems])
+               LIBS="$LIBS -lpsapi"
+       fi
+       ;;
+esac
+
 if test -z "$CACHE_HTTP_PORT"; then
        CACHE_HTTP_PORT="3128"
 fi
@@ -822,7 +837,15 @@ AC_ARG_ENABLE(ssl,
     echo "SSL gatewaying using OpenSSL enabled"
     AC_DEFINE(USE_SSL,1,[Define this to include code for SSL encryption.])
     AM_CONDITIONAL(ENABLE_SSL, true)
-    SSLLIB='-lssl -lcrypto'
+    case "$host_os" in
+    mingw|mingw32)
+        dnl Native Windows port of OpenSSL needs -lgdi32
+        SSLLIB='-lssl -lcrypto -lgdi32'
+        ;;
+    *)
+        SSLLIB='-lssl -lcrypto'
+       ;;
+    esac
     USE_OPENSSL=1
   fi
 ])
@@ -1888,6 +1911,38 @@ AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,[mtyp_t is defined by the system he
 dnl Check for needed libraries
 AC_CHECK_LIB(nsl, main)
 AC_CHECK_LIB(socket, main)
+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_TRY_LINK([
+                       char __attribute__((stdcall)) socket(int,int,int);
+                       char __attribute__((stdcall)) select(int,int,int,int,int);
+                       char __attribute__((stdcall)) closesocket(int);
+                       char __attribute__((stdcall)) gethostname(int,int);
+                       ],
+                       [
+                       socket(1,2,3);
+                       select(1,2,3,4,5);
+                       closesocket(1);
+                       gethostname(1,2);
+                       ],
+                       have_winsock=yes, have_winsock=no)
+
+       if test $have_winsock = yes; then
+               ac_cv_func_select='yes'
+               if test $curlib = ws2_32; then
+                       have_winsock=winsock2
+               fi
+               break
+       fi
+       LIBS="$save_LIBS"
+    done
+    AC_MSG_RESULT($have_winsock)
+    ;;
+esac
 
 dnl Ripped from the Samba sources
 AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
@@ -2501,6 +2556,12 @@ main() {
   SQUID_MAXFD=`cat conftestval`,
   SQUID_MAXFD=256,
   SQUID_MAXFD=256)
+  dnl Microsoft MSVCRT.DLL supports 2048 maximum FDs
+  case "$host_os" in
+  mingw|mingw32)
+    SQUID_MAXFD="2048"
+    ;;
+  esac
   AC_MSG_RESULT($SQUID_MAXFD)
 fi
 AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD,[Maximum number of open filedescriptors])
@@ -2670,12 +2731,19 @@ if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
        AC_MSG_RESULT("yes")
 else
        AC_MSG_RESULT("no")
-       echo "Will use our own inet_ntoa()."
-       AC_LIBOBJ(inet_ntoa)
-#      echo "WARNING: This looks bad, and probably prevents Squid from working."
-#      echo "         If you're on IRIX and using GCC 2.8, you probably need"
-#      echo "         to use the IRIX C compiler instead."
-#      sleep 10
+       case "$host_os" in
+       mingw|mingw32)
+         echo "Using Win32 resolver instead."
+         ;;
+       *)      
+         echo "Will use our own inet_ntoa()."
+         AC_LIBOBJ(inet_ntoa)
+#        echo "WARNING: This looks bad, and probably prevents Squid from working."
+#        echo "         If you're on IRIX and using GCC 2.8, you probably need"
+#        echo "         to use the IRIX C compiler instead."
+#        sleep 10
+         ;;
+       esac
 fi
 
 if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then