geom_gate userland utility improvements
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

413 lines
12 KiB

  1. # AC_PREREQ(2.57)
  2. AC_INIT(libssh2, [-], libssh2-devel@cool.haxx.se)
  3. AC_CONFIG_MACRO_DIR([m4])
  4. AC_CONFIG_SRCDIR([src])
  5. AC_CONFIG_HEADERS([src/libssh2_config.h])
  6. AM_MAINTAINER_MODE
  7. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  8. dnl SED is needed by some of the tools
  9. AC_PATH_PROG( SED, sed, sed-was-not-found-by-configure,
  10. $PATH:/usr/bin:/usr/local/bin)
  11. AC_SUBST(SED)
  12. if test "x$SED" = "xsed-was-not-found-by-configure"; then
  13. AC_MSG_WARN([sed was not found, this may ruin your chances to build fine])
  14. fi
  15. dnl figure out the libssh2 version
  16. LIBSSH2VER=`$SED -ne 's/^#define LIBSSH2_VERSION *"\(.*\)"/\1/p' ${srcdir}/include/libssh2.h`
  17. AM_INIT_AUTOMAKE
  18. AC_MSG_CHECKING([libssh2 version])
  19. AC_MSG_RESULT($LIBSSH2VER)
  20. AC_SUBST(LIBSSH2VER)
  21. AB_VERSION=$LIBSSH2VER
  22. AB_INIT
  23. # Check for the OS.
  24. # Daniel's note: this should not be necessary and we need to work to
  25. # get this removed.
  26. AC_CANONICAL_HOST
  27. case "$host" in
  28. *-mingw*)
  29. CFLAGS="$CFLAGS -DLIBSSH2_WIN32"
  30. LIBS="$LIBS -lws2_32"
  31. ;;
  32. *-cygwin)
  33. CFLAGS="$CFLAGS -DLIBSSH2_WIN32"
  34. ;;
  35. *darwin*)
  36. CFLAGS="$CFLAGS -DLIBSSH2_DARWIN"
  37. ;;
  38. *hpux*)
  39. ;;
  40. *osf*)
  41. CFLAGS="$CFLAGS -D_POSIX_PII_SOCKET"
  42. ;;
  43. *)
  44. ;;
  45. esac
  46. AC_CHECK_TYPE(long long,
  47. [AC_DEFINE(HAVE_LONGLONG, 1,
  48. [Define to 1 if the compiler supports the 'long long' data type.])]
  49. longlong="yes"
  50. )
  51. dnl Our configure and build reentrant settings
  52. CURL_CONFIGURE_REENTRANT
  53. # Some systems (Solaris?) have socket() in -lsocket.
  54. AC_SEARCH_LIBS(socket, socket)
  55. # Solaris has inet_addr() in -lnsl.
  56. AC_SEARCH_LIBS(inet_addr, nsl)
  57. AC_SUBST(LIBS)
  58. AC_PROG_CC
  59. AC_PROG_CXX
  60. AC_PROG_INSTALL
  61. AC_PROG_LN_S
  62. AC_PROG_MAKE_SET
  63. AC_PATH_PROGS(SSHD, [sshd], [],
  64. [$PATH$PATH_SEPARATOR/usr/libexec$PATH_SEPARATOR]dnl
  65. [/usr/sbin$PATH_SEPARATOR/usr/etc$PATH_SEPARATOR/etc])
  66. AM_CONDITIONAL(SSHD, test -n "$SSHD")
  67. AC_LIBTOOL_WIN32_DLL
  68. AC_PROG_LIBTOOL
  69. AC_C_BIGENDIAN
  70. dnl check for how to do large files
  71. AC_SYS_LARGEFILE
  72. # Crypto backends
  73. found_crypto=none
  74. found_crypto_str=""
  75. support_clear_memory=no
  76. crypto_errors=""
  77. m4_set_add([crypto_backends], [openssl])
  78. m4_set_add([crypto_backends], [libgcrypt])
  79. m4_set_add([crypto_backends], [mbedtls])
  80. m4_set_add([crypto_backends], [wincng])
  81. AC_ARG_WITH([crypto],
  82. AC_HELP_STRING([--with-crypto=auto|]m4_set_contents([crypto_backends], [|]),
  83. [Select crypto backend (default: auto)]),
  84. use_crypto=$withval,
  85. use_crypto=auto
  86. )
  87. case "${use_crypto}" in
  88. auto|m4_set_contents([crypto_backends], [|]))
  89. m4_set_map([crypto_backends], [LIBSSH2_CHECK_CRYPTO])
  90. ;;
  91. yes|"")
  92. crypto_errors="No crypto backend specified!"
  93. ;;
  94. *)
  95. crypto_errors="Unknown crypto backend '${use_crypto}' specified!"
  96. ;;
  97. esac
  98. if test "$found_crypto" = "none"; then
  99. crypto_errors="${crypto_errors}
  100. Specify --with-crypto=\$backend and/or the neccessary library search prefix.
  101. Known crypto backends: auto, m4_set_contents([crypto_backends], [, ])"
  102. AS_MESSAGE([ERROR: ${crypto_errors}])
  103. else
  104. test "$found_crypto_str" = "" && found_crypto_str="$found_crypto"
  105. fi
  106. m4_set_foreach([crypto_backends], [backend],
  107. [AM_CONDITIONAL(m4_toupper(backend), test "$found_crypto" = "backend")]
  108. )
  109. m4_undefine([backend])
  110. # libz
  111. AC_ARG_WITH([libz],
  112. AC_HELP_STRING([--with-libz],[Use libz for compression]),
  113. use_libz=$withval,
  114. use_libz=auto)
  115. found_libz=no
  116. libz_errors=""
  117. if test "$use_libz" != no; then
  118. AC_LIB_HAVE_LINKFLAGS([z], [], [#include <zlib.h>])
  119. if test "$ac_cv_libz" != yes; then
  120. if test "$use_libz" = auto; then
  121. AC_MSG_NOTICE([Cannot find libz, disabling compression])
  122. found_libz="disabled; no libz found"
  123. else
  124. libz_errors="No libz found!
  125. Try --with-libz-prefix=PATH if you know that you have it."
  126. AS_MESSAGE([ERROR: $libz_errors])
  127. fi
  128. else
  129. AC_DEFINE(LIBSSH2_HAVE_ZLIB, 1, [Compile in zlib support])
  130. LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }zlib"
  131. found_libz="yes"
  132. fi
  133. fi
  134. AC_SUBST(LIBSREQUIRED)
  135. #
  136. # Optional Settings
  137. #
  138. AC_ARG_ENABLE(crypt-none,
  139. AC_HELP_STRING([--enable-crypt-none],[Permit "none" cipher -- NOT RECOMMENDED]),
  140. [AC_DEFINE(LIBSSH2_CRYPT_NONE, 1, [Enable "none" cipher -- NOT RECOMMENDED])])
  141. AC_ARG_ENABLE(mac-none,
  142. AC_HELP_STRING([--enable-mac-none],[Permit "none" MAC -- NOT RECOMMENDED]),
  143. [AC_DEFINE(LIBSSH2_MAC_NONE, 1, [Enable "none" MAC -- NOT RECOMMENDED])])
  144. AC_ARG_ENABLE(gex-new,
  145. AC_HELP_STRING([--disable-gex-new],[Disable "new" diffie-hellman-group-exchange-sha1 method]),
  146. [GEX_NEW=$enableval])
  147. if test "$GEX_NEW" != "no"; then
  148. AC_DEFINE(LIBSSH2_DH_GEX_NEW, 1, [Enable newer diffie-hellman-group-exchange-sha1 syntax])
  149. fi
  150. AC_ARG_ENABLE(clear-memory,
  151. AC_HELP_STRING([--disable-clear-memory],[Disable clearing of memory before being freed]),
  152. [CLEAR_MEMORY=$enableval])
  153. if test "$CLEAR_MEMORY" != "no"; then
  154. if test "$support_clear_memory" = "yes"; then
  155. AC_DEFINE(LIBSSH2_CLEAR_MEMORY, 1, [Enable clearing of memory before being freed])
  156. enable_clear_memory=yes
  157. else
  158. if test "$CLEAR_MEMORY" = "yes"; then
  159. AC_MSG_ERROR([secure clearing/zeroing of memory is not supported by the selected crypto backend])
  160. else
  161. AC_MSG_WARN([secure clearing/zeroing of memory is not supported by the selected crypto backend])
  162. fi
  163. enable_clear_memory=unsupported
  164. fi
  165. else
  166. if test "$support_clear_memory" = "yes"; then
  167. enable_clear_memory=no
  168. else
  169. AC_MSG_WARN([secure clearing/zeroing of memory is not supported by the selected crypto backend])
  170. enable_clear_memory=unsupported
  171. fi
  172. fi
  173. dnl ************************************************************
  174. dnl option to switch on compiler debug options
  175. dnl
  176. AC_MSG_CHECKING([whether to enable pedantic and debug compiler options])
  177. AC_ARG_ENABLE(debug,
  178. AC_HELP_STRING([--enable-debug],[Enable pedantic and debug options])
  179. AC_HELP_STRING([--disable-debug],[Disable debug options]),
  180. [ case "$enable_debug" in
  181. no)
  182. AC_MSG_RESULT(no)
  183. CPPFLAGS="$CPPFLAGS -DNDEBUG"
  184. ;;
  185. *) AC_MSG_RESULT(yes)
  186. enable_debug=yes
  187. CPPFLAGS="$CPPFLAGS -DLIBSSH2DEBUG"
  188. CFLAGS="$CFLAGS -g"
  189. dnl set compiler "debug" options to become more picky, and remove
  190. dnl optimize options from CFLAGS
  191. CURL_CC_DEBUG_OPTS
  192. ;;
  193. esac
  194. ],
  195. enable_debug=no
  196. AC_MSG_RESULT(no)
  197. )
  198. dnl ************************************************************
  199. dnl Enable hiding of internal symbols in library to reduce its size and
  200. dnl speed dynamic linking of applications. This currently is only supported
  201. dnl on gcc >= 4.0 and SunPro C.
  202. dnl
  203. AC_MSG_CHECKING([whether to enable hidden symbols in the library])
  204. AC_ARG_ENABLE(hidden-symbols,
  205. AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
  206. AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
  207. [ case "$enableval" in
  208. no)
  209. AC_MSG_RESULT(no)
  210. ;;
  211. *)
  212. AC_MSG_CHECKING([whether $CC supports it])
  213. if test "$GCC" = yes ; then
  214. if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
  215. AC_MSG_RESULT(yes)
  216. AC_DEFINE(LIBSSH2_API, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
  217. CFLAGS="$CFLAGS -fvisibility=hidden"
  218. else
  219. AC_MSG_RESULT(no)
  220. fi
  221. else
  222. dnl Test for SunPro cc
  223. if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
  224. AC_MSG_RESULT(yes)
  225. AC_DEFINE(LIBSSH2_API, [__global], [to make a symbol visible])
  226. CFLAGS="$CFLAGS -xldscope=hidden"
  227. else
  228. AC_MSG_RESULT(no)
  229. fi
  230. fi
  231. ;;
  232. esac ],
  233. AC_MSG_RESULT(no)
  234. )
  235. # Build example applications?
  236. AC_MSG_CHECKING([whether to build example applications])
  237. AC_ARG_ENABLE([examples-build],
  238. AC_HELP_STRING([--enable-examples-build], [Build example applications (this is the default)])
  239. AC_HELP_STRING([--disable-examples-build], [Do not build example applications]),
  240. [case "$enableval" in
  241. no | false)
  242. build_examples='no'
  243. ;;
  244. *)
  245. build_examples='yes'
  246. ;;
  247. esac], [build_examples='yes'])
  248. AC_MSG_RESULT($build_examples)
  249. AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
  250. # Build OSS fuzzing targets?
  251. AC_ARG_ENABLE([ossfuzzers],
  252. [AS_HELP_STRING([--enable-ossfuzzers],
  253. [Whether to generate the fuzzers for OSS-Fuzz])],
  254. [have_ossfuzzers=yes], [have_ossfuzzers=no])
  255. AM_CONDITIONAL([USE_OSSFUZZERS], [test "x$have_ossfuzzers" = "xyes"])
  256. # Set the correct flags for the given fuzzing engine.
  257. AC_SUBST([LIB_FUZZING_ENGINE])
  258. AM_CONDITIONAL([USE_OSSFUZZ_FLAG], [test "x$LIB_FUZZING_ENGINE" = "x-fsanitize=fuzzer"])
  259. AM_CONDITIONAL([USE_OSSFUZZ_STATIC], [test -f "$LIB_FUZZING_ENGINE"])
  260. # Checks for header files.
  261. # AC_HEADER_STDC
  262. AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h])
  263. AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/ioctl.h sys/time.h])
  264. AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
  265. AC_CHECK_HEADERS([sys/un.h], [have_sys_un_h=yes], [have_sys_un_h=no])
  266. AM_CONDITIONAL([HAVE_SYS_UN_H], test "x$have_sys_un_h" = xyes)
  267. case $host in
  268. *-*-cygwin* | *-*-cegcc*)
  269. # These are POSIX-like systems using BSD-like sockets API.
  270. ;;
  271. *)
  272. AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h])
  273. ;;
  274. esac
  275. case $host in
  276. *darwin*|*interix*)
  277. dnl poll() does not work on these platforms
  278. dnl Interix: "does provide poll(), but the implementing developer must
  279. dnl have been in a bad mood, because poll() only works on the /proc
  280. dnl filesystem here"
  281. dnl Mac OS X's poll has funny behaviors, like:
  282. dnl not being able to do poll on no fildescriptors (10.3?)
  283. dnl not being able to poll on some files (like anything in /dev)
  284. dnl not having reliable timeout support
  285. dnl inconsistent return of POLLHUP where other implementations give POLLIN
  286. AC_MSG_NOTICE([poll use is disabled on this platform])
  287. ;;
  288. *)
  289. AC_CHECK_FUNCS(poll)
  290. ;;
  291. esac
  292. AC_CHECK_FUNCS(gettimeofday select strtoll memset_s)
  293. dnl Check for select() into ws2_32 for Msys/Mingw
  294. if test "$ac_cv_func_select" != "yes"; then
  295. AC_MSG_CHECKING([for select in ws2_32])
  296. AC_TRY_LINK([
  297. #ifdef HAVE_WINSOCK2_H
  298. #ifndef WIN32_LEAN_AND_MEAN
  299. #define WIN32_LEAN_AND_MEAN
  300. #endif
  301. #include <winsock2.h>
  302. #endif
  303. ],[
  304. select(0,(fd_set *)NULL,(fd_set *)NULL,(fd_set *)NULL,(struct timeval *)NULL);
  305. ],[
  306. AC_MSG_RESULT([yes])
  307. HAVE_SELECT="1"
  308. AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
  309. [Define to 1 if you have the select function.])
  310. ],[
  311. AC_MSG_RESULT([no])
  312. ])
  313. fi
  314. AC_FUNC_ALLOCA
  315. # Checks for typedefs, structures, and compiler characteristics.
  316. AC_C_CONST
  317. AC_C_INLINE
  318. CURL_CHECK_NONBLOCKING_SOCKET
  319. missing_required_deps=0
  320. if test "${libz_errors}" != ""; then
  321. AS_MESSAGE([ERROR: ${libz_errors}])
  322. missing_required_deps=1
  323. fi
  324. if test "$found_crypto" = "none"; then
  325. AS_MESSAGE([ERROR: ${crypto_errors}])
  326. missing_required_deps=1
  327. fi
  328. if test $missing_required_deps = 1; then
  329. AC_MSG_ERROR([Required dependencies are missing!])
  330. fi
  331. # Configure parameters
  332. LIBSSH2_CHECK_OPTION_WERROR
  333. AC_CONFIG_FILES([Makefile
  334. src/Makefile
  335. tests/Makefile
  336. tests/ossfuzz/Makefile
  337. example/Makefile
  338. docs/Makefile
  339. libssh2.pc])
  340. AC_OUTPUT
  341. AC_MSG_NOTICE([summary of build options:
  342. version: ${LIBSSH2VER}
  343. Host type: ${host}
  344. Install prefix: ${prefix}
  345. Compiler: ${CC}
  346. Compiler flags: ${CFLAGS}
  347. Library types: Shared=${enable_shared}, Static=${enable_static}
  348. Crypto library: ${found_crypto_str}
  349. Clear memory: $enable_clear_memory
  350. Debug build: $enable_debug
  351. Build examples: $build_examples
  352. Path to sshd: $ac_cv_path_SSHD (only for self-tests)
  353. zlib compression: ${found_libz}
  354. ])