blob: 4fac7b032ccd72671a5d38496637a39dd39dabdb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
include(CheckIncludeFile)
set(include_files
linux/fs.h
pwd.h
sys/clonefile.h
sys/ioctl.h
sys/mman.h
sys/time.h
sys/wait.h
sys/file.h
syslog.h
termios.h
dirent.h
strings.h
unistd.h
utime.h
sys/utime.h
varargs.h)
foreach(include_file IN ITEMS ${include_files})
string(TOUPPER ${include_file} include_var)
string(REGEX REPLACE "[/.]" "_" include_var ${include_var})
set(include_var HAVE_${include_var})
check_include_file(${include_file} ${include_var})
endforeach()
include(CheckFunctionExists)
set(functions
asctime_r
getopt_long
getpwuid
posix_fallocate
realpath
setenv
strndup
syslog
unsetenv
utimensat
utimes
)
foreach(func IN ITEMS ${functions})
string(TOUPPER ${func} func_var)
set(func_var HAVE_${func_var})
check_function_exists(${func} ${func_var})
endforeach()
include(CheckStructHasMember)
check_struct_has_member("struct stat" st_atim sys/stat.h
HAVE_STRUCT_STAT_ST_ATIM LANGUAGE CXX)
check_struct_has_member("struct stat" st_ctim sys/stat.h
HAVE_STRUCT_STAT_ST_CTIM LANGUAGE CXX)
check_struct_has_member("struct stat" st_mtim sys/stat.h
HAVE_STRUCT_STAT_ST_MTIM LANGUAGE CXX)
check_struct_has_member("struct stat" st_atimespec sys/stat.h
HAVE_STRUCT_STAT_ST_ATIMESPEC LANGUAGE CXX)
check_struct_has_member("struct stat" st_ctimespec sys/stat.h
HAVE_STRUCT_STAT_ST_CTIMESPEC LANGUAGE CXX)
check_struct_has_member("struct stat" st_mtimespec sys/stat.h
HAVE_STRUCT_STAT_ST_MTIMESPEC LANGUAGE CXX)
check_struct_has_member("struct statfs" f_fstypename sys/mount.h
HAVE_STRUCT_STATFS_F_FSTYPENAME LANGUAGE CXX)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles(
[=[
#include <immintrin.h>
#ifndef _MSC_VER // MSVC does not need explicit enabling of AVX2.
void func() __attribute__((target("avx2")));
#endif
void func() { _mm256_abs_epi8(_mm256_set1_epi32(42)); }
int main()
{
func();
return 0;
}
]=]
HAVE_AVX2)
if(WIN32)
set(_WIN32_WINNT 0x0600)
endif()
if(CMAKE_SYSTEM MATCHES "Darwin")
set(_DARWIN_C_SOURCE 1)
endif()
# alias
set(MTR_ENABLED "${ENABLE_TRACING}")
if(HAVE_SYS_MMAN_H
AND (HAVE_STRUCT_STAT_ST_MTIM OR HAVE_STRUCT_STAT_ST_MTIMESPEC)
AND (HAVE_LINUX_FS_H OR HAVE_STRUCT_STATFS_F_FSTYPENAME))
set(INODE_CACHE_SUPPORTED 1)
endif()
# Escape backslashes in SYSCONFDIR for C.
file(TO_NATIVE_PATH "${CMAKE_INSTALL_FULL_SYSCONFDIR}" CONFIG_SYSCONFDIR_C_ESCAPED)
string(REPLACE "\\" "\\\\" CONFIG_SYSCONFDIR_C_ESCAPED "${CONFIG_SYSCONFDIR_C_ESCAPED}")
configure_file(${CMAKE_SOURCE_DIR}/cmake/config.h.in
${CMAKE_BINARY_DIR}/config.h @ONLY)
|