From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7800 Path: news.gmane.org!not-for-mail From: Shiz Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH v2] configure: work around compilers that merely warn for unknown options Date: Thu, 28 May 2015 05:52:22 +0200 Message-ID: <1432785142-8309-1-git-send-email-hi@shiz.me> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1432785195 26722 80.91.229.3 (28 May 2015 03:53:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 May 2015 03:53:15 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7812-gllmg-musl=m.gmane.org@lists.openwall.com Thu May 28 05:53:14 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Yxosb-0006qg-R1 for gllmg-musl@m.gmane.org; Thu, 28 May 2015 05:53:13 +0200 Original-Received: (qmail 21545 invoked by uid 550); 28 May 2015 03:53:11 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 20457 invoked from network); 28 May 2015 03:53:07 -0000 X-Virus-Scanned: amavisd-new at shiz.me X-Mailer: git-send-email 2.4.1 Xref: news.gmane.org gmane.linux.lib.musl.general:7800 Archived-At: some compilers (such as clang) accept unknown options without error, but then print warnings on each invocation, cluttering the build output and burying meaningful warnings. this patch makes configure's tryflag and tryldflag functions use additional options to turn the unknown-option warnings into errors, if available, but only at check time. these options are not output in config.mak to avoid the risk of spurious build breakage; if they work, they will have already done their job at configure time. --- configure | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 143dc92..7b29ae4 100755 --- a/configure +++ b/configure @@ -80,7 +80,7 @@ fi tryflag () { printf "checking whether compiler accepts %s... " "$2" echo "typedef int x;" > "$tmpc" -if $CC $2 -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then +if $CC $CFLAGS_TRY $2 -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then printf "yes\n" eval "$1=\"\${$1} \$2\"" eval "$1=\${$1# }" @@ -94,7 +94,7 @@ fi tryldflag () { printf "checking whether linker accepts %s... " "$2" echo "typedef int x;" > "$tmpc" -if $CC -nostdlib -shared "$2" -o /dev/null "$tmpc" >/dev/null 2>&1 ; then +if $CC $LDFLAGS_TRY -nostdlib -shared "$2" -o /dev/null "$tmpc" >/dev/null 2>&1 ; then printf "yes\n" eval "$1=\"\${$1} \$2\"" eval "$1=\${$1# }" @@ -113,7 +113,9 @@ CFLAGS_C99FSE= CFLAGS_AUTO= CFLAGS_MEMOPS= CFLAGS_NOSSP= +CFLAGS_TRY= LDFLAGS_AUTO= +LDFLAGS_TRY= OPTIMIZE_GLOBS= prefix=/usr/local/musl exec_prefix='$(prefix)' @@ -205,6 +207,14 @@ exit 1 fi # +# Figure out options to force errors on unknown flags. +# +tryflag CFLAGS_TRY -Werror=unknown-warning-option +tryflag CFLAGS_TRY -Werror=unused-command-line-argument +tryldflag LDFLAGS_TRY -Werror=unknown-warning-option +tryldflag LDFLAGS_TRY -Werror=unused-command-line-argument + +# # Need to know if the compiler is gcc to decide whether to build the # musl-gcc wrapper, and for critical bug detection in some gcc versions. # -- 2.3.6