From 2f15e89145ad68f1809dd15abb6b659a3817b260 Mon Sep 17 00:00:00 2001 From: Morgan Deters Date: Wed, 28 Sep 2011 19:46:53 +0000 Subject: [PATCH] better fix for #281, also fix issue with command line options not existing on older g++en, like Apple's 4.2 on Snow Leopard. --- config/cvc4.m4 | 16 ++++++++++++++++ configure.ac | 3 +++ src/parser/cvc/Makefile.am | 2 +- src/util/Makefile.am | 7 +++++-- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/config/cvc4.m4 b/config/cvc4.m4 index 1138a2c4e..b003884ed 100644 --- a/config/cvc4.m4 +++ b/config/cvc4.m4 @@ -86,3 +86,19 @@ AC_DEFUN([CVC4_CONFIG_FILE_ONLY_IF_CHANGED], [ AC_CONFIG_FILES([$1.tmp:$1.in], CVC4_COPY_IF_CHANGED([$1.tmp],[$1])) ])# CVC4_CONFIG_FILE_ONLY_IF_CHANGED + +# CVC4_CXX_OPTION(OPTION, VAR) +# ---------------------------- +# Run $(CXX) $(CPPFLAGS) $(CXXFLAGS) OPTION and see if the compiler +# likes it. If so, add OPTION to shellvar VAR. +AC_DEFUN([CVC4_CXX_OPTION], [ +AC_MSG_CHECKING([whether $CXX supports $1]) +cvc4_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $1" +AC_LANG_PUSH([C++]) +AC_COMPILE_IFELSE([int main() { return 0; }], + [AC_MSG_RESULT([yes]); $2='$1'], + [AC_MSG_RESULT([no])]) +AC_LANG_POP([C++]) +CXXFLAGS="$cvc4_save_CXXFLAGS" +])# CVC4_CXX_OPTION diff --git a/configure.ac b/configure.ac index 01ce74565..ea7d4f7ae 100644 --- a/configure.ac +++ b/configure.ac @@ -652,6 +652,9 @@ fi # Check for ANTLR runantlr script (defined in config/antlr.m4) AC_PROG_ANTLR +CVC4_CXX_OPTION([-Wno-conversion-null], [WNO_CONVERSION_NULL]) +AC_SUBST([WNO_CONVERSION_NULL]) + # Doxygen configuration AC_ARG_ENABLE([internals-documentation], [AS_HELP_STRING([--enable-internals-documentation], diff --git a/src/parser/cvc/Makefile.am b/src/parser/cvc/Makefile.am index b78335516..fb5cc7fc7 100644 --- a/src/parser/cvc/Makefile.am +++ b/src/parser/cvc/Makefile.am @@ -1,7 +1,7 @@ AM_CPPFLAGS = \ -D__BUILDING_CVC4PARSERLIB \ -I@srcdir@/../../include -I@srcdir@/../.. -I@builddir@/../.. $(ANTLR_INCLUDES) -AM_CXXFLAGS = -Wall -Wno-unknown-pragmas $(FLAG_VISIBILITY_HIDDEN) -Wno-unused-function -Wno-unused-variable -Wno-conversion-null +AM_CXXFLAGS = -Wall -Wno-unknown-pragmas $(FLAG_VISIBILITY_HIDDEN) -Wno-unused-function -Wno-unused-variable $(WNO_CONVERSION_NULL) # Compile generated C files using C++ compiler CC=$(CXX) diff --git a/src/util/Makefile.am b/src/util/Makefile.am index f5a3b7d00..ed6881994 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -112,11 +112,14 @@ endif diff -q "$^" "$@" &>/dev/null || mv "$^" "$@" || true # .PHONY ensures the .tmp version is always rebuilt (to check for any changes) .PHONY: Debug_tags.tmp Trace_tags.tmp +# The "sed" invocation below is particularly obnoxious, but it works around +# inconsistencies in REs on different platforms, using only a basic regular +# expression (no |, no \<, ...). Debug_tags.tmp Trace_tags.tmp: $(AM_V_GEN)\ - grep '[^a-zA-Z0-9_]$(@:_tags.tmp=) *( *\".*\" *)' \ + grep '\<$(@:_tags.tmp=) *( *\".*\" *)' \ `find @srcdir@/../ -name "*.cpp" -or -name "*.h" -or -name "*.cc" -or -name "*.g"` | \ - sed 's/.*[^a-zA-Z0-9_]$(@:_tags.tmp=) *( *\"\([^"]*\)\".*/\1/g' | sort | uniq >"$@" + sed 's/^$(@:_tags.tmp=) *( *\"\([^"]*\)\".*/\1/;s/.*[^a-zA-Z0-9_]$(@:_tags.tmp=) *( *\"\([^"]*\)\".*/\1/' | sort | uniq >"$@" if CVC4_CLN_IMP libutil_la_SOURCES += \ -- 2.30.2