Index: /main/trunk/greenstone3/build.xml
===================================================================
--- /main/trunk/greenstone3/build.xml	(revision 22846)
+++ /main/trunk/greenstone3/build.xml	(revision 22847)
@@ -216,5 +216,5 @@
     </and>
   </condition>
-  
+
   <condition property="static.arg" value="LDFLAGS=-static" else=" ">
     <isset property="compile.static"/>
@@ -224,7 +224,7 @@
   <if><bool><isset property="use.support.lib"/></bool>
 	<if><bool><isset property="env.CFLAGS"/></bool>
-      <property name="cflags.arg" value="CFLAGS=-I${basedir}/ext/gnome-lib/${os.bin.dir}/include ${env.CFLAGS}"/>
+      <property name="cflags.arg" value="-I${basedir}/ext/gnome-lib/${os.bin.dir}/include ${env.CFLAGS}"/>
       <else>
-        <property name="cflags.arg" value="CFLAGS=-I${basedir}/ext/gnome-lib/${os.bin.dir}/include"/>
+        <property name="cflags.arg" value="-I${basedir}/ext/gnome-lib/${os.bin.dir}/include"/>
       </else>
     </if>
@@ -236,7 +236,7 @@
   <if><bool><isset property="use.support.lib"/></bool>
 	<if><bool><isset property="env.CPPFLAGS"/></bool>
-      <property name="cppflags.arg" value="CPPFLAGS=-I${basedir}/ext/gnome-lib/${os.bin.dir}/include ${env.CPPFLAGS}"/>
+      <property name="cppflags.arg" value="-I${basedir}/ext/gnome-lib/${os.bin.dir}/include ${env.CPPFLAGS}"/>
       <else>
-        <property name="cppflags.arg" value="CPPFLAGS=-I${basedir}/ext/gnome-lib/${os.bin.dir}/include"/>
+        <property name="cppflags.arg" value="-I${basedir}/ext/gnome-lib/${os.bin.dir}/include"/>
       </else>
     </if>
@@ -248,11 +248,23 @@
   <if><bool><isset property="use.support.lib"/></bool>
 	<if><bool><isset property="env.CXXFLAGS"/></bool>
-      <property name="cxxflags.arg" value="CXXFLAGS=-I${basedir}/ext/gnome-lib/${os.bin.dir}/include ${env.CXXFLAGS}"/>
+      <property name="cxxflags.arg" value="-I${basedir}/ext/gnome-lib/${os.bin.dir}/include ${env.CXXFLAGS}"/>
       <else>
-        <property name="cxxflags.arg" value="CXXFLAGS=-I${basedir}/ext/gnome-lib/${os.bin.dir}/include"/>
+        <property name="cxxflags.arg" value="-I${basedir}/ext/gnome-lib/${os.bin.dir}/include"/>
       </else>
     </if>
     <else>
       <property name="cxxflags.arg" value=" "/>
+    </else>
+  </if>
+
+  <if><bool><isset property="use.support.lib"/></bool>
+	<if><bool><isset property="env.LDFLAGS"/></bool>
+      <property name="ldflags.arg" value="-L${basedir}/ext/gnome-lib/${os.bin.dir}/lib ${env.LDFLAGS}"/>
+      <else>
+        <property name="ldflags.arg" value="-L${basedir}/ext/gnome-lib/${os.bin.dir}/lib"/>
+      </else>
+    </if>
+    <else>
+      <property name="ldflags.arg" value=" "/>
     </else>
   </if>
@@ -1345,7 +1357,4 @@
         <arg value="--bindir=${basedir}/bin"/>
         <arg value="${static.arg}"/>
-        <env key="CFLAGS" value="${cflags.arg}"/>        
-        <env key="CPPFLAGS" value="${cppflags.arg}"/>
-        <env key="CXXFLAGS" value="${cxxflags.arg}"/>
       </exec>
       <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
@@ -1440,5 +1449,5 @@
       <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
       <arg line="${gs2.opt.args}"/>
-      <arg line="${static.arg}"/>
+      <arg line="${static.arg} ${ldflags.arg}"/>
       <env key="CFLAGS" value="${cflags.arg}"/>        
       <env key="CPPFLAGS" value="${cppflags.arg}"/>
@@ -1480,4 +1489,5 @@
       <env key="CPPFLAGS" value="${cppflags.arg}"/>
       <env key="CXXFLAGS" value="${cxxflags.arg}"/>
+      <env key="LDFLAGS" value="${ldflags.arg}"/>
     </exec>
     <!-- windows: -->
@@ -1761,5 +1771,8 @@
       <arg value="--prefix=${gs2build.home}"/>
       <arg line="${gs2.opt.args}"/>
-      <arg line="${static.arg}"/>
+      <arg line="${static.arg} ${ldflags.arg}"/>
+      <env key="CFLAGS" value="${cflags.arg}"/>        
+      <env key="CPPFLAGS" value="${cppflags.arg}"/>
+      <env key="CXXFLAGS" value="${cxxflags.arg}"/>
     </exec>
   </target>
@@ -1772,4 +1785,5 @@
       <env key="CPPFLAGS" value="${cppflags.arg}"/>
       <env key="CXXFLAGS" value="${cxxflags.arg}"/>
+      <env key="LDFLAGS" value="${ldflags.arg}"/>
     </exec>
 	
