summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorAkim Demaille <akim@lrde.epita.fr>2012-11-08 09:24:51 +0100
committerAkim Demaille <akim@lrde.epita.fr>2012-11-08 09:26:44 +0100
commit6d58c632025cb6928a90e4176577982bfb9c3981 (patch)
tree9fda1936bfc3cfb4eb4ce5fec6cf4285b9f010e7 /m4
parente42906f7904ca7516e9867a3a19ee08d963b1205 (diff)
parent429436aaf254175d778d492e22d5ac9f8b26b5a3 (diff)
downloadbison-6d58c632025cb6928a90e4176577982bfb9c3981.tar.gz
Merge branch 'maint'
* origin/maint: regen maint: post-release administrivia version 2.6.5 regen tests: syntax-check tests: beware of compilers that do not support POSIXLY_CORRECT gnulib: update Conflicts: src/parse-gram.c src/parse-gram.h tests/atlocal.in
Diffstat (limited to 'm4')
-rw-r--r--m4/c-working.m444
1 files changed, 44 insertions, 0 deletions
diff --git a/m4/c-working.m4 b/m4/c-working.m4
index fbc6da44..ee84acf9 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" </dev/null` in
+ xx) gl_had_POSIXLY_CORRECT=exported ;;
+ x) gl_had_POSIXLY_CORRECT=yes ;;
+ *) gl_had_POSIXLY_CORRECT= ;;
+esac
+POSIXLY_CORRECT=1
+export POSIXLY_CORRECT
+$1
+case $gl_had_POSIXLY_CORRECT in
+ exported) ;;
+ yes) AS_UNSET([POSIXLY_CORRECT]); POSIXLY_CORRECT=1 ;;
+ *) AS_UNSET([POSIXLY_CORRECT]) ;;
+esac
+])
+
+# BISON_C_COMPILER_POSIXLY_CORRECT
+# --------------------------------
+# Whether the compiler supports -g in POSIXLY_CORRECT mode. clang-2.9
+# on OS X does not, 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'".
+#
+# Sets C_COMPILER_POSIXLY_CORRECT to true/false.
+AC_DEFUN([BISON_C_COMPILER_POSIXLY_CORRECT],
+[AC_CACHE_CHECK([whether $CC supports POSIXLY_CORRECT=1],
+ [bison_cv_cc_supports_posixly_correct],
+[BISON_CHECK_WITH_POSIXLY_CORRECT(
+[AC_LANG_PUSH([C])
+AC_LINK_IFELSE([AC_LANG_PROGRAM],
+ [bison_cv_cc_supports_posixly_correct=yes],
+ [bison_cv_cc_supports_posixly_correct=no])
+AC_LANG_POP([C])])])
+case $bison_cv_cc_supports_posixly_correct in
+ yes) AC_SUBST([C_COMPILER_POSIXLY_CORRECT], [true]) ;;
+ no) AC_SUBST([C_COMPILER_POSIXLY_CORRECT], [false]);;
+esac
+])