better fix for #281, also fix issue with command line options not existing on older...
authorMorgan Deters <mdeters@gmail.com>
Wed, 28 Sep 2011 19:46:53 +0000 (19:46 +0000)
committerMorgan Deters <mdeters@gmail.com>
Wed, 28 Sep 2011 19:46:53 +0000 (19:46 +0000)
config/cvc4.m4
configure.ac
src/parser/cvc/Makefile.am
src/util/Makefile.am

index 1138a2c4e7fe3e6500f23754b5f0e45ba003ed2e..b003884edb67640221d887411fb9dbc887dc3fa2 100644 (file)
@@ -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
index 01ce7456573f08a6a114bf9e60d2716885e5aea1..ea7d4f7aea22951018a446c4fd4265adf2245f09 100644 (file)
@@ -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],
index b783355160068dad8e22afcbfc33dfcf2850c4f0..fb5cc7fc758631f6316752c5e8568198c5023e2c 100644 (file)
@@ -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)
index f5a3b7d00a274315d77afeb80d7c03c9801f5da0..ed6881994b289fc022316e098fd09227f0ac6f66 100644 (file)
@@ -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 += \