Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 12638 invoked from network); 28 Jun 2005 03:21:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Jun 2005 03:21:15 -0000 Received: (qmail 62519 invoked by uid 500); 28 Jun 2005 03:21:12 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 62474 invoked by uid 500); 28 Jun 2005 03:21:11 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 62461 invoked by uid 99); 28 Jun 2005 03:21:11 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jun 2005 20:21:11 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of jayvdb@gmail.com designates 64.233.162.205 as permitted sender) Received: from [64.233.162.205] (HELO zproxy.gmail.com) (64.233.162.205) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jun 2005 20:21:10 -0700 Received: by zproxy.gmail.com with SMTP id 8so282737nzo for ; Mon, 27 Jun 2005 20:21:07 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=YNi5HEtyLgG8V3cQFnvuBqvYRVibfNszr480X8A8BT5WpTAgiAgtcf0ViQ54PKAuAgFaVkfKbXKfDcwZW6NVGiKfbH46eNuFBnANN8pP7bE1xY/TKcJcJ/n65owfXIjeWeJxQbH6z85ZujggQphwuo2oUkm3NPGNEHdd5ubekSc= Received: by 10.36.222.65 with SMTP id u65mr895067nzg; Mon, 27 Jun 2005 20:21:07 -0700 (PDT) Received: by 10.36.80.12 with HTTP; Mon, 27 Jun 2005 20:21:07 -0700 (PDT) Message-ID: Date: Tue, 28 Jun 2005 13:21:07 +1000 From: John Vandenberg Reply-To: John Vandenberg To: dev@apr.apache.org Subject: autotool based mingw port Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, This is the accumulation of a number of porting attempts that have petered out. It uses the standard unix build process, with a few (too many) win32 specific bits along the way. This patch isnt a finished product as there are tests that dont compile, but it would be handy to have the proposed changes to the build files reviewed early; they work for me, but I have no doubt they are not ideal. I will incorporate all feedback in order for this port to be inobtrusive to the real unix's or other Windows builds. btw, is there a legal way to test the Netware builds? Cheers, John Index: time/win32/time.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- time/win32/time.c=09(revision 201966) +++ time/win32/time.c=09(working copy) @@ -14,7 +14,7 @@ * limitations under the License. */ =20 -#include "win32/apr_arch_atime.h" +#include "apr_arch_atime.h" #include "apr_time.h" #include "apr_general.h" #include "apr_lib.h" Index: time/win32/access.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- time/win32/access.c=09(revision 201966) +++ time/win32/access.c=09(working copy) @@ -14,7 +14,7 @@ * limitations under the License. */ =20 -#include "win32/apr_arch_atime.h" +#include "apr_arch_atime.h" #include "apr_time.h" #include "apr_general.h" #include "apr_lib.h" Index: time/win32/timestr.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- time/win32/timestr.c=09(revision 201966) +++ time/win32/timestr.c=09(working copy) @@ -14,7 +14,7 @@ * limitations under the License. */ =20 -#include "win32/apr_arch_atime.h" +#include "apr_arch_atime.h" #include "apr_portable.h" #include "apr_strings.h" =20 Index: locks/win32/thread_rwlock.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- locks/win32/thread_rwlock.c=09(revision 201966) +++ locks/win32/thread_rwlock.c=09(working copy) @@ -18,7 +18,7 @@ #include "apr_private.h" #include "apr_general.h" #include "apr_strings.h" -#include "win32/apr_arch_thread_rwlock.h" +#include "apr_arch_thread_rwlock.h" #include "apr_portable.h" =20 static apr_status_t thread_rwlock_cleanup(void *data) Index: locks/win32/thread_cond.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- locks/win32/thread_cond.c=09(revision 201966) +++ locks/win32/thread_cond.c=09(working copy) @@ -18,8 +18,8 @@ #include "apr_private.h" #include "apr_general.h" #include "apr_strings.h" -#include "win32/apr_arch_thread_mutex.h" -#include "win32/apr_arch_thread_cond.h" +#include "apr_arch_thread_mutex.h" +#include "apr_arch_thread_cond.h" #include "apr_portable.h" =20 static apr_status_t thread_cond_cleanup(void *data) Index: atomic/win32/apr_atomic.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- atomic/win32/apr_atomic.c=09(revision 201978) +++ atomic/win32/apr_atomic.c=09(working copy) @@ -15,6 +15,7 @@ */ =20 #include "apr.h" +#include "apr_private.h" #include "apr_atomic.h" #include "apr_thread_mutex.h" =20 Index: test/Makefile.in =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- test/Makefile.in=09(revision 201966) +++ test/Makefile.in=09(working copy) @@ -36,7 +36,7 @@ CLEAN_SUBDIRS =3D internal =20 INCDIR=3D../include -INCLUDES=3D-I$(INCDIR) -I$(srcdir)/../include +INCLUDES=3D-I$(INCDIR) -I$(srcdir)/../include -I$(OSDIR) =20 # link programs using -no-install to get real executables not # libtool wrapper scripts which link an executable when first run. Index: include/apr_user.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- include/apr_user.h=09(revision 201966) +++ include/apr_user.h=09(working copy) @@ -23,6 +23,7 @@ */ =20 #include "apr.h" +#include "apr_private.h" #include "apr_errno.h" #include "apr_pools.h" =20 Index: include/apr.h.in =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- include/apr.h.in=09(revision 201966) +++ include/apr.h.in=09(working copy) @@ -109,6 +109,10 @@ * or the extern "C" namespace=20 */ =20 +#if HAVE_WINDOWS_H +#include +#endif + #if APR_HAVE_SYS_TYPES_H #include #endif @@ -221,8 +225,8 @@ #define APR_HAS_OTHER_CHILD @oc@ #define APR_HAS_DSO @aprdso@ #define APR_HAS_SO_ACCEPTFILTER @acceptfilter@ -#define APR_HAS_UNICODE_FS 0 -#define APR_HAS_PROC_INVOKED 0 +#define APR_HAS_UNICODE_FS @have_unicode_fs@ +#define APR_HAS_PROC_INVOKED @have_proc_invoked@ #define APR_HAS_USER 1 #define APR_HAS_LARGE_FILES @aprlfs@ #define APR_HAS_XTHREAD_FILES 0 Index: include/arch/win32/apr_arch_misc.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- include/arch/win32/apr_arch_misc.h=09(revision 201981) +++ include/arch/win32/apr_arch_misc.h=09(working copy) @@ -133,9 +133,11 @@ #if APR_HAS_ANSI_FS && APR_HAS_UNICODE_FS #define IF_WIN_OS_IS_UNICODE if (apr_os_level >=3D APR_WIN_UNICODE) #define ELSE_WIN_OS_IS_ANSI else -#else APR_HAS_UNICODE_FS +#else +#if APR_HAS_UNICODE_FS #define IF_WIN_OS_IS_UNICODE #define ELSE_WIN_OS_IS_ANSI +#endif #endif /* WINNT */ =20 typedef enum { @@ -152,15 +154,31 @@ =20 /* The apr_load_dll_func call WILL fault if the function cannot be loaded = */ =20 +#if !defined(_MSC_VER) + #define APR_DECLARE_LATE_DLL_FUNC(lib, rettype, calltype, fn, ord, args, names) \ typedef rettype (calltype *apr_winapi_fpt_##fn) args; \ static apr_winapi_fpt_##fn apr_winapi_pfn_##fn =3D NULL; \ + extern __inline rettype apr_winapi_##fn args \ + { if (!apr_winapi_pfn_##fn) \ + apr_winapi_pfn_##fn =3D (apr_winapi_fpt_##fn) \ + apr_load_dll_func(lib, #fn, ord); \ + return (*(apr_winapi_pfn_##fn)) names; }; \ + + +#else + +#define APR_DECLARE_LATE_DLL_FUNC(lib, rettype, calltype, fn, ord, args, names) \ + typedef rettype (calltype *apr_winapi_fpt_##fn) args; \ + static apr_winapi_fpt_##fn apr_winapi_pfn_##fn =3D NULL; \ __inline rettype apr_winapi_##fn args \ { if (!apr_winapi_pfn_##fn) \ apr_winapi_pfn_##fn =3D (apr_winapi_fpt_##fn) \ apr_load_dll_func(lib, #fn, ord); \ return (*(apr_winapi_pfn_##fn)) names; }; \ =20 +#endif + /* Provide late bound declarations of every API function missing from * one or more supported releases of the Win32 API * @@ -323,5 +341,32 @@ =20 #endif /* !defined(_WIN32_WCE) */ =20 +#if defined(_MSC_VER) +#include "crtdbg.h" + +APR_INLINE void* apr_malloc_dbg(size_t size, const char* filename, int linenumber) { + return _malloc_dbg(size, _CRT_BLOCK, filename, linenumber); +} + +APR_INLINE void* apr_realloc_dbg(void* userData, size_t newSize, const char* filename, int linenumber) { + return _realloc_dbg(userData, newSize, _CRT_BLOCK, filename, linenumbe= r); +} + +#else + +extern __inline void* apr_malloc_dbg(size_t size, const char* filename, int linenumber) { + return malloc(size); +} + +extern __inline void* apr_realloc_dbg(void* userData, size_t newSize, const char* filename, int linenumber) { + return realloc(userData, newSize); +} + +#endif /* ! _MSC_VER */ + +#ifndef _CRT_BLOCK +#define _CRT_BLOCK 2 +#endif + #endif /* ! MISC_H */ =20 Index: include/arch/win32/apr_private.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- include/arch/win32/apr_private.h=09(revision 201981) +++ include/arch/win32/apr_private.h=09(working copy) @@ -42,7 +42,14 @@ /* For the misc.h late-loaded dynamic symbols, we need some obscure types= =20 * Avoid dragging in wtypes.h unless it's absolutely necessary [generally * not with APR itself, until some GUI-related security is introduced.] - */ +*/ + +// MinGW depends on +// Im not sure this is the correct approach +#if !defined(_MSC_VER) +#include +#endif + #ifndef _WIN32_WCE #define HAVE_ACLAPI 1 #ifdef __wtypes_h__ Index: include/arch/win32/apr_arch_atime.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- include/arch/win32/apr_arch_atime.h=09(revision 201981) +++ include/arch/win32/apr_arch_atime.h=09(working copy) @@ -36,7 +36,12 @@ #define APR_DELTA_EPOCH_IN_USEC APR_TIME_C(11644473600000000); =20 =20 -__inline void FileTimeToAprTime(apr_time_t *result, FILETIME *input) +#ifdef __GNUC__ + extern __inline +#else + APR_INLINE /* whatever this is */ +#endif +void FileTimeToAprTime(apr_time_t *result, FILETIME *input) { /* Convert FILETIME one 64 bit number so we can work with it. */ *result =3D input->dwHighDateTime; @@ -48,7 +53,12 @@ } =20 =20 -__inline void AprTimeToFileTime(LPFILETIME pft, apr_time_t t) +#ifdef __GNUC__ + extern __inline +#else + APR_INLINE /* whatever this is */ +#endif +void AprTimeToFileTime(LPFILETIME pft, apr_time_t t) { LONGLONG ll; t +=3D APR_DELTA_EPOCH_IN_USEC; Index: include/arch/win32/apr_arch_file_io.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- include/arch/win32/apr_arch_file_io.h=09(revision 201981) +++ include/arch/win32/apr_arch_file_io.h=09(working copy) @@ -52,8 +52,6 @@ #include "arch/win32/apr_arch_utf8.h" #include =20 -typedef apr_uint16_t apr_wchar_t; - /* Helper functions for the WinNT ApiW() functions. APR treats all * resource identifiers (files, etc) by their UTF-8 name, to provide=20 * access to all named identifiers. [UTF-8 completely maps Unicode=20 Index: include/apr_strings.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- include/apr_strings.h=09(revision 201966) +++ include/apr_strings.h=09(working copy) @@ -46,15 +46,28 @@ */ =20 #include "apr.h" +#include "apr_private.h" #include "apr_errno.h" #include "apr_pools.h" +#include "apr_general.h" +#include "apr_lib.h" #define APR_WANT_IOVEC +#define APR_WANT_STDIO +#define APR_WANT_STRFUNC #include "apr_want.h" =20 #if APR_HAVE_STDARG_H #include +#else +#ifdef HAVE_STDDEF_H +#include /* NULL */ #endif +#endif =20 +#ifdef HAVE_STDLIB_H +#include /* strtol and strtoll */ +#endif + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ Index: include/apr_want.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- include/apr_want.h=09(revision 201966) +++ include/apr_want.h=09(working copy) @@ -83,7 +83,16 @@ =20 #if APR_HAVE_SYS_UIO_H #include +#else +#ifndef HAVE_STRUCT_IOVEC +struct iovec=20 +{ + char *iov_base; + int iov_len;=20 +}; +#define HAVE_STRUCT_IOVEC #endif +#endif =20 #undef APR_WANT_IOVEC #endif Index: build.conf =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- build.conf=09(revision 201966) +++ build.conf=09(working copy) @@ -24,3 +24,17 @@ =20 # we have a recursive makefile for the test files (for now) # test/*.c + +[win32] + +inherit =3D + filepath_util + errorcodes + getopt + inet_pton + inet_ntop + sockaddr + select + apr_pools # the empty memory/win32 directory makes this necessary + + Index: configure.in =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- configure.in=09(revision 201966) +++ configure.in=09(working copy) @@ -364,6 +364,9 @@ =09APR_SETVAR(CC,mwcc) =09APR_SETVAR(AR,ar) =09;; + *-mingw*:gcc ) + APR_ADDTO(LDFLAGS,[-Wl,--enable-auto-import,--subsystem,console]) + ;; esac =20 dnl Check the depend program we can use @@ -421,6 +424,12 @@ OSDIR=3D"as400" eolstr=3D"\\n" ;; + *mingw*) + OSDIR=3D"win32" + enable_threads=3D"system_threads" + eolstr=3D"\\n" + OBJECTS_PLATFORM=3D'$(OBJECTS_win32)' + ;; *cygwin*) OSDIR=3D"unix" APR_ADDTO(CPPFLAGS,-DCYGWIN) @@ -484,6 +493,10 @@ exit(ret); }], [apr_cv_use_lfs64=3Dyes], [apr_cv_use_lfs64=3Dno], [apr_cv_use_lfs64= =3Dno]) CPPFLAGS=3D$apr_save_CPPFLAGS]) + case $host in + *mingw*) apr_cv_use_lfs64=3Dyes + ;; + esac if test "$apr_cv_use_lfs64" =3D "yes"; then APR_ADDTO(CPPFLAGS, [-D_LARGEFILE64_SOURCE]) fi @@ -540,12 +553,19 @@ dnl It should check for LIBS being empty and set LIBS equal to the new val= ue=20 dnl without the extra " " in that case, but they didn't do that. So, we dnl end up LIBS=3D"-lm -lcrypt -lnsl -ldl" which is an annoyance. -AC_SEARCH_LIBS(gethostbyname, nsl) -AC_SEARCH_LIBS(gethostname, nsl) -AC_SEARCH_LIBS(socket, socket) -AC_SEARCH_LIBS(crypt, crypt ufc) -AC_CHECK_LIB(truerand, main) -AC_SEARCH_LIBS(modf, m) +case $host in + *mingw*) + APR_ADDTO(LIBS,[-lmsvcrt -lkernel32 -lshell32 -ladvapi32 -lws2_32 -lntdll -lntoskrnl -lrpcrt4]) + ;; + *) + AC_SEARCH_LIBS(gethostbyname, nsl) + AC_SEARCH_LIBS(gethostname, nsl) + AC_SEARCH_LIBS(socket, socket) + AC_SEARCH_LIBS(crypt, crypt ufc) + AC_CHECK_LIB(truerand, main) + AC_SEARCH_LIBS(modf, m) + ;; +esac =20 dnl ----------------------------- Checking for Threads echo "${nl}Checking for Threads..." @@ -693,9 +713,29 @@ #endif";; esac =20 -AC_CHECK_HEADERS([sys/types.h sys/mman.h sys/ipc.h sys/mutex.h sys/shm.h sys/file.h kernel/OS.h os2.h]) +AC_CHECK_HEADERS([sys/types.h sys/mman.h sys/ipc.h sys/mutex.h sys/shm.h sys/file.h kernel/OS.h os2.h windows.h winsock2.h]) AC_CHECK_FUNCS([mmap munmap shm_open shm_unlink shmget shmat shmdt shmctl = \ create_area]) +case $host in + *mingw*) +AC_MSG_CHECKING(for CreateFileMapping) +AC_TRY_RUN([ +#include +int main() +{ + CreateFileMapping( + INVALID_HANDLE_VALUE, // use paging file + NULL, // default security + PAGE_READWRITE, // read/write access + 0, // max. object size + 256, // buffer size + TEXT("TEST")); // name of mapping object + return 0; +}], [ac_cv_func_CreateFileMapping=3Dyes], [ac_cv_func_CreateFileMapping=3Dno], [ac_cv_func_CreateFileMapping=3Dno]) +AC_MSG_RESULT($ac_cv_func_CreateFileMapping) + ;; +esac + APR_CHECK_DEFINE(MAP_ANON, sys/mman.h) APR_CHECK_FILE(/dev/zero) =20 @@ -755,6 +795,10 @@ [havebeosshm=3D"1" APR_DECIDE(USE_SHMEM_BEOS_ANON, [BeOS areas])]) +APR_IFALLYES(header:windows.h func:CreateFileMapping, + [havewin32shm=3D"1" + APR_DECIDE(USE_SHMEM_WIN32_ANON, + [Windows CreateFileMapping()])]) case $host in *linux* )=20 # Linux has problems with MM_SHMT_MMANON even though it reports @@ -801,6 +845,7 @@ haveshmget=3D"0" havebeosarea=3D"0" haveos2shm=3D"0" +havewin32shm=3D"0" APR_BEGIN_DECISION([namebased memory allocation method]) APR_IFALLYES(header:sys/mman.h func:mmap func:munmap, [havemmaptmp=3D"1" @@ -821,6 +866,9 @@ APR_IFALLYES(header:os2.h, [haveos2shm=3D"1" APR_DECIDE(USE_SHMEM_OS2, [OS/2 DosAllocSharedMem()])]) +APR_IFALLYES(header:windows.h, + [havewin32shm=3D"1" + APR_DECIDE(USE_SHMEM_WIN32, [Windows shared memory])]) case $host in *linux* )=20 # Linux has problems with MM_SHMT_MMANON even though it reports @@ -841,6 +889,7 @@ useshmget=3D"0" usebeosarea=3D"0" useos2shm=3D"0" +usewin32shm=3D"0" =20 case $ac_decision in USE_SHMEM_MMAP_TMP ) @@ -858,10 +907,13 @@ USE_SHMEM_OS2 ) useos2shm=3D"1" ;; + USE_SHMEM_WIN32 ) + usewin32shm=3D"1" + ;; esac =20 # Do we have any shared memory support? -if test "$usemmaptmp$usemmapshm$usemmapzero$useshmget$usemmapanon$usebeosa= rea$useos2shm" =3D "0000000"; then +if test "$usemmaptmp$usemmapshm$usemmapzero$useshmget$usemmapanon$usebeosa= rea$useos2shm$usewin32shm" =3D "00000000"; then sharedmem=3D"0" else sharedmem=3D"1" @@ -872,11 +924,13 @@ AC_SUBST(useshmget) AC_SUBST(usebeosarea) AC_SUBST(useos2shm) +AC_SUBST(usewin32shm) AC_SUBST(havemmaptmp) AC_SUBST(havemmapshm) AC_SUBST(haveshmget) AC_SUBST(havebeosarea) AC_SUBST(haveos2shm) +AC_SUBST(havewin32shm) AC_SUBST(sharedmem) =20 dnl ----------------------------- Checks for Any required Functions @@ -1447,7 +1501,7 @@ # Everything else: if test "$dsotype" =3D "any"; then case $host in - *os390|*-os2*|*os400|*-aix*) dsotype=3Dother ;; + *os390|*-os2*|*os400|*-aix*|*mingw*) dsotype=3Dother ;; esac fi fi @@ -1660,6 +1714,11 @@ if test "x$apr_lock_method" !=3D "x"; then APR_DECISION_FORCE($apr_lock_method) fi +case "$host" in + *mingw* ) + APR_DECISION_FORCE(win32) + ;; +esac APR_END_DECISION AC_DEFINE_UNQUOTED($ac_decision) =20 @@ -1840,17 +1899,24 @@ =20 dnl ----------------------------- Checking for Networking Support=20 echo "${nl}Checking for Networking support..." -AC_MSG_CHECKING(for in_addr in netinet/in.h) -AC_TRY_COMPILE([ -#include -#include -],[ -struct in_addr arg; -arg.s_addr =3D htonl(INADDR_ANY); -], [ have_in_addr=3D"1"=20 -msg=3Dyes ] , [ have_in_addr=3D"0" -msg=3Dno ]) -AC_MSG_RESULT([$msg]) +case $host in + *mingw* ) + have_in_addr=3D"1" + ;; + * ) + AC_MSG_CHECKING(for in_addr in netinet/in.h) + AC_TRY_COMPILE([ + #include + #include + ],[ + struct in_addr arg; + arg.s_addr =3D htonl(INADDR_ANY); +], [ have_in_addr=3D"1" + msg=3Dyes ] , [ have_in_addr=3D"0" + msg=3Dno ]) + AC_MSG_RESULT([$msg]) + ;; +esac =20 AC_MSG_CHECKING([if fd =3D=3D socket on this platform]) if test "x$file_as_socket" !=3D "x0" ; then @@ -1990,6 +2056,24 @@ AC_CHECK_HEADERS(langinfo.h) AC_CHECK_FUNCS(nl_langinfo) =20 +have_unicode_fs=3D"0" +case "$host" in + *mingw* ) + have_unicode_fs=3D"1" + ;; +esac + +AC_SUBST(have_unicode_fs) + +have_proc_invoked=3D"0" +case "$host" in + *mingw* ) + have_proc_invoked=3D"1" + ;; +esac + +AC_SUBST(have_proc_invoked) + dnl ----------------------------- Finalize the variables =20 echo "${nl}Restore user-defined environment settings..." Index: misc/win32/apr_app.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- misc/win32/apr_app.c=09(revision 201966) +++ misc/win32/apr_app.c=09(working copy) @@ -34,8 +34,11 @@ */ =20 #include "apr_general.h" +#include "apr_private.h" #include "ShellAPI.h" -#include "crtdbg.h" +#ifdef _MSC_VER +#include +#endif #include "wchar.h" #include "apr_arch_file_io.h" #include "assert.h" Index: misc/win32/misc.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- misc/win32/misc.c=09(revision 201966) +++ misc/win32/misc.c=09(working copy) @@ -16,7 +16,9 @@ =20 #include "apr_private.h" #include "apr_arch_misc.h" -#include "crtdbg.h" +#ifdef _MSC_VER +#include +#endif #include "apr_arch_file_io.h" #include "assert.h" #include "apr_lib.h" Index: misc/win32/internal.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- misc/win32/internal.c=09(revision 201966) +++ misc/win32/internal.c=09(working copy) @@ -18,7 +18,9 @@ =20 #include "apr_arch_misc.h" #include "apr_arch_file_io.h" +#ifdef _MSC_VER #include +#endif #include =20 /* This module is the source of -static- helper functions that are @@ -52,8 +54,8 @@ ; } =20 - newarr =3D _malloc_dbg((args + 1) * sizeof(char *), - _CRT_BLOCK, __FILE__, __LINE__); + newarr =3D apr_malloc_dbg((args + 1) * sizeof(char *), + __FILE__, __LINE__); =20 for (arg =3D 0; arg < args; ++arg) { newarr[arg] =3D (void*)(wcslen(arr[arg]) + 1); @@ -66,8 +68,8 @@ * 4 ucs bytes will hold a wchar_t pair value (20 bits) */ elesize =3D elesize * 3 + 1; - ele =3D elements =3D _malloc_dbg(elesize * sizeof(char),=20 - _CRT_BLOCK, __FILE__, __LINE__); + ele =3D elements =3D apr_malloc_dbg(elesize * sizeof(char),=20 + __FILE__, __LINE__); =20 for (arg =3D 0; arg < args; ++arg) { apr_size_t len =3D (apr_size_t)newarr[arg]; @@ -87,8 +89,8 @@ =20 /* Return to the free store if the heap realloc is the least bit optim= ized */ - ele =3D _realloc_dbg(elements, ele - elements,=20 - _CRT_BLOCK, __FILE__, __LINE__); + ele =3D apr_realloc_dbg(elements, ele - elements,=20 + __FILE__, __LINE__); =20 if (ele !=3D elements) { apr_size_t diff =3D ele - elements; Index: misc/win32/start.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- misc/win32/start.c=09(revision 201966) +++ misc/win32/start.c=09(working copy) @@ -23,7 +23,9 @@ #include "apr_arch_misc.h" /* for WSAHighByte / WSALowByte */ #include "wchar.h" #include "apr_arch_file_io.h" -#include "crtdbg.h" +#ifdef _MSC_VER +#include +#endif #include "assert.h" =20 /* This symbol is _private_, although it must be exported. @@ -54,8 +56,8 @@ } wsize =3D 1 + wch - arrsz; =20 - newarr =3D _malloc_dbg((args + 1) * sizeof(char *), - _CRT_BLOCK, __FILE__, __LINE__); + newarr =3D apr_malloc_dbg((args + 1) * sizeof(char *), + __FILE__, __LINE__); =20 /* This is a safe max allocation, we will realloc after * processing and return the excess to the free store. @@ -63,8 +65,8 @@ * 4 ucs bytes will hold a wchar_t pair value (20 bits) */ newlen =3D totlen =3D wsize * 3 + 1; - newarr[0] =3D _malloc_dbg(newlen * sizeof(char),=20 - _CRT_BLOCK, __FILE__, __LINE__); + newarr[0] =3D apr_malloc_dbg(newlen * sizeof(char),=20 + __FILE__, __LINE__); =20 (void)apr_conv_ucs2_to_utf8(arrsz, &wsize, newarr[0], &newlen); @@ -72,8 +74,8 @@ assert(newlen && !wsize); /* Return to the free store if the heap realloc is the least bit optim= ized */ - newarr[0] =3D _realloc_dbg(newarr[0], totlen - newlen,=20 - _CRT_BLOCK, __FILE__, __LINE__); + newarr[0] =3D apr_realloc_dbg(newarr[0], totlen - newlen,=20 + __FILE__, __LINE__); =20 for (arg =3D 1; arg < args; ++arg) { newarr[arg] =3D newarr[arg - 1] + 2; @@ -128,8 +130,8 @@ dupenv =3D warrsztoastr(&_environ, sysstr, -1); =20 =09if (env) { - *env =3D _malloc_dbg((dupenv + 1) * sizeof (char *),=20 - _CRT_BLOCK, __FILE__, __LINE__ ); + *env =3D apr_malloc_dbg((dupenv + 1) * sizeof (char *),=20 + __FILE__, __LINE__ ); memcpy((void*)*env, _environ, (dupenv + 1) * sizeof (char *)); } else { Index: threadproc/win32/signals.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- threadproc/win32/signals.c=09(revision 201966) +++ threadproc/win32/signals.c=09(working copy) @@ -14,8 +14,8 @@ * limitations under the License. */ =20 -#include "win32/apr_arch_threadproc.h" -#include "win32/apr_arch_file_io.h" +#include "apr_arch_threadproc.h" +#include "apr_arch_file_io.h" #include "apr_thread_proc.h" #include "apr_file_io.h" #include "apr_general.h" Index: threadproc/win32/proc.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- threadproc/win32/proc.c=09(revision 201966) +++ threadproc/win32/proc.c=09(working copy) @@ -14,9 +14,13 @@ * limitations under the License. */ =20 -#include "win32/apr_arch_threadproc.h" -#include "win32/apr_arch_file_io.h" +#include "apr_arch_threadproc.h" +#include "apr_arch_file_io.h" =20 +#ifndef LOGON32_LOGON_NETWORK +#define LOGON32_LOGON_NETWORK 3 +#endif + #include "apr_thread_proc.h" #include "apr_file_io.h" #include "apr_general.h" Index: threadproc/win32/thread.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- threadproc/win32/thread.c=09(revision 201966) +++ threadproc/win32/thread.c=09(working copy) @@ -15,7 +15,7 @@ */ =20 #include "apr_private.h" -#include "win32/apr_arch_threadproc.h" +#include "apr_arch_threadproc.h" #include "apr_thread_proc.h" #include "apr_general.h" #include "apr_lib.h" Index: threadproc/win32/threadpriv.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- threadproc/win32/threadpriv.c=09(revision 201966) +++ threadproc/win32/threadpriv.c=09(working copy) @@ -14,7 +14,7 @@ * limitations under the License. */ =20 -#include "win32/apr_arch_threadproc.h" +#include "apr_arch_threadproc.h" #include "apr_thread_proc.h" #include "apr_general.h" #include "apr_lib.h" Index: build/gen-build.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- build/gen-build.py=09(revision 201966) +++ build/gen-build.py=09(working copy) @@ -29,6 +29,7 @@ ('beos', 'unix'), ('os2', 'unix'), ('os390', 'unix'), + ('win32', 'unix'), ] # note: MAKE_PLATFORMS is an ordered set. we want to generate unix symbols # first, so that the later platforms can reference them. @@ -66,8 +67,29 @@ group =3D [ '$(OBJECTS_all)' ] =20 for subdir in string.split(parser.get('options', 'platform_dirs')): + try: + inherit =3D string.split(parser.get(platform, 'inherit')) + except ConfigParser.NoSectionError: + inherit =3D None; + + inherited_files =3D [] + inherited_objects =3D [] + if inherit: + path =3D '%s/%s' % (subdir, parent) + if os.path.exists(path): + for file in inherit: + file =3D '%s/%s.c' % (path,file) + if os.path.isfile(file): + inherited_files.append(file) + if inherited_files: + inherited_objects, _unused =3D write_objects(f, legal_deps, h_deps, inherited_files) + inherited_symname =3D 'OBJECTS_%s_%s_inherit' % (subdir, platfor= m) + f.write('\n%s =3D %s\n\n' % (inherited_symname, string.join(inherited_objects))) + group.append('$(%s)' % inherited_symname) + path =3D '%s/%s' % (subdir, platform) - if not os.path.exists(path): + + if not inherited_files and not os.path.exists(path): # this subdir doesn't have a subdir for this platform, so we'll # use the parent-platform's set of symbols if parent: @@ -89,6 +111,9 @@ # and include that symbol in the group group.append('$(%s)' % symname) =20 + #group.append('file_io/unix/filepath_util.lo', + # 'misc/unix/errorcodes.lo'); + =20 # write out a symbol which contains the necessary files f.write('OBJECTS_%s =3D %s\n\n' % (platform, string.join(group))) =20 @@ -164,7 +189,8 @@ def get_files(patterns): files =3D [ ] for pat in string.split(patterns): - files.extend(glob.glob(pat)) + for file in glob.glob(pat): + files.extend([file.replace('\\','/')]) return files =20 =20 Index: file_io/win32/readwrite.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- file_io/win32/readwrite.c=09(revision 201966) +++ file_io/win32/readwrite.c=09(working copy) @@ -14,7 +14,7 @@ * limitations under the License. */ =20 -#include "win32/apr_arch_file_io.h" +#include "apr_arch_file_io.h" #include "apr_file_io.h" #include "apr_general.h" #include "apr_strings.h" Index: file_io/win32/seek.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- file_io/win32/seek.c=09(revision 201966) +++ file_io/win32/seek.c=09(working copy) @@ -14,7 +14,7 @@ * limitations under the License. */ =20 -#include "win32/apr_arch_file_io.h" +#include "apr_arch_file_io.h" #include "apr_file_io.h" #include #include Index: file_io/win32/filedup.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- file_io/win32/filedup.c=09(revision 201966) +++ file_io/win32/filedup.c=09(working copy) @@ -14,7 +14,7 @@ * limitations under the License. */ =20 -#include "win32/apr_arch_file_io.h" +#include "apr_arch_file_io.h" #include "apr_file_io.h" #include "apr_general.h" #include "apr_strings.h" Index: file_io/win32/pipe.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- file_io/win32/pipe.c=09(revision 201966) +++ file_io/win32/pipe.c=09(working copy) @@ -14,7 +14,7 @@ * limitations under the License. */ =20 -#include "win32/apr_arch_file_io.h" +#include "apr_arch_file_io.h" #include "apr_file_io.h" #include "apr_general.h" #include "apr_strings.h"