From patchwork Wed Jul 18 14:10:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 10124 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9B61523E56 for ; Wed, 18 Jul 2012 14:26:40 +0000 (UTC) Received: from mail-qc0-f180.google.com (mail-qc0-f180.google.com [209.85.216.180]) by fiordland.canonical.com (Postfix) with ESMTP id 4FFAEA180BC for ; Wed, 18 Jul 2012 14:26:40 +0000 (UTC) Received: by qcmv28 with SMTP id v28so953005qcm.11 for ; Wed, 18 Jul 2012 07:26:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=/67JS7oaUN8LVqtTkpowKlWUi47SmAga2Rn5YwZ9Gjo=; b=bUfoAksuNx1+0UZnRUxcoLkAIC7wttt6yrvHKTUselKyPogmYS9sMgST9SXXclaz8A 9HyGxa/2AERL/9seYYaLI75WtzbT8LUm00JpOFyOkMde9ieaXT0rbTLrHiDmaOKb1Erx 4IS94KlgPYJmvSuO7+28tT4iS809h/JO+z3bdZnFIj2CNh08a4hAtElh4PYa5uoJPF8a 9Asmj2HiIjlSynSXmVXTuUQ0IgiQZLRHI7JMveZb7HSjA1W8kd0SlaXUXXwiaBwZG91M ZxaTorHUpGCC1bx3dS3rgjx+3QnNbLwuPHJtUuqbKMxVtMsIXA64FMfieQLbQhDJAMrP SLdg== Received: by 10.50.57.167 with SMTP id j7mr2146738igq.53.1342621599457; Wed, 18 Jul 2012 07:26:39 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.153.7 with SMTP id i7csp368ibw; Wed, 18 Jul 2012 07:26:38 -0700 (PDT) Received: by 10.216.65.202 with SMTP id f52mr575569wed.206.1342621597603; Wed, 18 Jul 2012 07:26:37 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id n59si28457952wel.148.2012.07.18.07.26.36 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Jul 2012 07:26:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1SrUxQ-0003K8-A3; Wed, 18 Jul 2012 15:10:28 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Stefan Weil Subject: [PATCH 01/11] configure: Don't run configure tests with -Werror enabled Date: Wed, 18 Jul 2012 15:10:18 +0100 Message-Id: <1342620628-12751-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1342620628-12751-1-git-send-email-peter.maydell@linaro.org> References: <1342620628-12751-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQmxQwVLtF+v/4uUE3LXH3ld5KYLFZNWJ+3ff4TfRglEqxyQxvwl4cbg34yok5kgkxfSYjfw Don't run configure tests with -Werror in the compiler flags. The idea of -Werror is that it makes problems very obvious to developers, so they get fixed quickly. However, when running configure tests, failures due to -Werror are far from obvious -- they simply result in the test quietly failing when it should have passed. Not using -Werror is in line with recommended practice in the Autoconf world. This commit is essentially backing out the changes in commit 417c9d72. Instead we fix the problem that commit was trying to address in a different way: we add -Werror only for the test of the nss headers, with a comment that this is specifically intended to detect a bug in some releases of nss. We also have to clean up a bug in the smartcard test where it was trying to include smartcard_cflags in the test compile flags: this would always result in a failure with -Werror, because they include an escaped "$(SRC_PATH)" which is only valid when used in the final makefile. Signed-off-by: Peter Maydell Reviewed-by: Stefan Weil --- configure | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 0a3896e..383fa3d 100755 --- a/configure +++ b/configure @@ -1156,9 +1156,10 @@ gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags" -if test "$werror" = "yes" ; then - gcc_flags="-Werror $gcc_flags" -fi +# Note that we do not add -Werror to gcc_flags here, because that would +# enable it for all configure tests. If a configure test failed due +# to -Werror this would just silently disable some features, +# so it's too error prone. cat > $TMPC << EOF int main(void) { return 0; } EOF @@ -2656,8 +2657,16 @@ EOF smartcard_cflags="-I\$(SRC_PATH)/libcacard" libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs" libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags" + test_cflags="$libcacard_cflags" + # The header files in nss < 3.13.3 have a bug which causes them to + # emit a warning. If we're going to compile QEMU with -Werror, then + # test that the headers don't have this bug. Otherwise we would pass + # the configure test but fail to compile QEMU later. + if test "$werror" = "yes"; then + test_cflags="-Werror $test_cflags" + fi if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \ - compile_prog "$smartcard_cflags $libcacard_cflags" "$libcacard_libs"; then + compile_prog "$test_cflags" "$libcacard_libs"; then smartcard_nss="yes" QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags" libs_softmmu="$libcacard_libs $libs_softmmu" @@ -2903,6 +2912,11 @@ if test -z "$zero_malloc" ; then fi fi +# Now we've finished running tests it's OK to add -Werror to the compiler flags +if test "$werror" = "yes"; then + QEMU_CFLAGS="-Werror $QEMU_CFLAGS" +fi + if test "$solaris" = "no" ; then if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then LDFLAGS="-Wl,--warn-common $LDFLAGS"