Index: gs2-extensions/tdb/trunk/enable_tdb.sh
===================================================================
--- gs2-extensions/tdb/trunk/enable_tdb.sh	(revision 30254)
+++ gs2-extensions/tdb/trunk/enable_tdb.sh	(revision 30255)
@@ -75,136 +75,141 @@
 fi
 
-printf ' * Enabling TDB support in collection server... '
-# - Makefile.in
-MAKEFILE="${GSDLHOME}/runtime-src/src/colservr/Makefile.in"
-grep -q 'DUSE_TDB' "${MAKEFILE}"
-if [ $? -eq 1 ]
-then
-    # - Test for extension support in the makefile
-    grep -q 'EXT_DEFINES' "${MAKEFILE}"
-    if [ $? -eq 1 ]
-    then
-	sed -i 's:AR = ar:# Support for adding in extension classes\nEXT_DEFINES = -DUSE_TDB\nEXT_INCLUDES = -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\n\n&:' "${MAKEFILE}"
-	sed -i 's:DEFS = @DEFS@:& $(EXT_DEFINES):' "${MAKEFILE}"
-	sed -i 's:INCLUDES = -I. -I$(GSDL_DIR):& $(EXT_INCLUDES):' "${MAKEFILE}"
-    else
-	sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' "${MAKEFILE}"
-	sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib:' "${MAKEFILE}"
-    fi
-    echo 'Done!'
+# No runtime support needed for Greenstone3 - that's done via JNI
+if [ "${GSDL3HOME}x" == "x" ]
+then
+    printf ' * Enabling TDB support in collection server... '
+    # - Makefile.in
+    MAKEFILE="${GSDLHOME}/runtime-src/src/colservr/Makefile.in"
+    grep -q 'DUSE_TDB' "${MAKEFILE}"
+    if [ $? -eq 1 ]
+    then
+	# - Test for extension support in the makefile
+	grep -q 'EXT_DEFINES' "${MAKEFILE}"
+	if [ $? -eq 1 ]
+	then
+	    sed -i 's:AR = ar:# Support for adding in extension classes\nEXT_DEFINES = -DUSE_TDB\nEXT_INCLUDES = -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\n\n&:' "${MAKEFILE}"
+	    sed -i 's:DEFS = @DEFS@:& $(EXT_DEFINES):' "${MAKEFILE}"
+	    sed -i 's:INCLUDES = -I. -I$(GSDL_DIR):& $(EXT_INCLUDES):' "${MAKEFILE}"
+	else
+	    sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' "${MAKEFILE}"
+	    sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib:' "${MAKEFILE}"
+	fi
+	echo 'Done!'
+    else
+	echo 'already enabled'
+    fi
+    grep -q 'DUSE_TDB' "${MAKEFILE}"
+    if [ $? -eq 1 ]
+    then
+	echo "Error! Update of ${MAKEFILE} failed."
+	exit
+    fi
+
+    # - collectset.cpp
+    SRCFILE="${GSDLHOME}/runtime-src/src/colservr/collectset.cpp"
+    grep -q 'tdbclass.h' "${SRCFILE}"
+    if [ $? -eq 1 ]
+    then
+	grep -q '@EXTENSION HEADERS@' "${SRCFILE}"
+	if [ $? -eq 1 ]
+	then
+	    sed -i 's:collectset\:\:collectset (text_t& gsdlhome, text_t& collecthome):// @EXTENSION HEADERS@\n#include "tdbclass.h //TDB\n\n&:' "${SRCFILE}"
+	    sed -i 's:    // Use GDBM if the infodb type is empty or not one of the values above:    // @EXTENSION DATASOURCES@\n    if (infodbtype == "tdb") {db_ptr = new tdbclass(gsdlhome);} //TDB\n    if (infodbtype == "tdbserver") {db_ptr = new tdbclass(gsdlhome);} //TDBServer\n\n&:' "${SRCFILE}"
+	else
+	    sed -i 's:// @EXTENSION HEADERS@:&\n#include "tdbclass.h" //TDB:' "${SRCFILE}"
+	    sed -i 's:// @EXTENSION DATASOURCES@:&\n    if (infodbtype == "tdb") {db_ptr = new tdbclass(gsdlhome);} //TDB\n    if (infodbtype == "tdbserver") {db_ptr = new tdbclass(gsdlhome);} //TDBServer:' "${SRCFILE}"
+	fi
+    fi
+    grep -q 'tdbclass.h' "${SRCFILE}"
+    if [ $? -eq 1 ]
+    then
+	echo "Error! Update of ${SRCFILE} failed."
+	exit
+    fi
+
+    # - collectserver.cpp
+    # There are now sanity tests in collectserver to ensure appropriate indexer
+    # and infodbtype are compiled into colservr.  While not fatal to leave this
+    # as is, it does cause vast amounts of error messages in (Apache) logs
+    SRCFILE="${GSDLHOME}/runtime-src/src/colservr/collectserver.cpp"
+    grep -q 'TDB' "${SRCFILE}"
+    if [ $? -eq 1 ]
+    then
+	grep -q '@EXTENSION DATASOURCES@' "${SRCFILE}"
+	if [ $? -eq 1 ]
+	then
+	    sed -i 's:  if (infodbtype=="gdbm") {:  // @EXTENSION DATASOURCES@\n  if (infodbtype == "tdb") { return; } // TDB Do nothing\n  if (infodbtype == "tdbserver") { return; } // TDBServer Do nothing\n\n&:' "${SRCFILE}"
+	else
+	    sed -i 's:  // @EXTENSION DATASOURCES@:&\n  if (infodbtype == "tdb") { return; } // TDB Do nothing\n  if (infodbtype == "tdbserver") { return; } // TDBServer Do nothing:' "${SRCFILE}"
+	fi
+    fi
+    grep -q 'TDB' "${SRCFILE}"
+    if [ $? -eq 1 ]
+    then
+	echo "Error! Update of ${SRCFILE} failed."
+	exit
+    fi
+
+    printf ' * Enabling TDB support in Greenstone receptionist... '
+    # - Makefile.in
+    MAKEFILE="${GSDLHOME}/runtime-src/src/recpt/Makefile.in"
+    grep -q 'DUSE_TDB' "${MAKEFILE}"
+    if [ $? -eq 1 ]
+    then
+	grep -q 'EXT_DEFINES' "${MAKEFILE}"
+	if [ $? -eq 1 ]
+	then
+	    sed -i 's:AR = ar:# Support for adding in extension classes\nEXT_DEFINES = -DUSE_TDB\nEXT_INCLUDES = -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\nEXT_LDFLAGS = -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib\nEXT_LIBS = -ltdb\n\n&:' "${MAKEFILE}"
+	    sed -i 's:DEFS = @DEFS@ -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DHAVE_CONFIG_H:& $(EXT_DEFINES):' "${MAKEFILE}"
+	    sed -i 's:INCLUDES = -I. -I$(GSDL_DIR):& $(EXT_INCLUDES):' "${MAKEFILE}"
+	    sed -i 's:LDFLAGS = @LDFLAGS@ @ARCH_DEP_FLAGS@:& $(EXT_LDFLAGS):' "${MAKEFILE}"
+	    sed -i 's:LIBS = @LIBS@ $(GDBM_LIBS):& $(EXT_LIBS):' "${MAKEFILE}"
+	else
+	    sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' "${MAKEFILE}"
+	    sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib:' "${MAKEFILE}"
+	    sed -i 's:EXT_LDFLAGS =.*:& -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib:' "${MAKEFILE}"
+	    sed -i 's:EXT_LIBS =.*:& -ltdb:' "${MAKEFILE}"
+	fi
+	echo 'Done!'
+    else
+	echo 'already enabled'
+    fi
+    grep -q 'DUSE_TDB' "${MAKEFILE}"
+    if [ $? -eq 1 ]
+    then
+	echo "Error! Update of ${MAKEFILE} failed."
+    fi
+
+    printf ' * Enabling TDB support in OAI Server receptionist... '
+    # - Makefile.in
+    MAKEFILE="${GSDLHOME}/runtime-src/src/oaiservr/Makefile.in"
+    grep -q 'DUSE_TDB' "${MAKEFILE}"
+    if [ $? -eq 1 ]
+    then
+	grep -q 'EXT_DEFINES' "${MAKEFILE}"
+	if [ $? -eq 1 ]
+	then
+	    sed -i 's:CC = @CC@:# Support for adding in extension classes\nEXT_DEFINES = -DUSE_TDB\nEXT_INCLUDES = -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\nEXT_LDFLAGS = -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib\nEXT_LIBS = -ltdb\n\n&:' "${MAKEFILE}"
+	    sed -i 's:DEFS = @DEFS@:& $(EXT_DEFINES):' "${MAKEFILE}"
+	    sed -i 's:INCLUDES = -I$(COMMON_DIR)/src/lib:& $(EXT_INCLUDES):' "${MAKEFILE}"
+	    sed -i 's:LDFLAGS = @LDFLAGS@ @ARCH_DEP_FLAGS@:& $(EXT_LDFLAGS):' "${MAKEFILE}"
+	    sed -i 's:LIBS = @LIBS@ $(GDBM_LIBS):& $(EXT_LIBS):' "${MAKEFILE}"
+	else
+	    sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' "${MAKEFILE}"
+	    sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib:' "${MAKEFILE}"
+	    sed -i 's:EXT_LDFLAGS =.*:& -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib:' "${MAKEFILE}"
+	    sed -i 's:EXT_LIBS =.*:& -ltdb:' "${MAKEFILE}"
+	fi
+	echo 'Done!'
+    else
+	echo 'already enabled'
+    fi
+    grep -q 'DUSE_TDB' "${MAKEFILE}"
+    if [ $? -eq 1 ]
+    then
+	echo "Error! Update of ${MAKEFILE} failed."
+    fi
 else
-    echo 'already enabled'
-fi
-grep -q 'DUSE_TDB' "${MAKEFILE}"
-if [ $? -eq 1 ]
-then
-    echo "Error! Update of ${MAKEFILE} failed."
-    exit
-fi
-
-# - collectset.cpp
-SRCFILE="${GSDLHOME}/runtime-src/src/colservr/collectset.cpp"
-grep -q 'tdbclass.h' "${SRCFILE}"
-if [ $? -eq 1 ]
-then
-    grep -q '@EXTENSION HEADERS@' "${SRCFILE}"
-    if [ $? -eq 1 ]
-    then
-	sed -i 's:collectset\:\:collectset (text_t& gsdlhome, text_t& collecthome):// @EXTENSION HEADERS@\n#include "tdbclass.h //TDB\n\n&:' "${SRCFILE}"
-	sed -i 's:    // Use GDBM if the infodb type is empty or not one of the values above:    // @EXTENSION DATASOURCES@\n    if (infodbtype == "tdb") {db_ptr = new tdbclass(gsdlhome);} //TDB\n    if (infodbtype == "tdbserver") {db_ptr = new tdbclass(gsdlhome);} //TDBServer\n\n&:' "${SRCFILE}"
-    else
-	sed -i 's:// @EXTENSION HEADERS@:&\n#include "tdbclass.h" //TDB:' "${SRCFILE}"
-	sed -i 's:// @EXTENSION DATASOURCES@:&\n    if (infodbtype == "tdb") {db_ptr = new tdbclass(gsdlhome);} //TDB\n    if (infodbtype == "tdbserver") {db_ptr = new tdbclass(gsdlhome);} //TDBServer:' "${SRCFILE}"
-    fi
-fi
-grep -q 'tdbclass.h' "${SRCFILE}"
-if [ $? -eq 1 ]
-then
-    echo "Error! Update of ${SRCFILE} failed."
-    exit
-fi
-
-# - collectserver.cpp
-# There are now sanity tests in collectserver to ensure appropriate indexer and
-# infodbtype are compiled into colservr. While not fatal to leave this as is,
-# it does cause vast amounts of error messages in (Apache) logs
-SRCFILE="${GSDLHOME}/runtime-src/src/colservr/collectserver.cpp"
-grep -q 'TDB' "${SRCFILE}"
-if [ $? -eq 1 ]
-then
-    grep -q '@EXTENSION DATASOURCES@' "${SRCFILE}"
-    if [ $? -eq 1 ]
-    then
-	sed -i 's:  if (infodbtype=="gdbm") {:  // @EXTENSION DATASOURCES@\n  if (infodbtype == "tdb") { return; } // TDB Do nothing\n  if (infodbtype == "tdbserver") { return; } // TDBServer Do nothing\n\n&:' "${SRCFILE}"
-    else
-	sed -i 's:  // @EXTENSION DATASOURCES@:&\n  if (infodbtype == "tdb") { return; } // TDB Do nothing\n  if (infodbtype == "tdbserver") { return; } // TDBServer Do nothing:' "${SRCFILE}"
-    fi
-fi
-grep -q 'TDB' "${SRCFILE}"
-if [ $? -eq 1 ]
-then
-    echo "Error! Update of ${SRCFILE} failed."
-    exit
-fi
-
-printf ' * Enabling TDB support in Greenstone receptionist... '
-# - Makefile.in
-MAKEFILE="${GSDLHOME}/runtime-src/src/recpt/Makefile.in"
-grep -q 'DUSE_TDB' "${MAKEFILE}"
-if [ $? -eq 1 ]
-then
-    grep -q 'EXT_DEFINES' "${MAKEFILE}"
-    if [ $? -eq 1 ]
-    then
-	sed -i 's:AR = ar:# Support for adding in extension classes\nEXT_DEFINES = -DUSE_TDB\nEXT_INCLUDES = -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\nEXT_LDFLAGS = -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib\nEXT_LIBS = -ltdb\n\n&:' "${MAKEFILE}"
-	sed -i 's:DEFS = @DEFS@ -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DHAVE_CONFIG_H:& $(EXT_DEFINES):' "${MAKEFILE}"
-	sed -i 's:INCLUDES = -I. -I$(GSDL_DIR):& $(EXT_INCLUDES):' "${MAKEFILE}"
-	sed -i 's:LDFLAGS = @LDFLAGS@ @ARCH_DEP_FLAGS@:& $(EXT_LDFLAGS):' "${MAKEFILE}"
-	sed -i 's:LIBS = @LIBS@ $(GDBM_LIBS):& $(EXT_LIBS):' "${MAKEFILE}"
-    else
-	sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' "${MAKEFILE}"
-	sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib:' "${MAKEFILE}"
-	sed -i 's:EXT_LDFLAGS =.*:& -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib:' "${MAKEFILE}"
-	sed -i 's:EXT_LIBS =.*:& -ltdb:' "${MAKEFILE}"
-    fi
-    echo 'Done!'
-else
-    echo 'already enabled'
-fi
-grep -q 'DUSE_TDB' "${MAKEFILE}"
-if [ $? -eq 1 ]
-then
-    echo "Error! Update of ${MAKEFILE} failed."
-fi
-
-
-printf ' * Enabling TDB support in OAI Server receptionist... '
-# - Makefile.in
-MAKEFILE="${GSDLHOME}/runtime-src/src/oaiservr/Makefile.in"
-grep -q 'DUSE_TDB' "${MAKEFILE}"
-if [ $? -eq 1 ]
-then
-    grep -q 'EXT_DEFINES' "${MAKEFILE}"
-    if [ $? -eq 1 ]
-    then
-	sed -i 's:CC = @CC@:# Support for adding in extension classes\nEXT_DEFINES = -DUSE_TDB\nEXT_INCLUDES = -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\nEXT_LDFLAGS = -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib\nEXT_LIBS = -ltdb\n\n&:' "${MAKEFILE}"
-	sed -i 's:DEFS = @DEFS@:& $(EXT_DEFINES):' "${MAKEFILE}"
-	sed -i 's:INCLUDES = -I$(COMMON_DIR)/src/lib:& $(EXT_INCLUDES):' "${MAKEFILE}"
-	sed -i 's:LDFLAGS = @LDFLAGS@ @ARCH_DEP_FLAGS@:& $(EXT_LDFLAGS):' "${MAKEFILE}"
-	sed -i 's:LIBS = @LIBS@ $(GDBM_LIBS):& $(EXT_LIBS):' "${MAKEFILE}"
-    else
-	sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' "${MAKEFILE}"
-	sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib:' "${MAKEFILE}"
-	sed -i 's:EXT_LDFLAGS =.*:& -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib:' "${MAKEFILE}"
-	sed -i 's:EXT_LIBS =.*:& -ltdb:' "${MAKEFILE}"
-    fi
-    echo 'Done!'
-else
-    echo 'already enabled'
-fi
-grep -q 'DUSE_TDB' "${MAKEFILE}"
-if [ $? -eq 1 ]
-then
-    echo "Error! Update of ${MAKEFILE} failed."
+    echo " * Runtime TDB support delegated to Java/JNI/TDB bridge."
 fi
 
