apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Mark Vandenberg <jay...@gmail.com>
Subject [patch 05/17] win32api support
Date Sat, 15 Apr 2006 01:41:23 GMT
The include paths are automaticly set up to be:
   -I./include
   -I/path/to/apr/include/arch/win32
   -I./include/arch/unix
   -I/path/to/apr/include 

This patch sets up the MINGW header arrangement as follows:

include/apr.h.in -> apr.h includes
  windows.h
  winsock2.h

include/arch/win32/apr_private.h
  as per MS VC++ builds

include/arch/unix/apr_private.h.in include/arch/unix/apr_private.h
  not used.  In order to achieve this, AH_TOP & AH_BOTTOM add a
  condition around this generated file to prevent it from being
  included.

This set up requires careful ordering of includes.  Includes from
a unix header will result in the unix copy being included even if
a win32 copy exists. 

for example, apr_private.h will exist in include/arch/win32/ and 
include/arch/unix/, requiring that apr_private.h is included very
early to prevent a unix header including it.

locks/unix/global_mutex.c illistrates why this probably needs to be
improved before check.  Without the changes in this patch:
  global_mutex.c
    ...
    include/arch/unix/apr_arch_global_mutex.h
      ...
      include/arch/unix/apr_arch_thread_mutex.h <- wrong

Index: configure.in
===================================================================
--- configure.in.orig
+++ configure.in
@@ -21,6 +21,15 @@ sinclude(build/apr_hints.m4)
 sinclude(build/libtool.m4)
 sinclude(build/ltsugar.m4)
 
+dnl For win32, we need to be sure that arch/win32/apr_private.h is
+dnl included first, and the unix one cant be included
+AH_TOP([
+
+#ifndef APR_PRIVATE_H
+#define APR_PRIVATE_H
+
+])
+
 dnl Hard-coded inclusion at the tail end of apr_private.h:
 AH_BOTTOM([
 /* switch this on if we have a BeOS version below BONE */
@@ -34,6 +43,8 @@ AH_BOTTOM([
  * Include common private declarations.
  */
 #include "../apr_private_common.h"
+
+#endif /* APR_PRIVATE_H */
 ])
 
 dnl Save user-defined environment settings for later restoration
@@ -1058,6 +1069,8 @@ APR_FLAG_HEADERS(
     unix.h		\
     arpa/inet.h		\
     kernel/OS.h		\
+    windows.h		\
+    winsock2.h		\
     net/errno.h		\
     netinet/in.h	\
     netinet/sctp.h      \
@@ -1134,6 +1147,8 @@ AC_SUBST(signalh)
 AC_SUBST(sys_waith)
 AC_SUBST(pthreadh)
 AC_SUBST(semaphoreh)
+AC_SUBST(windowsh)
+AC_SUBST(winsock2h)
 
 # Checking for h_errno in <netdb.h>
 if test "$netdbh" = "1"; then
Index: include/apr.h.in
===================================================================
--- include/apr.h.in.orig
+++ include/apr.h.in
@@ -102,6 +102,8 @@
 #define APR_HAVE_SYS_WAIT_H      @sys_waith@
 #define APR_HAVE_TIME_H          @timeh@
 #define APR_HAVE_UNISTD_H        @unistdh@
+#define APR_HAVE_WINDOWS_H       @windowsh@
+#define APR_HAVE_WINSOCK2_H      @winsock2h@
 
 /** @} */
 
@@ -109,6 +111,14 @@
  * or the extern "C" namespace 
  */
 
+#if defined(APR_HAVE_WINDOWS_H)
+#include <windows.h>
+#endif
+
+#if defined(APR_HAVE_WINSOCK2_H)
+#include <winsock2.h>
+#endif
+
 #if APR_HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
Index: atomic/win32/apr_atomic.c
===================================================================
--- atomic/win32/apr_atomic.c.orig
+++ atomic/win32/apr_atomic.c
@@ -15,6 +15,7 @@
  */
 
 #include "apr.h"
+#include "apr_private.h"
 #include "apr_atomic.h"
 #include "apr_thread_mutex.h"
 
Index: misc/win32/apr_app.c
===================================================================
--- misc/win32/apr_app.c.orig
+++ misc/win32/apr_app.c
@@ -34,12 +34,12 @@
  */
 
 #include "apr_general.h"
+#include "apr_private.h"
 #include "ShellAPI.h"
 #include "crtdbg.h"
 #include "wchar.h"
 #include "apr_arch_file_io.h"
 #include "assert.h"
-#include "apr_private.h"
 #include "apr_arch_misc.h"
 
 /* This symbol is _private_, although it must be exported.
Index: locks/unix/global_mutex.c
===================================================================
--- locks/unix/global_mutex.c.orig
+++ locks/unix/global_mutex.c
@@ -16,6 +16,10 @@
 
 #include "apr.h"
 #include "apr_strings.h"
+// horrible hack to force win32 header inclusion
+#include "apr_private.h"
+#include "apr_arch_thread_mutex.h"
+
 #include "apr_arch_global_mutex.h"
 #include "apr_proc_mutex.h"
 #include "apr_thread_mutex.h"

--

Mime
View raw message