From 23371b5f67cfb42038e5fc83d37656e9479f8f76 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Wed, 20 May 2015 00:11:06 +0300 Subject: [PATCH] Re: [PATCH] configure: Add sanity checking for environment variables --- 27/af0ef208d6b6614ee604e31c4c5a75bf92ba76 | 136 ++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 27/af0ef208d6b6614ee604e31c4c5a75bf92ba76 diff --git a/27/af0ef208d6b6614ee604e31c4c5a75bf92ba76 b/27/af0ef208d6b6614ee604e31c4c5a75bf92ba76 new file mode 100644 index 000000000..030e6effd --- /dev/null +++ b/27/af0ef208d6b6614ee604e31c4c5a75bf92ba76 @@ -0,0 +1,136 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id D55076DE13DA + for ; Tue, 19 May 2015 14:11:34 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 1.062 +X-Spam-Level: * +X-Spam-Status: No, score=1.062 tagged_above=-999 required=5 tests=[AWL=0.410, + SPF_NEUTRAL=0.652] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id C64P4DqSDwxl for ; + Tue, 19 May 2015 14:11:32 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by arlo.cworth.org (Postfix) with ESMTP id 06AA96DE137E + for ; Tue, 19 May 2015 14:11:31 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id B22C11000F2; + Wed, 20 May 2015 00:11:06 +0300 (EEST) +From: Tomi Ollila +To: David Bremner , + Ronny Chevalier +Subject: Re: [PATCH] configure: Add sanity checking for environment variables +In-Reply-To: <1432068728-26587-1-git-send-email-david@tethera.net> +References: + + <1432068728-26587-1-git-send-email-david@tethera.net> +User-Agent: Notmuch/0.19+115~g9a981cb (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 19 May 2015 21:11:34 -0000 + +On Tue, May 19 2015, David Bremner wrote: + +> Passing in environment variables incompatible with the compiler may +> cause other parts of the configure script to fail in hard to +> understand ways, so we abort early. +> --- +> +> This doesn't actually fix the problem Ronny points out, but a more +> serious one where configure can actually fail when using gcc, if +> e.g. nonsense is passed in CFLAGS. +> +> configure | 30 ++++++++++++++++++++++++++++-- +> 1 file changed, 28 insertions(+), 2 deletions(-) +> +> diff --git a/configure b/configure +> index 4af7ba9..cf618e8 100755 +> --- a/configure +> +++ b/configure +> @@ -269,6 +269,34 @@ dependencies are available: +> EOF +> +> errors=0 +> +printf "int main(void){return 0;}\n" > minimal.c +> + +> +printf "Sanity checking C compilation environment... " +> +if ${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1 + +Looks good, but there is 2 spcs ^^ there (and same in CXX part)... + +... also minimal.c is not removed if we exit early. + + +In the future we could think of writing all temp files to a subdirectory +which is cleared out using trap -- then we could drop all temp file +deletions... but now simple rm -f minimal minimal.c suffices + +Tomi + + +> +then +> + printf "Ok.\n" +> +else +> + printf "Fail.\n" +> + errors=$((errors + 1)) +> +fi +> + +> +printf "Sanity checking C++ compilation environment... " +> +if ${CXX} ${CXXFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1 +> +then +> + printf "Ok.\n" +> +else +> + printf "Fail.\n" +> + errors=$((errors + 1)) +> +fi +> + +> +if [ $errors -gt 0 ]; then +> + cat < +*** Error: Initial sanity checking of environment failed. Please try +> +running configure in a clean environment, and if the problem persists, +> +report a bug. +> +EOF +> + exit 1 +> +fi +> +> if pkg-config --version > /dev/null 2>&1; then +> have_pkg_config=1 +> @@ -690,8 +718,6 @@ else +> fi +> rm -f compat/check_asctime +> +> -printf "int main(void){return 0;}\n" > minimal.c +> - +> printf "Checking for rpath support... " +> if ${CC} -Wl,--enable-new-dtags -Wl,-rpath,/tmp/ -o minimal minimal.c >/dev/null 2>&1 +> then +> -- +> 2.1.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2