aboutsummaryrefslogtreecommitdiff
path: root/config/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'config/CMakeLists.txt')
-rw-r--r--config/CMakeLists.txt32
1 files changed, 17 insertions, 15 deletions
diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt
index b780291264..e794a8c5b9 100644
--- a/config/CMakeLists.txt
+++ b/config/CMakeLists.txt
@@ -8,7 +8,6 @@ include(CheckCSourceCompiles)
check_type_size("int" SIZEOF_INT)
check_type_size("long" SIZEOF_LONG)
check_type_size("intmax_t" SIZEOF_INTMAX_T)
-check_type_size("off_t" SIZEOF_OFF_T)
check_type_size("size_t" SIZEOF_SIZE_T)
check_type_size("long long" SIZEOF_LONG_LONG)
check_type_size("void *" SIZEOF_VOID_PTR)
@@ -16,29 +15,21 @@ check_type_size("void *" SIZEOF_VOID_PTR)
check_symbol_exists(_NSGetEnviron crt_externs.h HAVE__NSGETENVIRON)
# Headers
-check_include_files(dirent.h HAVE_DIRENT_H)
-check_include_files(fcntl.h HAVE_FCNTL_H)
check_include_files(iconv.h HAVE_ICONV_H)
check_include_files(langinfo.h HAVE_LANGINFO_H)
-check_include_files(libgen.h HAVE_LIBGEN_H)
check_include_files(locale.h HAVE_LOCALE_H)
check_include_files(pwd.h HAVE_PWD_H)
check_include_files(strings.h HAVE_STRINGS_H)
-check_include_files(stropts.h HAVE_STROPTS_H)
-check_include_files(sys/param.h HAVE_SYS_PARAM_H)
check_include_files(sys/wait.h HAVE_SYS_WAIT_H)
if(NOT HAVE_SYS_WAIT_H AND UNIX)
# See if_cscope.c
- message(SEND_ERROR "header sys/wait.h is required for UNIX")
+ message(SEND_ERROR "header sys/wait.h is required for Unix")
endif()
check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
check_include_files(utime.h HAVE_UTIME_H)
-check_include_files(unistd.h HAVE_UNISTD_H)
-check_include_files(utime.h HAVE_UTIME_H)
# Functions
check_function_exists(fseeko HAVE_FSEEKO)
-check_function_exists(fsync HAVE_FSYNC)
check_function_exists(getpwent HAVE_GETPWENT)
check_function_exists(getpwnam HAVE_GETPWNAM)
check_function_exists(getpwuid HAVE_GETPWUID)
@@ -51,7 +42,10 @@ if(JEMALLOC_FOUND)
set(HAVE_JEMALLOC 1)
endif()
-check_function_exists(putenv HAVE_PUTENV)
+check_function_exists(_putenv_s HAVE_PUTENV_S)
+if(WIN32 AND NOT HAVE_PUTENV_S)
+ message(SEND_ERROR "_putenv_s() function not found on your system.")
+endif()
check_function_exists(opendir HAVE_OPENDIR)
check_function_exists(readlink HAVE_READLINK)
check_function_exists(setenv HAVE_SETENV)
@@ -73,6 +67,14 @@ if(HAVE_LANGINFO_H)
check_symbol_exists(CODESET "langinfo.h" HAVE_NL_LANGINFO_CODESET)
endif()
+check_include_files("endian.h" HAVE_ENDIAN_H)
+check_include_files("sys/endian.h" HAVE_SYS_ENDIAN_H)
+
+set(ENDIAN_INCLUDE_FILE "endian.h")
+if(HAVE_SYS_ENDIAN_H AND NOT HAVE_ENDIAN_H)
+ set(ENDIAN_INCLUDE_FILE "sys/endian.h")
+endif()
+
set(SI "#include <stdint.h>\n")
set(MS "int main(int argc,char**argv)\n{\n uint64_t i=0x0102030405060708ULL;")
set(ME "}")
@@ -80,7 +82,7 @@ check_c_source_compiles("
#define _BSD_SOURCE 1
#define _DEFAULT_SOURCE 1
${SI}
- #include <endian.h>
+ #include <${ENDIAN_INCLUDE_FILE}>
#ifndef be64toh
# error No be64toh macros
#endif
@@ -98,10 +100,10 @@ endif()
if (NOT "${HAVE_BE64TOH}")
if (NOT "${CMAKE_CROSSCOMPILING}")
# It is safe to make ORDER_BIG_ENDIAN not defined if
- # - HAVE_BE64TOH is true. In this case be64toh will be used unconditionally in
+ # - HAVE_BE64TOH is true. In this case be64toh will be used unconditionally in
# any case and ORDER_BIG_ENDIAN will not be examined.
- # - CMAKE_CROSSCOMPILING *and* HAVE_BE64TOH are both false. In this case
- # be64toh function which uses cycle and arithmetic operations is used which
+ # - CMAKE_CROSSCOMPILING *and* HAVE_BE64TOH are both false. In this case
+ # be64toh function which uses cycle and arithmetic operations is used which
# will work regardless of endianess. Function is sub-optimal though.
check_c_source_runs("
${SI}