Skip to contentSkip to conversation

configure: Replace bash code by standard shell code

PATCH In review Stefan Weil 4 participants 8 messages Jul 15, 2012 – Jul 20, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 configure: Replace bash code by standard shell code

"+=" does not work with dash and other simple /bin/sh implementations.

The new code prepends the flag while the old code either did not work (it continued after an error message which typically was not read) or appended the flag. That difference should not matter here.

---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure +1 -1
index 12351f5..0269ba0 100755
@@ -2822,7 +2822,7 @@ int main(int argc, char **argv)
 }
 EOF
   if ! compile_prog "" "" ; then
-    CFLAGS+="-march=i486"
+    CFLAGS="-march=i486 $CFLAGS"
   fi
 fi
 
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 2/2 configure: Fix errors in test for__sync_fetch_and_and

The old test code raises two compiler warnings which are errors since commit 417c9d72d48275d19c60861896efd4962d21aca2.

These errors could result in compilations with compiler flag -march486 (so all nice features of newer processors got lost).

---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure +1 -1
index 0269ba0..df5c99a 100755
@@ -2809,7 +2809,7 @@ fi
 # specification is necessary
 if test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
   cat > $TMPC << EOF
-int sfaa(unsigned *ptr)
+static int sfaa(int *ptr)
 {
   return __sync_fetch_and_and(ptr, 0);
 }
Signature · 1 line
1.7.0.4
#2 lore raw
In reply to Stefan Weil
Quoted 16 lines · Stefan Weil

"+=" does not work with dash and other simple /bin/sh implementations.

The new code prepends the flag while the old code either did not work (it continued after an error message which typically was not read) or appended the flag. That difference should not matter here.

---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure +0 -0
index 12351f5..0269ba0 100755

configure int main(int argc, char **argv) · line 2827

Quoted 7 lines
configure +1 -1
@@ -2822,7 +2822,7 @@ int main(int argc, char **argv)
 }
 EOF
   if ! compile_prog "" "" ; then
-    CFLAGS+="-march=i486"
+    CFLAGS="-march=i486 $CFLAGS"
   fi
 fi

This is not quite the right fix for this. This flag should be in QEMU_CFLAGS, because it is a flag without which QEMU would be unable to compile. See previous discussion in this thread:

http://lists.xen.org/archives/html/xen-devel/2012-04/msg00330.html

(Unfortunately Olaf never submitted an updated patch.)

-- PMM

#3 lore raw

Am 17.07.2012 20:43, schrieb Peter Maydell:

Quoted 30 lines · Stefan Weil
Quoted 16 lines

"+=" does not work with dash and other simple /bin/sh implementations.

The new code prepends the flag while the old code either did not work (it continued after an error message which typically was not read) or appended the flag. That difference should not matter here.

---
  configure |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
configure +0 -0
index 12351f5..0269ba0 100755

configure int main(int argc, char **argv) · line 2827

Quoted 7 lines
configure +1 -1
@@ -2822,7 +2822,7 @@ int main(int argc, char **argv)
  }
  EOF
    if ! compile_prog "" "" ; then
-    CFLAGS+="-march=i486"
+    CFLAGS="-march=i486 $CFLAGS"
    fi
  fi

This is not quite the right fix for this. This flag should be in QEMU_CFLAGS, because it is a flag without which QEMU would be unable to compile. See previous discussion in this thread:

Quoted 6 lines

http://lists.xen.org/archives/html/xen-devel/2012-04/msg00330.html

(Unfortunately Olaf never submitted an updated patch.)

-- PMM

If the user overrides CFLAGS, I expect that he/she will notice that compilation fails and hopefully find the cause (only expert users should override CFLAGS). Overriding -march=i486 might be useful to set -march=i686.

Therefore it was not so obvious to me whether CFLAGS or QEMU_CFLAGS was the better choice.

I don't mind if we decide to use QEMU_CFLAGS here, but suggest putting that change in a separate patch.

This one fixes a shell syntax error without changing the macro name.

Regards,

Stefan W.

#4 lore raw
Quoted 7 lines · Stefan Weil

If the user overrides CFLAGS, I expect that he/she will notice that compilation fails and hopefully find the cause (only expert users should override CFLAGS). Overriding -march=i486 might be useful to set -march=i686.

Therefore it was not so obvious to me whether CFLAGS or QEMU_CFLAGS was the better choice.

Yes, I had to dig to find out the underlying principle distinguishing the two. Having found it I would like us to fix this in a way which respects that principle.

-- PMM

#5 lore raw

Am 17.07.2012 21:19, schrieb Peter Maydell:

Quoted 6 lines · Stefan Weil
Quoted 5 lines

If the user overrides CFLAGS, I expect that he/she will notice that compilation fails and hopefully find the cause (only expert users should override CFLAGS). Overriding -march=i486 might be useful to set -march=i686.

Quoted 6 lines
Quoted 2 lines

Therefore it was not so obvious to me whether CFLAGS or QEMU_CFLAGS was the better choice.

Yes, I had to dig to find out the underlying principle distinguishing the two. Having found it I would like us to fix this in a way which respects that principle.

I was planning to pick up Olaf's patch doing just that but haven't got around to it in time for v1.1. Olaf, do you have time to resubmit a patch to upstream qemu-devel as requested by Peter and me?

Regards,
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
#6 lore raw
Quoted 10 lines · Andreas Färber

Am 17.07.2012 21:19, schrieb Peter Maydell:

Quoted 9 lines · Stefan Weil
Quoted 7 lines

If the user overrides CFLAGS, I expect that he/she will notice that compilation fails and hopefully find the cause (only expert users should override CFLAGS). Overriding -march=i486 might be useful to set -march=i686.

Therefore it was not so obvious to me whether CFLAGS or QEMU_CFLAGS was the better choice.

Quoted 7 lines
Quoted 3 lines

Yes, I had to dig to find out the underlying principle distinguishing the two. Having found it I would like us to fix this in a way which respects that principle.

I was planning to pick up Olaf's patch doing just that but haven't got around to it in time for v1.1. Olaf, do you have time to resubmit a patch to upstream qemu-devel as requested by Peter and me?

I actually wrote a patch sitting on top of this one by Stefan which moves the flag to QEMU_CFLAGS;
both are in the 11-patch series dealing with various configure Werror issues:
http://patchwork.ozlabs.org/patch/171689/
http://patchwork.ozlabs.org/patch/171706/

-- PMM

#7 lore raw
Quoted 5 lines · Peter Maydell

I actually wrote a patch sitting on top of this one by Stefan which moves the flag to QEMU_CFLAGS;
both are in the 11-patch series dealing with various configure Werror issues:
http://patchwork.ozlabs.org/patch/171689/

The actual CFLAGS issue had to be solved differently in the xen sources. And the patch above solves the bug in configure.

Olaf