From: Akim Demaille Date: Wed, 7 Nov 2012 16:23:06 +0000 (+0100) Subject: tests: beware of compilers that do not support POSIXLY_CORRECT X-Git-Tag: v2.6.5~3 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/0a36880ad19791ebf050f884df3a1aff151cd67f?ds=sidebyside;hp=5a000c51f7ca10071adea389cb32885a92dd852f 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. --- diff --git a/configure.ac b/configure.ac index 651fa139..86783d52 100644 --- a/configure.ac +++ b/configure.ac @@ -114,6 +114,7 @@ fi BISON_TEST_FOR_WORKING_C_COMPILER BISON_TEST_FOR_WORKING_CXX_COMPILER +BISON_C_COMPILER_POSIXLY_CORRECT AC_ARG_ENABLE([yacc], [AC_HELP_STRING([--disable-yacc], diff --git a/m4/c-working.m4 b/m4/c-working.m4 index d563d32b..0db60f76 100644 --- a/m4/c-working.m4 +++ b/m4/c-working.m4 @@ -25,3 +25,47 @@ AC_DEFUN([BISON_TEST_FOR_WORKING_C_COMPILER], [ [], [AC_MSG_FAILURE([cannot compile a simple C program])]) ]) + +# BISON_CHECK_WITH_POSIXLY_CORRECT(CODE) +# -------------------------------------- +# Run the Autoconf CODE with POSIXLY_CORRECT set to 1, and restored to +# its initial value afterwards. +AC_DEFUN([BISON_CHECK_WITH_POSIXLY_CORRECT], +[gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }' +case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe"