tests: beware of compilers that do not support POSIXLY_CORRECT

Running "maintainer-release-check" on OS X with Clang 2.9 fails,
because "clang-mp-2.9 -o test -g test.c" launches "/usr/bin/dsymutil
test -o test.dSYM" which fails with "error: unable to open executable
'-o'".

* m4/c-working.m4 (BISON_CHECK_WITH_POSIXLY_CORRECT)
(BISON_C_COMPILER_POSIXLY_CORRECT): New.
* configure.ac: Use the latter.
* tests/atlocal.in (POSIXLY_CORRECT_IS_EXPORTED): New.
* tests/local.at (AT_BISON_CHECK_WARNINGS_): Use it instead of computing its
value each time.
(AT_QUELL_VALGRIND): Skip tests that cannot work because of compilers
that do not support POSIXLY_CORRECT.
This commit is contained in:
Akim Demaille
2012-11-07 17:23:06 +01:00
parent 5a000c51f7
commit 0a36880ad1
4 changed files with 60 additions and 6 deletions

View File

@@ -468,11 +468,7 @@ m4_define([AT_BISON_CHECK_WARNINGS_],
[[# Defining POSIXLY_CORRECT causes bison to complain if options are
# added after the grammar file name, so skip these checks in that
# case.
#
# Don't just check if $POSIXLY_CORRECT is set, as Bash, when launched
# as /bin/sh, sets the shell variable POSIXLY_CORRECT to y, but not
# the environment variable.
if env | grep '^POSIXLY_CORRECT=' >/dev/null; then :; else
if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then
]AT_SAVE_SPECIAL_FILES[
# To avoid expanding it repeatedly, store specified stdout.
@@ -597,7 +593,10 @@ 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(m4_join([ ],
[AT_CHECK([case $POSIXLY_CORRECT_IS_EXPORTED:$C_COMPILER_POSIXLY_CORRECT in
true:false) echo 'cannot compile properly with POSIXLY_CORRECT' && exit 77;;
esac])
AT_CHECK(m4_join([ ],
[$CC $CFLAGS $CPPFLAGS],
[m4_bmatch([$1], [[.]], [-c], [$LDFLAGS])],
[-o $1],