Re: [FYI] New WIN32 Makefiles + DAV support
Richard Atterer <[email protected]>
| Newsgroups | gmane.comp.lib.libwww |
|---|---|
| Message-ID | <[email protected]> |
Hello, if you want to build libwww under Windows using mingw32 (a version of GCC that doesn't make produced binaries depend on the Cygwin DLL), here's a patch to enable mingw support. (I already posted this here last October or so.) Apart from applying the patch and re-bootstrapping, it is also necessary to update the automake/libtool scripts to the latest versions, since the ones from 5.3.2 do not yet support mingw. This patch only allows you to build static libs, not DLLs. AIUI adding DLL support the libtool way would be a bit of work... In case anybody is interested, I've also put a precompiled mingw libwww on my homepage; see the bottom of <http://atterer.net/jigdo/> All the best, Richard -- __ _ |_) /| Richard Atterer | CS student at the Technische | GnuPG key: | \/¯| http://atterer.net | Universität München, Germany | 0x888354F7 ¯ '` ¯
libwww-mingw.diff
(text/plain, 6 KB)
#! /bin/sh
patch --remove-empty-files -p0 -i "$0" "$@"
exit $?
--- ./configure.in
+++ ./configure.in Wed Oct 3 13:53:24 2001
@@ -31,11 +31,23 @@
dnl Regular configure...
AC_PROG_CC
+if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi
AC_ISC_POSIX
dnl AC_PROG_CXX Caused problems and is not needed...
-AC_CYGWIN dnl You should probably
-AC_MINGW32 dnl use all three of these
-AC_EXEEXT dnl for maximum portability
+dnl You should probably use all three of these for maximum portability
+AC_CYGWIN
+AC_MINGW32
+AC_EXEEXT
+if test "$MINGW32" = "yes"; then
+ # With MinGW, need to explicitly link against winsock2
+ LIBS="$LIBS -lws2_32"
+ # LIBS="$LIBS -no-unused" for DLL building, but doesn't work ATM,
+ # so completely disable shared libs (speeds up compilation because
+ # the .c files are not compiled twice):
+ AC_DISABLE_SHARED
+fi
+
+AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_INSTALL
@@ -183,12 +195,14 @@
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL
-AC_CHECK_TYPE(BOOLEAN, char)
-AC_CHECK_TYPE(u_char, unsigned char)
-AC_CHECK_TYPE(u_short, unsigned short)
-AC_CHECK_TYPE(u_long, unsigned long)
+if test "$MINGW32" != "yes"; then
+ AC_CHECK_TYPE(BOOLEAN, char)
+ AC_CHECK_TYPE(u_char, unsigned char)
+ AC_CHECK_TYPE(u_short, unsigned short)
+ AC_CHECK_TYPE(u_long, unsigned long)
+fi
-AC_CHECK_SIZEOF(char)
+AC_CHECK_SIZEOF(char,1)
AC_CHECK_SIZEOF(char *)
AC_CHECK_SIZEOF(int,4)
AC_CHECK_SIZEOF(long,4)
@@ -481,7 +495,7 @@
WWWXML="libwwwxml.la"
LWWWXML="-lwwwxml -lxmltok -lxmlparse"
LIBWWWXML='${top_builddir}/Library/src/libwwwxml.la ${top_builddir}/modules/expat/xmlparse/libxmlparse.la ${top_builddir}/modules/expat/xmltok/libxmltok.la'
- SHOWXML="showxml ptri stri rdf_parse_file rdf_parse_buffer"
+ SHOWXML='showxml$(EXEEXT) ptri$(EXEEXT) stri$(EXEEXT) rdf_parse_file$(EXEEXT) rdf_parse_buffer$(EXEEXT)'
;;
esac ],
AC_MSG_RESULT(yes)
@@ -493,7 +507,7 @@
WWWXML="libwwwxml.la"
LWWWXML="-lwwwxml -lxmltok -lxmlparse"
LIBWWWXML='${top_builddir}/Library/src/libwwwxml.la ${top_builddir}/modules/expat/xmlparse/libxmlparse.la ${top_builddir}/modules/expat/xmltok/libxmltok.la'
- SHOWXML="showxml ptri stri rdf_parse_file rdf_parse_buffer"
+ SHOWXML='showxml$(EXEEXT) ptri$(EXEEXT) stri$(EXEEXT) rdf_parse_file$(EXEEXT) rdf_parse_buffer$(EXEEXT)'
)
AC_SUBST(HTXML) # for old style big library
AC_SUBST(HTLIBXML) # for old style big library
@@ -580,7 +594,7 @@
WWWSSL="libwwwssl.la"
LWWWSSL="-lwwwssl"
LIBWWWSSL='${top_builddir}/Library/src/SSL/libwwwssl.la'
- WWWSSLEX="wwwssl"
+ WWWSSLEX='wwwssl$(EXEEXT)'
;;
esac ],
[ AC_MSG_RESULT(no) ])
--- ./Library/src/wwwsys.html
+++ ./Library/src/wwwsys.html Wed Oct 3 14:11:38 2001
@@ -308,6 +308,77 @@
<H2>
<A NAME="Macintosh">Macintosh</A>
</H2>
+<H3>
+ mingw32 - Minimalist GNU for Windows
+</H3>
+<P>
+A bit like Cygwin, except it uses the native Windows API, which means
+the programs do not need the huge Cygwin DLL to run.
+<P>
+Patch by Richard Atterer <[email protected]>, October 2001
+<PRE>
+#ifdef __MINGW32__
+
+#include <winsock2.h>
+
+#define WWW_MSWINDOWS
+/* #define WWW_WIN_CONSOLE */
+#define WWW_WIN_WINDOW
+/* #define WWW_WIN_ASYNC */
+/* #define WWW_WIN_DLL */
+
+#ifndef _WINSOCKAPI_
+#define _WINSOCKAPI_
+#endif
+
+#define NETREAD(s,b,l) recv((s),(b),(l),0)
+#define NETWRITE(s,b,l) send((s),(b),(l),0)
+#define NETCLOSE(s) closesocket(s)
+#define IOCTL(s,c,a) ioctlsocket(s,c, (long *) a)
+
+#define MKDIR(a,b) mkdir(a)
+#define REMOVE(a) remove((a))
+#define DEFAULT_SUFFIXES "."
+
+#define SOCKET SOCKET /* WinSocks socket descriptor */
+#define INVSOC INVALID_SOCKET /* WinSocks invalid socket */
+
+#define DESIRED_WINSOCK_VERSION 0x0101 /* we'd like winsock ver 1.1... */
+#define MINIMUM_WINSOCK_VERSION 0x0101 /* ...but we'll take ver 1.1 :) */
+
+#define DIR_SEPARATOR
+#define DIR_SEPARATOR_CHAR '\\'
+#define DIR_SEPARATOR_STR "\\"
+
+#define socerrno WSAGetLastError()
+#define ERRNO_DONE
+
+/* Taken from the WIN32 stuff above. */
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#define EINPROGRESS WSAEINPROGRESS
+#define ECONNREFUSED WSAECONNREFUSED
+#define ETIMEDOUT WSAETIMEDOUT
+#define ENETUNREACH WSAENETUNREACH
+#define EHOSTUNREACH WSAEHOSTUNREACH
+#define EHOSTDOWN WSAEHOSTDOWN
+#define EISCONN WSAEISCONN
+/*#define EINVAL WSAEINVAL*/
+#define ECONNRESET WSAECONNRESET
+#define ECONNABORTED WSAECONNABORTED
+#define ESHUTDOWN WSAESHUTDOWN
+
+/* The configure.in script is wrong to default to #define GETGROUPS_T int */
+#ifdef GETGROUPS_T
+#undef GETGROUPS_T
+#endif
+
+#define HT_LSTAT stat
+
+#endif /* __MINGW32__ */
+</PRE>
+<H2>
+ <A NAME="Macintosh">Macintosh</A>
+</H2>
<P>
We have two environments on Macintosh: Codeworrior and MPV.
<H3>
@@ -578,16 +649,21 @@
#endif
</PRE>
<P>
-On non-VMS machines STAT should be stat...On VMS machines STAT is a function
-that converts directories and devices so that you can stat them.
+On non-VMS machines STAT should be stat, unless that was overridden
+somewhere above. On VMS machines STAT is a function that converts
+directories and devices so that you can stat them.
<PRE>
#ifdef VMS
typedef unsigned long mode_t;
#define HT_STAT HTStat
#define HT_LSTAT HTStat
#else
+#ifndef HT_STAT
#define HT_STAT stat
+#endif
+#ifndef HT_STAT
#define HT_LSTAT lstat
+#endif
#endif /* non VMS */
</PRE>
<H3>
@@ -1026,9 +1102,11 @@
Booleans
</H2>
<PRE>
+#ifndef __MINGW32__ /* has a typedef for BOOLEAN */
#ifndef BOOLEAN
typedef char BOOLEAN; /* Logical value */
#endif
+#endif
#ifndef CURSES
#ifndef TRUE
@@ -1053,6 +1131,8 @@
If we don't have these (for some mysterious reason) then define them. This
should (is?) be handled by the configure script already.
<PRE>
+/* Disabled - caused problems because mingw32 has typedefs for these.
+
#ifndef u_short
#define u_short unsigned short
#endif
@@ -1060,6 +1140,7 @@
#ifndef u_long
#define u_long unsigned long
#endif
+*/
</PRE>
<H2>
NULL Definition