libbfd: prevent from incorrect assignment of $CFLAGS
Jim Huang [Sun, 9 Dec 2012 15:47:29 +0000 (23:47 +0800)]
For older versions of binutils, the automake script can not recognize the suffixing
environment variable $CFLAGS and complain as following:

       (cd libbfd-binutils-2.17 ; \
         .././../binutils/binutils-2.17/configure \
          --prefix=/usr/local --target= --host=x86_64-unknown-linux-gnu \
          --build=x86_64-unknown-linux-gnu --program-transform-name='s,y,y,' \
          --disable-shared \
          --enable-install-libbfd --with-included-gettext CFLAGS=" -m32") && \
        touch stmp-config-host-libbfd
configure: warning: CFLAGS= -m32: invalid host type
creating cache ./config.cache
configure: error: can only configure for one host and one target at a time

Change-Id: I075a37d4bfd9b5744ec9c5ffc73446cbbba220b8

Makefile.in

index 482d318..cb3a741 100644 (file)
@@ -368,12 +368,12 @@ config-host-libbfd: stmp-config-host-libbfd
 LIBBFD_CONFIG_ARGS=--prefix=$(prefix) \
        --target=${target_alias} --host=${host} --build=${build} \
        $(baseargs) --disable-shared \
-       --enable-install-libbfd --with-included-gettext \
-       CFLAGS="$(CFLAGS) -m32"
+       --enable-install-libbfd --with-included-gettext
 stmp-config-host-libbfd: config.status
        ([ -d libbfd-${BINUTILS_VERSION} ] || \
          mkdir libbfd-${BINUTILS_VERSION}) && \
        (cd libbfd-${BINUTILS_VERSION} ; \
+        export CFLAGS="$(CFLAGS) -m32" ; \
         $(call find-package-srcdir, ${BINUTILS_VERSION})/configure \
          $(LIBBFD_CONFIG_ARGS)) && \
        $(STAMP) $@