10bbfda8aSnia# 20bbfda8aSnia# Check for library functions and the like that we need. 30bbfda8aSnia# 40bbfda8aSnia# In some cases, we may decide to enable workarounds of various sorts 50bbfda8aSnia# here too; in others, we just bomb out. Technically, doing that is 60bbfda8aSnia# unnecessary, since the build will just fail later, but this may be 70bbfda8aSnia# friendlier in telling the user _why_ than letting them try to interpret 80bbfda8aSnia# compiler or linker errors. 90bbfda8aSnia# 100bbfda8aSnia# This is distinct from the checking in build_options.cmake; that's about 110bbfda8aSnia# stuff we have build options to enable/disable, whereas this is more 120bbfda8aSnia# stuff we depend on unconditionally. 130bbfda8aSnia# 140bbfda8aSnia 150bbfda8aSnia 160bbfda8aSnia# getopt_long(3) is in getopt.h everywhere I can find it. Until we find 170bbfda8aSnia# a system where it's somewhere else, or systems it's nowhere and we have 180bbfda8aSnia# to provide it, we'll either find it there or error out and blow up. If 190bbfda8aSnia# we don't find problems that require additional workaround in the next 200bbfda8aSnia# couple releases, we should retire the check to avoid wasting time/space 210bbfda8aSnia# checking things we know will work. 220bbfda8aSniacheck_include_files(getopt.h HAS_GETOPT_H) 230bbfda8aSniacheck_function_exists(getopt_long HAS_GETOPT_LONG) 240bbfda8aSniaif(NOT HAS_GETOPT_H) 250bbfda8aSnia message(FATAL_ERROR "Can't find getopt.h (needed for getopt_long()).") 260bbfda8aSniaendif(NOT HAS_GETOPT_H) 270bbfda8aSniaif(NOT HAS_GETOPT_LONG) 280bbfda8aSnia message(FATAL_ERROR "You don't seem to have getopt_long().") 290bbfda8aSniaendif(NOT HAS_GETOPT_LONG) 300bbfda8aSnia 310bbfda8aSnia 320bbfda8aSnia 330bbfda8aSnia# asprintf(3) has been in glibc since at least the early 90's, the BSD's 340bbfda8aSnia# since the mid 90's, and [Open]Solaris since 11. It's not in Sol10, at 350bbfda8aSnia# least some versions of AIX, etc. There's a version in openssh-portable 360bbfda8aSnia# that I believe is pretty portable if we find a system we care about 370bbfda8aSnia# lacking it and need to pull in a local version, but I don't expect to. 38b18c2d1eSnia# 39b18c2d1eSnia# n.b.; this slightly overlaps with earlier run code that sometimes needs 40b18c2d1eSnia# to crank on extra -D's to show this up in headers, but it differs a 41b18c2d1eSnia# little, so I won't bother collapsing them... 420bbfda8aSniacheck_function_exists(asprintf HAS_ASPRINTF) 430bbfda8aSniaif(NOT HAS_ASPRINTF) 440bbfda8aSnia message(FATAL_ERROR "You don't seem to have asprintf(3).") 450bbfda8aSniaendif(NOT HAS_ASPRINTF) 46