- make it work with httpd 2.4
diff --git a/src/apachetests/apachetest.tcl b/src/apachetests/apachetest.tcl
index f2fcc0d..f9a9f7a 100644
--- a/src/apachetests/apachetest.tcl
+++ b/src/apachetests/apachetest.tcl
@@ -33,6 +33,23 @@
 	mod_authz_user           authz_user_module
 	mod_authz_groupfile authz_groupfile_module
     }
+
+    ## Apache 2.4 also requires mod_unixd
+    array set module_assoc_24 {
+	mod_authn_core           authn_core_module
+	mod_authz_core           authz_core_module
+	mod_access_compat        access_compat_module
+	mod_unixd                unixd_module
+	mod_log_config           {config_log_module log_config_module}
+	mod_mime                       mime_module
+	mod_negotiation         negotiation_module
+	mod_dir                         dir_module
+	mod_authz_host           authz_host_module
+	mod_auth_basic           auth_basic_module
+	mod_authn_file           authn_file_module
+	mod_authz_user           authz_user_module
+	mod_authz_groupfile authz_groupfile_module
+    }
     # name of the apache binary, such as /usr/sbin/httpd
     variable binname ""
     # this file should be in the same directory this script is.
@@ -111,7 +128,7 @@
     }
     after cancel $kill9
     puts "Apache stopped"
-    catch {file delete httpd.pid}
+    catch {file delete logs/httpd.pid}
 }
 
 # startserver - start the server with 'options'.
@@ -256,7 +273,9 @@
 proc apachetest::determinemodules { binname } {
     variable module_assoc
     variable module_assoc_22
+    variable module_assoc_24
     variable modules
+    variable version
 
     set ver ""
     catch {exec $binname -v} ver
@@ -266,8 +285,13 @@
 
     if {[regexp {Apache/1\.3\.} $ver] || [regexp {Apache/2\.0\.} $ver]} {
 	array set modules [array get module_assoc]
+	set version 20
+    } elseif {[regexp {Apache/2\.4\.} $ver]} {
+	array set modules [array get module_assoc_24]
+	set version 24
     } else {
 	array set modules [array get module_assoc_22]
+	set version 22
     }
     set compiledin [lsort [getcompiledin $binname]]
     set conffile [gethttpdconf $binname]
@@ -299,6 +323,7 @@
     global port
     variable binname
     variable templatefile
+    variable version
     set CWD [pwd]
 
     # create directory for log files and lock etc.
@@ -307,6 +332,13 @@
     # replace with determinemodules
     set LOADMODULES [determinemodules $binname]
 
+    if {$version < 24} {
+	set LockFile "LockFile \"$CWD/logs/accept.lock\"\n"
+    } else {
+	# Apache 2.4. does not have a LockFile configuration anymore
+	set LockFile ""
+    }
+
     set fl [open [file join . $templatefile] r]
     set template [read $fl]
     close $fl
diff --git a/src/apachetests/conf/server.conf.tcl b/src/apachetests/conf/server.conf.tcl
index 15a69d2..abc387c 100644
--- a/src/apachetests/conf/server.conf.tcl
+++ b/src/apachetests/conf/server.conf.tcl
@@ -6,8 +6,7 @@
 ServerRoot "$CWD"
 
 PidFile "$CWD/logs/httpd.pid"
-LockFile "$CWD/logs/accept.lock"
-
+$LockFile
 Timeout 300
 
 MaxRequestsPerChild 0
diff --git a/src/generic/logutl.c b/src/generic/logutl.c
index 1f55202..999772b 100644
--- a/src/generic/logutl.c
+++ b/src/generic/logutl.c
@@ -472,7 +472,7 @@
 		    break;
 		case 't':
 #ifdef TCL_THREADS
-		    sprintf(tmpStr, "%d", (int) Tcl_GetCurrentThread());
+		    sprintf(tmpStr, "%p", Tcl_GetCurrentThread());
 		    Tcl_AppendToObj(fmsg, tmpStr, -1);
 #else
 		    /* no thread id */
diff --git a/src/win/Makefile b/src/win/Makefile
index fc8da74..18e3d17 100644
--- a/src/win/Makefile
+++ b/src/win/Makefile
@@ -101,7 +101,7 @@
 
 # compiler, linker, and other binaries
 CC = cl
-CCLD = $(CC)
+CCLD = link
 INSTALL = xcopy /y
 
 
@@ -118,9 +118,9 @@
 
 EXEC_CFLAGS = /D"_CONSOLE"
 !IF "$(DEBUG)" == "1"
-SHLIB_CFLAGS = /LDd /MDd /Gy
+SHLIB_CFLAGS = /DLL
 !ELSE
-SHLIB_CFLAGS = /LD /MD /Gy
+SHLIB_CFLAGS = /DLL
 !ENDIF
 
 # TCL stuff
@@ -159,11 +159,11 @@
 
 !IF "$(DEBUG)" == "0"
 CFLAGS = $(CFLAGS_DEFAULT) $(CFLAGS_OPTIMIZE) $(EXTRA_CFLAGS) $(INCLUDES)
-LD_CFLAGS =  $(CFLAGS_DEFAULT) $(CFLAGS_OPTIMIZE)
+LD_CFLAGS = 
 DEFAULT_MSVCRT=msvcrt.lib
 !ELSE
 CFLAGS = $(CFLAGS_DEFAULT) $(CFLAGS_DEBUG) $(EXTRA_CFLAGS) $(INCLUDES)
-LD_CFLAGS = $(CFLAGS_DEFAULT)
+LD_CFLAGS = /DEBUG
 DEFAULT_MSVCRT=msvcrtd.lib
 !ENDIF
 
@@ -221,22 +221,22 @@
 mod_websh.so: mod_websh$(VERSION).so websh$(VERSION).dll
 
 websh$(VERSION).exe: tclAppInit.$(OBJEXT) websh$(VERSION).dll
-	$(CCLD) $(LD_CFLAGS) $(EXEC_CFLAGS) \
+	$(CCLD) $(LD_CFLAGS) \
 	tclAppInit.$(OBJEXT) websh$(VERSION).lib \
-	$(TCL_LIB_SPEC) $(TCL_STUB_LIB_SPEC) $(TCL_LIBS) -o websh$(VERSION).exe \
-	/link /nodefaultlib:$(DEFAULT_MSVCRT)
+	$(TCL_LIB_SPEC) $(TCL_STUB_LIB_SPEC) $(TCL_LIBS) \
+	/out:websh$(VERSION).exe \
+	/nodefaultlib:$(DEFAULT_MSVCRT)
 
 mod_websh$(VERSION).so: $(web_OBJECTS_ap) websh$(VERSION).dll
-	$(CCLD) $(LD_CFLAGS) $(SHLIB_CFLAGS) -o mod_websh$(VERSION).so \
+	$(CCLD) $(LD_CFLAGS) $(SHLIB_CFLAGS) /out:mod_websh$(VERSION).so \
 	$(web_OBJECTS_ap) websh$(VERSION).lib $(TCL_LIB_SPEC) \
 	$(TCL_STUB_LIB_SPEC) $(HTTPD_LIBS) $(TCL_LIBS) \
-	/link /dll /nodefaultlib:msvcrt.lib /subsystem:windows
+	/nodefaultlib:$(DEFAULT_MSVCRT) /subsystem:windows
 
 websh$(VERSION).dll: $(web_OBJECTS)
-        $(CCLD) $(LD_CFLAGS) $(SHLIB_CFLAGS) -o websh$(VERSION).dll \
+        $(CCLD) $(LD_CFLAGS) $(SHLIB_CFLAGS) /out:websh$(VERSION).dll \
 	$(web_OBJECTS) $(TCL_LIB_SPEC) $(TCL_STUB_LIB_SPEC) \
-	$(TCL_LIBS) /link /dll \
-	/nodefaultlib:$(DEFAULT_MSVCRT) /subsystem:windows
+	$(TCL_LIBS) /nodefaultlib:$(DEFAULT_MSVCRT) /subsystem:windows
 
 test: websh.exe
 	set TCL_LIBRARY="$(TCL_PREFIX)/lib"