curl-confopts.m4 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2022, 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.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. AS_HELP_STRING([--enable-threaded-resolver],[Enable threaded resolver])
  34. AS_HELP_STRING([--disable-threaded-resolver],[Disable threaded resolver]),
  35. OPT_THRES=$enableval)
  36. case "$OPT_THRES" in
  37. no)
  38. dnl --disable-threaded-resolver option used
  39. want_thres="no"
  40. ;;
  41. *)
  42. dnl configure option not specified
  43. want_thres="yes"
  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. AS_HELP_STRING([--enable-ares@<:@=PATH@:>@],[Enable c-ares for DNS lookups])
  60. AS_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. AS_HELP_STRING([--enable-curldebug],[Enable curl debug memory tracking])
  92. AS_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 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. AC_DEFINE(CURLDEBUG, 1, [to enable curl debug memory tracking])
  110. else
  111. AC_MSG_RESULT([no])
  112. fi
  113. want_curldebug_assumed="yes"
  114. want_curldebug="$want_debug"
  115. ;;
  116. *)
  117. dnl --enable-curldebug option used.
  118. dnl The use of this option value is a request to enable curl's
  119. dnl debug memory tracking for the libcurl library. This can only
  120. dnl be done when some requisites are simultaneously satisfied.
  121. dnl Later on, these requisites are verified and if they are not
  122. dnl fully satisfied the option will be ignored and act as if
  123. dnl --disable-curldebug had been given setting shell variable
  124. dnl want_curldebug to 'no'.
  125. want_curldebug="yes"
  126. AC_DEFINE(CURLDEBUG, 1, [to enable curl debug memory tracking])
  127. AC_MSG_RESULT([yes])
  128. ;;
  129. esac
  130. ])
  131. dnl CURL_CHECK_OPTION_DEBUG
  132. dnl -------------------------------------------------
  133. dnl Verify if configure has been invoked with option
  134. dnl --enable-debug or --disable-debug, and set shell
  135. dnl variable want_debug value as appropriate.
  136. AC_DEFUN([CURL_CHECK_OPTION_DEBUG], [
  137. AC_BEFORE([$0],[CURL_CHECK_OPTION_WARNINGS])dnl
  138. AC_BEFORE([$0],[CURL_CHECK_OPTION_CURLDEBUG])dnl
  139. AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
  140. AC_MSG_CHECKING([whether to enable debug build options])
  141. OPT_DEBUG_BUILD="default"
  142. AC_ARG_ENABLE(debug,
  143. AS_HELP_STRING([--enable-debug],[Enable debug build options])
  144. AS_HELP_STRING([--disable-debug],[Disable debug build options]),
  145. OPT_DEBUG_BUILD=$enableval)
  146. case "$OPT_DEBUG_BUILD" in
  147. no)
  148. dnl --disable-debug option used
  149. want_debug="no"
  150. ;;
  151. default)
  152. dnl configure option not specified
  153. want_debug="no"
  154. ;;
  155. *)
  156. dnl --enable-debug option used
  157. want_debug="yes"
  158. AC_DEFINE(DEBUGBUILD, 1, [enable debug build options])
  159. ;;
  160. esac
  161. AC_MSG_RESULT([$want_debug])
  162. ])
  163. dnl CURL_CHECK_OPTION_OPTIMIZE
  164. dnl -------------------------------------------------
  165. dnl Verify if configure has been invoked with option
  166. dnl --enable-optimize or --disable-optimize, and set
  167. dnl shell variable want_optimize value as appropriate.
  168. AC_DEFUN([CURL_CHECK_OPTION_OPTIMIZE], [
  169. AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
  170. AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
  171. AC_MSG_CHECKING([whether to enable compiler optimizer])
  172. OPT_COMPILER_OPTIMIZE="default"
  173. AC_ARG_ENABLE(optimize,
  174. AS_HELP_STRING([--enable-optimize],[Enable compiler optimizations])
  175. AS_HELP_STRING([--disable-optimize],[Disable compiler optimizations]),
  176. OPT_COMPILER_OPTIMIZE=$enableval)
  177. case "$OPT_COMPILER_OPTIMIZE" in
  178. no)
  179. dnl --disable-optimize option used. We will handle this as
  180. dnl a request to disable compiler optimizations if possible.
  181. dnl If the compiler is known CFLAGS and CPPFLAGS will be
  182. dnl overridden, otherwise this can not be honored.
  183. want_optimize="no"
  184. AC_MSG_RESULT([no])
  185. ;;
  186. default)
  187. dnl configure's optimize option not specified. Initially we will
  188. dnl handle this as a request contrary to configure's setting
  189. dnl for --enable-debug. IOW, initially, for debug-enabled builds
  190. dnl this will be handled as a request to disable optimizations if
  191. dnl possible, and for debug-disabled builds this will be handled
  192. dnl initially as a request to enable optimizations if possible.
  193. dnl Finally, if the compiler is known and CFLAGS and CPPFLAGS do
  194. dnl not have any optimizer flag the request will be honored, in
  195. dnl any other case the request can not be honored.
  196. dnl IOW, existing optimizer flags defined in CFLAGS or CPPFLAGS
  197. dnl will always take precedence over any initial assumption.
  198. if test "$want_debug" = "yes"; then
  199. want_optimize="assume_no"
  200. AC_MSG_RESULT([(assumed) no])
  201. else
  202. want_optimize="assume_yes"
  203. AC_MSG_RESULT([(assumed) yes])
  204. fi
  205. ;;
  206. *)
  207. dnl --enable-optimize option used. We will handle this as
  208. dnl a request to enable compiler optimizations if possible.
  209. dnl If the compiler is known CFLAGS and CPPFLAGS will be
  210. dnl overridden, otherwise this can not be honored.
  211. want_optimize="yes"
  212. AC_MSG_RESULT([yes])
  213. ;;
  214. esac
  215. ])
  216. dnl CURL_CHECK_OPTION_SYMBOL_HIDING
  217. dnl -------------------------------------------------
  218. dnl Verify if configure has been invoked with option
  219. dnl --enable-symbol-hiding or --disable-symbol-hiding,
  220. dnl setting shell variable want_symbol_hiding value.
  221. AC_DEFUN([CURL_CHECK_OPTION_SYMBOL_HIDING], [
  222. AC_BEFORE([$0],[CURL_CHECK_COMPILER_SYMBOL_HIDING])dnl
  223. AC_MSG_CHECKING([whether to enable hiding of library internal symbols])
  224. OPT_SYMBOL_HIDING="default"
  225. AC_ARG_ENABLE(symbol-hiding,
  226. AS_HELP_STRING([--enable-symbol-hiding],[Enable hiding of library internal symbols])
  227. AS_HELP_STRING([--disable-symbol-hiding],[Disable hiding of library internal symbols]),
  228. OPT_SYMBOL_HIDING=$enableval)
  229. case "$OPT_SYMBOL_HIDING" in
  230. no)
  231. dnl --disable-symbol-hiding option used.
  232. dnl This is an indication to not attempt hiding of library internal
  233. dnl symbols. Default symbol visibility will be used, which normally
  234. dnl exposes all library internal symbols.
  235. want_symbol_hiding="no"
  236. AC_MSG_RESULT([no])
  237. ;;
  238. default)
  239. dnl configure's symbol-hiding option not specified.
  240. dnl Handle this as if --enable-symbol-hiding option was given.
  241. want_symbol_hiding="yes"
  242. AC_MSG_RESULT([yes])
  243. ;;
  244. *)
  245. dnl --enable-symbol-hiding option used.
  246. dnl This is an indication to attempt hiding of library internal
  247. dnl symbols. This is only supported on some compilers/linkers.
  248. want_symbol_hiding="yes"
  249. AC_MSG_RESULT([yes])
  250. ;;
  251. esac
  252. ])
  253. dnl CURL_CHECK_OPTION_THREADS
  254. dnl -------------------------------------------------
  255. dnl Verify if configure has been invoked with option
  256. dnl --enable-threads or --disable-threads, and
  257. dnl set shell variable want_threads as appropriate.
  258. dnl AC_DEFUN([CURL_CHECK_OPTION_THREADS], [
  259. dnl AC_BEFORE([$0],[CURL_CHECK_LIB_THREADS])dnl
  260. dnl AC_MSG_CHECKING([whether to enable threads for DNS lookups])
  261. dnl OPT_THREADS="default"
  262. dnl AC_ARG_ENABLE(threads,
  263. dnl AS_HELP_STRING([--enable-threads@<:@=PATH@:>@],[Enable threads for DNS lookups])
  264. dnl AS_HELP_STRING([--disable-threads],[Disable threads for DNS lookups]),
  265. dnl OPT_THREADS=$enableval)
  266. dnl case "$OPT_THREADS" in
  267. dnl no)
  268. dnl dnl --disable-threads option used
  269. dnl want_threads="no"
  270. dnl AC_MSG_RESULT([no])
  271. dnl ;;
  272. dnl default)
  273. dnl dnl configure option not specified
  274. dnl want_threads="no"
  275. dnl AC_MSG_RESULT([(assumed) no])
  276. dnl ;;
  277. dnl *)
  278. dnl dnl --enable-threads option used
  279. dnl want_threads="yes"
  280. dnl want_threads_path="$enableval"
  281. dnl AC_MSG_RESULT([yes])
  282. dnl ;;
  283. dnl esac
  284. dnl #
  285. dnl if test "$want_ares" = "assume_yes"; then
  286. dnl if test "$want_threads" = "yes"; then
  287. dnl AC_MSG_CHECKING([whether to ignore c-ares enabling assumed setting])
  288. dnl AC_MSG_RESULT([yes])
  289. dnl want_ares="no"
  290. dnl else
  291. dnl want_ares="yes"
  292. dnl fi
  293. dnl fi
  294. dnl if test "$want_threads" = "yes" && test "$want_ares" = "yes"; then
  295. dnl AC_MSG_ERROR([options --enable-ares and --enable-threads are mutually exclusive, at most one may be enabled.])
  296. dnl fi
  297. dnl ])
  298. dnl CURL_CHECK_OPTION_RT
  299. dnl -------------------------------------------------
  300. dnl Verify if configure has been invoked with option
  301. dnl --disable-rt and set shell variable dontwant_rt
  302. dnl as appropriate.
  303. AC_DEFUN([CURL_CHECK_OPTION_RT], [
  304. AC_BEFORE([$0], [CURL_CHECK_LIB_THREADS])dnl
  305. AC_MSG_CHECKING([whether to disable dependency on -lrt])
  306. OPT_RT="default"
  307. AC_ARG_ENABLE(rt,
  308. AS_HELP_STRING([--disable-rt],[disable dependency on -lrt]),
  309. OPT_RT=$enableval)
  310. case "$OPT_RT" in
  311. no)
  312. dnl --disable-rt used (reverse logic)
  313. dontwant_rt="yes"
  314. AC_MSG_RESULT([yes])
  315. ;;
  316. default)
  317. dnl configure option not specified (so not disabled)
  318. dontwant_rt="no"
  319. AC_MSG_RESULT([(assumed no)])
  320. ;;
  321. *)
  322. dnl --enable-rt option used (reverse logic)
  323. dontwant_rt="no"
  324. AC_MSG_RESULT([no])
  325. ;;
  326. esac
  327. ])
  328. dnl CURL_CHECK_OPTION_WARNINGS
  329. dnl -------------------------------------------------
  330. dnl Verify if configure has been invoked with option
  331. dnl --enable-warnings or --disable-warnings, and set
  332. dnl shell variable want_warnings as appropriate.
  333. AC_DEFUN([CURL_CHECK_OPTION_WARNINGS], [
  334. AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
  335. AC_BEFORE([$0],[CURL_CHECK_OPTION_WERROR])dnl
  336. AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
  337. AC_MSG_CHECKING([whether to enable strict compiler warnings])
  338. OPT_COMPILER_WARNINGS="default"
  339. AC_ARG_ENABLE(warnings,
  340. AS_HELP_STRING([--enable-warnings],[Enable strict compiler warnings])
  341. AS_HELP_STRING([--disable-warnings],[Disable strict compiler warnings]),
  342. OPT_COMPILER_WARNINGS=$enableval)
  343. case "$OPT_COMPILER_WARNINGS" in
  344. no)
  345. dnl --disable-warnings option used
  346. want_warnings="no"
  347. ;;
  348. default)
  349. dnl configure option not specified, so
  350. dnl use same setting as --enable-debug
  351. want_warnings="$want_debug"
  352. ;;
  353. *)
  354. dnl --enable-warnings option used
  355. want_warnings="yes"
  356. ;;
  357. esac
  358. AC_MSG_RESULT([$want_warnings])
  359. ])
  360. dnl CURL_CHECK_OPTION_WERROR
  361. dnl -------------------------------------------------
  362. dnl Verify if configure has been invoked with option
  363. dnl --enable-werror or --disable-werror, and set
  364. dnl shell variable want_werror as appropriate.
  365. AC_DEFUN([CURL_CHECK_OPTION_WERROR], [
  366. AC_BEFORE([$0],[CURL_CHECK_COMPILER])dnl
  367. AC_MSG_CHECKING([whether to enable compiler warnings as errors])
  368. OPT_COMPILER_WERROR="default"
  369. AC_ARG_ENABLE(werror,
  370. AS_HELP_STRING([--enable-werror],[Enable compiler warnings as errors])
  371. AS_HELP_STRING([--disable-werror],[Disable compiler warnings as errors]),
  372. OPT_COMPILER_WERROR=$enableval)
  373. case "$OPT_COMPILER_WERROR" in
  374. no)
  375. dnl --disable-werror option used
  376. want_werror="no"
  377. ;;
  378. default)
  379. dnl configure option not specified
  380. want_werror="no"
  381. ;;
  382. *)
  383. dnl --enable-werror option used
  384. want_werror="yes"
  385. ;;
  386. esac
  387. AC_MSG_RESULT([$want_werror])
  388. ])
  389. dnl CURL_CHECK_NONBLOCKING_SOCKET
  390. dnl -------------------------------------------------
  391. dnl Check for how to set a socket into non-blocking state.
  392. AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], [
  393. AC_REQUIRE([CURL_CHECK_FUNC_FCNTL])dnl
  394. AC_REQUIRE([CURL_CHECK_FUNC_IOCTL])dnl
  395. AC_REQUIRE([CURL_CHECK_FUNC_IOCTLSOCKET])dnl
  396. AC_REQUIRE([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL])dnl
  397. AC_REQUIRE([CURL_CHECK_FUNC_SETSOCKOPT])dnl
  398. #
  399. tst_method="unknown"
  400. AC_MSG_CHECKING([how to set a socket into non-blocking mode])
  401. if test "x$curl_cv_func_fcntl_o_nonblock" = "xyes"; then
  402. tst_method="fcntl O_NONBLOCK"
  403. elif test "x$curl_cv_func_ioctl_fionbio" = "xyes"; then
  404. tst_method="ioctl FIONBIO"
  405. elif test "x$curl_cv_func_ioctlsocket_fionbio" = "xyes"; then
  406. tst_method="ioctlsocket FIONBIO"
  407. elif test "x$curl_cv_func_ioctlsocket_camel_fionbio" = "xyes"; then
  408. tst_method="IoctlSocket FIONBIO"
  409. elif test "x$curl_cv_func_setsockopt_so_nonblock" = "xyes"; then
  410. tst_method="setsockopt SO_NONBLOCK"
  411. fi
  412. AC_MSG_RESULT([$tst_method])
  413. if test "$tst_method" = "unknown"; then
  414. AC_MSG_WARN([cannot determine non-blocking socket method.])
  415. fi
  416. ])
  417. dnl CURL_CONFIGURE_SYMBOL_HIDING
  418. dnl -------------------------------------------------
  419. dnl Depending on --enable-symbol-hiding or --disable-symbol-hiding
  420. dnl configure option, and compiler capability to actually honor such
  421. dnl option, this will modify compiler flags as appropriate and also
  422. dnl provide needed definitions for configuration and Makefile.am files.
  423. dnl This macro should not be used until all compilation tests have
  424. dnl been done to prevent interferences on other tests.
  425. AC_DEFUN([CURL_CONFIGURE_SYMBOL_HIDING], [
  426. AC_MSG_CHECKING([whether hiding of library internal symbols will actually happen])
  427. CFLAG_CURL_SYMBOL_HIDING=""
  428. doing_symbol_hiding="no"
  429. if test x"$curl_cv_native_windows" != "xyes" &&
  430. test "$want_symbol_hiding" = "yes" &&
  431. test "$supports_symbol_hiding" = "yes"; then
  432. doing_symbol_hiding="yes"
  433. CFLAG_CURL_SYMBOL_HIDING="$symbol_hiding_CFLAGS"
  434. AC_DEFINE_UNQUOTED(CURL_EXTERN_SYMBOL, $symbol_hiding_EXTERN,
  435. [Definition to make a library symbol externally visible.])
  436. AC_MSG_RESULT([yes])
  437. else
  438. AC_MSG_RESULT([no])
  439. fi
  440. AM_CONDITIONAL(DOING_CURL_SYMBOL_HIDING, test x$doing_symbol_hiding = xyes)
  441. AC_SUBST(CFLAG_CURL_SYMBOL_HIDING)
  442. ])
  443. dnl CURL_CHECK_LIB_ARES
  444. dnl -------------------------------------------------
  445. dnl When c-ares library support has been requested,
  446. dnl performs necessary checks and adjustsments needed
  447. dnl to enable support of this library.
  448. AC_DEFUN([CURL_CHECK_LIB_ARES], [
  449. #
  450. if test "$want_ares" = "yes"; then
  451. dnl c-ares library support has been requested
  452. clean_CPPFLAGS="$CPPFLAGS"
  453. clean_LDFLAGS="$LDFLAGS"
  454. clean_LIBS="$LIBS"
  455. configure_runpath=`pwd`
  456. if test -n "$want_ares_path"; then
  457. dnl c-ares library path has been specified
  458. ARES_PCDIR="$want_ares_path/lib/pkgconfig"
  459. CURL_CHECK_PKGCONFIG(libcares, [$ARES_PCDIR])
  460. if test "$PKGCONFIG" != "no" ; then
  461. ares_LIBS=`CURL_EXPORT_PCDIR([$ARES_PCDIR])
  462. $PKGCONFIG --libs-only-l libcares`
  463. ares_LDFLAGS=`CURL_EXPORT_PCDIR([$ARES_PCDIR])
  464. $PKGCONFIG --libs-only-L libcares`
  465. ares_CPPFLAGS=`CURL_EXPORT_PCDIR([$ARES_PCDIR])
  466. $PKGCONFIG --cflags-only-I libcares`
  467. AC_MSG_NOTICE([pkg-config: ares LIBS: "$ares_LIBS"])
  468. AC_MSG_NOTICE([pkg-config: ares LDFLAGS: "$ares_LDFLAGS"])
  469. AC_MSG_NOTICE([pkg-config: ares CPPFLAGS: "$ares_CPPFLAGS"])
  470. else
  471. dnl ... path without pkg-config
  472. ares_CPPFLAGS="-I$want_ares_path/include"
  473. ares_LDFLAGS="-L$want_ares_path/lib"
  474. ares_LIBS="-lcares"
  475. fi
  476. else
  477. dnl c-ares path not specified, use defaults
  478. CURL_CHECK_PKGCONFIG(libcares)
  479. if test "$PKGCONFIG" != "no" ; then
  480. ares_LIBS=`$PKGCONFIG --libs-only-l libcares`
  481. ares_LDFLAGS=`$PKGCONFIG --libs-only-L libcares`
  482. ares_CPPFLAGS=`$PKGCONFIG --cflags-only-I libcares`
  483. AC_MSG_NOTICE([pkg-config: ares_LIBS: "$ares_LIBS"])
  484. AC_MSG_NOTICE([pkg-config: ares_LDFLAGS: "$ares_LDFLAGS"])
  485. AC_MSG_NOTICE([pkg-config: ares_CPPFLAGS: "$ares_CPPFLAGS"])
  486. else
  487. ares_CPPFLAGS=""
  488. ares_LDFLAGS=""
  489. ares_LIBS="-lcares"
  490. fi
  491. fi
  492. #
  493. CPPFLAGS="$clean_CPPFLAGS $ares_CPPFLAGS"
  494. LDFLAGS="$clean_LDFLAGS $ares_LDFLAGS"
  495. LIBS="$ares_LIBS $clean_LIBS"
  496. #
  497. dnl check if c-ares new enough
  498. AC_MSG_CHECKING([that c-ares is good and recent enough])
  499. AC_LINK_IFELSE([
  500. AC_LANG_PROGRAM([[
  501. #include <ares.h>
  502. /* set of dummy functions in case c-ares was built with debug */
  503. void curl_dofree() { }
  504. void curl_sclose() { }
  505. void curl_domalloc() { }
  506. void curl_docalloc() { }
  507. void curl_socket() { }
  508. ]],[[
  509. ares_channel channel;
  510. ares_cancel(channel); /* added in 1.2.0 */
  511. ares_process_fd(channel, 0, 0); /* added in 1.4.0 */
  512. ares_dup(&channel, channel); /* added in 1.6.0 */
  513. ]])
  514. ],[
  515. AC_MSG_RESULT([yes])
  516. ],[
  517. AC_MSG_RESULT([no])
  518. AC_MSG_ERROR([c-ares library defective or too old])
  519. dnl restore initial settings
  520. CPPFLAGS="$clean_CPPFLAGS"
  521. LDFLAGS="$clean_LDFLAGS"
  522. LIBS="$clean_LIBS"
  523. # prevent usage
  524. want_ares="no"
  525. ])
  526. if test "$want_ares" = "yes"; then
  527. dnl finally c-ares will be used
  528. AC_DEFINE(USE_ARES, 1, [Define to enable c-ares support])
  529. AC_SUBST([USE_ARES], [1])
  530. curl_res_msg="c-ares"
  531. fi
  532. fi
  533. ])
  534. dnl CURL_CHECK_OPTION_NTLM_WB
  535. dnl -------------------------------------------------
  536. dnl Verify if configure has been invoked with option
  537. dnl --enable-ntlm-wb or --disable-ntlm-wb, and set
  538. dnl shell variable want_ntlm_wb and want_ntlm_wb_file
  539. dnl as appropriate.
  540. AC_DEFUN([CURL_CHECK_OPTION_NTLM_WB], [
  541. AC_BEFORE([$0],[CURL_CHECK_NTLM_WB])dnl
  542. OPT_NTLM_WB="default"
  543. AC_ARG_ENABLE(ntlm-wb,
  544. AS_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)])
  545. AS_HELP_STRING([--disable-ntlm-wb],[Disable NTLM delegation to winbind's ntlm_auth helper]),
  546. OPT_NTLM_WB=$enableval)
  547. want_ntlm_wb_file="/usr/bin/ntlm_auth"
  548. case "$OPT_NTLM_WB" in
  549. no)
  550. dnl --disable-ntlm-wb option used
  551. want_ntlm_wb="no"
  552. ;;
  553. default)
  554. dnl configure option not specified
  555. want_ntlm_wb="yes"
  556. ;;
  557. *)
  558. dnl --enable-ntlm-wb option used
  559. want_ntlm_wb="yes"
  560. if test -n "$enableval" && test "$enableval" != "yes"; then
  561. want_ntlm_wb_file="$enableval"
  562. fi
  563. ;;
  564. esac
  565. ])
  566. dnl CURL_CHECK_NTLM_WB
  567. dnl -------------------------------------------------
  568. dnl Check if support for NTLM delegation to winbind's
  569. dnl ntlm_auth helper will finally be enabled depending
  570. dnl on given configure options and target platform.
  571. AC_DEFUN([CURL_CHECK_NTLM_WB], [
  572. AC_REQUIRE([CURL_CHECK_OPTION_NTLM_WB])dnl
  573. AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
  574. AC_MSG_CHECKING([whether to enable NTLM delegation to winbind's helper])
  575. if test "$curl_cv_native_windows" = "yes" ||
  576. test "x$SSL_ENABLED" = "x"; then
  577. want_ntlm_wb_file=""
  578. want_ntlm_wb="no"
  579. fi
  580. AC_MSG_RESULT([$want_ntlm_wb])
  581. if test "$want_ntlm_wb" = "yes"; then
  582. AC_DEFINE(NTLM_WB_ENABLED, 1,
  583. [Define to enable NTLM delegation to winbind's ntlm_auth helper.])
  584. AC_DEFINE_UNQUOTED(NTLM_WB_FILE, "$want_ntlm_wb_file",
  585. [Define absolute filename for winbind's ntlm_auth helper.])
  586. NTLM_WB_ENABLED=1
  587. fi
  588. ])
  589. dnl CURL_CHECK_OPTION_ECH
  590. dnl -----------------------------------------------------
  591. dnl Verify whether configure has been invoked with option
  592. dnl --enable-ech or --disable-ech, and set
  593. dnl shell variable want_ech as appropriate.
  594. AC_DEFUN([CURL_CHECK_OPTION_ECH], [
  595. AC_MSG_CHECKING([whether to enable ECH support])
  596. OPT_ECH="default"
  597. AC_ARG_ENABLE(ech,
  598. AS_HELP_STRING([--enable-ech],[Enable ECH support])
  599. AS_HELP_STRING([--disable-ech],[Disable ECH support]),
  600. OPT_ECH=$enableval)
  601. case "$OPT_ECH" in
  602. no)
  603. dnl --disable-ech option used
  604. want_ech="no"
  605. curl_ech_msg="no (--enable-ech)"
  606. AC_MSG_RESULT([no])
  607. ;;
  608. default)
  609. dnl configure option not specified
  610. want_ech="no"
  611. curl_ech_msg="no (--enable-ech)"
  612. AC_MSG_RESULT([no])
  613. ;;
  614. *)
  615. dnl --enable-ech option used
  616. want_ech="yes"
  617. curl_ech_msg="enabled (--disable-ech)"
  618. experimental="ech"
  619. AC_MSG_RESULT([yes])
  620. ;;
  621. esac
  622. ])