File: checks.cmake

package info (click to toggle)
libapache2-mod-rivet 3.1.1-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 5,716 kB
  • sloc: xml: 8,442; tcl: 7,199; ansic: 6,727; sh: 4,983; makefile: 261; sql: 91; lisp: 78
file content (187 lines) | stat: -rw-r--r-- 5,970 bytes parent folder | download | duplicates (4)
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Check headers
include(CheckIncludeFile)
include(CheckIncludeFiles)
check_include_files(dlfcn.h        HAVE_DLFCN_H)
check_include_files(inttypes.h     HAVE_INTTYPES_H)
check_include_files(limits.h       HAVE_LIMITS_H)
check_include_files(memory.h       HAVE_MEMORY_H)
check_include_files(net/errno.h    HAVE_NET_ERRNO_H)
check_include_files(stdint.h       HAVE_STDINT_H)
check_include_files(stdlib.h       HAVE_STDLIB_H)
check_include_files(strings.h      HAVE_STRINGS_H)
check_include_files(string.h       HAVE_STRING_H)
check_include_files(sys/param.h    HAVE_SYS_PARAM_H)
check_include_files(sys/stat.h     HAVE_SYS_STAT_H )
check_include_files(sys/types.h    HAVE_SYS_TYPES_H )
check_include_files(unistd.h       HAVE_UNISTD_H )
check_include_files(dirent.h       HAVE_DIRENT_H)
check_include_files(limits.h       HAVE_LIMITS_H)
check_include_files(alloca.h       HAVE_ALLOCA_H )
check_include_files(stdint.h       HAVE_STDINT_H )
check_include_files(sys/mman.h     HAVE_SYS_MMAN_H)
check_include_files(errno.h        HAVE_ERRNO_H)
check_include_files(float.h        HAVE_FLOAT_H)
check_include_files(sys/wait.h     HAVE_SYS_WAIT_H)
check_include_files(values.h       HAVE_VALUES_H)
check_include_files(stdarg.h       HAVE_STDARG_H)

# Check functions
include(CheckFunctionExists)
check_function_exists(fseek64      HAVE_FSEEK64)
check_function_exists(open64       HAVE_OPEN64)
check_function_exists(memcpy       HAVE_MEMCPY)
check_function_exists(mmap         HAVE_MMAP)
check_function_exists(lseek64      HAVE_LSEEK64)
set(CMAKE_EXTRA_INCLUDE_FILES math.h)
if(NOT WIN32)
set(CMAKE_REQUIRED_LIBRARIES m)
endif()
check_function_exists(round        HAVE_ROUND)
set(CMAKE_EXTRA_INCLUDE_FILES)
set(CMAKE_REQUIRED_LIBRARIES)

# Check types
include ( CheckTypeSize )
check_type_size ( "long double" HAVE_LONG_DOUBLE )
check_type_size ( "double"      SIZEOF_DOUBLE )
check_type_size ( "long double" SIZEOF_LONG_DOUBLE )
check_type_size ( "void*"       SIZEOF_VOID_P )
# set(CMAKE_EXTRA_INCLUDE_FILES sys/stat.h)
# check_type_size("struct stat64" _LARGEFILE64_SOURCE)
# set(CMAKE_EXTRA_INCLUDE_FILES)

# Check symbols
include(CheckSymbolExists) 

# Custom checks...
include (CheckCSourceCompiles)
check_c_source_compiles("#include <sys/types.h>
int main () { off64_t offset; return 0;}" HAVE_TYPE_OFF64_T)

check_c_source_compiles("#include <sys/stat.h>
int main () { struct stat64 p; return 0;}" HAVE_STRUCT_STAT64)
check_c_source_compiles("#include <sys/types.h>
#include <sys/dirent.h>
int main () { struct dirent64 p; return 0;}" HAVE_STRUCT_DIRENT64)

check_c_source_compiles("#include <sys/stat.h>
int main () {struct stat64 buf; int i = stat64(\"/\", &buf); return 0;}"
NO_LARGEFILE64_SOURCE)
if(NOT NO_LARGEFILE64_SOURCE)
check_c_source_compiles("#define _LARGEFILE64_SOURCE 1
#include <sys/stat.h>
int main () {struct stat64 buf; int i = stat64(\"/\", &buf); return 0;}"
                        _LARGEFILE64_SOURCE)
endif(NOT NO_LARGEFILE64_SOURCE)

check_c_source_compiles("#include <stdlib.h>
int main () {char *p = (char *)strtoll; char *q = (char *)strtoull; return 0;}"
NO_ISOC99_SOURCE)
if(NOT NO_ISOC99_SOURCE)
check_c_source_compiles("#define _ISOC99_SOURCE 1
#include <stdlib.h>
int main () {char *p = (char *)strtoll; char *q = (char *)strtoull; return 0;}"
                        _ISOC99_SOURCE)
endif(NOT NO_ISOC99_SOURCE)

check_c_source_compiles("#include <sys/stat.h>
int main () {char *p = (char *)open64; return 0;}"
NO_LARGEFILE_SOURCE64)
if(NOT NO_LARGEFILE_SOURCE64)
check_c_source_compiles("#define _LARGEFILE_SOURCE64 1
#include <sys/stat.h>
int main () {char *p = (char *)open64; return 0;}"
                        _LARGEFILE_SOURCE64)
endif(NOT NO_LARGEFILE_SOURCE64)

# See if the compiler knows natively about __int64
set(tcl_cv_type_64bit "none")
check_c_source_compiles("int main () {__int64 value = (__int64) 0; return 0;}"
HAS___int64)
if(HAS___int64)
  set(tcl_type_64bit "__int64")
else(HAS___int64)
  set(tcl_type_64bit "long long")
endif(HAS___int64)
check_c_source_compiles("int main () {switch (0) {case 1:
case (sizeof(${tcl_type_64bit})==sizeof(long)): ; }; return 0;}"
HAS_WIDE_INT_NE_LONG)
if(HAS_WIDE_INT_NE_LONG)
  set(tcl_cv_type_64bit ${tcl_type_64bit})
endif(HAS_WIDE_INT_NE_LONG)

if(${tcl_cv_type_64bit} STREQUAL "none")
  set(TCL_WIDE_INT_IS_LONG 1)
elseif((${tcl_cv_type_64bit} STREQUAL "__int64") AND WIN32)
else(${tcl_cv_type_64bit} STREQUAL "none")
  set(TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit})
endif(${tcl_cv_type_64bit} STREQUAL "none")

#  Check for ANSI C header files...
# ==========================================================================
message(STATUS "Cheking for ANSI C header files...")
if(HAVE_STDLIB_H AND HAVE_STDARG_H AND HAVE_STRING_H AND HAVE_FLOAT_H)
  set(ac_cv_header_stdc ON)
endif(HAVE_STDLIB_H AND HAVE_STDARG_H AND HAVE_STRING_H AND HAVE_FLOAT_H)

if(ac_cv_header_stdc)
  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  SET(CMAKE_EXTRA_INCLUDE_FILES string.h)
  check_function_exists(memchr ac_cv_header_stdc)
  SET(CMAKE_EXTRA_INCLUDE_FILES)
endif(ac_cv_header_stdc)

if(ac_cv_header_stdc)
  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
  SET(CMAKE_EXTRA_INCLUDE_FILES stdlib.h)
  check_function_exists(free ac_cv_header_stdc)
  SET(CMAKE_EXTRA_INCLUDE_FILES)
endif(ac_cv_header_stdc)

if(ac_cv_header_stdc)
  set(STDC_HEADERS 1)
endif(ac_cv_header_stdc)

if(NOT HAVE_DIRENT_H)
  set(NO_DIRENT_H 1)
endif()

if(NOT HAVE_DLFCN_H)
  set(NO_DLFCN_H 1)
endif()

if(NOT HAVE_ERRNO_H)
  set(NO_ERRNO_H 1)
endif()

if(NOT HAVE_FLOAT_H)
  set(NO_FLOAT_H 1)
endif()

if(NOT HAVE_LIMITS_H)
  set(NO_LIMITS_H 1)
endif()

if(NOT HAVE_SYS_WAIT_H)
  set(NO_SYS_WAIT_H 1)
endif()

if(NOT HAVE_VALUES_H)
  set(NO_VALUES_H 1)
endif()

if(NOT HAVE_STDLIB_H)
  set(NO_STDLIB_H 1)
endif()

if(NOT HAVE_STRING_H)
  set(NO_STRING_H 1)
endif()

if(NOT HAVE_ROUND)
  set(NO_HAVE_ROUND 1)
endif()

if(BUILD_STATIC_LIBS)
  set(STATIC_BUILD 1)
endif(BUILD_STATIC_LIBS)