From patchwork Wed Nov 11 11:50:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 38131 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EA824B6F2B for ; Wed, 11 Nov 2009 22:55:06 +1100 (EST) Received: from localhost ([127.0.0.1]:60186 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8Bmv-0006V8-AH for incoming@patchwork.ozlabs.org; Wed, 11 Nov 2009 06:55:01 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N8Bkp-0005Y3-V5 for qemu-devel@nongnu.org; Wed, 11 Nov 2009 06:52:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N8Bkk-0005TQ-A9 for qemu-devel@nongnu.org; Wed, 11 Nov 2009 06:52:50 -0500 Received: from [199.232.76.173] (port=46572 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8Bkj-0005Sj-Qf for qemu-devel@nongnu.org; Wed, 11 Nov 2009 06:52:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58820) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N8Bkj-0002Gw-5r for qemu-devel@nongnu.org; Wed, 11 Nov 2009 06:52:45 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nABBqfki008936 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 11 Nov 2009 06:52:42 -0500 Received: from redhat.com (dhcp-0-94.tlv.redhat.com [10.35.0.94]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id nABBqdud017544 for ; Wed, 11 Nov 2009 06:52:40 -0500 Date: Wed, 11 Nov 2009 13:50:09 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <20091111115009.GA19210@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH] configure: use correct cflags in compiler checks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 < /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