configure: allow user to override cflags.
PATCH 1/1 configure: allow user to override cflags.
In order to allow user to override cflags, predefined flags must be inserted before user cflags.
--- configure | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
configure +4 -2
@@ -939,8 +939,10 @@ cat > $TMPC << EOF int main(void) { return 0; } EOF for flag in $gcc_flags; do - if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then - QEMU_CFLAGS="$QEMU_CFLAGS $flag" + if compile_prog "-Werror $flag $QEMU_CFLAGS" "" ; then + # Note: flag must be prepended so that they could be overriden by + # user flags (such as -fno-stack-protector) + QEMU_CFLAGS="$flag $QEMU_CFLAGS" fi done
Signature · 1 line
1.7.3.GIT
Quoted 5 lines · Tristan Gingold
In order to allow user to override cflags, predefined flags must be inserted before user cflags.
Signed-off-by Tristan Gingold<[email protected]>
I think there's a very specific reason we do it this way but I cannot remember at the moment.
Regards,
Anthony Liguori
Quoted 22 lines
--- configure | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)configure +4
-2@@ -939,8 +939,10 @@ cat> $TMPC<< EOF int main(void) { return 0; } EOF for flag in $gcc_flags; do - if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then - QEMU_CFLAGS="$QEMU_CFLAGS $flag" + if compile_prog "-Werror $flag $QEMU_CFLAGS" "" ; then + # Note: flag must be prepended so that they could be overriden by + # user flags (such as -fno-stack-protector) + QEMU_CFLAGS="$flag $QEMU_CFLAGS" fi done
Quoted 9 lines · Anthony Liguori
Quoted 5 lines · Tristan Gingold
In order to allow user to override cflags, predefined flags must be inserted before user cflags.
Signed-off-by Tristan Gingold<[email protected]>I think there's a very specific reason we do it this way but I cannot remember at the moment.
Commit 1e027be7e91d854d7a0132e4a32bdf222c33dcfe perhaps?
Quoted 27 lines
Regards,
Anthony Liguori
Quoted 22 lines
--- configure | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)configure +4
-2@@ -939,8 +939,10 @@ cat> $TMPC<< EOF int main(void) { return 0; } EOF for flag in $gcc_flags; do - if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then - QEMU_CFLAGS="$QEMU_CFLAGS $flag" + if compile_prog "-Werror $flag $QEMU_CFLAGS" "" ; then + # Note: flag must be prepended so that they could be overriden by + # user flags (such as -fno-stack-protector) + QEMU_CFLAGS="$flag $QEMU_CFLAGS" fi done
Quoted 6 lines · Markus Armbruster
Quoted 4 lines · Anthony Liguori
Quoted 3 lines · Tristan Gingold
In order to allow user to override cflags, predefined flags must be inserted before user cflags.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Signed-off-by Tristan Gingold<[email protected]>I think there's a very specific reason we do it this way but I cannot remember at the moment.
Commit
1e027be7e91d854d7a0132e4a32bdf222c33dcfeperhaps?
Ah, thanks. I then have to deal with -Wall.
Tristan.