From: Mika Lindqvist Date: Thu, 14 May 2015 12:13:18 +0000 (+0300) Subject: Fix ARCH detection when default target of gcc doesn't match uname. X-Git-Tag: 1.9.9-b1~818^2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F30%2Fhead;p=thirdparty%2Fzlib-ng.git Fix ARCH detection when default target of gcc doesn't match uname. --- diff --git a/.gitignore b/.gitignore index 3f55a29d..0cfd4838 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ Testing zconf.h zconf.h.cmakein zconf.h.included +ztest* configure.log a.out diff --git a/configure b/configure index 336f630b..0b9ae30e 100755 --- 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' ;;