Index: /main/trunk/greenstone2/runtime-src/src/oaiservr/Makefile.in
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/oaiservr/Makefile.in	(revision 22077)
+++ /main/trunk/greenstone2/runtime-src/src/oaiservr/Makefile.in	(revision 22078)
@@ -65,6 +65,8 @@
 ifeq ($(USE_GDBM), 1)
 GDBM_DEFINES = -DUSE_GDBM
+GDBM_LIBS = $(COMMON_PACKAGES_DIR)/gdbm/lib/libgdbm.a
 else
 GDBM_DEFINES = 
+GDBM_LIBS =
 endif
 
@@ -93,5 +95,5 @@
 INCLUDES = -I$(COMMON_DIR)/src/lib -I$(COLSERVR_DIR) -I$(PROTOCOL_DIR) -I$(RECPT_DIR) $(MGPP_INCLUDES)
 LDFLAGS = @LDFLAGS@ @COMPAT32BITFLAGS@
-LIBS = @LIBS@ $(COMMON_PACKAGES_DIR)/gdbm/lib/libgdbm.a -L$(COMMON_PACKAGES_DIR)/expat/lib -lexpat \
+LIBS = @LIBS@ $(GDBM_LIBS) -L$(COMMON_PACKAGES_DIR)/expat/lib -lexpat \
 	$(ACCENTFOLD_LIBS) $(SQLITE_LIBS)
 INSTALL = @INSTALL@
Index: /main/trunk/greenstone2/runtime-src/src/oaiservr/win32.mak
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/oaiservr/win32.mak	(revision 22077)
+++ /main/trunk/greenstone2/runtime-src/src/oaiservr/win32.mak	(revision 22078)
@@ -43,5 +43,8 @@
 DLLDEBUG = 0
 ENABLE_ACCENTFOLD = 1
+USE_GDBM = 1
+USE_JDBM = 1
 USE_SQLITE = 1
+USE_MSSQL = 0
 ENABLE_MG = 1
 ENABLE_MGPP = 1
@@ -74,8 +77,33 @@
 !ENDIF
 
+!IF $(USE_GDBM)
+GDBM_INCLUDES = -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3" \
+	-I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\windows"
+GDBM_LIBS = "$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\gdbm.lib"
+GDBM_DEFINES = -DUSE_GDBM
+!ELSE
+GDBM_INCLUDES = 
+GDBM_LIBS = 
+GDBM_DEFINES =
+!ENDIF
+
+!IF $(USE_JDBM)
+JDBM_DEFINES = -DUSE_JDBM
+!ELSE
+JDBM_DEFINES =
+!ENDIF
+
 !IF $(USE_SQLITE)
 SQLITE_LIBS = "$(COMMON_PACKAGES_DIR)\sqlite\lib\sqlite3.lib"
+SQLITE_DEFINES = -DUSE_SQLITE
 !ELSE
 SQLITE_LIBS = 
+SQLITE_DEFINES =
+!ENDIF
+
+!IF $(USE_MSSQL)
+MSSQL_DEFINES = -DUSE_MSSQL
+!ELSE
+MSSQL_DEFINES =
 !ENDIF
 
@@ -110,12 +138,13 @@
 CC = cl
 DEFS = -D__WIN32__ -DHAVE_CONFIG_H -DPARADOCNUM -D_LITTLE_ENDIAN -DSHORT_SUFFIX -D_CRT_SECURE_NO_DEPRECATE \
-        -DGSDL_NOCACHE $(MG_DEFS) $(MGPP_DEFS) $(LUCENE_DEFS)
+        -DGSDL_NOCACHE $(GDBM_DEFINES) $(JDBM_DEFINES) $(SQLITE_DEFINES) $(MSSQL_DEFINES) \
+	$(MG_DEFS) $(MGPP_DEFS) $(LUCENE_DEFS)
 INCLUDES = -I"$(COMMON_DIR)\src\lib" -I"$(COLSERVR_DIR)" -I"$(PROTOCOL_DIR)" -I"$(RECPT_DIR)" \
         $(MGPP_INCLUDES) -I"$(COMMON_PACKAGES_DIR)\windows\crypt\crypt" \
-	-I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3" -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\windows" \
+	$(GDBM_INCLUDES) \
 	-I"$(COMMON_PACKAGES_DIR)\windows\expat\expat"
 LDFLAGS = 
 LIBS = "$(COMMON_PACKAGES_DIR)\windows\crypt\crypt\crypt.lib" "$(COMMON_PACKAGES_DIR)\windows\expat\expat\libexpat.lib" \
-        "$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\gdbm.lib" $(ACCENTFOLD_LIBS) $(SQLITE_LIBS)
+        $(GDBM_LIBS) $(ACCENTFOLD_LIBS) $(SQLITE_LIBS)
 
 !IF $(GSDL_VC4)
Index: /main/trunk/greenstone2/runtime-src/src/protocol/Makefile.in
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/protocol/Makefile.in	(revision 22077)
+++ /main/trunk/greenstone2/runtime-src/src/protocol/Makefile.in	(revision 22078)
@@ -43,6 +43,8 @@
 ifeq ($(USE_GDBM), 1)
 GDBM_DEFINES = -DUSE_GDBM
+GDBM_INCLUDES = -I$(COMMON_PACKAGES_DIR)/gdbm/include
 else
 GDBM_DEFINES = 
+GDBM_INCLUDES =
 endif
 
@@ -67,5 +69,5 @@
 DEFS = @DEFS@ -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DGSDLSERVER $(GDBM_DEFINES) $(JDBM_DEFINES) $(SQLITE_DEFINES)
 # Do NOT add the "recpt" directory here: the protocol should be independent of the receptionist!
-INCLUDES = -I. -I$(GSDL_DIR) -I$(COMMON_DIR)/src/lib -I$(COMMON_PACKAGES_DIR)/gdbm/include \
+INCLUDES = -I. -I$(GSDL_DIR) -I$(COMMON_DIR)/src/lib $(GDBM_INCLUDES) \
 	-I$(COLSERVR_DIR) $(MGPP_INCLUDES)
 RANLIB = @RANLIB@
Index: /main/trunk/greenstone2/runtime-src/src/protocol/win32.mak
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/protocol/win32.mak	(revision 22077)
+++ /main/trunk/greenstone2/runtime-src/src/protocol/win32.mak	(revision 22078)
@@ -38,4 +38,8 @@
 DLL = 0
 DLLDEBUG = 0
+USE_GDBM = 1
+USE_JDBM = 1
+USE_SQLITE = 1
+USE_MSSQL = 0
 ENABLE_MG = 1
 ENABLE_MGPP = 1
@@ -60,4 +64,30 @@
 CXXFLAGS = $(CXXFLAGS) -MDd
 !ENDIF
+!ENDIF
+
+!IF $(USE_GDBM)
+GDBM_DEFINES = -DUSE_GDBM
+GDBM_INCLUDES = -I"$(COMMON_PACKAGES_DIR)\windows\gdbm\gdbm
+!ELSE
+GDBM_DEFINES = 
+GDBM_INCLUDES = 
+!ENDIF
+
+!IF $(USE_JDBM)
+JDBM_DEFINES = -DUSE_JDBM
+!ELSE
+JDBM_DEFINES = 
+!ENDIF
+
+!IF $(USE_SQLITE)
+SQLITE_DEFINES = -DUSE_SQLITE
+!ELSE
+SQLITE_DEFINES = 
+!ENDIF
+
+!IF $(USE_MSSQL)
+MSSQL_DEFINES = -DUSE_MSSQL
+!ELSE
+MSSQL_DEFINES = 
 !ENDIF
 
@@ -85,8 +115,9 @@
 CC = cl
 DEFS = -D__WIN32__ -DHAVE_CONFIG_H -DPARADOCNUM -D_LITTLE_ENDIAN -DSHORT_SUFFIX -D_CRT_SECURE_NO_DEPRECATE \
+	$(GDBM_DEFINES) $(JDBM_DEFINES) $(SQLITE_DEFINES) $(MSSQL_DEFINES) \
 	$(MG_DEFS) $(MGPP_DEFS) $(LUCENE_DEFS)
 # Do NOT add the "recpt" directory here: the protocol should be independent of the receptionist!
 INCLUDES = -I"$(GSDL_DIR)" -I"$(COMMON_DIR)\src\lib" -I"$(COLSERVR_DIR)" $(MGPP_INCLUDES) \
-	 -I"$(COMMON_PACKAGES_DIR)\windows\gdbm\gdbm"
+	 $(GDBM_INCLUDES)
 
 !IF $(GSDL_VC4)
Index: /main/trunk/greenstone2/runtime-src/src/recpt/Makefile.in
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/recpt/Makefile.in	(revision 22077)
+++ /main/trunk/greenstone2/runtime-src/src/recpt/Makefile.in	(revision 22078)
@@ -85,7 +85,9 @@
 GDBM_DEFINES = -DUSE_GDBM
 GDBM_INCLUDES = -I$(COMMON_PACKAGES_DIR)/gdbm/include
+GDBM_LIBS = $(COMMON_PACKAGES_DIR)/gdbm/lib/libgdbm.a
 else
 GDBM_DEFINES = 
 GDBM_INCLUDES = 
+GDBM_LIBS = 
 endif
 
@@ -155,5 +157,5 @@
 INSTALL = @INSTALL@
 LDFLAGS = @LDFLAGS@ @COMPAT32BITFLAGS@
-LIBS = @LIBS@ $(COMMON_PACKAGES_DIR)/gdbm/lib/libgdbm.a \
+LIBS = @LIBS@ $(GDBM_LIBS) \
 	$(COMMON_PACKAGES_DIR)/expat/lib/libexpat.a \
 	$(ACCENTFOLD_LIBS) $(FASTCGI_LIBS) $(SQLITE_LIBS) $(Z3950_LIBS)
Index: /main/trunk/greenstone2/runtime-src/src/recpt/win32.mak
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/recpt/win32.mak	(revision 22077)
+++ /main/trunk/greenstone2/runtime-src/src/recpt/win32.mak	(revision 22078)
@@ -45,5 +45,7 @@
 ENABLE_ACCENTFOLD = 1
 USE_GDBM = 1
+USE_JDBM = 1
 USE_SQLITE = 1
+USE_MSSQL = 0
 ENABLE_MG = 1
 ENABLE_MGPP = 1
@@ -78,8 +80,16 @@
 !IF $(USE_GDBM)
 GDBM_DEFINES = -DUSE_GDBM
+GDBM_LIBS = "$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\gdbm.lib"
 GDBM_INCLUDES = -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3" -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\windows"
 !ELSE
 GDBM_DEFINES = 
+GDBM_LIBS = 
 GDBM_INCLUDES = 
+!ENDIF
+
+!IF $(USE_JDBM)
+JDBM_DEFINES = -DUSE_JDBM
+!ELSE
+JDBM_DEFINES = 
 !ENDIF
 
@@ -94,4 +104,10 @@
 SQL_OBJECTS =
 SQLITE_LIBS = 
+!ENDIF
+
+!IF $(USE_MSSQL)
+MSSQL_DEFINES = -DUSE_MSSQL
+!ELSE
+MSSQL_DEFINES = 
 !ENDIF
 
@@ -142,5 +158,6 @@
 CC = cl
 DEFS = -D__WIN32__ -DHAVE_CONFIG_H -DPARADOCNUM -D_LITTLE_ENDIAN -DSHORT_SUFFIX -D_CRT_SECURE_NO_DEPRECATE \
-        -DGSDL_NOCACHE $(GDBM_DEFINES) $(Z3950_DEFS) $(MG_DEFS) $(MGPP_DEFS) $(LUCENE_DEFS)
+        -DGSDL_NOCACHE $(GDBM_DEFINES) $(JDBM_DEFINES) $(SQLITE_DEFINES) $(MSSQL_DEFINES) \
+	$(Z3950_DEFS) $(MG_DEFS) $(MGPP_DEFS) $(LUCENE_DEFS)
 INCLUDES = -I. -I"$(GSDL_DIR)" -I"$(COMMON_DIR)\src\lib" -I"$(COLSERVR_DIR)" -I"$(PROTOCOL_DIR)" \
 	$(MG_INCLUDES) $(MGPP_INCLUDES) \
@@ -150,5 +167,5 @@
 LDFLAGS = 
 LIBS = "$(COMMON_PACKAGES_DIR)\windows\crypt\crypt\crypt.lib" "$(COMMON_PACKAGES_DIR)\windows\expat\expat\libexpat.lib" \
-        "$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\gdbm.lib" $(ACCENTFOLD_LIBS) $(SQLITE_LIBS) $(Z3950_LIBS)
+       $(GDBM_LIBS) $(ACCENTFOLD_LIBS) $(SQLITE_LIBS) $(Z3950_LIBS)
 
 !IF $(GSDL_VC4)
Index: /main/trunk/greenstone2/runtime-src/src/w32server/win32.mak
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/w32server/win32.mak	(revision 22077)
+++ /main/trunk/greenstone2/runtime-src/src/w32server/win32.mak	(revision 22078)
@@ -40,5 +40,8 @@
 DEBUG = 0
 ENABLE_ACCENTFOLD = 1
+USE_GDBM = 1
+USE_JDBM = 1
 USE_SQLITE = 1
+USE_MSSQL = 0
 ENABLE_MG = 1
 ENABLE_MGPP = 1
@@ -66,8 +69,33 @@
 !ENDIF
 
+!IF $(USE_GDBM)
+GDBM_INCLUDES = -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3" \
+	-I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\windows"
+GDBM_LIBS = "$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\gdbm.lib"
+GDBM_DEFINES = -DUSE_GDBM
+!ELSE
+GDBM_INCLUDES = 
+GDBM_LIBS = 
+GDBM_DEFINES =
+!ENDIF
+
+!IF $(USE_JDBM)
+JDBM_DEFINES = -DUSE_JDBM
+!ELSE
+JDBM_DEFINES =
+!ENDIF
+
 !IF $(USE_SQLITE)
 SQLITE_LIBS = "$(COMMON_PACKAGES_DIR)\sqlite\lib\sqlite3.lib"
+SQLITE_DEFINES = -DUSE_SQLITE
 !ELSE
 SQLITE_LIBS = 
+SQLITE_DEFINES =
+!ENDIF
+
+!IF $(USE_MSSQL)
+MSSQL_DEFINES = -DUSE_MSSQL
+!ELSE
+MSSQL_DEFINES =
 !ENDIF
 
@@ -103,7 +131,8 @@
 CC = cl
 DEFS = -D__WIN32__ -DHAVE_CONFIG_H -D_LITTLE_ENDIAN -DPARADOCNUM -DSHORT_SUFFIX -D_CRT_SECURE_NO_DEPRECATE \
+	$(GDBM_DEFINES) $(JDBM_DEFINES) $(SQLITE_DEFINES) $(MSSQL_DEFINES) \
 	$(MG_DEFS) $(MGPP_DEFS) $(LUCENE_DEFS)
 INCLUDES = -I"$(GSDL_DIR)" -I"$(COMMON_DIR)\src\lib" -I"$(COLSERVR_DIR)" -I"$(PROTOCOL_DIR)" -I"$(RECPT_DIR)" \
-	-I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3" -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\windows" \
+	$(GDBM_INCLUDES) \	
 	-I"$(COLSERVR_DIR)" \
 	$(MG_INCLUDES) \
@@ -111,5 +140,5 @@
 
 LIBS = "$(COMMON_PACKAGES_DIR)\windows\crypt\crypt\crypt.lib" "$(COMMON_PACKAGES_DIR)\windows\expat\expat\libexpat.lib" \
-        "$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\gdbm.lib" $(ACCENTFOLD_LIBS) $(SQLITE_LIBS)
+        $(GDBM_LIBS) $(ACCENTFOLD_LIBS) $(SQLITE_LIBS)
 RSC = rc
 WINLIBS = kernel32.lib user32.lib gdi32.lib winspool.lib \
Index: /main/trunk/greenstone2/runtime-src/src/z3950/Makefile.in
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/z3950/Makefile.in	(revision 22077)
+++ /main/trunk/greenstone2/runtime-src/src/z3950/Makefile.in	(revision 22078)
@@ -64,6 +64,8 @@
 USE_GDBM = @USE_GDBM@
 ifeq ($(USE_GDBM), 1)
+GDBM_LIBS = $(COMMON_PACKAGES_DIR)/gdbm/lib/libgdbm.a
 GDBM_DEFINES = -DUSE_GDBM
 else
+GDBM_LIBS =
 GDBM_DEFINES = 
 endif
@@ -92,5 +94,5 @@
 CFLAGS = @CFLAGS@
 CPPFLAGS = @CXXFLAGS@
-DEFS = @DEFS@ -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DGSDLSERVER $(GDBM_DEFINES) $(JDBM_DEFINES) $(SQLITE_DEFINES) 
+DEFS = @DEFS@ -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DGSDLSERVER $(GDBM_DEFINES) $(JDBM_DEFINES) $(SQLITE_DEFINES)
 GSDLOS = @gsdlos@
 # Do NOT add the "recpt" directory here: the z39.50 code should be independent of the receptionist!
@@ -100,5 +102,5 @@
 INSTALL = @INSTALL@
 LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@ $(COMMON_PACKAGES_DIR)/gdbm/lib/libgdbm.a -L$(COMMON_PACKAGES_DIR)/expat/lib -lexpat \
+LIBS = @LIBS@ $(GDBM_LIBS) -L$(COMMON_PACKAGES_DIR)/expat/lib -lexpat \
 	$(ACCENTFOLD_LIBS) $(SQLITE_LIBS) \
 	$(RUNTIME_PACKAGES_DIR)/yaz/lib/libyaz.a $(RUNTIME_PACKAGES_DIR)/d2m/libd2m.a -lxml2
Index: /main/trunk/greenstone2/runtime-src/src/z3950/win32.mak
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/z3950/win32.mak	(revision 22077)
+++ /main/trunk/greenstone2/runtime-src/src/z3950/win32.mak	(revision 22078)
@@ -41,5 +41,8 @@
 DLLDEBUG = 0
 ENABLE_ACCENTFOLD = 1
+USE_GDBM = 1
+USE_JDBM = 1
 USE_SQLITE = 1
+USE_MSSQL = 0
 ENABLE_MG = 1
 ENABLE_MGPP = 1
@@ -72,8 +75,33 @@
 !ENDIF
 
+!IF $(USE_GDBM)
+GDBM_INCLUDES = -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3" \
+	-I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\windows"
+GDBM_LIBS = "$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\gdbm.lib"
+GDBM_DEFINES = -DUSE_GDBM
+!ELSE
+GDBM_INCLUDES = 
+GDBM_LIBS = 
+GDBM_DEFINES =
+!ENDIF
+
+!IF $(USE_JDBM)
+JDBM_DEFINES = -DUSE_JDBM
+!ELSE
+JDBM_DEFINES =
+!ENDIF
+
 !IF $(USE_SQLITE)
-SQLITE_LIBS = "$(COMMON_PACKAGES_DIR)\sqlite\lib\sqlite3.lib"
+SQLITE_LIBS = "$(COMMON_PACKAGES_DIR)\sqlite\lib\sqlite3.lib
+SQLITE_DEFINES = -DUSE_SQLITE
 !ELSE
 SQLITE_LIBS = 
+SQLITE_DEFINES =
+!ENDIF
+
+!IF $(USE_MSSQL)
+MSSQL_DEFINES = -DUSE_MSSQL
+!ELSE
+MSSQL_DEFINES =
 !ENDIF
 
@@ -107,4 +135,5 @@
 CC = cl
 DEFS = -D__WIN32__ -DHAVE_CONFIG_H -DPARADOCNUM -D_LITTLE_ENDIAN -DSHORT_SUFFIX -D_CRT_SECURE_NO_DEPRECATE \
+	$(GDBM_DEFINES) $(JDBM_DEFINES) $(SQLITE_DEFINES) $(MSSQL_DEFINES) \
 	$(MG_DEFS) $(MGPP_DEFS) $(LUCENE_DEFS)
 # Do NOT add the "recpt" directory here: the z39.50 code should be independent of the receptionist!
@@ -112,7 +141,7 @@
 	$(MGPP_INCLUDES) -I"$(PACKAGES_DIR)\yaz\yaz-2.1.4\include" \
 	-I"$(PACKAGES_DIR)\yaz\yaz-2.1.4\client" -I"$(PACKAGES_DIR)\d2m" \
-	-I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3" -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\windows"
+	$(GDBM_INCLUDES)
 LDFLAGS = 
-LIBS = "$(COMMON_PACKAGES_DIR)\windows\expat\expat\libexpat.lib" "$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\gdbm.lib" \
+LIBS = "$(COMMON_PACKAGES_DIR)\windows\expat\expat\libexpat.lib" $(GDBM_LIBS) \
         "$(PACKAGES_DIR)\d2m\libd2m.lib" "$(PACKAGES_DIR)\yaz\yaz-2.1.4\lib\yaz.lib" $(ACCENTFOLD_LIBS) \
 	$(SQLITE_LIBS)
