apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Vandenberg <jay...@gmail.com>
Subject autotool based mingw port
Date Tue, 28 Jun 2005 03:21:07 GMT
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
===================================================================
--- time/win32/time.c	(revision 201966)
+++ time/win32/time.c	(working copy)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#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
===================================================================
--- time/win32/access.c	(revision 201966)
+++ time/win32/access.c	(working copy)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#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
===================================================================
--- time/win32/timestr.c	(revision 201966)
+++ time/win32/timestr.c	(working copy)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "win32/apr_arch_atime.h"
+#include "apr_arch_atime.h"
 #include "apr_portable.h"
 #include "apr_strings.h"
 
Index: locks/win32/thread_rwlock.c
===================================================================
--- locks/win32/thread_rwlock.c	(revision 201966)
+++ locks/win32/thread_rwlock.c	(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"
 
 static apr_status_t thread_rwlock_cleanup(void *data)
Index: locks/win32/thread_cond.c
===================================================================
--- locks/win32/thread_cond.c	(revision 201966)
+++ locks/win32/thread_cond.c	(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"
 
 static apr_status_t thread_cond_cleanup(void *data)
Index: atomic/win32/apr_atomic.c
===================================================================
--- atomic/win32/apr_atomic.c	(revision 201978)
+++ atomic/win32/apr_atomic.c	(working copy)
@@ -15,6 +15,7 @@
  */
 
 #include "apr.h"
+#include "apr_private.h"
 #include "apr_atomic.h"
 #include "apr_thread_mutex.h"
 
Index: test/Makefile.in
===================================================================
--- test/Makefile.in	(revision 201966)
+++ test/Makefile.in	(working copy)
@@ -36,7 +36,7 @@
 CLEAN_SUBDIRS = internal
 
 INCDIR=../include
-INCLUDES=-I$(INCDIR) -I$(srcdir)/../include
+INCLUDES=-I$(INCDIR) -I$(srcdir)/../include -I$(OSDIR)
 
 # 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
===================================================================
--- include/apr_user.h	(revision 201966)
+++ include/apr_user.h	(working copy)
@@ -23,6 +23,7 @@
  */
 
 #include "apr.h"
+#include "apr_private.h"
 #include "apr_errno.h"
 #include "apr_pools.h"
 
Index: include/apr.h.in
===================================================================
--- include/apr.h.in	(revision 201966)
+++ include/apr.h.in	(working copy)
@@ -109,6 +109,10 @@
  * or the extern "C" namespace 
  */
 
+#if HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+
 #if APR_HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #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
===================================================================
--- include/arch/win32/apr_arch_misc.h	(revision 201981)
+++ include/arch/win32/apr_arch_misc.h	(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 >= 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 */
 
 typedef enum {
@@ -152,15 +154,31 @@
 
 /* The apr_load_dll_func call WILL fault if the function cannot be loaded */
 
+#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 = NULL; \
+    extern __inline rettype apr_winapi_##fn args \
+    {   if (!apr_winapi_pfn_##fn) \
+            apr_winapi_pfn_##fn = (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 = NULL; \
     __inline rettype apr_winapi_##fn args \
     {   if (!apr_winapi_pfn_##fn) \
             apr_winapi_pfn_##fn = (apr_winapi_fpt_##fn) \
                                       apr_load_dll_func(lib, #fn, ord); \
         return (*(apr_winapi_pfn_##fn)) names; }; \
 
+#endif
+
 /* Provide late bound declarations of every API function missing from
  * one or more supported releases of the Win32 API
  *
@@ -323,5 +341,32 @@
 
 #endif /* !defined(_WIN32_WCE) */
 
+#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, linenumber);
+}
+
+#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 */
 
Index: include/arch/win32/apr_private.h
===================================================================
--- include/arch/win32/apr_private.h	(revision 201981)
+++ include/arch/win32/apr_private.h	(working copy)
@@ -42,7 +42,14 @@
 /* For the misc.h late-loaded dynamic symbols, we need some obscure types 
  * Avoid dragging in wtypes.h unless it's absolutely necessary [generally
  * not with APR itself, until some GUI-related security is introduced.]
- */
+*/
+
+// MinGW <accctrl.h> depends on <windows.h>
+// Im not sure this is the correct approach
+#if !defined(_MSC_VER)
+#include <windows.h>
+#endif
+
 #ifndef _WIN32_WCE
 #define HAVE_ACLAPI 1
 #ifdef __wtypes_h__
Index: include/arch/win32/apr_arch_atime.h
===================================================================
--- include/arch/win32/apr_arch_atime.h	(revision 201981)
+++ include/arch/win32/apr_arch_atime.h	(working copy)
@@ -36,7 +36,12 @@
 #define APR_DELTA_EPOCH_IN_USEC   APR_TIME_C(11644473600000000);
 
 
-__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 = input->dwHighDateTime;
@@ -48,7 +53,12 @@
 }
 
 
-__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 += APR_DELTA_EPOCH_IN_USEC;
Index: include/arch/win32/apr_arch_file_io.h
===================================================================
--- include/arch/win32/apr_arch_file_io.h	(revision 201981)
+++ include/arch/win32/apr_arch_file_io.h	(working copy)
@@ -52,8 +52,6 @@
 #include "arch/win32/apr_arch_utf8.h"
 #include <wchar.h>
 
-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 
  * access to all named identifiers.  [UTF-8 completely maps Unicode 
Index: include/apr_strings.h
===================================================================
--- include/apr_strings.h	(revision 201966)
+++ include/apr_strings.h	(working copy)
@@ -46,15 +46,28 @@
  */
 
 #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"
 
 #if APR_HAVE_STDARG_H
 #include <stdarg.h>
+#else
+#ifdef HAVE_STDDEF_H
+#include <stddef.h> /* NULL */
 #endif
+#endif
 
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h> /* strtol and strtoll */
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
Index: include/apr_want.h
===================================================================
--- include/apr_want.h	(revision 201966)
+++ include/apr_want.h	(working copy)
@@ -83,7 +83,16 @@
 
 #if APR_HAVE_SYS_UIO_H
 #include <sys/uio.h>
+#else
+#ifndef HAVE_STRUCT_IOVEC
+struct iovec 
+{
+    char *iov_base;
+    int  iov_len; 
+};
+#define HAVE_STRUCT_IOVEC
 #endif
+#endif
 
 #undef APR_WANT_IOVEC
 #endif
Index: build.conf
===================================================================
--- build.conf	(revision 201966)
+++ build.conf	(working copy)
@@ -24,3 +24,17 @@
 
 # we have a recursive makefile for the test files (for now)
 # test/*.c
+
+[win32]
+
+inherit =
+  filepath_util
+  errorcodes
+  getopt
+  inet_pton
+  inet_ntop
+  sockaddr
+  select
+  apr_pools # the empty memory/win32 directory makes this necessary
+
+
Index: configure.in
===================================================================
--- configure.in	(revision 201966)
+++ configure.in	(working copy)
@@ -364,6 +364,9 @@
 	APR_SETVAR(CC,mwcc)
 	APR_SETVAR(AR,ar)
 	;;
+    *-mingw*:gcc )
+       APR_ADDTO(LDFLAGS,[-Wl,--enable-auto-import,--subsystem,console])
+       ;;
 esac
 
 dnl Check the depend program we can use
@@ -421,6 +424,12 @@
        OSDIR="as400"
        eolstr="\\n"
        ;;
+   *mingw*)
+       OSDIR="win32"
+       enable_threads="system_threads"
+       eolstr="\\n"
+       OBJECTS_PLATFORM='$(OBJECTS_win32)'
+       ;;
    *cygwin*)
        OSDIR="unix"
        APR_ADDTO(CPPFLAGS,-DCYGWIN)
@@ -484,6 +493,10 @@
     exit(ret);
 }], [apr_cv_use_lfs64=yes], [apr_cv_use_lfs64=no], [apr_cv_use_lfs64=no])
    CPPFLAGS=$apr_save_CPPFLAGS])
+   case $host in
+     *mingw*) apr_cv_use_lfs64=yes
+              ;;
+   esac
    if test "$apr_cv_use_lfs64" = "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 value 
 dnl without the extra " " in that case, but they didn't do that.  So, we
 dnl end up LIBS="-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
 
 dnl ----------------------------- Checking for Threads
 echo "${nl}Checking for Threads..."
@@ -693,9 +713,29 @@
 #endif";;
 esac
 
-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 <windows.h>
+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=yes],
[ac_cv_func_CreateFileMapping=no], [ac_cv_func_CreateFileMapping=no])
+AC_MSG_RESULT($ac_cv_func_CreateFileMapping)
+  ;;
+esac
+
 APR_CHECK_DEFINE(MAP_ANON, sys/mman.h)
 APR_CHECK_FILE(/dev/zero)
 
@@ -755,6 +795,10 @@
              [havebeosshm="1"
               APR_DECIDE(USE_SHMEM_BEOS_ANON,
                          [BeOS areas])])
+APR_IFALLYES(header:windows.h func:CreateFileMapping,
+             [havewin32shm="1"
+              APR_DECIDE(USE_SHMEM_WIN32_ANON,
+                         [Windows CreateFileMapping()])])
 case $host in
     *linux* ) 
         # Linux has problems with MM_SHMT_MMANON even though it reports
@@ -801,6 +845,7 @@
 haveshmget="0"
 havebeosarea="0"
 haveos2shm="0"
+havewin32shm="0"
 APR_BEGIN_DECISION([namebased memory allocation method])
 APR_IFALLYES(header:sys/mman.h func:mmap func:munmap,
              [havemmaptmp="1"
@@ -821,6 +866,9 @@
 APR_IFALLYES(header:os2.h,
              [haveos2shm="1"
               APR_DECIDE(USE_SHMEM_OS2, [OS/2 DosAllocSharedMem()])])
+APR_IFALLYES(header:windows.h,
+             [havewin32shm="1"
+              APR_DECIDE(USE_SHMEM_WIN32, [Windows shared memory])])
 case $host in
     *linux* ) 
         # Linux has problems with MM_SHMT_MMANON even though it reports
@@ -841,6 +889,7 @@
 useshmget="0"
 usebeosarea="0"
 useos2shm="0"
+usewin32shm="0"
 
 case $ac_decision in
     USE_SHMEM_MMAP_TMP )
@@ -858,10 +907,13 @@
     USE_SHMEM_OS2 )
         useos2shm="1"
         ;;
+    USE_SHMEM_WIN32 )
+        usewin32shm="1"
+        ;;
 esac
 
 # Do we have any shared memory support?
-if test "$usemmaptmp$usemmapshm$usemmapzero$useshmget$usemmapanon$usebeosarea$useos2shm"
= "0000000"; then
+if test "$usemmaptmp$usemmapshm$usemmapzero$useshmget$usemmapanon$usebeosarea$useos2shm$usewin32shm"
= "00000000"; then
   sharedmem="0"
 else
   sharedmem="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)
 
 dnl ----------------------------- Checks for Any required Functions
@@ -1447,7 +1501,7 @@
     # Everything else:
     if test "$dsotype" = "any"; then
         case $host in
-        *os390|*-os2*|*os400|*-aix*) dsotype=other ;;
+        *os390|*-os2*|*os400|*-aix*|*mingw*) dsotype=other ;;
         esac
     fi
 fi
@@ -1660,6 +1714,11 @@
 if test "x$apr_lock_method" != "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)
 
@@ -1840,17 +1899,24 @@
 
 dnl ----------------------------- Checking for Networking Support 
 echo "${nl}Checking for Networking support..."
-AC_MSG_CHECKING(for in_addr in netinet/in.h)
-AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <netinet/in.h>
-],[
-struct in_addr arg;
-arg.s_addr = htonl(INADDR_ANY);
-], [ have_in_addr="1" 
-msg=yes ] , [ have_in_addr="0"
-msg=no ])
-AC_MSG_RESULT([$msg])
+case $host in
+    *mingw* )
+      have_in_addr="1"
+      ;;
+    * )
+      AC_MSG_CHECKING(for in_addr in netinet/in.h)
+      AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <netinet/in.h>
+      ],[
+ struct in_addr arg;
+ arg.s_addr = htonl(INADDR_ANY);
+], [ have_in_addr="1"
+      msg=yes ] , [ have_in_addr="0"
+      msg=no ])
+      AC_MSG_RESULT([$msg])
+      ;;
+esac
 
 AC_MSG_CHECKING([if fd == socket on this platform])
 if test "x$file_as_socket" != "x0" ; then
@@ -1990,6 +2056,24 @@
 AC_CHECK_HEADERS(langinfo.h)
 AC_CHECK_FUNCS(nl_langinfo)
 
+have_unicode_fs="0"
+case "$host" in
+    *mingw* )
+        have_unicode_fs="1"
+        ;;
+esac
+
+AC_SUBST(have_unicode_fs)
+
+have_proc_invoked="0"
+case "$host" in
+    *mingw* )
+        have_proc_invoked="1"
+        ;;
+esac
+
+AC_SUBST(have_proc_invoked)
+
 dnl ----------------------------- Finalize the variables
 
 echo "${nl}Restore user-defined environment settings..."
Index: misc/win32/apr_app.c
===================================================================
--- misc/win32/apr_app.c	(revision 201966)
+++ misc/win32/apr_app.c	(working copy)
@@ -34,8 +34,11 @@
  */
 
 #include "apr_general.h"
+#include "apr_private.h"
 #include "ShellAPI.h"
-#include "crtdbg.h"
+#ifdef _MSC_VER
+#include <crtdbg.h>
+#endif
 #include "wchar.h"
 #include "apr_arch_file_io.h"
 #include "assert.h"
Index: misc/win32/misc.c
===================================================================
--- misc/win32/misc.c	(revision 201966)
+++ misc/win32/misc.c	(working copy)
@@ -16,7 +16,9 @@
 
 #include "apr_private.h"
 #include "apr_arch_misc.h"
-#include "crtdbg.h"
+#ifdef _MSC_VER
+#include <crtdbg.h>
+#endif
 #include "apr_arch_file_io.h"
 #include "assert.h"
 #include "apr_lib.h"
Index: misc/win32/internal.c
===================================================================
--- misc/win32/internal.c	(revision 201966)
+++ misc/win32/internal.c	(working copy)
@@ -18,7 +18,9 @@
 
 #include "apr_arch_misc.h"
 #include "apr_arch_file_io.h"
+#ifdef _MSC_VER
 #include <crtdbg.h>
+#endif
 #include <assert.h>
 
 /* This module is the source of -static- helper functions that are
@@ -52,8 +54,8 @@
             ;
     }
 
-    newarr = _malloc_dbg((args + 1) * sizeof(char *),
-                         _CRT_BLOCK, __FILE__, __LINE__);
+    newarr = apr_malloc_dbg((args + 1) * sizeof(char *),
+                         __FILE__, __LINE__);
 
     for (arg = 0; arg < args; ++arg) {
         newarr[arg] = (void*)(wcslen(arr[arg]) + 1);
@@ -66,8 +68,8 @@
      * 4 ucs bytes will hold a wchar_t pair value (20 bits)
      */
     elesize = elesize * 3 + 1;
-    ele = elements = _malloc_dbg(elesize * sizeof(char), 
-                                 _CRT_BLOCK, __FILE__, __LINE__);
+    ele = elements = apr_malloc_dbg(elesize * sizeof(char), 
+                                 __FILE__, __LINE__);
 
     for (arg = 0; arg < args; ++arg) {
         apr_size_t len = (apr_size_t)newarr[arg];
@@ -87,8 +89,8 @@
 
     /* Return to the free store if the heap realloc is the least bit optimized
      */
-    ele = _realloc_dbg(elements, ele - elements, 
-                       _CRT_BLOCK, __FILE__, __LINE__);
+    ele = apr_realloc_dbg(elements, ele - elements, 
+                       __FILE__, __LINE__);
 
     if (ele != elements) {
         apr_size_t diff = ele - elements;
Index: misc/win32/start.c
===================================================================
--- misc/win32/start.c	(revision 201966)
+++ misc/win32/start.c	(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 <crtdbg.h>
+#endif
 #include "assert.h"
 
 /* This symbol is _private_, although it must be exported.
@@ -54,8 +56,8 @@
     }
     wsize = 1 + wch - arrsz;
 
-    newarr = _malloc_dbg((args + 1) * sizeof(char *),
-                         _CRT_BLOCK, __FILE__, __LINE__);
+    newarr = apr_malloc_dbg((args + 1) * sizeof(char *),
+                         __FILE__, __LINE__);
 
     /* 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 = totlen = wsize * 3 + 1;
-    newarr[0] = _malloc_dbg(newlen * sizeof(char), 
-                            _CRT_BLOCK, __FILE__, __LINE__);
+    newarr[0] = apr_malloc_dbg(newlen * sizeof(char), 
+                            __FILE__, __LINE__);
 
     (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 optimized
      */
-    newarr[0] = _realloc_dbg(newarr[0], totlen - newlen, 
-                             _CRT_BLOCK, __FILE__, __LINE__);
+    newarr[0] = apr_realloc_dbg(newarr[0], totlen - newlen, 
+                             __FILE__, __LINE__);
 
     for (arg = 1; arg < args; ++arg) {
         newarr[arg] = newarr[arg - 1] + 2;
@@ -128,8 +130,8 @@
         dupenv = warrsztoastr(&_environ, sysstr, -1);
 
 	if (env) {
-            *env = _malloc_dbg((dupenv + 1) * sizeof (char *), 
-                               _CRT_BLOCK, __FILE__, __LINE__ );
+            *env = apr_malloc_dbg((dupenv + 1) * sizeof (char *), 
+                               __FILE__, __LINE__ );
             memcpy((void*)*env, _environ, (dupenv + 1) * sizeof (char *));
         }
         else {
Index: threadproc/win32/signals.c
===================================================================
--- threadproc/win32/signals.c	(revision 201966)
+++ threadproc/win32/signals.c	(working copy)
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#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
===================================================================
--- threadproc/win32/proc.c	(revision 201966)
+++ threadproc/win32/proc.c	(working copy)
@@ -14,9 +14,13 @@
  * limitations under the License.
  */
 
-#include "win32/apr_arch_threadproc.h"
-#include "win32/apr_arch_file_io.h"
+#include "apr_arch_threadproc.h"
+#include "apr_arch_file_io.h"
 
+#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
===================================================================
--- threadproc/win32/thread.c	(revision 201966)
+++ threadproc/win32/thread.c	(working copy)
@@ -15,7 +15,7 @@
  */
 
 #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
===================================================================
--- threadproc/win32/threadpriv.c	(revision 201966)
+++ threadproc/win32/threadpriv.c	(working copy)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#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
===================================================================
--- build/gen-build.py	(revision 201966)
+++ build/gen-build.py	(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 = [ '$(OBJECTS_all)' ]
 
     for subdir in string.split(parser.get('options', 'platform_dirs')):
+      try:
+        inherit = string.split(parser.get(platform, 'inherit'))
+      except ConfigParser.NoSectionError:
+        inherit = None;
+
+      inherited_files = []
+      inherited_objects = []
+      if inherit:
+        path = '%s/%s' % (subdir, parent)
+        if os.path.exists(path):
+          for file in inherit:
+            file = '%s/%s.c' % (path,file)
+            if os.path.isfile(file):
+              inherited_files.append(file)
+        if inherited_files:
+          inherited_objects, _unused = write_objects(f, legal_deps,
h_deps, inherited_files)
+          inherited_symname = 'OBJECTS_%s_%s_inherit' % (subdir, platform)
+          f.write('\n%s = %s\n\n' % (inherited_symname,
string.join(inherited_objects)))
+          group.append('$(%s)' % inherited_symname)
+
       path = '%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)
 
+    #group.append('file_io/unix/filepath_util.lo',
+    #             'misc/unix/errorcodes.lo');
+    
     # write out a symbol which contains the necessary files
     f.write('OBJECTS_%s = %s\n\n' % (platform, string.join(group)))
 
@@ -164,7 +189,8 @@
 def get_files(patterns):
   files = [ ]
   for pat in string.split(patterns):
-    files.extend(glob.glob(pat))
+    for file in glob.glob(pat):
+      files.extend([file.replace('\\','/')])
   return files
 
 
Index: file_io/win32/readwrite.c
===================================================================
--- file_io/win32/readwrite.c	(revision 201966)
+++ file_io/win32/readwrite.c	(working copy)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#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
===================================================================
--- file_io/win32/seek.c	(revision 201966)
+++ file_io/win32/seek.c	(working copy)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "win32/apr_arch_file_io.h"
+#include "apr_arch_file_io.h"
 #include "apr_file_io.h"
 #include <errno.h>
 #include <string.h>
Index: file_io/win32/filedup.c
===================================================================
--- file_io/win32/filedup.c	(revision 201966)
+++ file_io/win32/filedup.c	(working copy)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#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
===================================================================
--- file_io/win32/pipe.c	(revision 201966)
+++ file_io/win32/pipe.c	(working copy)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#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"

Mime
View raw message