aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-06-08 06:12:30 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-06-08 06:12:30 +0000
commit990e56fb13e1e538415a69c69754b21609a14ed6 (patch)
treee52e877df75c3b94d4eaa8270e38185dc77b2349
parent2bd3033f681eb3cb204f285bd0b2f0b8aa176c7e (diff)
Brian Dessent's fixes for cygwin builds
-rw-r--r--CHANGES23
-rw-r--r--RELEASE-NOTES5
-rw-r--r--configure.ac71
-rw-r--r--lib/if2ip.c2
-rw-r--r--lib/setup.h6
-rw-r--r--lib/url.c2
-rw-r--r--src/main.c4
-rw-r--r--src/setup.h6
8 files changed, 83 insertions, 36 deletions
diff --git a/CHANGES b/CHANGES
index bb1372cc6..3548e65b4 100644
--- 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...
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index cc1d28204..8c57223d3 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -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)
diff --git a/configure.ac b/configure.ac
index 5e337fd90..41ebf6000 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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"
diff --git a/lib/if2ip.c b/lib/if2ip.c
index c975ae200..479428f80 100644
--- a/lib/if2ip.c
+++ b/lib/if2ip.c
@@ -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)
diff --git a/lib/setup.h b/lib/setup.h
index 13f210a8a..cef40288e 100644
--- a/lib/setup.h
+++ b/lib/setup.h
@@ -79,10 +79,12 @@
* 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
diff --git a/lib/url.c b/lib/url.c
index be6c99dc2..985ade1c5 100644
--- 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
diff --git a/src/main.c b/src/main.c
index 0392d89a3..cf40b0e2c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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
diff --git a/src/setup.h b/src/setup.h
index 61726d61b..f07b3a7b7 100644
--- a/src/setup.h
+++ b/src/setup.h
@@ -81,10 +81,12 @@
* 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