Skip to contentSkip to conversation

qemu/configure: fix CFLAGS handling for i386

PATCH Superseded Olaf Hering 3 participants 6 messages Mar 30, 2012 – Apr 2, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu/configure: fix CFLAGS handling for i386

configure will generate incorrect CFLAGS which will lead to compile errors due to unknown gcc options, IFF CFLAGS was already in the environment during configure invocation.

Add a space before the -march=i486 gcc option.

This patch is against the qemu-xen tree, but it should apply also to qemu.git since it has the same issue. Please apply to both trees.

---
 configure |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
Index: qemu-xen-dir-remote/configure
===================================================================
@@ -2637,7 +2637,7 @@ int main(int argc, char **argv)
 }
 EOF
   if ! compile_prog "" "" ; then
-    CFLAGS+="-march=i486"
+    CFLAGS+=" -march=i486"
   fi
 fi
#1 lore raw

Hi Olaf,

Am 30.03.2012 17:24, schrieb Olaf Hering:

Quoted 11 lines

configure will generate incorrect CFLAGS which will lead to compile errors due to unknown gcc options, IFF CFLAGS was already in the environment during configure invocation.

Add a space before the -march=i486 gcc option.

This patch is against the qemu-xen tree, but it should apply also to qemu.git since it has the same issue. Please apply to both trees.

The patch applies fine to upstream QEMU (we should strip leading qemu/ from the commit message though).

This is the only usage of += outside Makefile fragments, so I wonder if its use may have been by accident. Is it safe in a POSIX context? Or should we better use CFLAGS="$CFLAGS -march=486"?
For QEMU_CFLAGS we use the pattern QEMU_CFLAGS="-options $QEMU_CFLAGS" to allow overriding options.

Andreas

Quoted 18 lines
---
 configure |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: qemu-xen-dir-remote/configure
===================================================================

configure +1 -1
@@ -2637,7 +2637,7 @@ int main(int argc, char **argv)
 }
 EOF
   if ! compile_prog "" "" ; then
-    CFLAGS+="-march=i486"
+    CFLAGS+=" -march=i486"
   fi
 fi
 
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw
Quoted 3 lines · Andreas Färber

This is the only usage of += outside Makefile fragments, so I wonder if its use may have been by accident. Is it safe in a POSIX context? Or should we better use CFLAGS="$CFLAGS -march=486"?

Now that I look at the shebang, configure is a sh script and += is most likely a bash feature. So your suggestion for the assignment is correct.

Olaf

#3 lore raw

Am 31.03.2012 18:46, schrieb Olaf Hering:

Quoted 8 lines · Andreas Färber
Quoted 4 lines

This is the only usage of += outside Makefile fragments, so I wonder if its use may have been by accident. Is it safe in a POSIX context? Or should we better use CFLAGS="$CFLAGS -march=486"?

Now that I look at the shebang, configure is a sh script and += is most likely a bash feature. So your suggestion for the assignment is correct.

...apart from the missing i in i486, obviously. ;)

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#4 lore raw
In reply to Andreas Färber
Quoted 5 lines · Andreas Färber

This is the only usage of += outside Makefile fragments, so I wonder if its use may have been by accident. Is it safe in a POSIX context? Or should we better use CFLAGS="$CFLAGS -march=486"?
For QEMU_CFLAGS we use the pattern QEMU_CFLAGS="-options $QEMU_CFLAGS" to allow overriding options.

For that matter, should this be setting QEMU_CFLAGS instead of CFLAGS? I have to say I'm not entirely sure what the difference is...

-- PMM

#5 lore raw
Quoted 10 lines · Peter Maydell
Quoted 5 lines · Andreas Färber

This is the only usage of += outside Makefile fragments, so I wonder if its use may have been by accident. Is it safe in a POSIX context? Or should we better use CFLAGS="$CFLAGS -march=486"?
For QEMU_CFLAGS we use the pattern QEMU_CFLAGS="-options $QEMU_CFLAGS" to allow overriding options.

For that matter, should this be setting QEMU_CFLAGS instead of CFLAGS? I have to say I'm not entirely sure what the difference is...

I havent looked into qemu build internals, but there is most likely a concept of HOST_TOOLS_CFLAGS and TARGET_CFLAGS in qemus Makefiles.

Olaf