curl-confopts.m4 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. #
  10. # This software is licensed as described in the file COPYING, which
  11. # you should have received as part of this distribution. The terms
  12. # are also available at https://curl.haxx.se/docs/copyright.html.
  13. #
  14. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. # copies of the Software, and permit persons to whom the Software is
  16. # furnished to do so, under the terms of the COPYING file.
  17. #
  18. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. # KIND, either express or implied.
  20. #
  21. #***************************************************************************
  22. # File version for 'aclocal' use. Keep it a single number.
  23. # serial 19
  24. dnl CURL_CHECK_OPTION_THREADED_RESOLVER
  25. dnl -------------------------------------------------
  26. dnl Verify if configure has been invoked with option
  27. dnl --enable-threaded-resolver or --disable-threaded-resolver, and
  28. dnl set shell variable want_thres as appropriate.
  29. AC_DEFUN([CURL_CHECK_OPTION_THREADED_RESOLVER], [
  30. AC_MSG_CHECKING([whether to enable the threaded resolver])
  31. OPT_THRES="default"
  32. AC_ARG_ENABLE(threaded_resolver,
  33. AC_HELP_STRING([--enable-threaded-resolver],[Enable threaded resolver])
  34. AC_HELP_STRING([--disable-threaded-resolver],[Disable threaded resolver]),
  35. OPT_THRES=$enableval)
  36. case "$OPT_THRES" in
  37. yes)
  38. dnl --enable-threaded-resolver option used
  39. want_thres="yes"
  40. ;;
  41. *)
  42. dnl configure option not specified
  43. want_thres="no"
  44. ;;
  45. esac
  46. AC_MSG_RESULT([$want_thres])
  47. ])
  48. dnl CURL_CHECK_OPTION_ARES
  49. dnl -------------------------------------------------
  50. dnl Verify if configure has been invoked with option
  51. dnl --enable-ares or --disable-ares, and
  52. dnl set shell variable want_ares as appropriate.
  53. AC_DEFUN([CURL_CHECK_OPTION_ARES], [
  54. dnl AC_BEFORE([$0],[CURL_CHECK_OPTION_THREADS])dnl
  55. AC_BEFORE([$0],[CURL_CHECK_LIB_ARES])dnl
  56. AC_MSG_CHECKING([whether to enable c-ares for DNS lookups])
  57. OPT_ARES="default"
  58. AC_ARG_ENABLE(ares,
  59. AC_HELP_STRING([--enable-ares@<:@=PATH@:>@],[Enable c-ares for DNS lookups])
  60. AC_HELP_STRING([--disable-ares],[Disable c-ares for DNS lookups]),
  61. OPT_ARES=$enableval)
  62. case "$OPT_ARES" in
  63. no)
  64. dnl --disable-ares option used
  65. want_ares="no"
  66. ;;
  67. default)
  68. dnl configure option not specified
  69. want_ares="no"
  70. ;;
  71. *)
  72. dnl --enable-ares option used
  73. want_ares="yes"
  74. if test -n "$enableval" && test "$enableval" != "yes"; then
  75. want_ares_path="$enableval"
  76. fi
  77. ;;
  78. esac
  79. AC_MSG_RESULT([$want_ares])
  80. ])
  81. dnl CURL_CHECK_OPTION_CURLDEBUG
  82. dnl -------------------------------------------------
  83. dnl Verify if configure has been invoked with option
  84. dnl --enable-curldebug or --disable-curldebug, and set
  85. dnl shell variable want_curldebug value as appropriate.
  86. AC_DEFUN([CURL_CHECK_OPTION_CURLDEBUG], [
  87. AC_BEFORE([$0],[CURL_CHECK_CURLDEBUG])dnl
  88. AC_MSG_CHECKING([whether to enable curl debug memory tracking])
  89. OPT_CURLDEBUG_BUILD="default"
  90. AC_ARG_ENABLE(curldebug,
  91. AC_HELP_STRING([--enable-curldebug],[Enable curl debug memory tracking])
  92. AC_HELP_STRING([--disable-curldebug],[Disable curl debug memory tracking]),
  93. OPT_CURLDEBUG_BUILD=$enableval)
  94. case "$OPT_CURLDEBUG_BUILD" in
  95. no)
  96. dnl --disable-curldebug option used
  97. want_curldebug="no"
  98. AC_MSG_RESULT([no])
  99. ;;
  100. default)
  101. dnl configure's curldebug option not specified. Initially we will
  102. dnl handle this as a a request to use the same setting as option
  103. dnl --enable-debug. IOW, initially, for debug-enabled builds
  104. dnl this will be handled as a request to enable curldebug if
  105. dnl possible, and for debug-disabled builds this will be handled
  106. dnl as a request to disable curldebug.
  107. if test "$want_debug" = "yes"; then
  108. AC_MSG_RESULT([(assumed) yes])
  109. else
  110. AC_MSG_RESULT([no])
  111. fi
  112. want_curldebug_assumed="yes"
  113. want_curldebug="$want_debug"
  114. ;;
  115. *)
  116. dnl --enable-curldebug option used.
  117. dnl The use of this option value is a request to enable curl's
  118. dnl debug memory tracking for the libcurl library. This can only
  119. dnl be done when some requisites are simultaneously satisfied.
  120. dnl Later on, these requisites are verified and if they are not
  121. dnl fully satisfied the option will be ignored and act as if
  122. dnl --disable-curldebug had been given setting shell variable
  123. dnl want_curldebug to 'no'.
  124. want_curldebug="yes"
  125. AC_MSG_RESULT([yes])
  126. ;;
  127. esac
  128. ])
  129. dnl CURL_CHECK_OPTION_DEBUG
  130. dnl -------------------------------------------------
  131. dnl Verify if configure has been invoked with option
  132. dnl --enable-debug or --disable-debug, and set shell
  133. dnl variable want_debug value as appropriate.
  134. AC_DEFUN([CURL_CHECK_OPTION_DEBUG], [
  135. AC_BEFORE([$0],[CURL_CHECK_OPTION_WARNINGS])dnl
  136. AC_BEFORE([$0],[CURL_CHECK_OPTION_CURLDEBUG])dnl
  137. AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
  138. AC_MSG_CHECKING([whether to enable debug build options])
  139. OPT_DEBUG_BUILD="default"
  140. AC_ARG_ENABLE(debug,
  141. AC_HELP_STRING([--enable-debug],[Enable debug build options])
  142. AC_HELP_STRING([--disable-debug],[Disable debug build options]),
  143. OPT_DEBUG_BUILD=$enableval)
  144. case "$OPT_DEBUG_BUILD" in
  145. no)
  146. dnl --disable-debug option used
  147. want_debug="no"
  148. ;;
  149. default)
  150. dnl configure option not specified
  151. want_debug="no"
  152. ;;
  153. *)
  154. dnl --enable-debug option used
  155. want_debug="yes"
  156. ;;
  157. esac
  158. AC_MSG_RESULT([$want_debug])
  159. ])
  160. dnl CURL_CHECK_OPTION_OPTIMIZE
  161. dnl -------------------------------------------------
  162. dnl Verify if configure has been invoked with option
  163. dnl --enable-optimize or --disable-optimize, and set
  164. dnl shell variable want_optimize value as appropriate.
  165. AC_DEFUN([CURL_CHECK_OPTION_OPTIMIZE], [
  166. AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
  167. AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
  168. AC_MSG_CHECKING([whether to enable compiler optimizer])
  169. OPT_COMPILER_OPTIMIZE="default"
  170. AC_ARG_ENABLE(optimize,
  171. AC_HELP_STRING([--enable-optimize],[Enable compiler optimizations])
  172. AC_HELP_STRING([--disable-optimize],[Disable compiler optimizations]),
  173. OPT_COMPILER_OPTIMIZE=$enableval)
  174. case "$OPT_COMPILER_OPTIMIZE" in
  175. no)
  176. dnl --disable-optimize option used. We will handle this as
  177. dnl a request to disable compiler optimizations if possible.
  178. dnl If the compiler is known CFLAGS and CPPFLAGS will be
  179. dnl overridden, otherwise this can not be honored.
  180. want_optimize="no"
  181. AC_MSG_RESULT([no])
  182. ;;
  183. default)
  184. dnl configure's optimize option not specified. Initially we will
  185. dnl handle this as a a request contrary to configure's setting
  186. dnl for --enable-debug. IOW, initially, for debug-enabled builds
  187. dnl this will be handled as a request to disable optimizations if
  188. dnl possible, and for debug-disabled builds this will be handled
  189. dnl initially as a request to enable optimizations if possible.
  190. dnl Finally, if the compiler is known and CFLAGS and CPPFLAGS do
  191. dnl not have any optimizer flag the request will be honored, in
  192. dnl any other case the request can not be honored.
  193. dnl IOW, existing optimizer flags defined in CFLAGS or CPPFLAGS
  194. dnl will always take precedence over any initial assumption.
  195. if test "$want_debug" = "yes"; then
  196. want_optimize="assume_no"
  197. AC_MSG_RESULT([(assumed) no])
  198. else
  199. want_optimize="assume_yes"
  200. AC_MSG_RESULT([(assumed) yes])
  201. fi
  202. ;;
  203. *)
  204. dnl --enable-optimize option used. We will handle this as
  205. dnl a request to enable compiler optimizations if possible.
  206. dnl If the compiler is known CFLAGS and CPPFLAGS will be
  207. dnl overridden, otherwise this can not be honored.
  208. want_optimize="yes"
  209. AC_MSG_RESULT([yes])
  210. ;;
  211. esac
  212. ])
  213. dnl CURL_CHECK_OPTION_SYMBOL_HIDING
  214. dnl -------------------------------------------------
  215. dnl Verify if configure has been invoked with option
  216. dnl --enable-symbol-hiding or --disable-symbol-hiding,
  217. dnl setting shell variable want_symbol_hiding value.
  218. AC_DEFUN([CURL_CHECK_OPTION_SYMBOL_HIDING], [
  219. AC_BEFORE([$0],[CURL_CHECK_COMPILER_SYMBOL_HIDING])dnl
  220. AC_MSG_CHECKING([whether to enable hiding of library internal symbols])
  221. OPT_SYMBOL_HIDING="default"
  222. AC_ARG_ENABLE(symbol-hiding,
  223. AC_HELP_STRING([--enable-symbol-hiding],[Enable hiding of library internal symbols])
  224. AC_HELP_STRING([--disable-symbol-hiding],[Disable hiding of library internal symbols]),
  225. OPT_SYMBOL_HIDING=$enableval)
  226. AC_ARG_ENABLE(hidden-symbols,
  227. AC_HELP_STRING([--enable-hidden-symbols],[To be deprecated, use --enable-symbol-hiding])
  228. AC_HELP_STRING([--disable-hidden-symbols],[To be deprecated, use --disable-symbol-hiding]),
  229. OPT_SYMBOL_HIDING=$enableval)
  230. case "$OPT_SYMBOL_HIDING" in
  231. no)
  232. dnl --disable-symbol-hiding option used.
  233. dnl This is an indication to not attempt hiding of library internal
  234. dnl symbols. Default symbol visibility will be used, which normally
  235. dnl exposes all library internal symbols.
  236. want_symbol_hiding="no"
  237. AC_MSG_RESULT([no])
  238. ;;
  239. default)
  240. dnl configure's symbol-hiding option not specified.
  241. dnl Handle this as if --enable-symbol-hiding option was given.
  242. want_symbol_hiding="yes"
  243. AC_MSG_RESULT([yes])
  244. ;;
  245. *)
  246. dnl --enable-symbol-hiding option used.
  247. dnl This is an indication to attempt hiding of library internal
  248. dnl symbols. This is only supported on some compilers/linkers.
  249. want_symbol_hiding="yes"
  250. AC_MSG_RESULT([yes])
  251. ;;
  252. esac
  253. ])
  254. dnl CURL_CHECK_OPTION_THREADS
  255. dnl -------------------------------------------------
  256. dnl Verify if configure has been invoked with option
  257. dnl --enable-threads or --disable-threads, and
  258. dnl set shell variable want_threads as appropriate.
  259. dnl AC_DEFUN([CURL_CHECK_OPTION_THREADS], [
  260. dnl AC_BEFORE([$0],[CURL_CHECK_LIB_THREADS])dnl
  261. dnl AC_MSG_CHECKING([whether to enable threads for DNS lookups])
  262. dnl OPT_THREADS="default"
  263. dnl AC_ARG_ENABLE(threads,
  264. dnl AC_HELP_STRING([--enable-threads@<:@=PATH@:>@],[Enable threads for DNS lookups])
  265. dnl AC_HELP_STRING([--disable-threads],[Disable threads for DNS lookups]),
  266. dnl OPT_THREADS=$enableval)
  267. dnl case "$OPT_THREADS" in
  268. dnl no)
  269. dnl dnl --disable-threads option used
  270. dnl want_threads="no"
  271. dnl AC_MSG_RESULT([no])
  272. dnl ;;
  273. dnl default)
  274. dnl dnl configure option not specified
  275. dnl want_threads="no"
  276. dnl AC_MSG_RESULT([(assumed) no])
  277. dnl ;;
  278. dnl *)
  279. dnl dnl --enable-threads option used
  280. dnl want_threads="yes"
  281. dnl want_threads_path="$enableval"
  282. dnl AC_MSG_RESULT([yes])
  283. dnl ;;
  284. dnl esac
  285. dnl #
  286. dnl if test "$want_ares" = "assume_yes"; then
  287. dnl if test "$want_threads" = "yes"; then
  288. dnl AC_MSG_CHECKING([whether to ignore c-ares enabling assumed setting])
  289. dnl AC_MSG_RESULT([yes])
  290. dnl want_ares="no"
  291. dnl else
  292. dnl want_ares="yes"
  293. dnl fi
  294. dnl fi
  295. dnl if test "$want_threads" = "yes" && test "$want_ares" = "yes"; then
  296. dnl AC_MSG_ERROR([options --enable-ares and --enable-threads are mutually exclusive, at most one may be enabled.])
  297. dnl fi
  298. dnl ])
  299. dnl CURL_CHECK_OPTION_RT
  300. dnl -------------------------------------------------
  301. dnl Verify if configure has been involed with option
  302. dnl --disable-rt and set shell variable dontwant_rt
  303. dnl as appropriate.
  304. AC_DEFUN([CURL_CHECK_OPTION_RT], [
  305. AC_BEFORE([$0], [CURL_CHECK_LIB_THREADS])dnl
  306. AC_MSG_CHECKING([whether to disable dependency on -lrt])
  307. OPT_RT="default"
  308. AC_ARG_ENABLE(rt,
  309. AC_HELP_STRING([--disable-rt],[disable dependency on -lrt]),
  310. OPT_RT=$enableval)
  311. case "$OPT_RT" in
  312. no)
  313. dnl --disable-rt used (reverse logic)
  314. dontwant_rt="yes"
  315. AC_MSG_RESULT([yes])
  316. ;;
  317. default)
  318. dnl configure option not specified (so not disabled)
  319. dontwant_rt="no"
  320. AC_MSG_RESULT([(assumed no)])
  321. ;;
  322. *)
  323. dnl --enable-rt option used (reverse logic)
  324. dontwant_rt="no"
  325. AC_MSG_RESULT([no])
  326. ;;
  327. esac
  328. dnl TODO: may require mutual exclusion
  329. if test "$dontwant_rt" = "yes" && test "$want_thres" = "yes" ; then
  330. AC_MSG_ERROR([options --disable-rt and --enable-thread-resolver are mutually exclusive, at most one can be selected.])
  331. fi
  332. ])
  333. dnl CURL_CHECK_OPTION_WARNINGS
  334. dnl -------------------------------------------------
  335. dnl Verify if configure has been invoked with option
  336. dnl --enable-warnings or --disable-warnings, and set
  337. dnl shell variable want_warnings as appropriate.
  338. AC_DEFUN([CURL_CHECK_OPTION_WARNINGS], [
  339. AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
  340. AC_BEFORE([$0],[CURL_CHECK_OPTION_WERROR])dnl
  341. AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
  342. AC_MSG_CHECKING([whether to enable strict compiler warnings])
  343. OPT_COMPILER_WARNINGS="default"
  344. AC_ARG_ENABLE(warnings,
  345. AC_HELP_STRING([--enable-warnings],[Enable strict compiler warnings])
  346. AC_HELP_STRING([--disable-warnings],[Disable strict compiler warnings]),
  347. OPT_COMPILER_WARNINGS=$enableval)
  348. case "$OPT_COMPILER_WARNINGS" in
  349. no)
  350. dnl --disable-warnings option used
  351. want_warnings="no"
  352. ;;
  353. default)
  354. dnl configure option not specified, so
  355. dnl use same setting as --enable-debug
  356. want_warnings="$want_debug"
  357. ;;
  358. *)
  359. dnl --enable-warnings option used
  360. want_warnings="yes"
  361. ;;
  362. esac
  363. AC_MSG_RESULT([$want_warnings])
  364. ])
  365. dnl CURL_CHECK_OPTION_WERROR
  366. dnl -------------------------------------------------
  367. dnl Verify if configure has been invoked with option
  368. dnl --enable-werror or --disable-werror, and set
  369. dnl shell variable want_werror as appropriate.
  370. AC_DEFUN([CURL_CHECK_OPTION_WERROR], [
  371. AC_BEFORE([$0],[CURL_CHECK_COMPILER])dnl
  372. AC_MSG_CHECKING([whether to enable compiler warnings as errors])
  373. OPT_COMPILER_WERROR="default"
  374. AC_ARG_ENABLE(werror,
  375. AC_HELP_STRING([--enable-werror],[Enable compiler warnings as errors])
  376. AC_HELP_STRING([--disable-werror],[Disable compiler warnings as errors]),
  377. OPT_COMPILER_WERROR=$enableval)
  378. case "$OPT_COMPILER_WERROR" in
  379. no)
  380. dnl --disable-werror option used
  381. want_werror="no"
  382. ;;
  383. default)
  384. dnl configure option not specified
  385. want_werror="no"
  386. ;;
  387. *)
  388. dnl --enable-werror option used
  389. want_werror="yes"
  390. ;;
  391. esac
  392. AC_MSG_RESULT([$want_werror])
  393. ])
  394. dnl CURL_CHECK_NONBLOCKING_SOCKET
  395. dnl -------------------------------------------------
  396. dnl Check for how to set a socket into non-blocking state.
  397. AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], [
  398. AC_REQUIRE([CURL_CHECK_FUNC_FCNTL])dnl
  399. AC_REQUIRE([CURL_CHECK_FUNC_IOCTL])dnl
  400. AC_REQUIRE([CURL_CHECK_FUNC_IOCTLSOCKET])dnl
  401. AC_REQUIRE([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL])dnl
  402. AC_REQUIRE([CURL_CHECK_FUNC_SETSOCKOPT])dnl
  403. #
  404. tst_method="unknown"
  405. AC_MSG_CHECKING([how to set a socket into non-blocking mode])
  406. if test "x$ac_cv_func_fcntl_o_nonblock" = "xyes"; then
  407. tst_method="fcntl O_NONBLOCK"
  408. elif test "x$ac_cv_func_ioctl_fionbio" = "xyes"; then
  409. tst_method="ioctl FIONBIO"
  410. elif test "x$ac_cv_func_ioctlsocket_fionbio" = "xyes"; then
  411. tst_method="ioctlsocket FIONBIO"
  412. elif test "x$ac_cv_func_ioctlsocket_camel_fionbio" = "xyes"; then
  413. tst_method="IoctlSocket FIONBIO"
  414. elif test "x$ac_cv_func_setsockopt_so_nonblock" = "xyes"; then
  415. tst_method="setsockopt SO_NONBLOCK"
  416. fi
  417. AC_MSG_RESULT([$tst_method])
  418. if test "$tst_method" = "unknown"; then
  419. AC_MSG_WARN([cannot determine non-blocking socket method.])
  420. fi
  421. ])
  422. dnl CURL_CONFIGURE_SYMBOL_HIDING
  423. dnl -------------------------------------------------
  424. dnl Depending on --enable-symbol-hiding or --disable-symbol-hiding
  425. dnl configure option, and compiler capability to actually honor such
  426. dnl option, this will modify compiler flags as appropriate and also
  427. dnl provide needed definitions for configuration and Makefile.am files.
  428. dnl This macro should not be used until all compilation tests have
  429. dnl been done to prevent interferences on other tests.
  430. AC_DEFUN([CURL_CONFIGURE_SYMBOL_HIDING], [
  431. AC_MSG_CHECKING([whether hiding of library internal symbols will actually happen])
  432. CFLAG_CURL_SYMBOL_HIDING=""
  433. doing_symbol_hiding="no"
  434. if test x"$ac_cv_native_windows" != "xyes" &&
  435. test "$want_symbol_hiding" = "yes" &&
  436. test "$supports_symbol_hiding" = "yes"; then
  437. doing_symbol_hiding="yes"
  438. CFLAG_CURL_SYMBOL_HIDING="$symbol_hiding_CFLAGS"
  439. AC_DEFINE_UNQUOTED(CURL_EXTERN_SYMBOL, $symbol_hiding_EXTERN,
  440. [Definition to make a library symbol externally visible.])
  441. AC_MSG_RESULT([yes])
  442. else
  443. AC_MSG_RESULT([no])
  444. fi
  445. AM_CONDITIONAL(DOING_CURL_SYMBOL_HIDING, test x$doing_symbol_hiding = xyes)
  446. AC_SUBST(CFLAG_CURL_SYMBOL_HIDING)
  447. ])
  448. dnl CURL_CHECK_LIB_ARES
  449. dnl -------------------------------------------------
  450. dnl When c-ares library support has been requested,
  451. dnl performs necessary checks and adjustsments needed
  452. dnl to enable support of this library.
  453. AC_DEFUN([CURL_CHECK_LIB_ARES], [
  454. #
  455. if test "$want_ares" = "yes"; then
  456. dnl c-ares library support has been requested
  457. clean_CPPFLAGS="$CPPFLAGS"
  458. clean_LDFLAGS="$LDFLAGS"
  459. clean_LIBS="$LIBS"
  460. embedded_ares="unknown"
  461. configure_runpath=`pwd`
  462. embedded_ares_builddir="$configure_runpath/ares"
  463. if test -n "$want_ares_path"; then
  464. dnl c-ares library path has been specified
  465. ares_CPPFLAGS="-I$want_ares_path/include"
  466. ares_LDFLAGS="-L$want_ares_path/lib"
  467. ares_LIBS="-lcares"
  468. else
  469. dnl c-ares library path has not been given
  470. if test -d "$srcdir/ares"; then
  471. dnl c-ares sources embedded in curl tree
  472. embedded_ares="yes"
  473. AC_CONFIG_SUBDIRS(ares)
  474. dnl c-ares has installable configured header files, path
  475. dnl inclusion fully done in makefiles for in-tree builds.
  476. ares_CPPFLAGS=""
  477. ares_LDFLAGS="-L$embedded_ares_builddir"
  478. ares_LIBS="-lcares"
  479. else
  480. dnl c-ares path not specified, use defaults
  481. ares_CPPFLAGS=""
  482. ares_LDFLAGS=""
  483. ares_LIBS="-lcares"
  484. fi
  485. fi
  486. #
  487. CPPFLAGS="$ares_CPPFLAGS $clean_CPPFLAGS"
  488. LDFLAGS="$ares_LDFLAGS $clean_LDFLAGS"
  489. LIBS="$ares_LIBS $clean_LIBS"
  490. #
  491. if test "$embedded_ares" != "yes"; then
  492. dnl check if c-ares new enough when not using an embedded
  493. dnl source tree one which normally has not been built yet.
  494. AC_MSG_CHECKING([that c-ares is good and recent enough])
  495. AC_LINK_IFELSE([
  496. AC_LANG_PROGRAM([[
  497. #include <ares.h>
  498. /* set of dummy functions in case c-ares was built with debug */
  499. void curl_dofree() { }
  500. void curl_sclose() { }
  501. void curl_domalloc() { }
  502. void curl_docalloc() { }
  503. void curl_socket() { }
  504. ]],[[
  505. ares_channel channel;
  506. ares_cancel(channel); /* added in 1.2.0 */
  507. ares_process_fd(channel, 0, 0); /* added in 1.4.0 */
  508. ares_dup(&channel, channel); /* added in 1.6.0 */
  509. ]])
  510. ],[
  511. AC_MSG_RESULT([yes])
  512. ],[
  513. AC_MSG_RESULT([no])
  514. AC_MSG_ERROR([c-ares library defective or too old])
  515. dnl restore initial settings
  516. CPPFLAGS="$clean_CPPFLAGS"
  517. LDFLAGS="$clean_LDFLAGS"
  518. LIBS="$clean_LIBS"
  519. # prevent usage
  520. want_ares="no"
  521. ])
  522. fi
  523. if test "$want_ares" = "yes"; then
  524. dnl finally c-ares will be used
  525. AC_DEFINE(USE_ARES, 1, [Define to enable c-ares support])
  526. AC_SUBST([USE_ARES], [1])
  527. curl_res_msg="c-ares"
  528. fi
  529. fi
  530. ])
  531. dnl CURL_CHECK_OPTION_NTLM_WB
  532. dnl -------------------------------------------------
  533. dnl Verify if configure has been invoked with option
  534. dnl --enable-ntlm-wb or --disable-ntlm-wb, and set
  535. dnl shell variable want_ntlm_wb and want_ntlm_wb_file
  536. dnl as appropriate.
  537. AC_DEFUN([CURL_CHECK_OPTION_NTLM_WB], [
  538. AC_BEFORE([$0],[CURL_CHECK_NTLM_WB])dnl
  539. OPT_NTLM_WB="default"
  540. AC_ARG_ENABLE(ntlm-wb,
  541. AC_HELP_STRING([--enable-ntlm-wb@<:@=FILE@:>@],[Enable NTLM delegation to winbind's ntlm_auth helper, where FILE is ntlm_auth's absolute filename (default: /usr/bin/ntlm_auth)])
  542. AC_HELP_STRING([--disable-ntlm-wb],[Disable NTLM delegation to winbind's ntlm_auth helper]),
  543. OPT_NTLM_WB=$enableval)
  544. want_ntlm_wb_file="/usr/bin/ntlm_auth"
  545. case "$OPT_NTLM_WB" in
  546. no)
  547. dnl --disable-ntlm-wb option used
  548. want_ntlm_wb="no"
  549. ;;
  550. default)
  551. dnl configure option not specified
  552. want_ntlm_wb="yes"
  553. ;;
  554. *)
  555. dnl --enable-ntlm-wb option used
  556. want_ntlm_wb="yes"
  557. if test -n "$enableval" && test "$enableval" != "yes"; then
  558. want_ntlm_wb_file="$enableval"
  559. fi
  560. ;;
  561. esac
  562. ])
  563. dnl CURL_CHECK_NTLM_WB
  564. dnl -------------------------------------------------
  565. dnl Check if support for NTLM delegation to winbind's
  566. dnl ntlm_auth helper will finally be enabled depending
  567. dnl on given configure options and target platform.
  568. AC_DEFUN([CURL_CHECK_NTLM_WB], [
  569. AC_REQUIRE([CURL_CHECK_OPTION_NTLM_WB])dnl
  570. AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
  571. AC_MSG_CHECKING([whether to enable NTLM delegation to winbind's helper])
  572. if test "$ac_cv_native_windows" = "yes" ||
  573. test "x$SSL_ENABLED" = "x"; then
  574. want_ntlm_wb_file=""
  575. want_ntlm_wb="no"
  576. fi
  577. AC_MSG_RESULT([$want_ntlm_wb])
  578. if test "$want_ntlm_wb" = "yes"; then
  579. AC_DEFINE(NTLM_WB_ENABLED, 1,
  580. [Define to enable NTLM delegation to winbind's ntlm_auth helper.])
  581. AC_DEFINE_UNQUOTED(NTLM_WB_FILE, "$want_ntlm_wb_file",
  582. [Define absolute filename for winbind's ntlm_auth helper.])
  583. NTLM_WB_ENABLED=1
  584. fi
  585. ])