From: David Bremner Date: Wed, 20 May 2015 09:45:06 +0000 (+0200) Subject: [PATCH] configure: Add sanity checking for environment variables X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cdb7386b3d9c042206fe3a8cf29e4691c360acce;p=notmuch-archives.git [PATCH] configure: Add sanity checking for environment variables --- diff --git a/8d/434ad825499e29c62a4dfcd48659685e00f7f0 b/8d/434ad825499e29c62a4dfcd48659685e00f7f0 new file mode 100644 index 000000000..0a0d4d2c8 --- /dev/null +++ b/8d/434ad825499e29c62a4dfcd48659685e00f7f0 @@ -0,0 +1,117 @@ +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 7DAF96DE19F6 + for ; Wed, 20 May 2015 02:46:59 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.294 +X-Spam-Level: +X-Spam-Status: No, score=0.294 tagged_above=-999 required=5 tests=[AWL=0.284, + T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] 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 FcUrNwukgyGI for ; + Wed, 20 May 2015 02:46:57 -0700 (PDT) +Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net + [87.98.215.224]) + by arlo.cworth.org (Postfix) with ESMTPS id 64B3C6DE19E7 + for ; Wed, 20 May 2015 02:46:57 -0700 (PDT) +Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim + 4.80) (envelope-from ) + id 1Yv0ZM-0003nh-H7; Wed, 20 May 2015 09:45:44 +0000 +Received: (nullmailer pid 15867 invoked by uid 1000); Wed, 20 May 2015 + 09:45:09 -0000 +From: David Bremner +To: Tomi Ollila , David Bremner +Subject: [PATCH] configure: Add sanity checking for environment variables +Date: Wed, 20 May 2015 11:45:06 +0200 +Message-Id: <1432115106-15806-1-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.1.4 +In-Reply-To: +References: +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: Wed, 20 May 2015 09:46:59 -0000 + +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. +--- +Gah, I left out the one line I actually wanted feedback on. + + configure | 32 ++++++++++++++++++++++++++++++-- + 1 file changed, 30 insertions(+), 2 deletions(-) + +diff --git a/configure b/configure +index 4af7ba9..9b01025 100755 +--- a/configure ++++ b/configure +@@ -47,6 +47,7 @@ CC=${CC:-cc} + CXX=${CXX:-c++} + CFLAGS=${CFLAGS:--g -O2} + CPPFLAGS=${CPPFLAGS:-} ++CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}} + CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)} + LDFLAGS=${LDFLAGS:-} + XAPIAN_CONFIG=${XAPIAN_CONFIG:-xapian-config} +@@ -269,6 +270,35 @@ 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 ++then ++ printf "OK.\n" ++else ++ printf "Fail.\n" ++ errors=$((errors + 1)) ++fi ++ ++printf "Sanity checking C++ compilation environment... " ++if ${CXX} ${CXXFLAGS_for_sh} ${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 < /dev/null 2>&1; then + have_pkg_config=1 +@@ -690,8 +720,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 +