public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Provide early warning about configure failure
@ 2018-12-08 22:22 coypu
  0 siblings, 0 replies; only message in thread
From: coypu @ 2018-12-08 22:22 UTC (permalink / raw)
  To: gcc-patches

[-- 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-08 22:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-08 22:22 [PATCH] Provide early warning about configure failure coypu

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