Index: /main/trunk/greenstone2/common-src/indexers/mgpp/jni/Makefile.in
===================================================================
--- /main/trunk/greenstone2/common-src/indexers/mgpp/jni/Makefile.in	(revision 30862)
+++ /main/trunk/greenstone2/common-src/indexers/mgpp/jni/Makefile.in	(revision 30863)
@@ -39,4 +39,7 @@
   QUERY_LIBS = ../text/libmgpptext.a   ../lib/libmgpplib.a $(AFLIBS) -static-libstdc++ ../../../packages/iconv/lib/libiconv.a @LIBS@
   PASSES_LIBS = ../text/libmgpppass.a ../lib/libmgpplib.a -static-libstdc++ @LIBS@
+else ifeq ($(GSDLOS),darwin)
+  QUERY_LIBS = ../text/libmgpptext.a   ../lib/libmgpplib.a $(AFLIBS) -liconv @LIBS@
+  PASSES_LIBS = ../text/libmgpppass.a ../lib/libmgpplib.a @LIBS@
 else
   QUERY_LIBS = ../text/libmgpptext.a   ../lib/libmgpplib.a $(AFLIBS) ../../../packages/iconv/lib/libiconv.a @LIBS@
Index: /main/trunk/greenstone2/common-src/indexers/mgpp/text/Makefile.in
===================================================================
--- /main/trunk/greenstone2/common-src/indexers/mgpp/text/Makefile.in	(revision 30862)
+++ /main/trunk/greenstone2/common-src/indexers/mgpp/text/Makefile.in	(revision 30863)
@@ -61,9 +61,15 @@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 LDFLAGS = @LDFLAGS@
-DEP_LIBS = ../lib/libmgpplib.a $(AFLIBS) ../../../packages/iconv/lib/libiconv.a
-LIBS = $(DEP_LIBS) -lstdc++ @LIBS@
 TOUCH = echo timestamp >
 AWK = @AWK@
 GSDLOS = @gsdlos@
+ifeq ($(GSDLOS),darwin)
+  DEP_LIBS = ../lib/libmgpplib.a $(AFLIBS) 
+  LIBS = $(DEP_LIBS) -liconv -lstdc++ @LIBS@
+else
+  DEP_LIBS = ../lib/libmgpplib.a $(AFLIBS) ../../../packages/iconv/lib/libiconv.a
+  LIBS = $(DEP_LIBS) -lstdc++ @LIBS@
+endif
+
 
 datadir = $(prefix)/share
Index: /main/trunk/greenstone2/common-src/packages/configure
===================================================================
--- /main/trunk/greenstone2/common-src/packages/configure	(revision 30862)
+++ /main/trunk/greenstone2/common-src/packages/configure	(revision 30863)
@@ -178,5 +178,8 @@
 cd "$PACKAGES/iconv"
 
-# Darwin requires a different version of iconv than the one we use for Linux
+# Darwin before El Capitan required a different version of iconv than the one we use for Linux
+# From El Capitan onwards, we realised that MacOS came with its own specific version of libiconv
+# and so we'll use that system libiconv, in order to get around with Macs wiping out the DYLD_LIBRARY_PATH
+
 if test $GSDLOS != darwin ; then
 
@@ -194,30 +197,37 @@
     echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --enable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
     CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --enable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
+#else
+    ##darwin
+    #if test ! -d libiconv-1.11 ; then
+    #	gzip -dc gs-libiconv-1.11.tar.gz | tar -xf -
+    #fi
+    #cd "$PACKAGES/iconv/libiconv-1.11"
+    #
+    #if test -e Makefile ; then	
+    #	echo make distclean && \
+    #	    make distclean
+    #fi
+
+    ## configure
+    #echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --disable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
+    #CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --disable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
+#fi
+
+  # make
+  echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make $ENVIRONMENT
+  CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make $ENVIRONMENT
+
+  # make install
+  echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make install $ENVIRONMENT
+  CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make install $ENVIRONMENT
+
+  echo make distclean && \
+  make distclean
+
 else
-    if test ! -d libiconv-1.11 ; then
-	gzip -dc gs-libiconv-1.11.tar.gz | tar -xf -
-    fi
-    cd "$PACKAGES/iconv/libiconv-1.11"
-
-    if test -e Makefile ; then	
-	echo make distclean && \
-	    make distclean
-    fi
-
-    # configure
-    echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --disable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
-    CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --disable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
-fi
-
-# make
-echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make $ENVIRONMENT
-CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make $ENVIRONMENT
-
-# make install
-echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make install $ENVIRONMENT
-CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make install $ENVIRONMENT
-
-echo make distclean && \
-make distclean
+    # darwin, no need to compile libiconv: use system libiconv
+    echo "******* NOT Configuring iconv *****"
+    echo "******* Relying on system libiconv for compiling GS on MacOS *****"
+fi
 
 
