diff options
Diffstat (limited to '3rdparty/expat/ConfigureChecks.cmake')
-rw-r--r-- | 3rdparty/expat/ConfigureChecks.cmake | 60 |
1 files changed, 46 insertions, 14 deletions
diff --git a/3rdparty/expat/ConfigureChecks.cmake b/3rdparty/expat/ConfigureChecks.cmake index f03faa637d0..c06b2f27857 100644 --- a/3rdparty/expat/ConfigureChecks.cmake +++ b/3rdparty/expat/ConfigureChecks.cmake @@ -1,6 +1,8 @@ +include(CheckCCompilerFlag) +include(CheckCSourceCompiles) include(CheckIncludeFile) include(CheckIncludeFiles) -include(CheckFunctionExists) +include(CheckLibraryExists) include(CheckSymbolExists) include(TestBigEndian) @@ -16,10 +18,21 @@ check_include_file("sys/stat.h" HAVE_SYS_STAT_H) check_include_file("sys/types.h" HAVE_SYS_TYPES_H) check_include_file("unistd.h" HAVE_UNISTD_H) -check_function_exists("getpagesize" HAVE_GETPAGESIZE) -check_function_exists("bcopy" HAVE_BCOPY) -check_symbol_exists("memmove" "string.h" HAVE_MEMMOVE) -check_function_exists("mmap" HAVE_MMAP) +check_symbol_exists("getpagesize" "unistd.h" HAVE_GETPAGESIZE) +check_symbol_exists("mmap" "sys/mman.h" HAVE_MMAP) +check_symbol_exists("getrandom" "sys/random.h" HAVE_GETRANDOM) + +if(EXPAT_WITH_LIBBSD) + set(CMAKE_REQUIRED_LIBRARIES "${LIB_BSD}") + set(_bsd "bsd/") +else() + set(_bsd "") +endif() +check_symbol_exists("arc4random_buf" "${_bsd}stdlib.h" HAVE_ARC4RANDOM_BUF) +if(NOT HAVE_ARC4RANDOM_BUF) + check_symbol_exists("arc4random" "${_bsd}stdlib.h" HAVE_ARC4RANDOM) +endif() +set(CMAKE_REQUIRED_LIBRARIES) #/* Define to 1 if you have the ANSI C header files. */ check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS) @@ -33,12 +46,31 @@ else(WORDS_BIGENDIAN) endif(WORDS_BIGENDIAN) if(HAVE_SYS_TYPES_H) - check_symbol_exists("off_t" "sys/types.h" OFF_T) - check_symbol_exists("size_t" "sys/types.h" SIZE_T) -else(HAVE_SYS_TYPES_H) - set(OFF_T "long") - set(SIZE_T "unsigned") -endif(HAVE_SYS_TYPES_H) - -configure_file(expat_config.h.cmake expat_config.h) -add_definitions(-DHAVE_EXPAT_CONFIG_H) + check_c_source_compiles(" + #include <sys/types.h> + int main(void) { + const off_t offset = -123; + return 0; + }" + HAVE_OFF_T) +endif() + +if(NOT HAVE_OFF_T) + set(off_t "long") +endif() + +check_c_source_compiles(" + #define _GNU_SOURCE + #include <stdlib.h> /* for NULL */ + #include <unistd.h> /* for syscall */ + #include <sys/syscall.h> /* for SYS_getrandom */ + int main(void) { + syscall(SYS_getrandom, NULL, 0, 0); + return 0; + }" + HAVE_SYSCALL_GETRANDOM) + +check_c_compiler_flag("-fno-strict-aliasing" FLAG_NO_STRICT_ALIASING) +check_c_compiler_flag("-fvisibility=hidden" FLAG_VISIBILITY) + +check_library_exists(m cos "" _EXPAT_LIBM_FOUND) |