Add build-w32-w64 convenience option
authorAndre Heinecke <aheinecke@intevation.de>
Fri, 14 Jun 2013 15:11:29 +0000 (15:11 +0000)
committerAndre Heinecke <aheinecke@intevation.de>
Fri, 14 Jun 2013 15:11:29 +0000 (15:11 +0000)
    By default this option checks for amd64-mingw32msvc and
    calls configure with settings to additionally build gpgex
    for this host.

    * autogen.sh: Add option to build gpgEx for an x64 host

autogen.sh

index 45de064..58a4082 100755 (executable)
@@ -65,6 +65,7 @@ fi
 # Begin list of optional variables sourced from ~/.gnupg-autogen.rc
 w32_toolprefixes=
 w32_extraoptions=
+w64_toolprefixes=
 
 if [ -f "$HOME/.gnupg-autogen.rc" ]; then
     echo "sourcing extra definitions from $HOME/.gnupg-autogen.rc"
@@ -80,6 +81,11 @@ case "$1" in
         myhost="w32"
         shift
         ;;
+    --build-w32-w64)
+        myhost="w32"
+        myhostsub="w64"
+        shift
+        ;;
     --build*)
         echo "**Error**: invalid build option $1" >&2
         shift
@@ -102,6 +108,13 @@ if [ "$myhost" = "w32" ]; then
     build=`$tsdir/config.guess`
 
     case $myhostsub in
+        w64)
+          [ -z "$w32root" ] && w32root="$HOME/w32root"
+          toolprefixes="$w32_toolprefixes i686-w64-mingw32 i586-mingw32msvc"
+          toolprefixes="$toolprefixes i386-mingw32msvc mingw32"
+          extraoptions="$w32_extraoptions"
+          extratoolprefixes="$w64_toolprefixes amd64-mingw32msvc"
+          ;;
         *)
           [ -z "$w32root" ] && w32root="$HOME/w32root"
           toolprefixes="$w32_toolprefixes i686-w64-mingw32 i586-mingw32msvc"
@@ -121,6 +134,15 @@ if [ "$myhost" = "w32" ]; then
         fi
     done
 
+    w64_crossbindir=
+    for extra_host in $extratoolprefixes; do
+        if ${extra_host}-gcc --version >/dev/null 2>&1 ; then
+            w64_crossbindir=/usr/${extra_host}/bin
+            extraoptions="$extraoptions --with-additional-gpgex-host=${extra_host} "
+            break;
+        fi
+    done
+
     if [ -z "$crossbindir" ]; then
         echo "Cross compiler kit not installed" >&2
         echo "Under Debian GNU/Linux, you may install it using" >&2
@@ -129,6 +151,14 @@ if [ "$myhost" = "w32" ]; then
         exit 1
     fi
 
+    if [ "$myhostsub" = "w64" -a -z "$w64_crossbindir" ]; then
+        echo "Cross compiler for x64 architecture not installed" >&2
+        echo "Under Debian GNU/Linux, you may install it using" >&2
+        echo "  apt-get install mingw-w64" >&2
+        echo "Stop." >&2
+        exit 1
+    fi
+
     if [ -f "$tsdir/config.log" ]; then
         if ! head $tsdir/config.log | grep "$host" >/dev/null; then
             echo "Pease run a 'make distclean' first" >&2