Index: /main/trunk/greenstone2/common-src/cgi-bin/win32.mak
===================================================================
--- /main/trunk/greenstone2/common-src/cgi-bin/win32.mak	(revision 24901)
+++ /main/trunk/greenstone2/common-src/cgi-bin/win32.mak	(revision 24902)
@@ -38,12 +38,22 @@
 DLLDEBUG = 0
 
+CGIDIR="$(GSDLHOME)\cgi-bin\windows"
+!IF "$(PROCESSOR_ARCHITECTURE)"==""	
+CGIDIR=$(GSDLHOME)\cgi-bin\windows
+!ELSE IF EXIST ("$(GSDLHOME)\bin\windows")
+CGIDIR=$(GSDLHOME)\cgi-bin\windows
+!ELSE IF "$(PROCESSOR_ARCHITECTURE)"=="x86"	
+CGIDIR=$(GSDLHOME)\cgi-bin\windows32
+!ELSE
+CGIDIR=$(GSDLHOME)\cgi-bin\windows64
+!ENDIF
 
-all:
-	if not exist "$(GSDLHOME)\cgi-bin\windows" mkdir "$(GSDLHOME)\cgi-bin\windows" 
-	for %%i in ("$(COMMON_DIR)\cgi-bin") do copy %%i "$(GSDLHOME)\cgi-bin\windows\."
-	for %%i in (Makefile.in Makefile win32.mak) do if exist "$(GSDLHOME)\cgi-bin\windows\%%i" del "$(GSDLHOME)\cgi-bin\windows\%%i"	
+all:	
+	if not exist "$(CGIDIR)" mkdir "$(CGIDIR)" 
+	for %%i in ("$(COMMON_DIR)\cgi-bin") do copy %%i "$(CGIDIR)\."
+	for %%i in (Makefile.in Makefile win32.mak) do if exist "$(CGIDIR)\%%i" del "$(CGIDIR)\%%i"	
 
 clean:
-	if exist "$(GSDLHOME)\cgi-bin\windows" rmdir /S "$(GSDLHOME)\cgi-bin\windows"
+	if exist "$(CGIDIR)" rmdir /S "$(CGIDIR)"
 
 install:
Index: /main/trunk/greenstone2/gsicontrol.bat
===================================================================
--- /main/trunk/greenstone2/gsicontrol.bat	(revision 24901)
+++ /main/trunk/greenstone2/gsicontrol.bat	(revision 24902)
@@ -86,7 +86,13 @@
 echo.
 
-::set cgibin=cgi-bin
-::set cgibin=cgi-bin\windows
-set cgibin=cgi-bin\%GSDLOS%
+:: If %PROCESSOR_ARCHITECTURE% is x86, default the architecture to 32 bits, else 64.
+:: (Can't test for x64, since the 64 bit Win 7 here returns "AMD64" instead of "x64".)
+:: Then, if the svn version already uses just %GSDLOS% not %GSDLOS%%GSDLARCH%, 
+:: set GSDLARCH to the empty string. Same if %PROCESSOR_ARCHITECTURE% is empty.
+if "%PROCESSOR_ARCHITECTURE%" == "x86" (set GSDLARCH=32) else (set GSDLARCH=64)
+if "%PROCESSOR_ARCHITECTURE%" == "" set GSDLARCH=
+if exist "bin\windows" set GSDLARCH=
+set cgibin=cgi-bin\%GSDLOS%%GSDLARCH%
+::set cgibin=cgi-bin ::set cgibin=cgi-bin\windows
 
 if "%target%" == "web-start" goto start
@@ -335,5 +341,5 @@
 if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" %GS2_APACHE_HTTPD_SIGNAL% SILENT
 echo Setting config file to use port %port%
-type "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf.in" | %_sed% "s@\*\*GSDLOS\*\*@%GSDLOS%@g" | %_sed% "s@\*\*PORT\*\*@%port%@g" | %_sed% "s@\*\*CONNECTPERMISSION\*\*@%allowfromall%@g" | %_sed% "s@\*\*HOST_IP\*\*@%hostIP%@g" | %_sed% "s@\*\*HOSTS\*\*@%hosts%@g" | %_sed% "s@\*\*COLLECTHOME\*\*@%safecollectpath%@g" | %_sed% "s@\*\*GSDLHOME\*\*@%safepath%@g" | %_sed% "s@\*\*APACHE_HOME_OS\*\*@%safepath%\/apache-httpd\/%GSDLOS%@g" > "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf"
+type "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf.in" | %_sed% "s@\*\*GSDL_OS_ARCH\*\*@%GSDLOS%%GSDLARCH%@g" | %_sed% "s@\*\*PORT\*\*@%port%@g" | %_sed% "s@\*\*CONNECTPERMISSION\*\*@%allowfromall%@g" | %_sed% "s@\*\*HOST_IP\*\*@%hostIP%@g" | %_sed% "s@\*\*HOSTS\*\*@%hosts%@g" | %_sed% "s@\*\*COLLECTHOME\*\*@%safecollectpath%@g" | %_sed% "s@\*\*GSDLHOME\*\*@%safepath%@g" | %_sed% "s@\*\*APACHE_HOME_OS\*\*@%safepath%\/apache-httpd\/%GSDLOS%@g" > "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf"
 echo Type '%0 web-start' to start the web server running on port %port%
 echo Done
Index: /main/trunk/greenstone2/runtime-src/packages/apache-httpd/windows-httpd.conf.in
===================================================================
--- /main/trunk/greenstone2/runtime-src/packages/apache-httpd/windows-httpd.conf.in	(revision 24901)
+++ /main/trunk/greenstone2/runtime-src/packages/apache-httpd/windows-httpd.conf.in	(revision 24902)
@@ -496,6 +496,6 @@
 
 
-  ScriptAlias /greenstone/cgi-bin "**GSDLHOME**/cgi-bin/**GSDLOS**"
-  <Directory "**GSDLHOME**/cgi-bin/**GSDLOS**">
+  ScriptAlias /greenstone/cgi-bin "**GSDLHOME**/cgi-bin/**GSDL_OS_ARCH**"
+  <Directory "**GSDLHOME**/cgi-bin/**GSDL_OS_ARCH**">
      Options None
      AllowOverride None
Index: /main/trunk/greenstone2/runtime-src/src/oaiservr/win32.mak
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/oaiservr/win32.mak	(revision 24901)
+++ /main/trunk/greenstone2/runtime-src/src/oaiservr/win32.mak	(revision 24902)
@@ -242,5 +242,13 @@
 !ELSE
 install: $(EXECUTABLE)
+!IF "$(PROCESSOR_ARCHITECTURE)"==""
 	copy $(EXECUTABLE) "$(GSDL_DIR)\cgi-bin\windows"
+!ELSE IF EXIST ("$(GSDL_DIR)\bin\windows")	
+	copy $(EXECUTABLE) "$(GSDL_DIR)\cgi-bin\windows"	
+!ELSE IF "$(PROCESSOR_ARCHITECTURE)"=="x86"	
+	copy $(EXECUTABLE) "$(GSDL_DIR)\cgi-bin\windows32"
+!ELSE
+	copy $(EXECUTABLE) "$(GSDL_DIR)\cgi-bin\windows64"
+!ENDIF
 !ENDIF
 
Index: /main/trunk/greenstone2/runtime-src/src/recpt/win32.mak
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/recpt/win32.mak	(revision 24901)
+++ /main/trunk/greenstone2/runtime-src/src/recpt/win32.mak	(revision 24902)
@@ -384,5 +384,13 @@
 !ELSE
 install: $(EXECUTABLE)
+!IF "$(PROCESSOR_ARCHITECTURE)"==""	
 	copy $(EXECUTABLE) "$(GSDL_DIR)\cgi-bin\windows"
+!ELSE IF EXIST ("$(GSDL_DIR)\bin\windows")
+	copy $(EXECUTABLE) "$(GSDL_DIR)\cgi-bin\windows"	
+!ELSE IF "$(PROCESSOR_ARCHITECTURE)"=="x86"	
+	copy $(EXECUTABLE) "$(GSDL_DIR)\cgi-bin\windows32"
+!ELSE
+	copy $(EXECUTABLE) "$(GSDL_DIR)\cgi-bin\windows64"
+!ENDIF
 !ENDIF
 
