]> granicus.if.org Git - curl/commitdiff
Brian Dessent's fixes for cygwin builds
authorDaniel Stenberg <daniel@haxx.se>
Thu, 8 Jun 2006 06:12:30 +0000 (06:12 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 8 Jun 2006 06:12:30 +0000 (06:12 +0000)
CHANGES
RELEASE-NOTES
configure.ac
lib/if2ip.c
lib/setup.h
lib/url.c
src/main.c
src/setup.h

diff --git a/CHANGES b/CHANGES
index bb1372cc6d54eaf1c12a9a1cf6c31909b77d6ccf..3548e65b451f530cf39bd216d87ad339b24cc8d9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,29 @@
 
                                   Changelog
 
+Daniel (8 June 2006)
+- Brian Dessent fixed the code for cygwin in three distinct ways:
+
+  The first modifies {lib,src}/setup.h to not include the winsock headers
+  under Cygwin.  This fixes the reported build problem.  Cygwin attempts as
+  much as possible to emulate a posix environment under Windows.  This means
+  that WIN32 is *not* #defined and (to the extent possible) everything is done
+  as it would be on a *ix type system.  Thus <sys/socket.h> is the proper
+  include, and even though winsock2.h is present, including it just introduces
+  a whole bunch of incompatible socket API stuff.
+
+  The second is a patch I've included in the Cygwin binary packages for a
+  while.  It skips two unnecessary library checks (-lwinmm and -lgdi32).  The
+  checks are innocuous and they do succeed, but they pollute LIBS with
+  unnecessary stuff which gets recorded as such in the libcurl.la file, which
+  brings them into the build of any libcurl-downstream.  As far as I know
+  these libs are really only necessary for mingw, so alternatively they could
+  be designed to only run if $host matches *-*-mingw* but I took the safer
+  route of skipping them for *-*-cygwin*.
+
+  The third patch replaces all uses of the ancient and obsolete __CYGWIN32__
+  with __CYGWIN__. Ref: <http://cygwin.com/ml/cygwin/2003-09/msg01520.html>.
+
 Daniel (7 June 2006)
 - Mikael Sennerholm provided a patch that added NTLM2 session response support
   to libcurl. The 21 NTLM test cases were again modified to comply...
index cc1d282044ea2db4769a4bb39dda975fe9cc8b65..8c57223d3df14afa6bc8b95a7941bcaaca1db82c 100644 (file)
@@ -23,6 +23,7 @@ This release includes the following changes:
 
 This release includes the following bugfixes:
 
+ o builds fine on cygwin
  o md5-sess with Digest authentication
  o dict with letters such as space in a word
  o dict with url-encoded words in the URL
@@ -41,7 +42,6 @@ This release includes the following bugfixes:
  o improved NTLM functionality
  o following redirects with more than one question mark in source URL
  o fixed debug build crash with -d
- o TFTP works on more systems
  o generates a fine AIX Toolbox RPM spec
  o treat FTP AUTH failures properly
  o TFTP transfers could trash data
@@ -65,6 +65,7 @@ advice from friends like these:
  Dan Fandrich, Ilja van Sprundel, David McCreedy, Tor Arntsen, Xavier Bouchoux,
  David Byron, Michele Bini, Ates Goral, Katie Wang, Robson Braga Araujo,
  Ale Vesely, Paul Querna, Gisle Vanem, Mark Eichin, Roland Blom, Andreas
- Ntaflos, David Shaw, Michael Wallner, Olaf Stüben, Mikael Sennerholm
+ Ntaflos, David Shaw, Michael Wallner, Olaf Stüben, Mikael Sennerholm,
+ Brian Dessent
 
         Thanks! (and sorry if I forgot to mention someone)
index 5e337fd903236bc9562c2bd54a5bd743b77a6d23..41ebf600015da0fbb4625386766f50d300e3ca03 100644 (file)
@@ -472,20 +472,31 @@ dnl **********************************************************************
 dnl Check for the presence of the winmm library.
 dnl **********************************************************************
 
-AC_MSG_CHECKING([for timeGetTime in winmm])
-my_ac_save_LIBS=$LIBS
-LIBS="-lwinmm $LIBS"
-AC_TRY_LINK([#include <windef.h>
-             #include <mmsystem.h>
-             ],
-             [timeGetTime();],
-             [ dnl worked!
-             AC_MSG_RESULT([yes])
-             ],
-             [ dnl failed, restore LIBS
-             LIBS=$my_ac_save_LIBS
-             AC_MSG_RESULT(no)]
-           )
+case $host in
+  *-*-cygwin*)
+    dnl Under Cygwin, winmm exists but is not needed as WIN32 is not #defined
+    dnl and gettimeofday() will be used regardless of the outcome of this test.
+    dnl Skip this test, otherwise -lwinmm will be needlessly added to LIBS
+    dnl (and recorded as such in the .la file, potentially affecting downstream
+    dnl clients of the library.)
+    ;;
+  *)
+    AC_MSG_CHECKING([for timeGetTime in winmm])
+    my_ac_save_LIBS=$LIBS
+    LIBS="-lwinmm $LIBS"
+    AC_TRY_LINK([#include <windef.h>
+                 #include <mmsystem.h>
+                 ],
+                 [timeGetTime();],
+                 [ dnl worked!
+                 AC_MSG_RESULT([yes])
+                 ],
+                 [ dnl failed, restore LIBS
+                 LIBS=$my_ac_save_LIBS
+                 AC_MSG_RESULT(no)]
+               )
+    ;;
+esac
 
 dnl **********************************************************************
 dnl Checks for IPv6
@@ -888,18 +899,26 @@ if test X"$OPT_SSL" != Xno; then
   fi
 
   dnl This is for Msys/Mingw
-  AC_MSG_CHECKING([for gdi32])
-  my_ac_save_LIBS=$LIBS
-  LIBS="-lgdi32 $LIBS"
-  AC_TRY_LINK([#include <windef.h>
-               #include <wingdi.h>],
-               [GdiFlush();],
-               [ dnl worked!
-               AC_MSG_RESULT([yes])],
-               [ dnl failed, restore LIBS
-               LIBS=$my_ac_save_LIBS
-               AC_MSG_RESULT(no)]
-              )
+  case $host in    
+    *-*-cygwin*)
+      dnl Under Cygwin this is extraneous and causes an unnecessary -lgdi32
+      dnl to be added to LIBS and recorded in the .la file.
+      ;;
+    *)
+      AC_MSG_CHECKING([for gdi32])
+      my_ac_save_LIBS=$LIBS
+      LIBS="-lgdi32 $LIBS"
+      AC_TRY_LINK([#include <windef.h>
+                   #include <wingdi.h>],
+                   [GdiFlush();],
+                   [ dnl worked!
+                   AC_MSG_RESULT([yes])],
+                   [ dnl failed, restore LIBS
+                   LIBS=$my_ac_save_LIBS
+                   AC_MSG_RESULT(no)]
+                  )
+      ;;
+  esac
 
   AC_CHECK_LIB(crypto, CRYPTO_lock,[
      HAVECRYPTO="yes"
index c975ae20049acf3e7c4bd3ee572dab8dd32d26d5..479428f80b6dbea4df22dde7228f1112b96b928d 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "if2ip.h"
 
-#if !defined(WIN32) && !defined(__BEOS__) && !defined(__CYGWIN32__) && \
+#if !defined(WIN32) && !defined(__BEOS__) && !defined(__CYGWIN__) && \
     !defined(__riscos__) && !defined(__INTERIX) && !defined(NETWARE) && \
     !defined(_AMIGASF)
 
index 13f210a8a2fa6d94d6cd5349fc139c6109028639..cef40288e0f26e77ba30a8267e51472fcf568f4e 100644 (file)
  * Include header files for windows builds before redefining anything.
  * Use this preproessor block only to include or exclude windows.h,
  * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
- * to any other further and independant block.
+ * to any other further and independant block.  Under Cygwin things work
+ * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
+ * never be included.
  */
 
-#ifdef HAVE_WINDOWS_H
+#if defined(HAVE_WINDOWS_H) && !defined(__CYGWIN__)
 #  ifndef WIN32_LEAN_AND_MEAN
 #    define WIN32_LEAN_AND_MEAN
 #  endif
index be6c99dc2b73ac08924823336e2af86ea9ca32dd..985ade1c5d57087e1b07cdc74c66aa6ab776d8e3 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -157,7 +157,7 @@ static long ConnectionStore(struct SessionHandle *data,
 #ifndef USE_ARES
 /* not for Win32, unless it is cygwin
    not for ares builds */
-#if !defined(WIN32) || defined(__CYGWIN32__)
+#if !defined(WIN32) || defined(__CYGWIN__)
 
 #ifndef RETSIGTYPE
 #define RETSIGTYPE void
index 0392d89a3434f78549c1e43bb0068c567c4dd6e9..cf40b0e2cf979cac030728723970763c6f3c404e 100644 (file)
@@ -3242,7 +3242,7 @@ static void free_config_fields(struct Configurable *config)
   curl_slist_free_all(config->headers);
 }
 
-#if defined(WIN32) && !defined(__CYGWIN32__)
+#if defined(WIN32) && !defined(__CYGWIN__)
 
 /* Function to find CACert bundle on a Win32 platform using SearchPath.
  * (SearchPath is already declared via inclusions done in setup header file)
@@ -3485,7 +3485,7 @@ operate(struct Configurable *config, int argc, char *argv[])
 
     if(env)
       curl_free(env);
-#if defined(WIN32) && !defined(__CYGWIN32__)
+#if defined(WIN32) && !defined(__CYGWIN__)
     else
       FindWin32CACert(config, "curl-ca-bundle.crt");
 #endif
index 61726d61bc3bbb8db12cf3e0a24d7d9880202c34..f07b3a7b7921e8fcba77661590d315a6b8d22ea8 100644 (file)
  * Include header files for windows builds before redefining anything.
  * Use this preproessor block only to include or exclude windows.h, 
  * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs 
- * to any other further and independant block.
+ * to any other further and independant block.  Under Cygwin things work
+ * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
+ * never be included.
  */
 
-#ifdef HAVE_WINDOWS_H
+#if defined(HAVE_WINDOWS_H) && !defined(__CYGWIN__)
 #  ifndef WIN32_LEAN_AND_MEAN
 #    define WIN32_LEAN_AND_MEAN
 #  endif