Discussion:
AC_CONFIG_SUBDIRS but immediately
Gavin Smith
2015-11-12 12:12:06 UTC
Permalink
It also needs to be resilient against failure of the subsidiary
configure script. This happened due to the AC_PROG_CC macro
discovering that the C compiler didn't exist, or didn't work. This
compiler was the one that that Perl said it was compiled with (output
of "perl -V:cc"), so it's quite possible for it not to exist or not
work.
So about this. I simulated this failure by putting

CC=xxxxxxxxxxxx

in the subsidiary configure script. This leads to an error message:

checking for gcc... xxxxxxxxxxxx
checking whether the C compiler works... no
configure: error: in
`/home/g/src/texinfo/PROJ_SVN/tp/Texinfo/Convert/XSParagraph':
configure: error: C compiler cannot create executables

I tried to get rid of this failure by removing the use of AC_PROG_CC,
but it made no difference, probably because some other macro does
AC_REQUIRE([AC_PROG_CC]).

Doing the following in the top-level configure script appeared to work
well, though:

save_subdirs=$subdirs
subdirs=tp/Texinfo/Convert/XSParagraph
( _AC_OUTPUT_SUBDIRS) || echo XXXXXXXXXXXXXXXXXXXXXXXXXfailure
subdirs=$save_subdirs

Doing the configuration inside a subshell insulates from the failure.
Sample output.

checking whether to use NLS... yes
checking where the gettext function comes from... libc
=== configuring in tp/Texinfo/Convert/XSParagraph
(/home/g/src/texinfo/PROJ_SVN/tp/Texinfo/Convert/XSParagraph)
configure: running /bin/sh ./configure --disable-option-checking
'--prefix=NONE' 'CFLAGS=-Wdeclaration-after-statement -g -O0 -Wunused
-Wimplicit-function-declaration -Wreturn-type' --cache-file=/dev/null
--srcdir=.
checking for a BSD-compatible install... /usr/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for perl... /usr/bin/perl
checking Perl configuration value cc... cc
checking for style of include used by make... GNU
checking for gcc... xxxxxxxxxxxx
checking whether the C compiler works... no
configure: error: in
`/home/g/src/texinfo/PROJ_SVN/tp/Texinfo/Convert/XSParagraph':
configure: error: C compiler cannot create executables
See `config.log' for more details
configure: error: ./configure failed for tp/Texinfo/Convert/XSParagraph
XXXXXXXXXXXXXXXXXXXXXXXXXfailure
checking whether we can build Perl extension modules... configure:
error: in `/home/g/src/texinfo/PROJ_SVN/tp/Texinfo/Convert/XSParagraph':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** [config.status] Error 77
no
checking for prove... prove
checking parser tests requirements... yes
checking Perl Texinfo API texinfo documentation build requirements... yes

and as you can see the configure script continues on after the failure.

Taking the subshell out, the top-level configure script fails after
trying to configure the subdirectory. configure.ac excerpt:

save_subdirs=$subdirs
subdirs=tp/Texinfo/Convert/XSParagraph
_AC_OUTPUT_SUBDIRS
subdirs=$save_subdirs

End of configure output:

checking whether to use NLS... yes
checking where the gettext function comes from... libc
=== configuring in tp/Texinfo/Convert/XSParagraph
(/home/g/src/texinfo/PROJ_SVN/tp/Texinfo/Convert/XSParagraph)
configure: running /bin/sh ./configure --disable-option-checking
'--prefix=NONE' 'CFLAGS=-Wdeclaration-after-statement -g -O0 -Wunused
-Wimplicit-function-declaration -Wreturn-type' --cache-file=/dev/null
--srcdir=.
checking for a BSD-compatible install... /usr/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for perl... /usr/bin/perl
checking Perl configuration value cc... cc
checking for style of include used by make... GNU
checking for gcc... xxxxxxxxxxxx
checking whether the C compiler works... no
configure: error: in
`/home/g/src/texinfo/PROJ_SVN/tp/Texinfo/Convert/XSParagraph':
configure: error: C compiler cannot create executables
See `config.log' for more details
configure: error: ./configure failed for tp/Texinfo/Convert/XSParagraph
Loading...