Merge branch 'tizen_base' into tizen
[platform/upstream/expat.git] / ConfigureChecks.cmake
1 include(CheckCCompilerFlag)\r
2 include(CheckCSourceCompiles)\r
3 include(CheckIncludeFile)\r
4 include(CheckIncludeFiles)\r
5 include(CheckFunctionExists)\r
6 include(CheckSymbolExists)\r
7 include(TestBigEndian)\r
8 \r
9 check_include_file("dlfcn.h" HAVE_DLFCN_H)\r
10 check_include_file("fcntl.h" HAVE_FCNTL_H)\r
11 check_include_file("inttypes.h" HAVE_INTTYPES_H)\r
12 check_include_file("memory.h" HAVE_MEMORY_H)\r
13 check_include_file("stdint.h" HAVE_STDINT_H)\r
14 check_include_file("stdlib.h" HAVE_STDLIB_H)\r
15 check_include_file("strings.h" HAVE_STRINGS_H)\r
16 check_include_file("string.h" HAVE_STRING_H)\r
17 check_include_file("sys/stat.h" HAVE_SYS_STAT_H)\r
18 check_include_file("sys/types.h" HAVE_SYS_TYPES_H)\r
19 check_include_file("unistd.h" HAVE_UNISTD_H)\r
20 \r
21 check_function_exists("getpagesize" HAVE_GETPAGESIZE)\r
22 check_function_exists("bcopy" HAVE_BCOPY)\r
23 check_symbol_exists("memmove" "string.h" HAVE_MEMMOVE)\r
24 check_function_exists("mmap" HAVE_MMAP)\r
25 check_function_exists("getrandom" HAVE_GETRANDOM)\r
26 \r
27 if(USE_libbsd)\r
28     set(CMAKE_REQUIRED_LIBRARIES "${LIB_BSD}")\r
29 endif()\r
30 check_function_exists("arc4random_buf" HAVE_ARC4RANDOM_BUF)\r
31 if(NOT HAVE_ARC4RANDOM_BUF)\r
32     check_function_exists("arc4random" HAVE_ARC4RANDOM)\r
33 endif()\r
34 set(CMAKE_REQUIRED_LIBRARIES)\r
35 \r
36 #/* Define to 1 if you have the ANSI C header files. */\r
37 check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)\r
38 \r
39 test_big_endian(WORDS_BIGENDIAN)\r
40 #/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */\r
41 if(WORDS_BIGENDIAN)\r
42     set(BYTEORDER 4321)\r
43 else(WORDS_BIGENDIAN)\r
44     set(BYTEORDER 1234)\r
45 endif(WORDS_BIGENDIAN)\r
46 \r
47 if(HAVE_SYS_TYPES_H)\r
48     check_symbol_exists("off_t" "sys/types.h" OFF_T)\r
49     check_symbol_exists("size_t" "sys/types.h" SIZE_T)\r
50 else(HAVE_SYS_TYPES_H)\r
51     set(OFF_T "long")\r
52     set(SIZE_T "unsigned")\r
53 endif(HAVE_SYS_TYPES_H)\r
54 \r
55 check_c_source_compiles("\r
56         #include <stdlib.h>  /* for NULL */\r
57         #include <unistd.h>  /* for syscall */\r
58         #include <sys/syscall.h>  /* for SYS_getrandom */\r
59         int main() {\r
60             syscall(SYS_getrandom, NULL, 0, 0);\r
61             return 0;\r
62         }"\r
63     HAVE_SYSCALL_GETRANDOM)\r
64 \r
65 configure_file(expat_config.h.cmake "${CMAKE_CURRENT_BINARY_DIR}/expat_config.h")\r
66 add_definitions(-DHAVE_EXPAT_CONFIG_H)\r
67 \r
68 check_c_compiler_flag("-fno-strict-aliasing" FLAG_NO_STRICT_ALIASING)\r