Imported Upstream version 2.6.2
[platform/upstream/expat.git] / ConfigureChecks.cmake
index d97b397..3fc732f 100644 (file)
@@ -1,68 +1,69 @@
-include(CheckCCompilerFlag)\r
-include(CheckCSourceCompiles)\r
-include(CheckIncludeFile)\r
-include(CheckIncludeFiles)\r
-include(CheckFunctionExists)\r
-include(CheckSymbolExists)\r
-include(TestBigEndian)\r
-\r
-check_include_file("dlfcn.h" HAVE_DLFCN_H)\r
-check_include_file("fcntl.h" HAVE_FCNTL_H)\r
-check_include_file("inttypes.h" HAVE_INTTYPES_H)\r
-check_include_file("memory.h" HAVE_MEMORY_H)\r
-check_include_file("stdint.h" HAVE_STDINT_H)\r
-check_include_file("stdlib.h" HAVE_STDLIB_H)\r
-check_include_file("strings.h" HAVE_STRINGS_H)\r
-check_include_file("string.h" HAVE_STRING_H)\r
-check_include_file("sys/stat.h" HAVE_SYS_STAT_H)\r
-check_include_file("sys/types.h" HAVE_SYS_TYPES_H)\r
-check_include_file("unistd.h" HAVE_UNISTD_H)\r
-\r
-check_function_exists("getpagesize" HAVE_GETPAGESIZE)\r
-check_function_exists("bcopy" HAVE_BCOPY)\r
-check_symbol_exists("memmove" "string.h" HAVE_MEMMOVE)\r
-check_function_exists("mmap" HAVE_MMAP)\r
-check_function_exists("getrandom" HAVE_GETRANDOM)\r
-\r
-if(USE_libbsd)\r
-    set(CMAKE_REQUIRED_LIBRARIES "${LIB_BSD}")\r
-endif()\r
-check_function_exists("arc4random_buf" HAVE_ARC4RANDOM_BUF)\r
-if(NOT HAVE_ARC4RANDOM_BUF)\r
-    check_function_exists("arc4random" HAVE_ARC4RANDOM)\r
-endif()\r
-set(CMAKE_REQUIRED_LIBRARIES)\r
-\r
-#/* Define to 1 if you have the ANSI C header files. */\r
-check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)\r
-\r
-test_big_endian(WORDS_BIGENDIAN)\r
-#/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */\r
-if(WORDS_BIGENDIAN)\r
-    set(BYTEORDER 4321)\r
-else(WORDS_BIGENDIAN)\r
-    set(BYTEORDER 1234)\r
-endif(WORDS_BIGENDIAN)\r
-\r
-if(HAVE_SYS_TYPES_H)\r
-    check_symbol_exists("off_t" "sys/types.h" OFF_T)\r
-    check_symbol_exists("size_t" "sys/types.h" SIZE_T)\r
-else(HAVE_SYS_TYPES_H)\r
-    set(OFF_T "long")\r
-    set(SIZE_T "unsigned")\r
-endif(HAVE_SYS_TYPES_H)\r
-\r
-check_c_source_compiles("\r
-        #include <stdlib.h>  /* for NULL */\r
-        #include <unistd.h>  /* for syscall */\r
-        #include <sys/syscall.h>  /* for SYS_getrandom */\r
-        int main() {\r
-            syscall(SYS_getrandom, NULL, 0, 0);\r
-            return 0;\r
-        }"\r
-    HAVE_SYSCALL_GETRANDOM)\r
-\r
-configure_file(expat_config.h.cmake "${CMAKE_CURRENT_BINARY_DIR}/expat_config.h")\r
-add_definitions(-DHAVE_EXPAT_CONFIG_H)\r
-\r
-check_c_compiler_flag("-fno-strict-aliasing" FLAG_NO_STRICT_ALIASING)\r
+include(CheckCCompilerFlag)
+include(CheckCSourceCompiles)
+include(CheckIncludeFile)
+include(CheckIncludeFiles)
+include(CheckLibraryExists)
+include(CheckSymbolExists)
+include(TestBigEndian)
+
+check_include_file("dlfcn.h" HAVE_DLFCN_H)
+check_include_file("fcntl.h" HAVE_FCNTL_H)
+check_include_file("inttypes.h" HAVE_INTTYPES_H)
+check_include_file("memory.h" HAVE_MEMORY_H)
+check_include_file("stdint.h" HAVE_STDINT_H)
+check_include_file("stdlib.h" HAVE_STDLIB_H)
+check_include_file("strings.h" HAVE_STRINGS_H)
+check_include_file("string.h" HAVE_STRING_H)
+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_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)
+
+test_big_endian(WORDS_BIGENDIAN)
+#/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
+if(WORDS_BIGENDIAN)
+    set(BYTEORDER 4321)
+else(WORDS_BIGENDIAN)
+    set(BYTEORDER 1234)
+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)
+
+check_c_source_compiles("
+        #include <stdlib.h>  /* for NULL */
+        #include <unistd.h>  /* for syscall */
+        #include <sys/syscall.h>  /* for SYS_getrandom */
+        int main() {
+            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)