public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: coypu@sdf.org
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Provide early warning about configure failure
Date: Sat, 08 Dec 2018 22:22:00 -0000	[thread overview]
Message-ID: <20181208222132.GA204@SDF.ORG> (raw)

[-- Attachment #1: Type: text/plain, Size: 639 bytes --]

Hi folks,

I was bitten by this, and it seemed like a few people online had similar
issues (for example https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65794).

We run a configure script from another configure script, to generate auto-build.h.
Secondary configure might fail.
This failure isn't fatal, and we continue running a configure script.
The output is obscured by a lot of configure messages.
We fail later auto-build.h not existing.

I added a test to see if making auto-build.h succeeded and fail & warn
otherwise. As an added bonus, it means the secondary configure
config.log stays around to inspect.

Let me know what you think.

[-- Attachment #2: auto-build.diff --]
[-- Type: text/plain, Size: 1713 bytes --]

configure.ac: Fail early if creating auto-build.h fails
configure: regen

---
 gcc/configure    | 8 ++++++--
 gcc/configure.ac | 4 ++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index dc4298097..5bf4b2954 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11893,6 +11893,10 @@ else
 		--enable-languages=${enable_languages-all} \
 		--target=$target_alias --host=$build_alias --build=$build_alias
 
+	if test ! -f auto-host.h ; then
+		as_fn_error $? "Failed to generate build configuration" "$LINENO" 5
+	fi
+
 	# We just finished tests for the build machine, so rename
 	# the file auto-build.h in the gcc directory.
 	mv auto-host.h ../auto-build.h
@@ -18572,7 +18576,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18575 "configure"
+#line 18579 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18678,7 +18682,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18681 "configure"
+#line 18685 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 2a1f3bb39..5f05ab8da 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1740,6 +1740,10 @@ else
 		--enable-languages=${enable_languages-all} \
 		--target=$target_alias --host=$build_alias --build=$build_alias
 
+	if test ! -f auto-host.h ; then
+		AC_MSG_ERROR([Failed to generate build configuration])
+	fi
+
 	# We just finished tests for the build machine, so rename
 	# the file auto-build.h in the gcc directory.
 	mv auto-host.h ../auto-build.h
-- 
2.19.1


                 reply	other threads:[~2018-12-08 22:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181208222132.GA204@SDF.ORG \
    --to=coypu@sdf.org \
    --cc=gcc-patches@gcc.gnu.org \
    /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.
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).