Index: /main/trunk/greenstone3/build.xml
===================================================================
--- /main/trunk/greenstone3/build.xml	(revision 26764)
+++ /main/trunk/greenstone3/build.xml	(revision 26765)
@@ -176,4 +176,7 @@
 
   <!-- is there a better way to do this?? what about solaris?? -->
+  <condition property="os.bin.dir" value="${cross.os}">
+      <istrue value="${compile.cross}"/>
+  </condition>
   <condition property="os.bin.dir" value="windows">
     <os family="windows"/>
@@ -190,5 +193,5 @@
     </and>
   </condition>
-  
+
   
   <condition property="collection.building.disabled">
@@ -348,4 +351,16 @@
   </if>
   <property name="allargs" value="${cflags.arg} ${cxxflags.arg} ${cppflags.arg} ${ldflags.arg} ${path.arg} ${ldlpath.arg} ${pcpath.arg}"/>
+
+  <condition property="opt.cross.build" 
+	     value="--build=${cross.build}" else=" ">
+    <isset property="cross.build"/>
+  </condition>
+
+
+  <condition property="cross.configure.args" 
+	     value="--host=${cross.host} ${opt.cross.build} CPP=${cross.host}-cpp CC=${cross.host}-gcc CXX=${cross.host}-g++ LD=${cross.host}-ld AR=${cross.host}-ar RANLIB=${cross.host}-ranlib ${cross.configure.extraargs} crossOS=${cross.os}">
+    <istrue value="${compile.cross}"/>
+  </condition>
+
 
   <condition property="gs2.opt.args" value= " " else="--disable-mg --disable-mgpp --disable-accentfold --disable-gdbm --disable-sqlite">
@@ -1770,4 +1785,5 @@
       <arg value="--libdir=${lib.jni}"/>
       <arg value="--with-gdbm=${gdbm.home}"/>
+      <arg line="${cross.configure.args}"/>
     </exec>    
   </target>
@@ -1850,4 +1866,5 @@
         <arg value="--bindir=${basedir}/bin"/>
         <arg value="${static.arg}"/>
+        <arg line="${cross.configure.args}"/>
       </exec>
       <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
@@ -1886,10 +1903,28 @@
 
   <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
-    <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
-    <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
-    <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
-    <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
-    <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
-    <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
+
+    <if>
+
+      <bool><equals arg1="${os.bin.dir}" arg2="windows"/></bool>
+      <!-- cross compiling to windows -->
+      <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
+      <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
+      <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
+      <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
+      <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
+      <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
+      
+      <else>
+	<!-- otherwise do the usual Unix copies -->
+	<copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
+	<copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
+	<copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
+	<copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
+	<copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
+	<copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
+      </else>
+    </if>
+
+
   </target>
   <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
@@ -1941,4 +1976,7 @@
     
   <target name="configure-common-src" depends="init">
+<!--
+    <echo>cross configure args: ${cross.configure.args}</echo>
+-->
     <exec executable="${common.src.home}/configure" os="${os.unix}"
       dir="${common.src.home}" failonerror="true">
@@ -1947,4 +1985,5 @@
       <arg line="${gs2.opt.args}"/>
       <arg line="${static.arg}"/>
+      <arg line="${cross.configure.args}"/>
       <arg line="${allargs}"/>
     </exec>
@@ -2281,5 +2320,5 @@
       dir="${build.src.home}" failonerror="true">
       <arg value="--prefix=${gs2build.home}"/>
-      <arg line="${gs2.opt.args} ${static.arg} ${allargs}"/>
+      <arg line="${gs2.opt.args} ${static.arg} ${cross.configure.args} ${allargs}"/>
     </exec>
   </target>
