tests: don't fail if the C++ compiler does not work

Also, make sure that `make dist` generates a correct tarball even if
the C++ compiler does not work.

Reported by Nelson H. F. Beebe.

* m4/cxx.m4 (BISON_CXX_WORKS): Define to true/false instead of
true/exit 77.  The latter is too dangerous to use (it directly quits).
(ENABLE_CXX): New name for the Automake conditional, for consistency
with ENABLE_CXX11 etc.
* tests/local.at (AT_COMPILE, AT_COMPILE_CXX): Adjust to the new
semantics of BISON_CXX_WORKS.
* examples/c++/local.mk: Skip the variant test if C++ does not work.
* examples/calc++/local.mk: Likewise.
This commit is contained in:
Akim Demaille
2018-11-04 11:26:17 +01:00
parent e93c40b33d
commit cf1446dc9e
5 changed files with 29 additions and 29 deletions

View File

@@ -98,10 +98,8 @@ fi
: ${CXX_COMPILER_POSIXLY_CORRECT='@CXX_COMPILER_POSIXLY_CORRECT@'}
if $POSIXLY_CORRECT_IS_EXPORTED; then
$C_COMPILER_POSIXLY_CORRECT ||
BISON_C_WORKS="as_fn_error 77 POSIXLY_CORRECT"
$CXX_COMPILER_POSIXLY_CORRECT ||
BISON_CXX_WORKS="as_fn_error 77 POSIXLY_CORRECT"
$C_COMPILER_POSIXLY_CORRECT || BISON_C_WORKS=false
$CXX_COMPILER_POSIXLY_CORRECT || BISON_CXX_WORKS=false
fi
# Handle --compile-c-with-cxx here, once CXX and CXXFLAGS are known.

View File

@@ -777,7 +777,7 @@ m4_define([AT_QUELL_VALGRIND],
# otherwise pass "-c"; this is a hack. The default SOURCES is OUTPUT
# with trailing .o removed, and ".c" appended.
m4_define([AT_COMPILE],
[AT_CHECK([$BISON_C_WORKS], 0, ignore, ignore)
[AT_SKIP_IF([[! $BISON_C_WORKS]])
AT_CHECK(m4_join([ ],
[$CC $CFLAGS $CPPFLAGS $3],
[m4_bmatch([$1], [[.]], [-c], [$LDFLAGS])],
@@ -797,7 +797,7 @@ AT_CHECK(m4_join([ ],
# with trailing ".o" removed, and ".cc" appended.
m4_define([AT_COMPILE_CXX],
[AT_KEYWORDS(c++)
AT_CHECK([$BISON_CXX_WORKS], 0, ignore, ignore)
AT_SKIP_IF([[! $BISON_CXX_WORKS]])
AT_CHECK(m4_join([ ],
[$CXX $CXXFLAGS $CPPFLAGS $3],
[m4_bmatch([$1], [[.]], [-c], [$LDFLAGS])],