-
Notifications
You must be signed in to change notification settings - Fork 9.7k
/
Copy pathConfigure.cmake
125 lines (111 loc) · 3.38 KB
/
Configure.cmake
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
################################################################################
#
# configure
#
################################################################################
########################################
# FUNCTION check_includes
########################################
function(check_includes files)
foreach(F ${${files}})
set(name ${F})
string(REPLACE "-" "_" name ${name})
string(REPLACE "." "_" name ${name})
string(REPLACE "/" "_" name ${name})
string(TOUPPER ${name} name)
check_include_files(${F} HAVE_${name})
file(APPEND ${AUTOCONFIG_SRC} "/* Define to 1 if you have the <${F}> header file. */\n")
file(APPEND ${AUTOCONFIG_SRC} "#cmakedefine HAVE_${name} 1\n")
file(APPEND ${AUTOCONFIG_SRC} "\n")
endforeach()
endfunction(check_includes)
########################################
# FUNCTION check_functions
########################################
function(check_functions functions)
foreach(F ${${functions}})
set(name ${F})
string(TOUPPER ${name} name)
check_function_exists(${F} HAVE_${name})
file(APPEND ${AUTOCONFIG_SRC} "/* Define to 1 if you have the `${F}' function. */\n")
file(APPEND ${AUTOCONFIG_SRC} "#cmakedefine HAVE_${name} 1\n")
file(APPEND ${AUTOCONFIG_SRC} "\n")
endforeach()
endfunction(check_functions)
########################################
# FUNCTION check_types
########################################
function(check_types types)
foreach(T ${${types}})
set(name ${T})
string(REPLACE " " "_" name ${name})
string(REPLACE "-" "_" name ${name})
string(REPLACE "." "_" name ${name})
string(REPLACE "/" "_" name ${name})
string(TOUPPER ${name} name)
check_type_size(${T} HAVE_${name})
file(APPEND ${AUTOCONFIG_SRC} "/* Define to 1 if the system has the type `${T}'. */\n")
file(APPEND ${AUTOCONFIG_SRC} "#cmakedefine HAVE_${name} 1\n")
file(APPEND ${AUTOCONFIG_SRC} "\n")
endforeach()
endfunction(check_types)
########################################
file(WRITE ${AUTOCONFIG_SRC})
include(CheckCSourceCompiles)
include(CheckCSourceRuns)
include(CheckCXXSourceCompiles)
include(CheckCXXSourceRuns)
include(CheckFunctionExists)
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckPrototypeDefinition)
include(CheckStructHasMember)
include(CheckSymbolExists)
include(CheckTypeSize)
include(TestBigEndian)
set(include_files_list
dlfcn.h
inttypes.h
limits.h
malloc.h
memory.h
stdbool.h
stdint.h
stdlib.h
strings.h
string.h
sys/ipc.h
sys/shm.h
sys/stat.h
sys/types.h
sys/wait.h
unistd.h
cairo/cairo-version.h
CL/cl.h
OpenCL/cl.h
pango-1.0/pango/pango-features.h
tiffio.h
unicode/uchar.h
)
check_includes(include_files_list)
set(functions_list
getline
snprintf
)
check_functions(functions_list)
set(types_list
"long long int"
off_t
mbstate_t
wchar_t
_Bool
)
check_types(types_list)
test_big_endian(WORDS_BIGENDIAN)
file(APPEND ${AUTOCONFIG_SRC} "
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#cmakedefine WORDS_BIGENDIAN 1
")
########################################
################################################################################