find_library(ANTLR_LIBRARIES NAMES antlr3c)
endif()
+# Check if antlr3FileStreamNew is available. If not we have to
+# define CVC4_ANTLR3_OLD_INPUT_STREAM (src/parser/CMakeLists.txt).
+if(ANTLR_INCLUDE_DIR)
+ include(CheckSymbolExists)
+ set(CMAKE_REQUIRED_INCLUDES ${ANTLR_INCLUDE_DIR})
+ set(CMAKE_REQUIRED_LIBRARIES ${ANTLR_LIBRARIES})
+ check_symbol_exists(
+ antlr3FileStreamNew "antlr3defs.h" HAVE_ANTLR3_FILE_STREAM_NEW)
+endif()
+
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
ANTLR DEFAULT_MSG ANTLR_BINARY ANTLR_INCLUDE_DIR ANTLR_LIBRARIES)
-mark_as_advanced(ANTLR_BINARY ANTLR_INCLUDE_DIR ANTLR_LIBRARIES)
+mark_as_advanced(ANTLR_BINARY ANTLR_INCLUDE_DIR ANTLR_LIBRARIES
+ HAVE_ANTLR3_FILE_STREAM_NEW)
set(ANTLR_HOME ${ANTLR_DIR})
find_package(ANTLR REQUIRED)
+if(NOT HAVE_ANTLR3_FILE_STREAM_NEW)
+ add_definitions(-DCVC4_ANTLR3_OLD_INPUT_STREAM)
+endif()
+
# Java runtime is required for ANTLR
find_package(Java COMPONENTS Runtime REQUIRED)