Skip to contentSkip to conversation

configure: allow user to override cflags.

PATCH In review Tristan Gingold 3 participants 4 messages Feb 7, 2011

lore
Share & tools
lore
#0 lore raw

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
index 598e8e1..f18ed0d 100755
@@ -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
#1 lore raw
Quoted 5 lines · Tristan Gingold

In order to allow user to override cflags, predefined flags must be inserted before user cflags.

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
index 598e8e1..f18ed0d 100755
@@ -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
 
#2 lore raw
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.

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
index 598e8e1..f18ed0d 100755
@@ -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
 
#3 lore raw
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

I think there's a very specific reason we do it this way but I cannot remember at the moment.

Commit 1e027be7e91d854d7a0132e4a32bdf222c33dcfe perhaps?

Ah, thanks. I then have to deal with -Wall.

Tristan.