From 1638a47a884b089825e26459081e137483b7d454 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Thu, 14 Aug 2003 01:23:25 +0000 Subject: [PATCH] Applied patch from Mikhail Grushinskiy for mingw compiler on Windows. * Makefile.am configure.in example/Makefile.am libxml.h nanoftp.c nanohttp.c xmllint.c: Applied patch from Mikhail Grushinskiy for mingw compiler on Windows. Daniel --- ChangeLog | 6 ++++++ Makefile.am | 3 ++- configure.in | 16 ++++++++++++++++ example/Makefile.am | 3 ++- libxml.h | 2 +- nanoftp.c | 10 ++++++++++ nanohttp.c | 10 ++++++++++ xmllint.c | 9 +++++++++ 8 files changed, 56 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b3936a75..059441fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Aug 14 03:19:08 CEST 2003 Daniel Veillard + + * Makefile.am configure.in example/Makefile.am libxml.h nanoftp.c + nanohttp.c xmllint.c: Applied patch from Mikhail Grushinskiy for + mingw compiler on Windows. + Thu Aug 14 02:28:36 CEST 2003 Daniel Veillard * parser.c: fixed the serious CPU usage problem reported by diff --git a/Makefile.am b/Makefile.am index 2f749517..bab9ae8b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,7 +39,8 @@ libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \ endif DEPS = $(top_builddir)/libxml2.la -LDADDS = @STATIC_BINARIES@ $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm +LDADDS = @STATIC_BINARIES@ $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm @WIN32_EXTRA_LIBADD@ + man_MANS = xml2-config.1 libxml.3 diff --git a/configure.in b/configure.in index d5c12067..63aaed05 100644 --- a/configure.in +++ b/configure.in @@ -714,6 +714,22 @@ else fi AC_SUBST(WITH_MEM_DEBUG) + +WIN32_EXTRA_LIBADD= +WIN32_EXTRA_LDFLAGS= +case "$host" in + *-*-mingw*) + WIN32_EXTRA_LIBADD="-lwsock32" + WIN32_EXTRA_LDFLAGS="-no-undefined" + AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation]) + AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around]) + AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around]) + ;; +esac +AC_SUBST(WIN32_EXTRA_LIBADD) +AC_SUBST(WIN32_EXTRA_LDFLAGS) + + AC_SUBST(CFLAGS) AC_SUBST(XML_CFLAGS) diff --git a/example/Makefile.am b/example/Makefile.am index b78e05f0..45ab56b8 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -7,5 +7,6 @@ INCLUDES = \ -I$(top_builddir)/include \ -I$(top_srcdir)/include -I@srcdir@ -LDADD = $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm +LDADD = $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm @WIN32_EXTRA_LIBADD@ + diff --git a/libxml.h b/libxml.h index fcf0f9e6..b26ff57a 100644 --- a/libxml.h +++ b/libxml.h @@ -18,7 +18,7 @@ #endif #endif -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__) #include "win32config.h" #elif defined(macintosh) #include "config-mac.h" diff --git a/nanoftp.c b/nanoftp.c index b6fd9a11..43ac8ac3 100644 --- a/nanoftp.c +++ b/nanoftp.c @@ -76,6 +76,16 @@ #endif #endif + +#ifdef __MINGW32__ +#define _WINSOCKAPI_ +#include +#include +#undef SOCKLEN_T +#define SOCKLEN_T unsigned int +#endif + + /** * A couple portability macros */ diff --git a/nanohttp.c b/nanohttp.c index a3b4661e..15cc94dd 100644 --- a/nanohttp.c +++ b/nanohttp.c @@ -73,6 +73,16 @@ #define SOCKET int #endif + +#ifdef __MINGW32__ +#define _WINSOCKAPI_ +#include +#include +#undef SOCKLEN_T +#define SOCKLEN_T unsigned int +#endif + + #include #include #include diff --git a/xmllint.c b/xmllint.c index 00d806da..b8efb50c 100644 --- a/xmllint.c +++ b/xmllint.c @@ -31,6 +31,15 @@ #endif #endif /* _WIN32 */ +#ifdef __MINGW32__ +#define _WINSOCKAPI_ +#include +#include +#undef SOCKLEN_T +#define SOCKLEN_T unsigned int +#endif + + #ifdef HAVE_SYS_TIMEB_H #include #endif