Index: main/trunk/greenstone2/runtime-src/src/colservr/Makefile.in
===================================================================
--- main/trunk/greenstone2/runtime-src/src/colservr/Makefile.in	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/colservr/Makefile.in	(revision 21324)
@@ -31,4 +31,53 @@
 COMMON_PACKAGES_DIR = $(COMMON_DIR)/packages
 
+# NOTE: phrasequeryfilter inherits from mgqueryfilter and uses mgsearch
+ENABLE_MG = @ENABLE_MG@
+ifeq ($(ENABLE_MG), 1)
+MG_SOURCES = mgq.c \
+	mgqueryfilter.cpp \
+	mgsearch.cpp \
+	mgsource.cpp \
+	phrasequeryfilter.cpp
+MG_OBJECTS = mgq.o \
+	mgqueryfilter.o \
+	mgsearch.o \
+	mgsource.o \
+	phrasequeryfilter.o
+MG_INCLUDES = -I$(INDEXERS_DIR)/mg -I$(INDEXERS_DIR)/mg/lib -I$(INDEXERS_DIR)/mg/src/text
+else
+MG_SOURCES =
+MG_OBJECTS =
+MG_INCLUDES =
+endif
+
+ENABLE_MGPP = @ENABLE_MGPP@
+ifeq ($(ENABLE_MGPP), 1)
+MGPP_SOURCES = mgppqueryfilter.cpp \
+	mgppsearch.cpp \
+	mgppsource.cpp
+MGPP_OBJECTS = mgppqueryfilter.o \
+	mgppsearch.o \
+	mgppsource.o
+MGPP_INCLUDES = -I$(INDEXERS_DIR)/mgpp/lib -I$(INDEXERS_DIR)/mgpp/text
+else
+MGPP_SOURCES =
+MGPP_OBJECTS =
+MGPP_INCLUDES =
+endif
+
+
+ENABLE_LUCENE = @ENABLE_LUCENE@
+ifeq ($(ENABLE_LUCENE), 1)
+LUCENE_SOURCES = lucenequeryfilter.cpp \
+	lucenesearch.cpp \
+	lucenesource.cpp
+LUCENE_OBJECTS = lucenequeryfilter.o \
+	lucenesearch.o \
+	lucenesource.o
+else
+LUCENE_SOURCES =
+LUCENE_OBJECTS =
+endif
+
 
 USE_SQLITE = @USE_SQLITE@
@@ -50,6 +99,6 @@
 # Do NOT add the "recpt" directory here: the colserver should be independent of the receptionist!
 INCLUDES = -I. -I$(GSDL_DIR) -I$(COMMON_DIR)/src/lib -I$(COMMON_PACKAGES_DIR)/gdbm/include \
-	-I$(INDEXERS_DIR)/mg -I$(INDEXERS_DIR)/mg/lib -I$(INDEXERS_DIR)/mg/src/text \
-	-I$(INDEXERS_DIR)/mgpp/lib -I$(INDEXERS_DIR)/mgpp/text \
+	$(MG_INCLUDES) \
+	$(MGPP_INCLUDES) \
 	-I$(COMMON_PACKAGES_DIR)/expat/include $(SQLITE_INCLUDES)
 RANLIB = @RANLIB@
@@ -79,15 +128,8 @@
 	expat_resultset.cpp \
 	filter.cpp \
-	lucenequeryfilter.cpp \
-	lucenesearch.cpp \
-	lucenesource.cpp \
+	$(LUCENE_SOURCES) \
 	maptools.cpp \
-	mgq.c \
-	mgqueryfilter.cpp \
-	mgsearch.cpp \
-	mgsource.cpp \
-	mgppqueryfilter.cpp \
-	mgppsearch.cpp \
-	phrasequeryfilter.cpp \
+	$(MG_SOURCES) \
+	$(MGPP_SOURCES) \
 	phrasesearch.cpp \
 	querycache.cpp \
@@ -107,15 +149,8 @@
 	expat_resultset.o \
 	filter.o \
-	lucenequeryfilter.o \
-	lucenesearch.o \
-	lucenesource.o \
+	$(LUCENE_OBJECTS) \
 	maptools.o \
-	mgq.o \
-	mgqueryfilter.o \
-	mgsearch.o \
-	mgsource.o \
-	mgppqueryfilter.o \
-	mgppsearch.o \
-	phrasequeryfilter.o \
+	$(MG_OBJECTS) \
+	$(MGPP_OBJECTS) \
 	phrasesearch.o \
 	querycache.o \
Index: main/trunk/greenstone2/runtime-src/src/colservr/collectserver.cpp
===================================================================
--- main/trunk/greenstone2/runtime-src/src/colservr/collectserver.cpp	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/colservr/collectserver.cpp	(revision 21324)
@@ -29,4 +29,31 @@
 #include <assert.h>
 #include "display.h"
+
+void check_if_valid_buildtype(const text_t& buildtype)
+{
+  if (buildtype=="mg") {
+#ifndef ENABLE_MG
+    cerr << "Warning: Greenstone installation has not been compiled to support buildtype 'mg'." << endl;
+#endif
+  }
+
+  else if (buildtype=="mgpp") {
+#ifndef ENABLE_MGPP
+    cerr << "Warning: Greenstone installation has not been compiled to support buildtype 'mgpp'." << endl;
+#endif
+  }
+
+  else if (buildtype=="lucene") {
+#ifndef ENABLE_LUCENE
+    cerr << "Warning: Greenstone installation has not been compiled to support buildtype 'lucene'." << endl;
+#endif
+  }
+
+  else {
+    cerr << "Error: buildtype '" << buildtype << "' is not a recognized indexer for Greenstone." << endl;
+  }
+
+}
+
 
 
@@ -202,8 +229,12 @@
     else if (key == "httpprefix") collectinfo.httpprefix = value;
     else if (key == "receptionist") collectinfo.receptionist = value;
-    else if (key == "buildtype") collectinfo.buildType = value;
+    else if (key == "buildtype") {
+      check_if_valid_buildtype(value); // prints warning if value (indexer) is invalid
+      collectinfo.buildType = value;
+    }
     // backwards compatibility - searchytpes is now a format statement
     else if (key == "searchtype") { // means buildtype is mgpp
       if (collectinfo.buildType.empty()) {
+	check_if_valid_buildtype("mgpp"); // prints warning if value (indexer) is invalid
 	collectinfo.buildType = "mgpp";
       }
Index: main/trunk/greenstone2/runtime-src/src/colservr/collectset.cpp
===================================================================
--- main/trunk/greenstone2/runtime-src/src/colservr/collectset.cpp	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/colservr/collectset.cpp	(revision 21324)
@@ -36,9 +36,17 @@
 #include "sqlbrowsefilter.h"
 #include "queryfilter.h"
+
+#ifdef ENABLE_MG
 #include "mgqueryfilter.h"
+#include "mgsource.h"
+#endif
+#ifdef ENABLE_MGPP
 #include "mgppqueryfilter.h"
-#include "mgsource.h"
+#include "mgppsource.h"
+#endif
+#ifdef ENABLE_LUCENE
 #include "lucenequeryfilter.h"
 #include "lucenesource.h"
+#endif
 
 #include <assert.h>
@@ -61,7 +69,13 @@
   text_tarray collections;
 
+#ifdef ENABLE_MG
   mgsearch = NULL;
+#endif
+#ifdef ENABLE_MGPP
   mgppsearch = NULL;
+#endif
+#ifdef ENABLE_LUCENE
   lucenesearch = NULL;
+#endif
 
   // get gsdlhome (if we fail the error will be picked up later -- in
@@ -100,7 +114,13 @@
   httpprefix = httpprefix_arg;
 
+#ifdef ENABLE_MG
   mgsearch = NULL;
+#endif
+#ifdef ENABLE_MGPP
   mgppsearch = NULL;
+#endif
+#ifdef ENABLE_LUCENE
   lucenesearch = NULL;
+#endif
 
 }
@@ -108,7 +128,13 @@
 collectset::collectset ()
 {
+#ifdef ENABLE_MG
   mgsearch = NULL;
+#endif
+#ifdef ENABLE_MGPP
   mgppsearch = NULL;
+#endif
+#ifdef ENABLE_LUCENE
   lucenesearch = NULL;
+#endif
 }
 
@@ -310,4 +336,5 @@
 
     if (buildtype == "mg") {
+#ifdef ENABLE_MG
       mgsearch = new mgsearchclass();
  
@@ -323,6 +350,10 @@
       mgsource->set_textsearchptr (mgsearch);
       cserver->add_source (mgsource);
+#else
+      cerr << "Error: buildtype " << buildtype << " not enabled." << endl;
+#endif
     }
     else if (buildtype == "mgpp") {
+#ifdef ENABLE_MGPP
       mgppsearch = new mgppsearchclass();
 
@@ -333,11 +364,15 @@
       cserver->add_filter (queryfilter);
       
-      // add a mg source
-      mgsourceclass *mgsource = new mgsourceclass ();
-      mgsource->set_db_ptr(db_ptr);
-      mgsource->set_textsearchptr (mgppsearch);
-      cserver->add_source (mgsource);
+      // add a mgpp source
+      mgppsourceclass *mgppsource = new mgppsourceclass ();
+      mgppsource->set_db_ptr(db_ptr);
+      mgppsource->set_textsearchptr (mgppsearch);
+      cserver->add_source (mgppsource);
+#else
+      cerr << "Error: buildtype " << buildtype << " not enabled." << endl;
+#endif
     }
     else if (buildtype == "lucene") {
+#ifdef ENABLE_LUCENE
       lucenesearch = new lucenesearchclass();
       lucenesearch->set_gsdlhome(gsdlhome); 
@@ -354,7 +389,10 @@
       lucenesource->set_textsearchptr (lucenesearch);
       cserver->add_source (lucenesource);
+#else
+      cerr << "Error: buildtype " << buildtype << " not enabled." << endl;
+#endif
     }
     else {
-      cerr << "Warning: unrecognized buildtype" << buildtype << endl;
+      cerr << "Warning: unrecognized buildtype " << buildtype << endl;
     }
 
@@ -414,8 +452,10 @@
 void collectset::remove_all_collections () {
 
+#ifdef ENABLE_MG
   // first unload any cached mg databases
   if (mgsearch != NULL) {
     mgsearch->unload_database();
   }
+#endif
 
   // now delete the collection server objects
@@ -512,4 +552,5 @@
   if (cservers.getcollectserver(collection) == NULL) return;
 
+#ifdef ENABLE_MG
   // first unload any cached mg databases - we may need to do something
   // similar to this for mgpp and lucene too
@@ -517,4 +558,5 @@
     mgsearch->unload_database();
   }
+#endif
 
   // now delete the collection server object
Index: main/trunk/greenstone2/runtime-src/src/colservr/collectset.h
===================================================================
--- main/trunk/greenstone2/runtime-src/src/colservr/collectset.h	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/colservr/collectset.h	(revision 21324)
@@ -10,7 +10,14 @@
 #include "collectserver.h"
 #include "cnfgable.h"
+
+#ifdef ENABLE_MG
 #include "mgsearch.h"
+#endif
+#ifdef ENABLE_MGPP
 #include "mgppsearch.h"
+#endif
+#ifdef ENABLE_LUCENE
 #include "lucenesearch.h"
+#endif
 
 class collectset : public configurable
@@ -18,7 +25,14 @@
  protected:
   collectservermapclass cservers;
+#ifdef ENABLE_MG
   mgsearchclass         *mgsearch;
+#endif
+#ifdef ENABLE_MGPP
   mgppsearchclass       *mgppsearch;
+#endif
+#ifdef ENABLE_LUCENE
   lucenesearchclass     *lucenesearch;
+#endif
+
   int                   noofservers;
   text_t                httpdomain;
Index: main/trunk/greenstone2/runtime-src/src/colservr/phrasesearch.cpp
===================================================================
--- main/trunk/greenstone2/runtime-src/src/colservr/phrasesearch.cpp	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/colservr/phrasesearch.cpp	(revision 21324)
@@ -111,4 +111,5 @@
 }
 
+#ifdef ENABLE_MG
 bool doc_phrase_search (unsigned char *doc, int doclen,
 			const termfreqclassarray &phrase) {
@@ -258,2 +259,3 @@
   return result;
 }
+#endif
Index: main/trunk/greenstone2/runtime-src/src/colservr/phrasesearch.h
===================================================================
--- main/trunk/greenstone2/runtime-src/src/colservr/phrasesearch.h	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/colservr/phrasesearch.h	(revision 21324)
@@ -31,5 +31,9 @@
 #include "text_t.h"
 #include "unitool.h"
+
+#ifdef ENABLE_MG
 #include "mgsearch.h"
+#endif
+
 #include "dbclass.h"
 
@@ -38,4 +42,5 @@
 // a document number. This function has not been coded with all
 // situations in mind and expects mgsearch and db set up ready to go
+#ifdef ENABLE_MG
 bool OID_phrase_search (mgsearchclass &mgsearch,
 			dbclass &db,
@@ -47,4 +52,5 @@
 			const termfreqclassarray &phrase,
 			int docnum);
+#endif
 
 #endif
Index: main/trunk/greenstone2/runtime-src/src/colservr/win32.mak
===================================================================
--- main/trunk/greenstone2/runtime-src/src/colservr/win32.mak	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/colservr/win32.mak	(revision 21324)
@@ -39,4 +39,7 @@
 USE_SQLITE = 1
 USE_MSSQL = 0
+ENABLE_MG = 1
+ENABLE_MGPP = 1
+ENABLE_LUCENE = 1
 
 !IF $(DEBUG)
@@ -61,10 +64,10 @@
 !ENDIF
 
-!IF $(USE_SQLITE)
+!IF "$(USE_SQLITE)" == "0"
+SQLITE_DEFINES = 
+SQLITE_INCLUDES = 
+!ELSE
 SQLITE_DEFINES = -DUSE_SQLITE
 SQLITE_INCLUDES = -I"$(COMMON_PACKAGES_DIR)\sqlite\include"
-!ELSE
-SQLITE_DEFINES = 
-SQLITE_INCLUDES = 
 !ENDIF
 
@@ -73,4 +76,46 @@
 !ELSE
 MSSQL_DEFINES = 
+!ENDIF
+
+!IF "$(ENABLE_MG)" == "0"
+MG_DEFS =
+MG_SOURCES =
+MG_OBJECTS =
+MG_INCLUDES =
+!ELSE
+MG_DEFS = -DENABLE_MG
+MG_SOURCES = mgq.c \
+	mgqueryfilter.cpp \
+	mgsearch.cpp \
+	phrasequeryfilter.cpp \
+	mgsource.cpp
+MG_OBJECTS = mgq.obj \
+	mgqueryfilter.obj \
+	mgsearch.obj \
+	phrasequeryfilter.obj \
+	mgsource.obj
+MG_INCLUDES = -I"$(INDEXERS_DIR)\mg" -I"$(INDEXERS_DIR)\mg\lib" -I"$(INDEXERS_DIR)\mg\src\text"
+!ENDIF
+
+!IF "$(ENABLE_MGPP)" == "0"
+MGPP_DEFS =
+MGPP_SOURCES =
+MGPP_OBJECTS =
+MGPP_INCLUDES =
+!ELSE
+MGPP_DEFS = -DENABLE_MGPP
+MGPP_SOURCES = mgppqueryfilter.cpp \
+	mgppsearch.cpp \
+	mgppsource.cpp
+MGPP_OBJECTS = mgppqueryfilter.obj \
+	mgppsearch.obj \
+	mgppsource.obj
+MGPP_INCLUDES = -I"$(INDEXERS_DIR)\mgpp\lib" -I"$(INDEXERS_DIR)\mgpp\text"
+!ENDIF
+
+!IF "$(ENABLE_LUCENE)" == "0"
+LUCENE_DEFS =
+!ELSE
+LUCENE_DEFS = -DENABLE_LUCENE
 !ENDIF
 
@@ -79,9 +124,9 @@
 CC = cl
 DEFS = -D__WIN32__ -DHAVE_CONFIG_H -DPARADOCNUM -D_LITTLE_ENDIAN -DSHORT_SUFFIX -D_CRT_SECURE_NO_DEPRECATE \
-        -DXML_STATIC $(SQLITE_DEFINES) $(MSSQL_DEFINES)
+        -DXML_STATIC $(SQLITE_DEFINES) $(MSSQL_DEFINES) $(MG_DEFS) $(MGPP_DEFS) $(LUCENE_DEFS)
 # Do NOT add the "recpt" directory here: the colserver should be independent of the receptionist!
 INCLUDES = -I"$(GSDL_DIR)" -I"$(COMMON_DIR)\src\lib" \
-	-I"$(INDEXERS_DIR)\mg" -I"$(INDEXERS_DIR)\mg\lib" -I"$(INDEXERS_DIR)\mg\src\text" \
-	-I"$(INDEXERS_DIR)\mgpp\lib" -I"$(INDEXERS_DIR)\mgpp\text" \
+	$(MG_INCLUDES) \
+	$(MGPP_INCLUDES) \
 	-I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3" -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\windows" \
 	-I"$(COMMON_PACKAGES_DIR)\windows\expat\expat" $(SQLITE_INCLUDES)
@@ -119,11 +164,6 @@
 	lucenesource.cpp \
 	maptools.cpp \
-	mgq.c \
-	mgqueryfilter.cpp \
-	mgsearch.cpp \
-	mgsource.cpp \
-	mgppqueryfilter.cpp \
-	mgppsearch.cpp \
-	phrasequeryfilter.cpp \
+	$(MG_SOURCES) \
+	$(MGPP_SOURCES) \
 	phrasesearch.cpp \
 	querycache.cpp \
@@ -147,11 +187,6 @@
 	lucenesource.obj \
 	maptools.obj \
-	mgq.obj \
-	mgqueryfilter.obj \
-	mgsearch.obj \
-	mgsource.obj \
-	mgppqueryfilter.obj \
-	mgppsearch.obj \
-	phrasequeryfilter.obj \
+	$(MG_OBJECTS) \
+	$(MGPP_OBJECTS) \
 	phrasesearch.obj \
 	querycache.obj \
Index: main/trunk/greenstone2/runtime-src/src/corba/Makefile.in
===================================================================
--- main/trunk/greenstone2/runtime-src/src/corba/Makefile.in	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/corba/Makefile.in	(revision 21324)
@@ -44,4 +44,24 @@
 endif
 
+
+ENABLE_MG = @ENABLE_MG@
+ifeq ($(ENABLE_MG), 1)
+MG_INDEXERS_LIBS = $(INDEXERS_DIR)/mg/src/text/libmgtext.a \
+	$(INDEXERS_DIR)/mg/lib/libmglib.a
+else
+MG_INDEXERS_LIBS =
+endif
+
+ENABLE_MGPP = @ENABLE_MGPP@
+ifeq ($(ENABLE_MGPP), 1)
+MGPP_INDEXERS_LIBS = $(INDEXERS_DIR)/mgpp/text/libmgpptext.a \
+	$(INDEXERS_DIR)/mgpp/lib/libmgpplib.a
+MGPP_INCLUDES = -I$(INDEXERS_DIR)/mgpp/text 
+else
+MGPP_INDEXERS_LIBS =
+MGPP_INCLUDES =
+endif
+
+
 USE_SQLITE = @USE_SQLITE@
 ifeq ($(USE_SQLITE), 1)
@@ -71,5 +91,5 @@
 CFLAGS = @CFLAGS@
 DEFS = @DEFS@ -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DGSDLSERVER
-INCLUDES = -I$(COMMON_DIR)/src/lib -I$(COLSERVR_DIR) -I$(PROTOCOL_DIR) -I$(RECPT_DIR) -I$(INDEXERS_DIR)/mgpp/text \
+INCLUDES = -I$(COMMON_DIR)/src/lib -I$(COLSERVR_DIR) -I$(PROTOCOL_DIR) -I$(RECPT_DIR) $(MGPP_INCLUDES) \
 	$(MICO_INCLUDES)
 INSTALL = @INSTALL@
@@ -113,8 +133,6 @@
 	$(PROTOCOL_DIR)/gsdlprotocol.a \
 	$(COLSERVR_DIR)/gsdlcolservr.a \
-	$(INDEXERS_DIR)/mg/src/text/libmgtext.a \
-	$(INDEXERS_DIR)/mg/lib/libmglib.a \
-	$(INDEXERS_DIR)/mgpp/text/libmgpptext.a \
-	$(INDEXERS_DIR)/mgpp/lib/libmgpplib.a \
+	$(MG_INDEXERS_LIBS) \
+	$(MGPP_INDEXERS_LIBS) \
 	$(COMMON_DIR)/src/lib/gsdllib.a
 
Index: main/trunk/greenstone2/runtime-src/src/corba/corbaclient.mpp
===================================================================
--- main/trunk/greenstone2/runtime-src/src/corba/corbaclient.mpp	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/corba/corbaclient.mpp	(revision 21324)
@@ -33,5 +33,7 @@
 #include "browsefilter.h"
 #include "queryfilter.h"
+#ifdef ENABLE_MG
 #include "mgsearch.h"
+#endif
 #include "fileutil.h"
 #include <assert.h>
Index: main/trunk/greenstone2/runtime-src/src/oaiservr/Makefile.in
===================================================================
--- main/trunk/greenstone2/runtime-src/src/oaiservr/Makefile.in	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/oaiservr/Makefile.in	(revision 21324)
@@ -43,4 +43,24 @@
 endif
 
+
+ENABLE_MG = @ENABLE_MG@
+ifeq ($(ENABLE_MG), 1)
+MG_INDEXERS_LIBS = $(INDEXERS_DIR)/mg/src/text/libmgtext.a \
+	$(INDEXERS_DIR)/mg/lib/libmglib.a
+else
+MG_INDEXERS_LIBS =
+endif
+
+ENABLE_MGPP = @ENABLE_MGPP@
+ifeq ($(ENABLE_MGPP), 1)
+MGPP_INDEXERS_LIBS = $(INDEXERS_DIR)/mgpp/text/libmgpptext.a \
+	$(INDEXERS_DIR)/mgpp/lib/libmgpplib.a
+MGPP_INCLUDES = -I$(INDEXERS_DIR)/mgpp/text 
+else
+MGPP_INDEXERS_LIBS =
+MGPP_INCLUDES =
+endif
+
+
 USE_SQLITE = @USE_SQLITE@
 ifeq ($(USE_SQLITE), 1)
@@ -55,5 +75,5 @@
 CXX = @CXX@
 CXXFLAGS = @CXXFLAGS@ @COMPAT32BITFLAGS@
-INCLUDES = -I$(COMMON_DIR)/src/lib -I$(COLSERVR_DIR) -I$(PROTOCOL_DIR) -I$(RECPT_DIR) -I$(INDEXERS_DIR)/mgpp/text
+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 \
@@ -120,8 +140,6 @@
 	$(PROTOCOL_DIR)/gsdlprotocol.a \
 	$(COLSERVR_DIR)/gsdlcolservr.a \
-	$(INDEXERS_DIR)/mg/src/text/libmgtext.a \
-	$(INDEXERS_DIR)/mg/lib/libmglib.a \
-	$(INDEXERS_DIR)/mgpp/text/libmgpptext.a \
-	$(INDEXERS_DIR)/mgpp/lib/libmgpplib.a \
+	$(MG_INDEXERS_LIBS) \
+	$(MGPP_INDEXERS_LIBS) \
 	$(COMMON_DIR)/src/lib/gsdllib.a
 
Index: main/trunk/greenstone2/runtime-src/src/oaiservr/win32.mak
===================================================================
--- main/trunk/greenstone2/runtime-src/src/oaiservr/win32.mak	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/oaiservr/win32.mak	(revision 21324)
@@ -44,4 +44,7 @@
 ENABLE_ACCENTFOLD = 1
 USE_SQLITE = 1
+ENABLE_MG = 1
+ENABLE_MGPP = 1
+ENABLE_LUCENE = 1
 
 !IF $(DEBUG)
@@ -71,9 +74,26 @@
 !ENDIF
 
-!IF $(USE_SQLITE)
+!IF "$(USE_SQLITE)" == "0"
+SQLITE_LIBS = 
+!ELSE
 SQLITE_LIBS = "$(COMMON_PACKAGES_DIR)\sqlite\lib\sqlite3.lib"
-!ELSE
-SQLITE_LIBS = 
-!ENDIF
+!ENDIF
+
+!IF "$(ENABLE_MG)" == "0"
+MG_LIBS =
+!ELSE
+MG_LIBS = "$(INDEXERS_DIR)\mg\src\text\libmgtext.lib" \
+	"$(INDEXERS_DIR)\mg\lib\libmglib.lib"	
+!ENDIF
+
+!IF "$(ENABLE_MGPP)" == "0"
+MGPP_LIBS =
+MGPP_INCLUDES =
+!ELSE
+MGPP_LIBS = "$(INDEXERS_DIR)\mgpp\text\libmgpptext.lib" \
+	"$(INDEXERS_DIR)\mgpp\lib\libmgpplib.lib"
+MGPP_INCLUDES = -I"$(INDEXERS_DIR)\mgpp\text"
+!ENDIF
+
 
 
@@ -83,5 +103,5 @@
         -DGSDL_NOCACHE
 INCLUDES = -I"$(COMMON_DIR)\src\lib" -I"$(COLSERVR_DIR)" -I"$(PROTOCOL_DIR)" -I"$(RECPT_DIR)" \
-        -I"$(INDEXERS_DIR)\mgpp\text" -I"$(COMMON_PACKAGES_DIR)\windows\crypt\crypt" \
+        $(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" \
 	-I"$(COMMON_PACKAGES_DIR)\windows\expat\expat"
@@ -157,8 +177,6 @@
 	"$(PROTOCOL_DIR)\gsdlprotocol.lib" \
 	"$(COLSERVR_DIR)\gsdlcolservr.lib" \
-	"$(INDEXERS_DIR)\mg\src\text\libmgtext.lib" \
-	"$(INDEXERS_DIR)\mg\lib\libmglib.lib" \
-	"$(INDEXERS_DIR)\mgpp\text\libmgpptext.lib" \
-	"$(INDEXERS_DIR)\mgpp\lib\libmgpplib.lib" \
+	$(MG_LIBS) \
+	$(MGPP_LIBS) \
 	"$(COMMON_DIR)\src\lib\gsdllib.lib"
 
Index: main/trunk/greenstone2/runtime-src/src/protocol/Makefile.in
===================================================================
--- main/trunk/greenstone2/runtime-src/src/protocol/Makefile.in	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/protocol/Makefile.in	(revision 21324)
@@ -33,4 +33,10 @@
 COLSERVR_DIR = $(RUNTIME_DIR)/src/colservr
 
+ENABLE_MGPP = @ENABLE_MGPP@
+ifeq ($(ENABLE_MGPP), 1)
+MGPP_INCLUDES = -I$(INDEXERS_DIR)/mgpp/text
+else
+MGPP_INCLUDES =
+endif
 
 AR = ar
@@ -40,5 +46,5 @@
 # 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 \
-	-I$(COLSERVR_DIR) -I$(INDEXERS_DIR)/mgpp/text
+	-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 21323)
+++ main/trunk/greenstone2/runtime-src/src/protocol/win32.mak	(revision 21324)
@@ -38,4 +38,5 @@
 DLL = 0
 DLLDEBUG = 0
+ENABLE_MGPP = 1
 
 !IF $(DEBUG)
@@ -59,4 +60,9 @@
 !ENDIF
 
+!IF $(ENABLE_MGPP) == "0"
+MGPP_INCLUDES =
+!ELSE
+MGPP_INCLUDES = -I"$(INDEXERS_DIR)\mgpp\text"
+!ENDIF
 
 AR = lib
@@ -64,5 +70,5 @@
 DEFS = -D__WIN32__ -DHAVE_CONFIG_H -DPARADOCNUM -D_LITTLE_ENDIAN -DSHORT_SUFFIX -D_CRT_SECURE_NO_DEPRECATE
 # 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)" -I"$(INDEXERS_DIR)\mgpp\text" \
+INCLUDES = -I"$(GSDL_DIR)" -I"$(COMMON_DIR)\src\lib" -I"$(COLSERVR_DIR)" $(MGPP_INCLUDES) \
 	 -I"$(COMMON_PACKAGES_DIR)\windows\gdbm\gdbm"
 
Index: main/trunk/greenstone2/runtime-src/src/recpt/Makefile.in
===================================================================
--- main/trunk/greenstone2/runtime-src/src/recpt/Makefile.in	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/recpt/Makefile.in	(revision 21324)
@@ -44,4 +44,28 @@
 else
 ACCENTFOLD_LIBS = 
+endif
+
+ENABLE_MG = @ENABLE_MG@
+ifeq ($(ENABLE_MG), 1)
+MG_INDEXERS_LIBS = $(INDEXERS_DIR)/mg/src/text/libmgtext.a \
+	$(INDEXERS_DIR)/mg/lib/libmglib.a
+MG_INCLUDES = -I$(INDEXERS_DIR)/mg -I$(INDEXERS_DIR)/mg/lib
+else
+MG_INDEXERS_LIBS =
+MG_INCLUDES =
+endif
+
+ENABLE_MGPP = @ENABLE_MGPP@
+ifeq ($(ENABLE_MGPP), 1)
+MGPP_SOURCES = phindaction.cpp
+MGPP_OBJECTS = phindaction.o
+MGPP_INDEXERS_LIBS = $(INDEXERS_DIR)/mgpp/text/libmgpptext.a \
+	$(INDEXERS_DIR)/mgpp/lib/libmgpplib.a
+MGPP_INCLUDES = -I$(INDEXERS_DIR)/mgpp/text -I$(INDEXERS_DIR)/mgpp/lib
+else
+MGPP_SOURCES =
+MGPP_OBJECTS =
+MGPP_INDEXERS_LIBS =
+MGPP_INCLUDES =
 endif
 
@@ -104,5 +128,5 @@
 INCLUDES = -I. -I$(GSDL_DIR) -I$(COMMON_DIR)/src/lib -I$(COMMON_PACKAGES_DIR)/gdbm/include \
         -I$(COLSERVR_DIR) -I$(PROTOCOL_DIR) \
-	-I$(INDEXERS_DIR)/mg -I$(INDEXERS_DIR)/mg/lib -I$(INDEXERS_DIR)/mgpp/text \
+	$(MG_INCLUDES) $(MGPP_INCLUDES) \
         -I$(COMMON_PACKAGES_DIR)/expat/include $(FASTCGI_INCLUDES) $(Z3950_INCLUDES)
 INSTALL = @INSTALL@
@@ -149,5 +173,5 @@
 	pageaction.cpp \
 	pagedbrowserclass.cpp \
-	phindaction.cpp \
+	$(MGPP_SOURCES) \
 	phindbrowserclass.cpp \
 	pingaction.cpp \
@@ -194,5 +218,5 @@
 	pageaction.o \
 	pagedbrowserclass.o \
-	phindaction.o \
+	$(MGPP_OBJECTS) \
 	phindbrowserclass.o \
 	pingaction.o \
@@ -213,8 +237,6 @@
 	$(PROTOCOL_DIR)/gsdlprotocol.a \
 	$(COLSERVR_DIR)/gsdlcolservr.a \
-	$(INDEXERS_DIR)/mg/src/text/libmgtext.a \
-	$(INDEXERS_DIR)/mg/lib/libmglib.a \
-	$(INDEXERS_DIR)/mgpp/text/libmgpptext.a \
-	$(INDEXERS_DIR)/mgpp/lib/libmgpplib.a \
+	$(MG_INDEXERS_LIBS) \
+	$(MGPP_INDEXERS_LIBS) \
 	$(COMMON_DIR)/src/lib/gsdllib.a
 
Index: main/trunk/greenstone2/runtime-src/src/recpt/gsdl_modules_cfg.h
===================================================================
--- main/trunk/greenstone2/runtime-src/src/recpt/gsdl_modules_cfg.h	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/recpt/gsdl_modules_cfg.h	(revision 21324)
@@ -56,5 +56,9 @@
 #define GSDL_USE_EXTLINK_ACTION
 #undef  GSDL_USE_GTI_ACTION
+
+#ifdef ENABLE_MGPP
 #define GSDL_USE_PHIND_ACTION
+#endif
+
 #define GSDL_USE_PING_ACTION
 #define GSDL_USE_STATUS_ACTION
Index: main/trunk/greenstone2/runtime-src/src/recpt/librarymain.cpp
===================================================================
--- main/trunk/greenstone2/runtime-src/src/recpt/librarymain.cpp	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/recpt/librarymain.cpp	(revision 21324)
@@ -44,5 +44,7 @@
 #include "extlinkaction.h"
 #include "pageaction.h"
+#ifdef ENABLE_MGPP
 #include "phindaction.h"
+#endif
 #include "pingaction.h"
 #include "queryaction.h"
Index: main/trunk/greenstone2/runtime-src/src/recpt/mod_gsdl.cpp
===================================================================
--- main/trunk/greenstone2/runtime-src/src/recpt/mod_gsdl.cpp	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/recpt/mod_gsdl.cpp	(revision 21324)
@@ -69,8 +69,11 @@
 #include "filter.h"
 #include "browsefilter.h"
-#include "mgqueryfilter.h"
+
+//#ifdef ENABLE_MG
+//#include "mgqueryfilter.h"
+//#include "mgsearch.h"
+//#endif
+
 #include "infodbclass.h"
-#include "mgsource.h"
-#include "mgsearch.h"
 #include "collectset.h"
 
@@ -82,5 +85,7 @@
 #include "documentaction.h"
 #include "extlinkaction.h"
+#ifdef ENABLE_MGPP
 #include "phindaction.h"
+#endif
 #if defined(USE_MYSQL) || defined(USE_ACCESS)
 #include "orderaction.h"
@@ -266,6 +271,9 @@
   recpt.add_action(anextlinkaction);
 
+  // phindaction is for MGPP and uses MGQuery
+#ifdef ENABLE_MGPP
   phindaction *aphindaction = new phindaction();
   recpt.add_action(aphindaction);
+#endif
 
 #if defined(USE_MYSQL) || defined(USE_ACCESS)
Index: main/trunk/greenstone2/runtime-src/src/recpt/win32.mak
===================================================================
--- main/trunk/greenstone2/runtime-src/src/recpt/win32.mak	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/recpt/win32.mak	(revision 21324)
@@ -45,4 +45,7 @@
 ENABLE_ACCENTFOLD = 1
 USE_SQLITE = 1
+ENABLE_MG = 1
+ENABLE_MGPP = 1
+ENABLE_LUCENE = 1
 
 !IF $(DEBUG)
@@ -72,8 +75,8 @@
 !ENDIF
 
-!IF $(USE_SQLITE)
+!IF "$(USE_SQLITE)" == "0"
+SQLITE_LIBS = 
+!ELSE
 SQLITE_LIBS = "$(COMMON_PACKAGES_DIR)\sqlite\lib\sqlite3.lib"
-!ELSE
-SQLITE_LIBS = 
 !ENDIF
 
@@ -88,11 +91,36 @@
 !ENDIF
 
+!IF "$(ENABLE_MG)" == "0"
+MG_DEFS =
+MG_LIBS =
+MG_INCLUDES =
+!ELSE
+MG_DEFS = -DENABLE_MG
+MG_LIBS = "$(INDEXERS_DIR)\mg\src\text\libmgtext.lib" \
+	"$(INDEXERS_DIR)\mg\lib\libmglib.lib"
+MG_INCLUDES = -I"$(INDEXERS_DIR)\mg" -I"$(INDEXERS_DIR)\mg\lib" 
+!ENDIF
+
+!IF "$(ENABLE_MGPP)" == "0"
+MGPP_DEFS =
+MGPP_SOURCES = 
+MGPP_OBJECTS = 
+MGPP_LIBS =
+MGPP_INCLUDES =
+!ELSE
+MGPP_DEFS = -DENABLE_MGPP
+MGPP_SOURCES = phindaction.cpp
+MGPP_OBJECTS = phindaction.obj
+MGPP_LIBS = "$(INDEXERS_DIR)\mgpp\text\libmgpptext.lib" \
+	"$(INDEXERS_DIR)\mgpp\lib\libmgpplib.lib"
+MGPP_INCLUDES = -I"$(INDEXERS_DIR)\mgpp\text"
+!ENDIF
 
 AR = lib
 CC = cl
 DEFS = -D__WIN32__ -DHAVE_CONFIG_H -DPARADOCNUM -D_LITTLE_ENDIAN -DSHORT_SUFFIX -D_CRT_SECURE_NO_DEPRECATE \
-        -DGSDL_NOCACHE $(Z3950_DEFS)
+        -DGSDL_NOCACHE $(Z3950_DEFS) $(MG_DEFS) $(MGPP_DEFS)
 INCLUDES = -I. -I"$(GSDL_DIR)" -I"$(COMMON_DIR)\src\lib" -I"$(COLSERVR_DIR)" -I"$(PROTOCOL_DIR)" \
-	-I"$(INDEXERS_DIR)\mg" -I"$(INDEXERS_DIR)\mg\lib" -I"$(INDEXERS_DIR)\mgpp\text" \
+	$(MG_INCLUDES) $(MGPP_INCLUDES) \
 	-I"$(COMMON_PACKAGES_DIR)\windows\crypt\crypt" -I"$(COMMON_PACKAGES_DIR)\windows\expat\expat" \
 	-I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3" -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\windows" \
@@ -152,5 +180,5 @@
 	pageaction.cpp \
 	pagedbrowserclass.cpp \
-	phindaction.cpp \
+	$(MGPP_SOURCES) \
 	phindbrowserclass.cpp \
 	pingaction.cpp \
@@ -197,5 +225,5 @@
 	pageaction.obj \
 	pagedbrowserclass.obj \
-	phindaction.obj \
+	$(MGPP_OBJECTS) \
 	phindbrowserclass.obj \
 	pingaction.obj \
@@ -216,8 +244,6 @@
 	"$(PROTOCOL_DIR)\gsdlprotocol.lib" \
 	"$(COLSERVR_DIR)\gsdlcolservr.lib" \
-	"$(INDEXERS_DIR)\mg\src\text\libmgtext.lib" \
-	"$(INDEXERS_DIR)\mg\lib\libmglib.lib" \
-	"$(INDEXERS_DIR)\mgpp\text\libmgpptext.lib" \
-	"$(INDEXERS_DIR)\mgpp\lib\libmgpplib.lib" \
+	$(MG_LIBS) \
+	$(MGPP_LIBS) \
 	"$(COMMON_DIR)\src\lib\gsdllib.lib"
 
Index: main/trunk/greenstone2/runtime-src/src/recpt/wizardaction.cpp
===================================================================
--- main/trunk/greenstone2/runtime-src/src/recpt/wizardaction.cpp	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/recpt/wizardaction.cpp	(revision 21324)
@@ -555,5 +555,9 @@
   text_t indextype = args[macro_prefix+"buildtype"];
   if(indextype == "") {
+#ifdef ENABLE_MG
     indextype = "mg";
+#else
+    cerr << "Unable to choose mg as the default indextype, since the Greenstone installation was not compiled with MG enabled." << endl;
+#endif
   }
   options += " -indextype \"" + indextype + "\"";
Index: main/trunk/greenstone2/runtime-src/src/w32server/cgiwrapper.cpp
===================================================================
--- main/trunk/greenstone2/runtime-src/src/w32server/cgiwrapper.cpp	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/w32server/cgiwrapper.cpp	(revision 21324)
@@ -69,5 +69,7 @@
 #include "extlinkaction.h"
 #include "collectoraction.h"
+#ifdef ENABLE_MGPP
 #include "phindaction.h"
+#endif
 #include "configaction.h"
 
@@ -350,5 +352,7 @@
 collectoraction *acollectoraction = NULL;
 authenaction *aauthenaction = NULL;
+#ifdef ENABLE_MGPP
 phindaction *aphindaction = NULL;
+#endif
 configaction *aconfigaction = NULL;
 vlistbrowserclass *avlistbrowserclass = NULL;
@@ -584,8 +588,10 @@
   }
 
+#ifdef ENABLE_MGPP
   if (aphindaction == NULL) {
     aphindaction = new phindaction();
     recpt.add_action (aphindaction);
   }
+#endif
   
   if (aconfigaction == NULL) {
Index: main/trunk/greenstone2/runtime-src/src/w32server/win32.mak
===================================================================
--- main/trunk/greenstone2/runtime-src/src/w32server/win32.mak	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/w32server/win32.mak	(revision 21324)
@@ -41,4 +41,7 @@
 ENABLE_ACCENTFOLD = 1
 USE_SQLITE = 1
+ENABLE_MG = 1
+ENABLE_MGPP = 1
+ENABLE_LUCENE = 1
 
 !IF $(DEBUG)
@@ -63,19 +66,38 @@
 !ENDIF
 
-!IF $(USE_SQLITE)
+!IF "$(USE_SQLITE)" == "0"
+SQLITE_LIBS = 
+!ELSE
 SQLITE_LIBS = "$(COMMON_PACKAGES_DIR)\sqlite\lib\sqlite3.lib"
-!ELSE
-SQLITE_LIBS = 
-!ENDIF
-
+!ENDIF
+
+!IF "$(ENABLE_MG)" == "0"
+MG_LIBS =
+MG_INCLUDES =
+!ELSE
+MG_LIBS = "$(INDEXERS_DIR)\mg\src\text\libmgtext.lib" \
+	"$(INDEXERS_DIR)\mg\lib\libmglib.lib"
+MG_INCLUDES = -I"$(INDEXERS_DIR)\mg" -I"$(INDEXERS_DIR)\mg\lib" -I"$(INDEXERS_DIR)\mg\src\text"
+!ENDIF
+
+!IF "$(ENABLE_MGPP)" == "0"
+MGPP_DEFS =
+MGPP_LIBS =
+MGPP_INCLUDES =
+!ELSE
+MGPP_DEFS = -DENABLE_MGPP
+MGPP_LIBS = "$(INDEXERS_DIR)\mgpp\text\libmgpptext.lib" \
+	"$(INDEXERS_DIR)\mgpp\lib\libmgpplib.lib"
+MGPP_INCLUDES = -I"$(INDEXERS_DIR)\mgpp\lib" -I"$(INDEXERS_DIR)\mgpp\text"
+!ENDIF
 
 AR = lib
 CC = cl
-DEFS = -D__WIN32__ -DHAVE_CONFIG_H -D_LITTLE_ENDIAN -DPARADOCNUM -DSHORT_SUFFIX -D_CRT_SECURE_NO_DEPRECATE
+DEFS = -D__WIN32__ -DHAVE_CONFIG_H -D_LITTLE_ENDIAN -DPARADOCNUM -DSHORT_SUFFIX -D_CRT_SECURE_NO_DEPRECATE $(MGPP_DEFS)
 INCLUDES = -I"$(GSDL_DIR)" -I"$(COMMON_DIR)\src\lib" -I"$(COLSERVR_DIR)" -I"$(PROTOCOL_DIR)" -I"$(RECPT_DIR)" \
-	-I"$(COLSERVR_DIR)" -I"$(INDEXERS_DIR)\mg" \
 	-I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3" -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\windows" \
-        -I"$(INDEXERS_DIR)\mg\lib" -I"$(INDEXERS_DIR)\mg\src\text" \
-    	-I"$(INDEXERS_DIR)\mgpp\lib" -I"$(INDEXERS_DIR)\mgpp\text"
+	-I"$(COLSERVR_DIR)" \
+	$(MG_INCLUDES) \
+    	$(MGPP_INCLUDES)
 
 LIBS = "$(COMMON_PACKAGES_DIR)\windows\crypt\crypt\crypt.lib" "$(COMMON_PACKAGES_DIR)\windows\expat\expat\libexpat.lib" \
@@ -141,8 +163,6 @@
 	"$(PROTOCOL_DIR)\gsdlprotocol.lib" \
 	"$(COLSERVR_DIR)\gsdlcolservr.lib" \
-	"$(INDEXERS_DIR)\mg\src\text\libmgtext.lib" \
-	"$(INDEXERS_DIR)\mg\lib\libmglib.lib" \
-	"$(INDEXERS_DIR)\mgpp\text\libmgpptext.lib" \
-	"$(INDEXERS_DIR)\mgpp\lib\libmgpplib.lib" \
+	$(MG_LIBS) \
+	$(MGPP_LIBS) \
 	"$(COMMON_DIR)\src\lib\gsdllib.lib"
 
Index: main/trunk/greenstone2/runtime-src/src/z3950/Makefile.in
===================================================================
--- main/trunk/greenstone2/runtime-src/src/z3950/Makefile.in	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/z3950/Makefile.in	(revision 21324)
@@ -43,4 +43,24 @@
 endif
 
+
+ENABLE_MG = @ENABLE_MG@
+ifeq ($(ENABLE_MG), 1)
+MG_INDEXERS_LIBS = $(INDEXERS_DIR)/mg/src/text/libmgtext.a \
+	$(INDEXERS_DIR)/mg/lib/libmglib.a
+else
+MG_INDEXERS_LIBS =
+endif
+
+ENABLE_MGPP = @ENABLE_MGPP@
+ifeq ($(ENABLE_MGPP), 1)
+MGPP_INDEXERS_LIBS = $(INDEXERS_DIR)/mgpp/text/libmgpptext.a \
+	$(INDEXERS_DIR)/mgpp/lib/libmgpplib.a
+MGPP_INCLUDES = -I$(INDEXERS_DIR)/mgpp/text 
+else
+MGPP_INDEXERS_LIBS =
+MGPP_INCLUDES =
+endif
+
+
 USE_SQLITE = @USE_SQLITE@
 ifeq ($(USE_SQLITE), 1)
@@ -61,5 +81,5 @@
 # Do NOT add the "recpt" directory here: the z39.50 code should be independent of the receptionist!
 INCLUDES = -I. -I$(GSDL_DIR) -I$(COMMON_DIR)/src/lib -I$(COLSERVR_DIR) -I$(PROTOCOL_DIR) \
-	-I$(INDEXERS_DIR)/mgpp/text -I$(RUNTIME_PACKAGES_DIR)/yaz/yaz-2.1.4/include \
+	$(MGPP_INCLUDES) -I$(RUNTIME_PACKAGES_DIR)/yaz/yaz-2.1.4/include \
 	-I$(RUNTIME_PACKAGES_DIR)/yaz/yaz-2.1.4/client -I$(RUNTIME_PACKAGES_DIR)/d2m
 INSTALL = @INSTALL@
@@ -118,8 +138,6 @@
 	$(PROTOCOL_DIR)/gsdlprotocol.a \
 	$(COLSERVR_DIR)/gsdlcolservr.a \
-	$(INDEXERS_DIR)/mg/src/text/libmgtext.a \
-	$(INDEXERS_DIR)/mg/lib/libmglib.a \
-	$(INDEXERS_DIR)/mgpp/text/libmgpptext.a \
-	$(INDEXERS_DIR)/mgpp/lib/libmgpplib.a \
+	$(MG_INDEXERS_LIBS) \
+	$(MGPP_INDEXERS_LIBS) \
 	$(COMMON_DIR)/src/lib/gsdllib.a
 
Index: main/trunk/greenstone2/runtime-src/src/z3950/win32.mak
===================================================================
--- main/trunk/greenstone2/runtime-src/src/z3950/win32.mak	(revision 21323)
+++ main/trunk/greenstone2/runtime-src/src/z3950/win32.mak	(revision 21324)
@@ -42,4 +42,7 @@
 ENABLE_ACCENTFOLD = 1
 USE_SQLITE = 1
+ENABLE_MG = 1
+ENABLE_MGPP = 1
+ENABLE_LUCENE = 1
 
 !IF $(DEBUG)
@@ -69,10 +72,25 @@
 !ENDIF
 
-!IF $(USE_SQLITE)
+!IF "$(USE_SQLITE)" == "0"
+SQLITE_LIBS = 
+!ELSE
 SQLITE_LIBS = "$(COMMON_PACKAGES_DIR)\sqlite\lib\sqlite3.lib"
-!ELSE
-SQLITE_LIBS = 
 !ENDIF
 
+!IF "$(ENABLE_MG)" == "0"
+MG_LIBS =
+!ELSE
+MG_LIBS = "$(INDEXERS_DIR)\mg\src\text\libmgtext.lib" \
+	"$(INDEXERS_DIR)\mg\lib\libmglib.lib"
+!ENDIF
+
+!IF "$(ENABLE_MGPP)" == "0"
+MGPP_LIBS =
+MGPP_INCLUDES =
+!ELSE
+MGPP_LIBS = "$(INDEXERS_DIR)\mgpp\text\libmgpptext.lib" \
+	"$(INDEXERS_DIR)\mgpp\lib\libmgpplib.lib"
+MGPP_INCLUDES = -I"$(INDEXERS_DIR)\mgpp\text"
+!ENDIF
 
 AR = lib
@@ -81,5 +99,5 @@
 # Do NOT add the "recpt" directory here: the z39.50 code should be independent of the receptionist!
 INCLUDES = -I"$(GSDL_DIR)" -I"$(COMMON_DIR)\src\lib" -I"$(COLSERVR_DIR)" -I"$(PROTOCOL_DIR)" \
-	-I"$(INDEXERS_DIR)\mgpp\text" -I"$(PACKAGES_DIR)\yaz\yaz-2.1.4\include" \
+	$(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"
@@ -142,8 +160,6 @@
 	$(PROTOCOL_DIR)\gsdlprotocol.lib \
 	$(COLSERVR_DIR)\gsdlcolservr.lib \
-	$(INDEXERS_DIR)\mg/src/text/libmgtext.lib \
-	$(INDEXERS_DIR)\mg/lib/libmglib.lib \
-	$(INDEXERS_DIR)\mgpp/text/libmgpptext.lib \
-	$(INDEXERS_DIR)\mgpp/lib/libmgpplib.lib \
+	$(MG_LIBS) \
+	$(MGPP_LIBS) \
 	$(COMMON_DIR)\src\lib\gsdllib.lib
 
