* [Qemu-devel] [PATCH] configure: use correct cflags in compiler checks
@ 2009-11-11 11:50 Michael S. Tsirkin
[not found] ` <m3fx8lz0ot.fsf@neno.mitica>
0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2009-11-11 11:50 UTC (permalink / raw)
To: qemu-devel
linux-user build on fedora 11 breaks because fallocate
is broken on that system if -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
are specified, which is what QEMU uses.
We do have a configure check to catch this and disable fallocate,
however, it turns out that default QEMU_CFLAGS/LDFLAGS were assigned in
script *after* all compiler checks: so during checks we were not running
compiler with same flags that we used for build later.
Fix this by moving QEMU_CFLAGS to before compiler checks, and using
comple_prog when checking for fallocate. This also fixes the fact that
we do some compiler checks while assigning the flags, right below a
comment that says "no cc tests beyond this point".
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
configure | 41 +++++++++++++++++++++--------------------
1 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/configure b/configure
index fb66246..bce9aff 100755
--- a/configure
+++ b/configure
@@ -91,6 +91,26 @@ ar="${cross_prefix}${ar}"
objcopy="${cross_prefix}${objcopy}"
ld="${cross_prefix}${ld}"
+# default flags for all hosts
+QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
+CFLAGS="-g $CFLAGS"
+QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
+QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
+QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
+QEMU_CFLAGS="-U_FORTIFY_SOURCE $QEMU_CFLAGS"
+QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS"
+LDFLAGS="-g $LDFLAGS"
+
+gcc_flags="-Wold-style-declaration -Wold-style-definition"
+cat > $TMPC << EOF
+int main(void) { }
+EOF
+for flag in $gcc_flags; do
+ if compile_prog "$QEMU_CFLAGS" "$flag" ; then
+ QEMU_CFLAGS="$flag $QEMU_CFLAGS"
+ fi
+done
+
# check that the C compiler works.
cat > $TMPC <<EOF
int main(void) {}
@@ -1585,7 +1605,7 @@ int main(void)
return 0;
}
EOF
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+if compile_prog "$ARCH_CFLAGS" "" ; then
fallocate=yes
fi
@@ -1733,28 +1753,9 @@ fi
# End of CC checks
# After here, no more $cc or $ld runs
-# default flags for all hosts
-QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
-CFLAGS="-g $CFLAGS"
if test "$debug" = "no" ; then
CFLAGS="-O2 $CFLAGS"
fi
-QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
-QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
-QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
-QEMU_CFLAGS="-U_FORTIFY_SOURCE $QEMU_CFLAGS"
-QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS"
-LDFLAGS="-g $LDFLAGS"
-
-gcc_flags="-Wold-style-declaration -Wold-style-definition"
-cat > $TMPC << EOF
-int main(void) { }
-EOF
-for flag in $gcc_flags; do
- if compile_prog "$QEMU_CFLAGS" "$flag" ; then
- QEMU_CFLAGS="$flag $QEMU_CFLAGS"
- fi
-done
# Consult white-list to determine whether to enable werror
# by default. Only enable by default for git builds
--
1.6.5.2.143.g8cc62
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Qemu-devel] Re: [PATCH] configure: use correct cflags in compiler checks
[not found] ` <m3fx8lz0ot.fsf@neno.mitica>
@ 2009-11-11 12:51 ` Michael S. Tsirkin
0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2009-11-11 12:51 UTC (permalink / raw)
To: Juan Quintela; +Cc: qemu-devel
On Wed, Nov 11, 2009 at 01:49:06PM +0100, Juan Quintela wrote:
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> Hi
>
> > @@ -1585,7 +1605,7 @@ int main(void)
> > return 0;
> > }
> > EOF
> > -if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
> > +if compile_prog "$ARCH_CFLAGS" "" ; then
>
> s/$ARCH_CFLAGS//
>
> ARCH_CFLAGS died long ago.
ACK.
> We need to do the same change for dup3
OK.
> This code was this way from the beggining. I agree that it is better to
> move the QEMU_CFLAGS to the top of the file.
>
> Later, Juan.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-11 12:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-11 11:50 [Qemu-devel] [PATCH] configure: use correct cflags in compiler checks Michael S. Tsirkin
[not found] ` <m3fx8lz0ot.fsf@neno.mitica>
2009-11-11 12:51 ` [Qemu-devel] " Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).