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.
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 via email to