aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt39
-rw-r--r--apps/nc/CMakeLists.txt2
2 files changed, 23 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 048f6cf..a7574af 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -200,21 +200,23 @@ else()
200 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") 200 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
201endif() 201endif()
202 202
203# XXX - needs _GNU_SOURCE on linux
203check_function_exists(asprintf HAVE_ASPRINTF) 204check_function_exists(asprintf HAVE_ASPRINTF)
204if(HAVE_ASPRINTF) 205if(HAVE_ASPRINTF)
205 add_definitions(-DHAVE_ASPRINTF) 206 add_definitions(-DHAVE_ASPRINTF)
206endif() 207endif()
207 208
208check_function_exists(getopt HAVE_GETOPT) 209check_symbol_exists(getopt "unistd.h" HAVE_GETOPT)
209if(HAVE_GETOPT) 210if(HAVE_GETOPT)
210 add_definitions(-DHAVE_GETOPT) 211 add_definitions(-DHAVE_GETOPT)
211endif() 212endif()
212 213
213check_function_exists(reallocarray HAVE_REALLOCARRAY) 214check_symbol_exists(reallocarray "stdlib.h" HAVE_REALLOCARRAY)
214if(HAVE_REALLOCARRAY) 215if(HAVE_REALLOCARRAY)
215 add_definitions(-DHAVE_REALLOCARRAY) 216 add_definitions(-DHAVE_REALLOCARRAY)
216endif() 217endif()
217 218
219# XXX strcasecmp() is in strings.h which isn't available everywhere
218check_function_exists(strcasecmp HAVE_STRCASECMP) 220check_function_exists(strcasecmp HAVE_STRCASECMP)
219if(HAVE_STRCASECMP) 221if(HAVE_STRCASECMP)
220 add_definitions(-DHAVE_STRCASECMP) 222 add_definitions(-DHAVE_STRCASECMP)
@@ -222,18 +224,18 @@ endif()
222 224
223# Emscripten's strlcat and strlcpy triggers ASAN errors 225# Emscripten's strlcat and strlcpy triggers ASAN errors
224if(NOT EMSCRIPTEN) 226if(NOT EMSCRIPTEN)
225 check_function_exists(strlcat HAVE_STRLCAT) 227 check_symbol_exists(strlcat "string.h" HAVE_STRLCAT)
226 if(HAVE_STRLCAT) 228 if(HAVE_STRLCAT)
227 add_definitions(-DHAVE_STRLCAT) 229 add_definitions(-DHAVE_STRLCAT)
228 endif() 230 endif()
229 231
230 check_function_exists(strlcpy HAVE_STRLCPY) 232 check_symbol_exists(strlcpy "string.h" HAVE_STRLCPY)
231 if(HAVE_STRLCPY) 233 if(HAVE_STRLCPY)
232 add_definitions(-DHAVE_STRLCPY) 234 add_definitions(-DHAVE_STRLCPY)
233 endif() 235 endif()
234endif() 236endif()
235 237
236check_function_exists(strndup HAVE_STRNDUP) 238check_symbol_exists(strndup "string.h" HAVE_STRNDUP)
237if(HAVE_STRNDUP) 239if(HAVE_STRNDUP)
238 add_definitions(-DHAVE_STRNDUP) 240 add_definitions(-DHAVE_STRNDUP)
239endif() 241endif()
@@ -242,62 +244,64 @@ if(WIN32)
242 set(HAVE_STRNLEN true) 244 set(HAVE_STRNLEN true)
243 add_definitions(-DHAVE_STRNLEN) 245 add_definitions(-DHAVE_STRNLEN)
244else() 246else()
245 check_function_exists(strnlen HAVE_STRNLEN) 247 check_symbol_exists(strnlen "string.h" HAVE_STRNLEN)
246 if(HAVE_STRNLEN) 248 if(HAVE_STRNLEN)
247 add_definitions(-DHAVE_STRNLEN) 249 add_definitions(-DHAVE_STRNLEN)
248 endif() 250 endif()
249endif() 251endif()
250 252
251check_function_exists(strsep HAVE_STRSEP) 253check_symbol_exists(strsep "string.h" HAVE_STRSEP)
252if(HAVE_STRSEP) 254if(HAVE_STRSEP)
253 add_definitions(-DHAVE_STRSEP) 255 add_definitions(-DHAVE_STRSEP)
254endif() 256endif()
255 257
256check_function_exists(strtonum HAVE_STRTONUM) 258check_symbol_exists(strtonum "stdlib.h" HAVE_STRTONUM)
257if(HAVE_STRTONUM) 259if(HAVE_STRTONUM)
258 add_definitions(-DHAVE_STRTONUM) 260 add_definitions(-DHAVE_STRTONUM)
259endif() 261endif()
260 262
261check_function_exists(arc4random_buf HAVE_ARC4RANDOM_BUF) 263check_symbol_exists(arc4random_buf "stdlib.h" HAVE_ARC4RANDOM_BUF)
262if(HAVE_ARC4RANDOM_BUF) 264if(HAVE_ARC4RANDOM_BUF)
263 add_definitions(-DHAVE_ARC4RANDOM_BUF) 265 add_definitions(-DHAVE_ARC4RANDOM_BUF)
264endif() 266endif()
265 267
266check_function_exists(arc4random_uniform HAVE_ARC4RANDOM_UNIFORM) 268check_symbol_exists(arc4random_uniform "stdlib.h" HAVE_ARC4RANDOM_UNIFORM)
267if(HAVE_ARC4RANDOM_UNIFORM) 269if(HAVE_ARC4RANDOM_UNIFORM)
268 add_definitions(-DHAVE_ARC4RANDOM_UNIFORM) 270 add_definitions(-DHAVE_ARC4RANDOM_UNIFORM)
269endif() 271endif()
270 272
271check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO) 273check_symbol_exists(explicit_bzero "string.h" HAVE_EXPLICIT_BZERO)
272if(HAVE_EXPLICIT_BZERO) 274if(HAVE_EXPLICIT_BZERO)
273 add_definitions(-DHAVE_EXPLICIT_BZERO) 275 add_definitions(-DHAVE_EXPLICIT_BZERO)
274endif() 276endif()
275 277
276check_function_exists(getauxval HAVE_GETAUXVAL) 278check_symbol_exists(getauxval "sys/auxv.h" HAVE_GETAUXVAL)
277if(HAVE_GETAUXVAL) 279if(HAVE_GETAUXVAL)
278 add_definitions(-DHAVE_GETAUXVAL) 280 add_definitions(-DHAVE_GETAUXVAL)
279endif() 281endif()
280 282
283# XXX macos fails to find getentropy with check_symbol_exists()
281check_function_exists(getentropy HAVE_GETENTROPY) 284check_function_exists(getentropy HAVE_GETENTROPY)
282if(HAVE_GETENTROPY) 285if(HAVE_GETENTROPY)
283 add_definitions(-DHAVE_GETENTROPY) 286 add_definitions(-DHAVE_GETENTROPY)
284endif() 287endif()
285 288
286check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE) 289check_symbol_exists(getpagesize "unistd.h" HAVE_GETPAGESIZE)
287if(HAVE_GETPAGESIZE) 290if(HAVE_GETPAGESIZE)
288 add_definitions(-DHAVE_GETPAGESIZE) 291 add_definitions(-DHAVE_GETPAGESIZE)
289endif() 292endif()
290 293
291check_function_exists(getprogname HAVE_GETPROGNAME) 294check_symbol_exists(getprogname "stdlib.h" HAVE_GETPROGNAME)
292if(HAVE_GETPROGNAME) 295if(HAVE_GETPROGNAME)
293 add_definitions(-DHAVE_GETPROGNAME) 296 add_definitions(-DHAVE_GETPROGNAME)
294endif() 297endif()
295 298
296check_function_exists(syslog_r HAVE_SYSLOG_R) 299check_symbol_exists(syslog_r "syslog.h stdarg.h" HAVE_SYSLOG_R)
297if(HAVE_SYSLOG_R) 300if(HAVE_SYSLOG_R)
298 add_definitions(-DHAVE_SYSLOG_R) 301 add_definitions(-DHAVE_SYSLOG_R)
299endif() 302endif()
300 303
304# XXX - needs _GNU_SOURCE on linux
301check_function_exists(syslog HAVE_SYSLOG) 305check_function_exists(syslog HAVE_SYSLOG)
302if(HAVE_SYSLOG) 306if(HAVE_SYSLOG)
303 add_definitions(-DHAVE_SYSLOG) 307 add_definitions(-DHAVE_SYSLOG)
@@ -308,16 +312,17 @@ if(HAVE_TIMESPECSUB)
308 add_definitions(-DHAVE_TIMESPECSUB) 312 add_definitions(-DHAVE_TIMESPECSUB)
309endif() 313endif()
310 314
311check_function_exists(timingsafe_bcmp HAVE_TIMINGSAFE_BCMP) 315check_symbol_exists(timingsafe_bcmp "string.h" HAVE_TIMINGSAFE_BCMP)
312if(HAVE_TIMINGSAFE_BCMP) 316if(HAVE_TIMINGSAFE_BCMP)
313 add_definitions(-DHAVE_TIMINGSAFE_BCMP) 317 add_definitions(-DHAVE_TIMINGSAFE_BCMP)
314endif() 318endif()
315 319
316check_function_exists(timingsafe_memcmp HAVE_TIMINGSAFE_MEMCMP) 320check_symbol_exists(timingsafe_memcmp "string.h" HAVE_TIMINGSAFE_MEMCMP)
317if(HAVE_TIMINGSAFE_MEMCMP) 321if(HAVE_TIMINGSAFE_MEMCMP)
318 add_definitions(-DHAVE_TIMINGSAFE_MEMCMP) 322 add_definitions(-DHAVE_TIMINGSAFE_MEMCMP)
319endif() 323endif()
320 324
325# XXX - needs _GNU_SOURCE on linux
321check_function_exists(memmem HAVE_MEMMEM) 326check_function_exists(memmem HAVE_MEMMEM)
322if(HAVE_MEMMEM) 327if(HAVE_MEMMEM)
323 add_definitions(-DHAVE_MEMMEM) 328 add_definitions(-DHAVE_MEMMEM)
diff --git a/apps/nc/CMakeLists.txt b/apps/nc/CMakeLists.txt
index 7bbdb02..d5f7813 100644
--- a/apps/nc/CMakeLists.txt
+++ b/apps/nc/CMakeLists.txt
@@ -22,7 +22,7 @@ else()
22 set(NC_SRC ${NC_SRC} compat/accept4.c) 22 set(NC_SRC ${NC_SRC} compat/accept4.c)
23endif() 23endif()
24 24
25check_function_exists(readpassphrase HAVE_READPASSPHRASE) 25check_symbol_exists(readpassphrase "readpassphrase.h" HAVE_READPASSPHRASE)
26if(HAVE_READPASSPHRASE) 26if(HAVE_READPASSPHRASE)
27 add_definitions(-DHAVE_READPASSPHRASE) 27 add_definitions(-DHAVE_READPASSPHRASE)
28else() 28else()