diff mbox

[RFC,1/4] configure: move EXTRA_CFLAGS append to the end

Message ID 1453740558-16303-2-git-send-email-alex.bennee@linaro.org
State New
Headers show

Commit Message

Alex Bennée Jan. 25, 2016, 4:49 p.m. UTC
When using --extra-cflags to override defaults the flags need to be set
at the end lest they be reset by later options. This affects
optimisation as well where "-O0 .. -O3" will just takes the most recent
option.

We also set CFLAGS so the options are passed to other built binaries.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 configure | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

-- 
2.7.0

Comments

Peter Maydell Jan. 25, 2016, 5:04 p.m. UTC | #1
On 25 January 2016 at 16:49, Alex Bennée <alex.bennee@linaro.org> wrote:
> When using --extra-cflags to override defaults the flags need to be set

> at the end lest they be reset by later options. This affects

> optimisation as well where "-O0 .. -O3" will just takes the most recent

> option.

>

> We also set CFLAGS so the options are passed to other built binaries.

>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  configure | 7 +++++--

>  1 file changed, 5 insertions(+), 2 deletions(-)

>

> diff --git a/configure b/configure

> index 44ac9ab..7d23c6c 100755

> --- a/configure

> +++ b/configure

> @@ -360,8 +360,7 @@ for opt do

>    ;;

>    --cpu=*) cpu="$optarg"

>    ;;

> -  --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"

> -                    EXTRA_CFLAGS="$optarg"

> +  --extra-cflags=*) EXTRA_CFLAGS="$optarg"

>    ;;

>    --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"

>                       EXTRA_LDFLAGS="$optarg"

> @@ -4715,6 +4714,10 @@ fi

>  QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"

>  libs_softmmu="$pixman_libs $libs_softmmu"

>

> +# Now it the time to append extra-cflags

> +CFLAGS="$CFLAGS $EXTRA_CFLAGS"


We don't in general use plain CFLAGS. What breaks without this?
(For instance, when we build pixman we set its CFLAGS to include
extra_cflags in the makefile rune.)

> +QEMU_CFLAGS="$QEMU_CFLAGS $EXTRA_CFLAGS"

> +

>  echo "Install prefix    $prefix"

>  echo "BIOS directory    `eval echo $qemu_datadir`"

>  echo "binary directory  `eval echo $bindir`"


I think this will break the use case where you were using --extra-cflags
to pass flags that are needed for the test code in configure to build
correctly.

thanks
-- PMM
Peter Maydell Jan. 25, 2016, 5:37 p.m. UTC | #2
On 25 January 2016 at 16:49, Alex Bennée <alex.bennee@linaro.org> wrote:
> When using --extra-cflags to override defaults the flags need to be set

> at the end lest they be reset by later options. This affects

> optimisation as well where "-O0 .. -O3" will just takes the most recent

> option.

>

> We also set CFLAGS so the options are passed to other built binaries.

>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>


By the way, is this fixing a regression since your commit de3852877f1e,
or did that not fully fix the issue it claimed to?

thanks
-- PMM
diff mbox

Patch

diff --git a/configure b/configure
index 44ac9ab..7d23c6c 100755
--- a/configure
+++ b/configure
@@ -360,8 +360,7 @@  for opt do
   ;;
   --cpu=*) cpu="$optarg"
   ;;
-  --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
-                    EXTRA_CFLAGS="$optarg"
+  --extra-cflags=*) EXTRA_CFLAGS="$optarg"
   ;;
   --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
                      EXTRA_LDFLAGS="$optarg"
@@ -4715,6 +4714,10 @@  fi
 QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
 libs_softmmu="$pixman_libs $libs_softmmu"
 
+# Now it the time to append extra-cflags
+CFLAGS="$CFLAGS $EXTRA_CFLAGS"
+QEMU_CFLAGS="$QEMU_CFLAGS $EXTRA_CFLAGS"
+
 echo "Install prefix    $prefix"
 echo "BIOS directory    `eval echo $qemu_datadir`"
 echo "binary directory  `eval echo $bindir`"