Re: [PATCH] configure: Add sanity checking for environment variables
authorTomi Ollila <tomi.ollila@iki.fi>
Tue, 19 May 2015 21:11:06 +0000 (00:11 +0300)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:48:54 +0000 (14:48 -0700)
27/af0ef208d6b6614ee604e31c4c5a75bf92ba76 [new file with mode: 0644]

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