From: David Bremner <david@tethera.net>
To: Tomi Ollila <tomi.ollila@iki.fi>,
David Bremner <david@tethera.net>,
Ronny Chevalier <chevalier.ronny@gmail.com>
Cc: notmuch@notmuchmail.org
Subject: [PATCH] configure: Add sanity checking for environment variables
Date: Wed, 20 May 2015 10:12:31 +0200 [thread overview]
Message-ID: <1432109551-16861-1-git-send-email-david@tethera.net> (raw)
In-Reply-To: <m2617onuhh.fsf@guru.guru-group.fi>
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.
---
meh, the previous version was borken by lazy evaluation of CXXFLAGS
using make syntax. Better suggestions for how to do this?
configure | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 4af7ba9..650b976 100755
--- a/configure
+++ b/configure
@@ -269,6 +269,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 <<EOF
+*** Error: Initial sanity checking of environment failed. Please try
+running configure in a clean environment, and if the problem persists,
+report a bug.
+EOF
+ rm -f minimal minimal.c
+ exit 1
+fi
if pkg-config --version > /dev/null 2>&1; then
have_pkg_config=1
@@ -690,8 +719,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
next prev parent reply other threads:[~2015-05-20 8:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-19 18:31 configure tool Ronny Chevalier
2015-05-19 19:01 ` David Bremner
2015-05-19 19:08 ` Ronny Chevalier
2015-05-19 20:52 ` [PATCH] configure: Add sanity checking for environment variables David Bremner
2015-05-19 21:11 ` Tomi Ollila
2015-05-20 8:12 ` David Bremner [this message]
2015-05-20 8:37 ` Tomi Ollila
2015-05-20 8:41 ` Tomi Ollila
2015-05-20 8:48 ` Tomi Ollila
2015-05-20 9:45 ` David Bremner
2015-05-20 10:45 ` Tomi Ollila
2015-05-23 18:33 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432109551-16861-1-git-send-email-david@tethera.net \
--to=david@tethera.net \
--cc=chevalier.ronny@gmail.com \
--cc=notmuch@notmuchmail.org \
--cc=tomi.ollila@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).