]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix ARCH detection when default target of gcc doesn't match uname. 30/head
authorMika Lindqvist <postmaster@raasu.org>
Thu, 14 May 2015 12:13:18 +0000 (15:13 +0300)
committerMika Lindqvist <postmaster@raasu.org>
Thu, 14 May 2015 12:37:33 +0000 (15:37 +0300)
.gitignore
configure

index 3f55a29dc2fa421398b06321335be86c409fd03b..0cfd4838158e60a9a8ea1dfa0c04797cec2fd91b 100644 (file)
@@ -40,6 +40,7 @@ Testing
 zconf.h
 zconf.h.cmakein
 zconf.h.included
+ztest*
 
 configure.log
 a.out
index 336f630b1d6e2f6e9f991adb742ecf34ff397707..0b9ae30e16beb324f77fe1d44b0d23dff5546ada 100755 (executable)
--- a/configure
+++ b/configure
@@ -199,6 +199,18 @@ show $cc -c $test.c
 if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
   echo ... using gcc >> configure.log
   CC="$cc"
+# Re-check arch if gcc is a cross-compiler
+  GCC_ARCH=`$CC -dumpmachine | sed 's/-.*//g'`
+  case $GCC_ARCH in
+    i386 | i486 | i586 | i686)
+# Honor user choice if gcc is multilib and 64-bit is requested 
+      if test $build64 -eq 1; then
+        ARCH=x86_64
+      else
+        ARCH=$GCC_ARCH 
+      fi ;;
+    x86_64) ARCH=$GCC_ARCH ;;
+  esac
   CFLAGS="${CFLAGS--O3} ${ARCHS} -Wall"
   SFLAGS="${CFLAGS--O3} -fPIC"
   LDFLAGS="${LDFLAGS} ${ARCHS}"
@@ -271,6 +283,11 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
         DEFFILE='win32/zlib.def'
         RC='windres'
         RCFLAGS='--define GCC_WINDRES'
+        if [ "$CC" == "mingw32-gcc" ]; then
+          case $ARCH in
+          i386 | i486 | i586 | i686) RCFLAGS="${RCFLAGS} -F pe-i386";;
+          esac;
+        fi
         RCOBJS='zlibrc.o'
         STRIP='strip'
         EXE='.exe' ;;