unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] configure: Be more verbose when compiler sanity checks fail
@ 2017-04-08 19:23 Tomi Ollila
  2017-05-07 11:48 ` David Bremner
  0 siblings, 1 reply; 2+ messages in thread
From: Tomi Ollila @ 2017-04-08 19:23 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

When configure could not get past initial compiler sanity check
the user was left with no explanation why this happened (usually
the reason is that compilers are not installed).

By printing the executed command line and re-executing it without
output redirection user gets better information how to proceed
(or ask for help) to resolve this problem.

The shell builtin 'printf' is used to print the executed command
line to ensure verbatim output.
---

It is easy to test the behaviour before and after this change:

$ CC=haz-no-cc CXX=haz-no-cxx ./configure


 configure | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 3447d86..ed7c228 100755
--- a/configure
+++ b/configure
@@ -322,22 +322,29 @@ 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
+test_cmdline="${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal"
+if  ${test_cmdline} > /dev/null 2>&1
 then
     printf "OK.\n"
 else
     printf "Fail.\n"
     errors=$((errors + 1))
+    printf Executed:; printf ' %s' ${test_cmdline}; echo
+    ${test_cmdline}
 fi
 
 printf "Sanity checking C++ compilation environment... "
-if ${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
+test_cmdline="${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal"
+if ${test_cmdline} > /dev/null 2>&1
 then
     printf "OK.\n"
 else
     printf "Fail.\n"
     errors=$((errors + 1))
+    printf Executed:; printf ' %s' ${test_cmdline}; echo
+    ${test_cmdline}
 fi
+unset test_cmdline
 
 if [ $errors -gt 0 ]; then
     cat <<EOF
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] configure: Be more verbose when compiler sanity checks fail
  2017-04-08 19:23 [PATCH] configure: Be more verbose when compiler sanity checks fail Tomi Ollila
@ 2017-05-07 11:48 ` David Bremner
  0 siblings, 0 replies; 2+ messages in thread
From: David Bremner @ 2017-05-07 11:48 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: tomi.ollila, notmuch

Tomi Ollila <tomi.ollila@iki.fi> writes:

> By printing the executed command line and re-executing it without
> output redirection user gets better information how to proceed
> (or ask for help) to resolve this problem.

pushed to master (some time ago)

d

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-07 11:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-08 19:23 [PATCH] configure: Be more verbose when compiler sanity checks fail Tomi Ollila
2017-05-07 11:48 ` David Bremner

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).