autoconf-archive-maintainers | |
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AX_PROG_CC_FOR_BUILD should use CFLAGS, etc. in non-crossbuilds
From: |
Paolo Bonzini |
Subject: |
Re: AX_PROG_CC_FOR_BUILD should use CFLAGS, etc. in non-crossbuilds |
Date: |
Sat, 11 Jan 2014 16:48:48 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9 |
Il 02/01/2014 17:46, Ryan Lortie ha scritto:
> hi,
>
> Please excuse (and redirect) me if this is not the correct place to file
> this bug.
>
> The AX_PROG_CC_FOR_BUILD macro in autoconf-archive defines the variables
> CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD and LDFLAGS_FOR_BUILD so that
> people can build executables on the build machine with different
> compiler flags when cross-compiling.
>
> When not cross-compiling, however, this is a bit of an anti-feature
> because it requires the user to explicitly set these variables in
> addition to the usual CFLAGS, CPPFLAGS, LDFLAGS.
>
> I consider that there are probably two approaches to fixing it.
>
> First approach (code added to the top of the macro):
>
> if test "$cross_compiling" = "no"; then
> if test -n "$CFLAGS"; then
> CFLAGS_FOR_BUILD=$CFLAGS
> fi
> if test -n "$CPPFLAGS"; then
> CPPFLAGS_FOR_BUILD=$CPPFLAGS
> fi
> if test -n "$LDFLAGS"; then
> LDFLAGS_FOR_BUILD=$LDFLAGS
> fi
> fi
>
> ie: if we see that we are not cross-compiling, initialise the values of
> the _FOR_BUILD variables from their host counterparts (since host ==
> build).
>
> Second approach:
>
> if test -z "$CFLAGS_FOR_BUILD" -a -n "$CFLAGS"; then
> CFLAGS_FOR_BUILD="$CFLAGS"
> fi
> if test -z "$CPPFLAGS_FOR_BUILD" -a -n "$CPPFLAGS"; then
> CPPFLAGS_FOR_BUILD="$CPPFLAGS"
> fi
> if test -z "$LDFLAGS_FOR_BUILD" -a -n "$LDFLAGS"; then
> LDFLAGS_FOR_BUILD="$LDFLAGS"
> fi
>
> ie: always initialise these variables from their host counterparts
> except in the case that they are already explicitly set.
I think the second approach is wrong. The $cross_compiling test is
necessary. But you can do: initialise the variables from their host
counterparts in the non-cross-compiling case, but not in the case that
they are already explicitly set.
What do you think?
Paolo