Index: main/trunk/greenstone3/build.xml
===================================================================
--- main/trunk/greenstone3/build.xml	(revision 23610)
+++ main/trunk/greenstone3/build.xml	(revision 23611)
@@ -223,5 +223,4 @@
   <!-- If building a release then we want to adjust environment variables so that the support library can be see during compilation -->
   <if><bool><isset property="use.support.lib"/></bool>
-
 	<property name="gnome-lib-dir" value="${basedir}/ext/gnome-lib-minimal/${os.bin.dir}"/>
 
@@ -268,8 +267,18 @@
 	</if>
 
-	<if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
-		<property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.LD_LIBRARY_PATH}&quot;"/>
+	<if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
+		<if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
+			<property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.DYLD_LIBRARY_PATH}&quot;"/>
+		<else>
+			<property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
+		</else>
+		</if>
 	<else>
-        	<property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
+		<if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
+			<property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.LD_LIBRARY_PATH}&quot;"/>
+		<else>
+			<property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
+		</else>
+		</if>
 	</else>
 	</if>
@@ -318,12 +327,24 @@
 		</if>
 
-		<if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
-			<property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${env.LD_LIBRARY_PATH}&quot;"/>
+		<if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
+			<if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
+				<property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${env.DYLD_LIBRARY_PATH}&quot;"/>
+			<else>
+				<property name="ldlpath.arg" value=" "/>
+			</else>
+			</if>
 		<else>
-			<property name="ldlpath.arg" value=" "/>
-		</else>
+			<if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
+				<property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${env.LD_LIBRARY_PATH}&quot;"/>
+			<else>
+				<property name="ldlpath.arg" value=" "/>
+			</else>
+			</if>
+		</else>	 
 		</if>
 	</else>
   </if>
+  <property name="allargs" value="${cflags.arg} ${cxxflags.arg} ${cppflags.arg} ${ldflags.arg} ${path.arg} ${ldlpath.arg} ${pcpath.arg}"/>
+  <echo>ALL ARGS = ${allargs}</echo>
 
   <condition property="gs2.opt.args" value= " " else="--disable-mg --disable-mgpp --disable-accentfold --disable-gdbm --disable-sqlite">
@@ -1524,11 +1545,5 @@
       <arg line="${gs2.opt.args}"/>
       <arg line="${static.arg}"/>
-      <arg line="${ldflags.arg}"/>
-      <arg line="${cflags.arg}"/>        
-      <arg line="${cppflags.arg}"/>
-      <arg line="${cxxflags.arg}"/>
-      <arg line="${path.arg}"/>
-      <arg line="${pcpath.arg}"/>
-      <arg line="${ldlpath.arg}"/>
+      <arg line="${allargs}"/>
     </exec>
   </target>
@@ -1844,16 +1859,9 @@
   <target name="configure-build-src" depends="init" if="collection.building.enabled"
     description="Configure the build-src component">
+    <echo>ALL ARGS - BUILD-SRC = ${allargs}</echo>
     <exec executable="${build.src.home}/configure" os="${os.unix}"
       dir="${build.src.home}" failonerror="true">
       <arg value="--prefix=${gs2build.home}"/>
-      <arg line="${gs2.opt.args}"/>
-      <arg line="${static.arg}"/>
-      <arg line="${ldflags.arg}"/>
-      <arg line="${cflags.arg}"/>        
-      <arg line="${cppflags.arg}"/>
-      <arg line="${cxxflags.arg}"/>
-      <arg line="${path.arg}"/>
-      <arg line="${pcpath.arg}"/>
-      <arg line="${ldlpath.arg}"/>
+      <arg line="${gs2.opt.args} ${static.arg} ${allargs}"/>
     </exec>
   </target>
@@ -1863,4 +1871,5 @@
     
     <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
+    	<arg line="${ldlpath.arg}"/>
     </exec>
 	
