Index: gs2-extensions/tdb/trunk/enable_tdb.sh
===================================================================
--- gs2-extensions/tdb/trunk/enable_tdb.sh	(revision 30252)
+++ gs2-extensions/tdb/trunk/enable_tdb.sh	(revision 30253)
@@ -10,6 +10,16 @@
 
 # Test that GSDLHOME is set otherwise we won't be able to find the required files
-if [ "${GSDLHOME}x" == "x" ] ; then echo 'Error! GSDLHOME not set. Please source setup.bash before running.' ; echo ; exit 0 ; fi
-if [ "${GSDLOS}x" == "x" ] ; then echo 'Error! GSDLOS not set. Please source setup.bash before running.' ; echo ; exit 0 ; fi
+if [ "${GSDLHOME}x" == "x" ]
+then
+    echo 'Error! GSDLHOME not set. Please source setup.bash before running.'
+    echo
+    exit 0
+fi
+if [ "${GSDLOS}x" == "x" ]
+then
+    echo 'Error! GSDLOS not set. Please source setup.bash before running.'
+    echo
+    exit 0
+fi
 
 # Black magic to determine the actual name of the extension folder (in case I
@@ -17,9 +27,17 @@
 EXTNAME=${PWD##*/}
 
-echo ' - enabling TDB support in common function library'
 # - Symlink the source file into place
-ln -f -s "${GSDLHOME}/ext/${EXTNAME}/src/lib/tdbclass.h" "${GSDLHOME}/common-src/src/lib/tdbclass.h"
-ln -f -s "${GSDLHOME}/ext/${EXTNAME}/src/lib/tdbclass.cpp" "${GSDLHOME}/common-src/src/lib/tdbclass.cpp"
-# - Makefile.in
+printf ' * Symlinking TDB source files into place... '
+if [ -f "${GSDLHOME}/common-src/src/lib/tdbclass.h" ]
+then
+    echo 'already present'
+else
+    ln -f -s "${GSDLHOME}/ext/${EXTNAME}/src/lib/tdbclass.h" "${GSDLHOME}/common-src/src/lib/tdbclass.h"
+    ln -f -s "${GSDLHOME}/ext/${EXTNAME}/src/lib/tdbclass.cpp" "${GSDLHOME}/common-src/src/lib/tdbclass.cpp"
+    echo 'Done!'
+fi
+
+# - Makefile.in
+printf ' * Enabling TDB support in common function library... '
 MAKEFILE="${GSDLHOME}/common-src/src/lib/Makefile.in"
 # - I have no idea why this is commented out in the Makefile
@@ -28,21 +46,24 @@
 if [ $? -eq 1 ]
 then
-  # - Test for extension support in the makefile
-  grep -q 'EXT_DEFINES' "${MAKEFILE}"
-  if [ $? -eq 1 ]
-  then
-    # - No Extension variables yet - add them in with TDB parts
-    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_SOURCES = tdbclass.cpp\nEXT_OBJECTS = tdbclass.o\n\n&:' "${MAKEFILE}"
-    sed -i 's:DEFS = @DEFS@ .*:& $(EXT_DEFINES):' "${MAKEFILE}"
-    sed -i 's:INCLUDES = -I. .*:& $(EXT_INCLUDES):' "${MAKEFILE}"
-    sed -i 's:unitool.cpp:& \\\n        $(EXT_SOURCES):' "${MAKEFILE}"
-    sed -i 's:unitool.o:& \\\n        $(EXT_OBJECTS):' "${MAKEFILE}"
-  else
-    # - Extension support already present - add TDB parts
-    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_SOURCES =.*:& tdbclass.cpp:' "${MAKEFILE}"
-    sed -i 's:EXT_OBJECTS =.*:& tdbclass.o:' "${MAKEFILE}"
-  fi
+    # - Test for extension support in the makefile
+    grep -q 'EXT_DEFINES' "${MAKEFILE}"
+    if [ $? -eq 1 ]
+    then
+	# - No Extension variables yet - add them in with TDB parts
+	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_SOURCES = tdbclass.cpp\nEXT_OBJECTS = tdbclass.o\n\n&:' "${MAKEFILE}"
+	sed -i 's:DEFS = @DEFS@ .*:& $(EXT_DEFINES):' "${MAKEFILE}"
+	sed -i 's:INCLUDES = -I. .*:& $(EXT_INCLUDES):' "${MAKEFILE}"
+	sed -i 's:unitool.cpp:& \\\n        $(EXT_SOURCES):' "${MAKEFILE}"
+	sed -i 's:unitool.o:& \\\n        $(EXT_OBJECTS):' "${MAKEFILE}"
+    else
+	# - Extension support already present - add TDB parts
+	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_SOURCES =.*:& tdbclass.cpp:' "${MAKEFILE}"
+	sed -i 's:EXT_OBJECTS =.*:& tdbclass.o:' "${MAKEFILE}"
+    fi
+    echo 'Done!'
+else
+    echo 'already enabled'
 fi
 grep -q 'DUSE_TDB' "${MAKEFILE}"
@@ -53,5 +74,5 @@
 fi
 
-echo ' - enabling TDB support in collection server'
+printf ' * Enabling TDB support in collection server... '
 # - Makefile.in
 MAKEFILE="${GSDLHOME}/runtime-src/src/colservr/Makefile.in"
@@ -59,21 +80,24 @@
 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
-fi
-grep -q 'DUSE_TDB' "${MAKEFILE}"
-if [ $? -eq 1 ]
-then
-  echo "Error! Update of ${MAKEFILE} failed."
-  exit
+    # - 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
 
@@ -83,19 +107,19 @@
 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
+    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
+    echo "Error! Update of ${SRCFILE} failed."
+    exit
 fi
 
@@ -108,20 +132,20 @@
 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
+    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
-
-echo ' - enabling TDB support in Greenstone receptionist'
+    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"
@@ -129,27 +153,30 @@
 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
-fi
-grep -q 'DUSE_TDB' "${MAKEFILE}"
-if [ $? -eq 1 ]
-then
-  echo "Error! Update of ${MAKEFILE} failed."
-fi
-
-
-echo ' - enabling TDB support in OAI Server receptionist'
+    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"
@@ -157,23 +184,26 @@
 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
-fi
-grep -q 'DUSE_TDB' "${MAKEFILE}"
-if [ $? -eq 1 ]
-then
-  echo "Error! Update of ${MAKEFILE} failed."
+    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
 
