1 include(CheckCXXSourceCompiles)
2 include(CheckIncludeFile)
3 include(CheckIncludeFileCXX)
4 include(CheckSymbolExists)
6 # Check whether "long" and "int64_t" are distinct types w.r.t. overloading.
7 # Even if they have the same size, they can be distinct, and some platforms
8 # can have problems with ambiguous function calls when auto-converting
9 # int64_t to long, and others will complain if you overload a function
10 # that takes an int64_t with one that takes a long (giving a redefinition
11 # error). So we have to keep both happy. Probably the same underlying
12 # issue as the hash specialization below, but let's check separately
14 check_cxx_source_compiles(
19 int main() { return 0; }
21 CVC4_NEED_INT64_T_OVERLOADS
23 if(NOT CVC4_NEED_INT64_T_OVERLOADS)
24 set(CVC4_NEED_INT64_T_OVERLOADS 0)
27 # Check to see if this version/architecture of GNU C++ explicitly
28 # instantiates std::hash<uint64_t> or not. Some do, some don't.
29 # See src/util/hash.h.
30 check_cxx_source_compiles(
34 namespace std { template<> struct hash<uint64_t> {}; }
35 int main() { return 0; }
37 CVC4_NEED_HASH_UINT64_T_OVERLOAD
39 if(CVC4_NEED_HASH_UINT64_T_OVERLOAD)
40 add_definitions(-DCVC4_NEED_HASH_UINT64_T)
43 check_include_file(unistd.h HAVE_UNISTD_H)
44 check_include_file_cxx(ext/stdio_filebuf.h HAVE_EXT_STDIO_FILEBUF_H)
46 # For Windows builds check if clock_gettime is available via -lpthread
48 if(CVC4_WINDOWS_BUILD)
49 set(CMAKE_REQUIRED_FLAGS -pthread)
50 check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
51 unset(CMAKE_REQUIRED_FLAGS)
52 if(HAVE_CLOCK_GETTIME)
53 add_c_cxx_flag(-pthread)
56 check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
58 check_symbol_exists(ffs "strings.h" HAVE_FFS)
59 check_symbol_exists(optreset "getopt.h" HAVE_DECL_OPTRESET)
60 check_symbol_exists(sigaltstack "signal.h" HAVE_SIGALTSTACK)
61 check_symbol_exists(strerror_r "string.h" HAVE_STRERROR_R)
62 check_symbol_exists(strtok_r "string.h" HAVE_STRTOK_R)
64 # Determine if we have the POSIX (int) or GNU (char *) variant of strerror_r.
65 check_c_source_compiles(
71 char c = *strerror_r(0, buf, 0);
78 # Defined if using the CLN multi-precision arithmetic library.
79 set(CVC4_CLN_IMP ${CVC4_USE_CLN_IMP})
80 # Defined if using the GMP multi-precision arithmetic library.
81 set(CVC4_GMP_IMP ${CVC4_USE_GMP_IMP})
82 # Define the full name of this package.
83 set(PACKAGE_NAME "${PROJECT_NAME}")