-- Updated makefile to include changes suggested by Holger Zeinert for
	building under GCC 3.x, as well as against a binary-only build of Apache

-- Updated makefile to include beginnings of threaded Tcl support

-- Updated README.mingw32 to reflect new makefile target

-- Updated os.h.diff against 1.3.27 so it now applies cleanly

diff --git a/win32/README.mingw32 b/win32/README.mingw32
index db3bac4..0e59e53 100644
--- a/win32/README.mingw32
+++ b/win32/README.mingw32
@@ -8,15 +8,19 @@
 
 2)	Edit the win32\makefile in the mod_dtcl source tree to reflect your 
 environment, i.e. where is Tcl installed, where is Apache installed, where
-are your Apache sources and object files, etc.
+are your Apache sources and object files, etc.  The latest version of
+the makefile has a 'bin_style' target that will allow the use of a binary
+only install of Apache - see below and the makefile notes for more info.
 
 	You may also specify values for these variables from the command line,
 like this :
 
-	make TEMP_LIBS=C:\\TEMP\\OBJ 
+	make TEMP_LIBS=C:/TEMP/OBJ 
 
-	NOTE: Be sure to use the double slashes and quote spaces!  
-	See the makefile for the complete list of variable options.
+	NOTE:  See the makefile for the complete list of variable options.
+	The latest version of the makefile has a 'bin_style' target that will 
+	allow the use of a binary-only install of Apache - see below and the 
+    makefile notes for more info.
 
 3)  Apply the diffs for Apache.  The diff for Apache wraps a few declarations 
 and one #include directive in the os.h file that aren't needed or used with the MingW32 compiler.  
@@ -30,10 +34,17 @@
 4)  Run make.  There will be some warnings about a redefinition - you can 
 ignore it. You should be left with a file called mod_dtcl.so.  
 
-	NOTE: If you are using Apache 1.3.14 or older that uses .dll files 
+	NOTES: 
+
+	If you are using Apache 1.3.14 or older that uses .dll files 
 	for modules, you can run 'make dll_style' to get a dll file.  Or 
 	you can simply rename the .so file :) 
 
+	If you are using a recent binary install of Apache, you can run
+	'make bin_style' to produce a 'mod_dtcl.so' without needing the
+	Apache sources!  See the makefile for details.
+
+
 5)  Run make install.  Make the changes to your Apache configuration as 
 described on the mod_dtcl documentation, and you are off.
 
@@ -42,6 +53,7 @@
 	-- These instructions assume you have the MingW32 gcc setup as well
  	   as a good collection of GNU tools on your NT machine (sed, grep, etc).
 	   They also assume you have Tcl setup.
+	-- The makefile now supports GCC 2.X or GCC 3.x (new default).  
   	-- You will need a fairly recent version of the MingW32 toolset and 
 	   the associated win32api fileset - see http://www.mingw.org for 
 	   details on obtaining new releases.
diff --git a/win32/makefile b/win32/makefile
index 7c00c67..90e8ed4 100644
--- a/win32/makefile
+++ b/win32/makefile
@@ -9,11 +9,29 @@
 # Most of these variables can be set from the shell or command line
 # 
 
+# 
+# Command line options differ for different versions of gcc
+#
+# GCC 2.x
+# NATIVESTRUCT ?= -fnative-struct
+#
+# GCC 3.x
+NATIVESTRUCT ?= -mms-bitfields
+
+#
+# Experemental threaded flag - set this and mod_dtcl will link against a 
+# threaded version of Tcl
+#
+# THREADED =t
+#
+# XXX - not ready yet :)
+THREADED ?=
+
 #
 # I use this as a pointer to a good temporary location. 
 # The default works for most people
 #
-TEMP_LIBS ?= C:\\TEMP
+TEMP_LIBS ?= C:/TEMP
 
 #
 # Set this to your TCL version
@@ -24,25 +42,31 @@
 # 
 # Set TCL_HOME to where you have installed Tcl
 #
-TCL_HOME ?= C:\\"Program Files\\Tcl"
+TCL_HOME ?= C:/"Program Files/Tcl8.4"
 
 #
 # Set this to where you have installed Apache - used for the install step.
 #
-APACHE_HOME ?= C:\\"Program Files\\Apache Group\\Apache"
+APACHE_HOME ?= C:/"Program Files/Apache Group/Apache"
 
 #
 # Set APACHE_SRC to where your APACHE sources live.
 # NOTE: You must apply the diff to the os.h file as described in the
 # readme, and this directory must contain built sources, e.g. object files
+# If you use a binary install of Apache just set this to the same location
+# as APACHE_HOME like this:
+#APACHE_SRC ?= $(APACHE_HOME)
 #
-APACHE_SRC ?= ..\\..\\apache
+APACHE_SRC ?= ../../apache
 
 #
-# Set APACHE_INC to where the APACHE source include files live. This default
-# should be OK.
+# Set APACHE_INC to where the Apache source include files live. This default
+# should be OK if you built Apache from source.  If you used a binary install
+# of Apache, you probably want something like this assuming you set APACHE_SRC
+# as suggested above:
+#APACHE_INC ?= -I $(APACHE_SRC)/include
 #
-APACHE_INC ?= -I $(APACHE_SRC)\\src\\include -I $(APACHE_SRC)\\src\\os\\win32
+APACHE_INC ?= -I $(APACHE_SRC)/src/include -I $(APACHE_SRC)/src/os/win32
 
 
 #
@@ -51,19 +75,21 @@
 # during a build, so a temporary location is OK
 #
 APACHE_LIB ?= $(TEMP_LIBS) 
-APACHE_DEF ?= $(TEMP_LIBS)\\ApacheCore.def
+APACHE_DEF ?= $(TEMP_LIBS)/ApacheCore.def
 
 #
 # You shouldn't have to change anything below this
 #
-ROOT_DIR = ..\\
-TCL_INC = $(TCL_HOME)\\include
-TCL_LIB = $(TCL_HOME)\\lib
+ROOT_DIR = ../
+TCL_INC = -I $(TCL_HOME)/include
+TCL_LIB = $(TCL_HOME)/lib
 
-CC = gcc -O3 -fnative-struct -shared -mwindows -DSHARED_MODULE -DDTCL_VERSION="\"`cat $(ROOT_DIR)\\VERSION`\""
+CFLAGS = -O3 $(NATIVESTRUCT) -shared -mwindows -DSHARED_MODULE -DDTCL_VERSION="\"`cat $(ROOT_DIR)/VERSION`\""
 
-INCLUDES = -I$(TCL_INC) $(APACHE_INC)
-LIBS = $(TCL_LIB)\\tcl$(TCL_VERSION).lib -L$(APACHE_LIB) -lapachecore 
+CC = gcc $(CFLAGS)
+
+INCLUDES = $(TCL_INC) $(APACHE_INC)
+LIBS = $(TCL_LIB)/tcl$(TCL_VERSION)$(THREADED).lib -L$(APACHE_LIB) -lapachecore 
 
 APREQ_OBJECTS = apache_cookie.o apache_multipart_buffer.o apache_request.o
 OBJECTS = tcl_commands.o parser.o channel.o $(APREQ_OBJECTS)
@@ -83,13 +109,22 @@
 #
 # By default we build a .so file (Apache > 1.3.14)
 #
+# "make so_style" gives you a mod_dtcl.so file
+# "make dll_style" gives you a ApacheModuleDtcl.dll
+# "make bin_style" gives you a mod_dtcl.so and assumes you used a binary install
+# of Apache
+
 all : so_style 
 
-dll_style:	APACHE_EXP=$(APACHE_SRC)\\CoreR\\ApacheCore.exp 
+bin_style:  APACHE_EXP=$(APACHE_HOME)/libexec/ApacheCore.exp
+bin_style:	DLL_BUILD=$(DLL_SO)	
+bin_style:	apache_libs $(DLL_SO)
+
+dll_style:	APACHE_EXP=$(APACHE_SRC)/CoreR/ApacheCore.exp 
 dll_style:	DLL_BUILD=$(DLL_DYNAMIC)
 dll_style:	apache_libs $(DLL_DYNAMIC)
 
-so_style:	APACHE_EXP=$(APACHE_SRC)\\src\\Release\\ApacheCore.exp
+so_style:	APACHE_EXP=$(APACHE_SRC)/src/Release/ApacheCore.exp
 so_style:	DLL_BUILD=$(DLL_SO)	
 so_style:	apache_libs $(DLL_SO)
 
@@ -125,7 +160,7 @@
 
 install: $(DLL_BUILD) $(DLL_EXP_LIB)
 	echo Installing mod_dtcl...
-	-cp $(DLL_BUILD) $(APACHE_HOME)\\modules
+	-cp $(DLL_BUILD) $(APACHE_HOME)/modules
 
 apache_libs:
 	-@mkdir $(TEMP_LIBS)
@@ -133,6 +168,6 @@
 	echo EXPORTS > $(APACHE_DEF)
 	nm $(APACHE_EXP) |grep " U _" | sed "s/.* U _//" >> $(APACHE_DEF)
 	dlltool --def $(APACHE_DEF) --dllname ApacheCore.dll \
-		--output-lib $(TEMP_LIBS)\libapachecore.a -k
+		--output-lib $(TEMP_LIBS)/libapachecore.a -k
 	
 
diff --git a/win32/os.h.diff b/win32/os.h.diff
index eea16fe..433f32b 100644
--- a/win32/os.h.diff
+++ b/win32/os.h.diff
@@ -1,39 +1,34 @@
-*** Vendors/Apache/Apache/src/os/win32/os.h	2001/02/02 08:36:15	1.1
---- Vendors/Apache/Apache/src/os/win32/os.h	2001/02/28 10:08:50	1.4
+*** os.h.orig	Mon Jun 17 21:08:26 2002
+--- os.h	Fri Jan 31 15:27:53 2003
 ***************
-*** 109,119 ****
---- 109,121 ----
+*** 120,126 ****
+--- 120,128 ----
   #define HAVE_UNC_PATHS
   typedef int uid_t;
   typedef int gid_t;
 + #ifndef __MINGW32__
   typedef int pid_t;
++ #endif /* !__MINGW32__ */
+  typedef int tid_t;
   #ifdef _MSC_VER
   /* modified to match declaration in sys/stat.h */
-  typedef unsigned short mode_t;
-  #endif
-+ #endif /* !__MINGW32__ */
-  typedef char * caddr_t;
-  
-  /*
 ***************
-*** 163,168 ****
---- 165,171 ----
+*** 181,186 ****
+--- 183,189 ----
   #define NO_OTHER_CHILD
   #define NO_RELIABLE_PIPED_LOGS
   
-+ #ifndef _AP_OS_IS_PATH_ABS_
++ #ifndef _AP_OS_IS_PATH_ABS_ 
   __inline int ap_os_is_path_absolute(const char *file)
   {
     /* For now, just do the same check that http_request.c and mod_alias.c
 ***************
-*** 170,175 ****
---- 173,179 ----
+*** 188,193 ****
+--- 191,197 ----
      */
     return file && (file[0] == '/' || (file[1] == ':' && file[2] == '/'));
   }
-+ #endif
++ #endif /* !_AP_OS_IS_PATH_ABS_ */
   
   #define stat(f,ps)  os_stat(f,ps)
   API_EXPORT(int) os_stat(const char *szPath,struct stat *pStat);
-