curl-confopts.m4 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 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. # SPDX-License-Identifier: curl
  22. #
  23. #***************************************************************************
  24. # File version for 'aclocal' use. Keep it a single number.
  25. # serial 19
  26. dnl CURL_CHECK_OPTION_THREADED_RESOLVER
  27. dnl -------------------------------------------------
  28. dnl Verify if configure has been invoked with option
  29. dnl --enable-threaded-resolver or --disable-threaded-resolver, and
  30. dnl set shell variable want_thres as appropriate.
  31. AC_DEFUN([CURL_CHECK_OPTION_THREADED_RESOLVER], [
  32. AC_MSG_CHECKING([whether to enable the threaded resolver])
  33. OPT_THRES="default"
  34. AC_ARG_ENABLE(threaded_resolver,
  35. AS_HELP_STRING([--enable-threaded-resolver],[Enable threaded resolver])
  36. AS_HELP_STRING([--disable-threaded-resolver],[Disable threaded resolver]),
  37. OPT_THRES=$enableval)
  38. case "$OPT_THRES" in
  39. no)
  40. dnl --disable-threaded-resolver option used
  41. want_thres="no"
  42. ;;
  43. *)
  44. dnl configure option not specified
  45. want_thres="yes"
  46. ;;
  47. esac
  48. AC_MSG_RESULT([$want_thres])
  49. ])
  50. dnl CURL_CHECK_OPTION_ARES
  51. dnl -------------------------------------------------
  52. dnl Verify if configure has been invoked with option
  53. dnl --enable-ares or --disable-ares, and
  54. dnl set shell variable want_ares as appropriate.
  55. AC_DEFUN([CURL_CHECK_OPTION_ARES], [
  56. dnl AC_BEFORE([$0],[CURL_CHECK_OPTION_THREADS])dnl
  57. AC_BEFORE([$0],[CURL_CHECK_LIB_ARES])dnl
  58. AC_MSG_CHECKING([whether to enable c-ares for DNS lookups])
  59. OPT_ARES="default"
  60. AC_ARG_ENABLE(ares,
  61. AS_HELP_STRING([--enable-ares@<:@=PATH@:>@],[Enable c-ares for DNS lookups])
  62. AS_HELP_STRING([--disable-ares],[Disable c-ares for DNS lookups]),
  63. OPT_ARES=$enableval)
  64. case "$OPT_ARES" in
  65. no)
  66. dnl --disable-ares option used
  67. want_ares="no"
  68. ;;
  69. default)
  70. dnl configure option not specified
  71. want_ares="no"
  72. ;;
  73. *)
  74. dnl --enable-ares option used
  75. want_ares="yes"
  76. if test -n "$enableval" && test "$enableval" != "yes"; then
  77. want_ares_path="$enableval"
  78. fi
  79. ;;
  80. esac
  81. AC_MSG_RESULT([$want_ares])
  82. ])
  83. dnl CURL_CHECK_OPTION_CURLDEBUG
  84. dnl -------------------------------------------------
  85. dnl Verify if configure has been invoked with option
  86. dnl --enable-curldebug or --disable-curldebug, and set
  87. dnl shell variable want_curldebug value as appropriate.
  88. AC_DEFUN([CURL_CHECK_OPTION_CURLDEBUG], [
  89. AC_BEFORE([$0],[CURL_CHECK_CURLDEBUG])dnl
  90. AC_MSG_CHECKING([whether to enable curl debug memory tracking])
  91. OPT_CURLDEBUG_BUILD="default"
  92. AC_ARG_ENABLE(curldebug,
  93. AS_HELP_STRING([--enable-curldebug],[Enable curl debug memory tracking])
  94. AS_HELP_STRING([--disable-curldebug],[Disable curl debug memory tracking]),
  95. OPT_CURLDEBUG_BUILD=$enableval)
  96. case "$OPT_CURLDEBUG_BUILD" in
  97. no)
  98. dnl --disable-curldebug option used
  99. want_curldebug="no"
  100. AC_MSG_RESULT([no])
  101. ;;
  102. default)
  103. dnl configure's curldebug option not specified. Initially we will
  104. dnl handle this as a request to use the same setting as option
  105. dnl --enable-debug. IOW, initially, for debug-enabled builds
  106. dnl this will be handled as a request to enable curldebug if
  107. dnl possible, and for debug-disabled builds this will be handled
  108. dnl as a request to disable curldebug.
  109. if test "$want_debug" = "yes"; then
  110. AC_MSG_RESULT([(assumed) yes])
  111. AC_DEFINE(CURLDEBUG, 1, [to enable curl debug memory tracking])
  112. else
  113. AC_MSG_RESULT([no])
  114. fi
  115. want_curldebug_assumed="yes"
  116. want_curldebug="$want_debug"
  117. ;;
  118. *)
  119. dnl --enable-curldebug option used.
  120. dnl The use of this option value is a request to enable curl's
  121. dnl debug memory tracking for the libcurl library. This can only
  122. dnl be done when some requisites are simultaneously satisfied.
  123. dnl Later on, these requisites are verified and if they are not
  124. dnl fully satisfied the option will be ignored and act as if
  125. dnl --disable-curldebug had been given setting shell variable
  126. dnl want_curldebug to 'no'.
  127. want_curldebug="yes"
  128. AC_DEFINE(CURLDEBUG, 1, [to enable curl debug memory tracking])
  129. AC_MSG_RESULT([yes])
  130. ;;
  131. esac
  132. ])
  133. dnl CURL_CHECK_OPTION_DEBUG
  134. dnl -------------------------------------------------
  135. dnl Verify if configure has been invoked with option
  136. dnl --enable-debug or --disable-debug, and set shell
  137. dnl variable want_debug value as appropriate.
  138. AC_DEFUN([CURL_CHECK_OPTION_DEBUG], [
  139. AC_BEFORE([$0],[CURL_CHECK_OPTION_WARNINGS])dnl
  140. AC_BEFORE([$0],[CURL_CHECK_OPTION_CURLDEBUG])dnl
  141. AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
  142. AC_MSG_CHECKING([whether to enable debug build options])
  143. OPT_DEBUG_BUILD="default"
  144. AC_ARG_ENABLE(debug,
  145. AS_HELP_STRING([--enable-debug],[Enable debug build options])
  146. AS_HELP_STRING([--disable-debug],[Disable debug build options]),
  147. OPT_DEBUG_BUILD=$enableval)
  148. case "$OPT_DEBUG_BUILD" in
  149. no)
  150. dnl --disable-debug option used
  151. want_debug="no"
  152. ;;
  153. default)
  154. dnl configure option not specified
  155. want_debug="no"
  156. ;;
  157. *)
  158. dnl --enable-debug option used
  159. want_debug="yes"
  160. AC_DEFINE(DEBUGBUILD, 1, [enable debug build options])
  161. ;;
  162. esac
  163. AC_MSG_RESULT([$want_debug])
  164. ])
  165. dnl CURL_CHECK_OPTION_OPTIMIZE
  166. dnl -------------------------------------------------
  167. dnl Verify if configure has been invoked with option
  168. dnl --enable-optimize or --disable-optimize, and set
  169. dnl shell variable want_optimize value as appropriate.
  170. AC_DEFUN([CURL_CHECK_OPTION_OPTIMIZE], [
  171. AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
  172. AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
  173. AC_MSG_CHECKING([whether to enable compiler optimizer])
  174. OPT_COMPILER_OPTIMIZE="default"
  175. AC_ARG_ENABLE(optimize,
  176. AS_HELP_STRING([--enable-optimize],[Enable compiler optimizations])
  177. AS_HELP_STRING([--disable-optimize],[Disable compiler optimizations]),
  178. OPT_COMPILER_OPTIMIZE=$enableval)
  179. case "$OPT_COMPILER_OPTIMIZE" in
  180. no)
  181. dnl --disable-optimize option used. We will handle this as
  182. dnl a request to disable compiler optimizations if possible.
  183. dnl If the compiler is known CFLAGS and CPPFLAGS will be
  184. dnl overridden, otherwise this can not be honored.
  185. want_optimize="no"
  186. AC_MSG_RESULT([no])
  187. ;;
  188. default)
  189. dnl configure's optimize option not specified. Initially we will
  190. dnl handle this as a request contrary to configure's setting
  191. dnl for --enable-debug. IOW, initially, for debug-enabled builds
  192. dnl this will be handled as a request to disable optimizations if
  193. dnl possible, and for debug-disabled builds this will be handled
  194. dnl initially as a request to enable optimizations if possible.
  195. dnl Finally, if the compiler is known and CFLAGS and CPPFLAGS do
  196. dnl not have any optimizer flag the request will be honored, in
  197. dnl any other case the request can not be honored.
  198. dnl IOW, existing optimizer flags defined in CFLAGS or CPPFLAGS
  199. dnl will always take precedence over any initial assumption.
  200. if test "$want_debug" = "yes"; then
  201. want_optimize="assume_no"
  202. AC_MSG_RESULT([(assumed) no])
  203. else
  204. want_optimize="assume_yes"
  205. AC_MSG_RESULT([(assumed) yes])
  206. fi
  207. ;;
  208. *)
  209. dnl --enable-optimize option used. We will handle this as
  210. dnl a request to enable compiler optimizations if possible.
  211. dnl If the compiler is known CFLAGS and CPPFLAGS will be
  212. dnl overridden, otherwise this can not be honored.
  213. want_optimize="yes"
  214. AC_MSG_RESULT([yes])
  215. ;;
  216. esac
  217. ])
  218. dnl CURL_CHECK_OPTION_SYMBOL_HIDING
  219. dnl -------------------------------------------------
  220. dnl Verify if configure has been invoked with option
  221. dnl --enable-symbol-hiding or --disable-symbol-hiding,
  222. dnl setting shell variable want_symbol_hiding value.
  223. AC_DEFUN([CURL_CHECK_OPTION_SYMBOL_HIDING], [
  224. AC_BEFORE([$0],[CURL_CHECK_COMPILER_SYMBOL_HIDING])dnl
  225. AC_MSG_CHECKING([whether to enable hiding of library internal symbols])
  226. OPT_SYMBOL_HIDING="default"
  227. AC_ARG_ENABLE(symbol-hiding,
  228. AS_HELP_STRING([--enable-symbol-hiding],[Enable hiding of library internal symbols])
  229. AS_HELP_STRING([--disable-symbol-hiding],[Disable hiding of library internal symbols]),
  230. OPT_SYMBOL_HIDING=$enableval)
  231. case "$OPT_SYMBOL_HIDING" in
  232. no)
  233. dnl --disable-symbol-hiding option used.
  234. dnl This is an indication to not attempt hiding of library internal
  235. dnl symbols. Default symbol visibility will be used, which normally
  236. dnl exposes all library internal symbols.
  237. want_symbol_hiding="no"
  238. AC_MSG_RESULT([no])
  239. ;;
  240. default)
  241. dnl configure's symbol-hiding option not specified.
  242. dnl Handle this as if --enable-symbol-hiding option was given.
  243. want_symbol_hiding="yes"
  244. AC_MSG_RESULT([yes])
  245. ;;
  246. *)
  247. dnl --enable-symbol-hiding option used.
  248. dnl This is an indication to attempt hiding of library internal
  249. dnl symbols. This is only supported on some compilers/linkers.
  250. want_symbol_hiding="yes"
  251. AC_MSG_RESULT([yes])
  252. ;;
  253. esac
  254. ])
  255. dnl CURL_CHECK_OPTION_THREADS
  256. dnl -------------------------------------------------
  257. dnl Verify if configure has been invoked with option
  258. dnl --enable-threads or --disable-threads, and
  259. dnl set shell variable want_threads as appropriate.
  260. dnl AC_DEFUN([CURL_CHECK_OPTION_THREADS], [
  261. dnl AC_BEFORE([$0],[CURL_CHECK_LIB_THREADS])dnl
  262. dnl AC_MSG_CHECKING([whether to enable threads for DNS lookups])
  263. dnl OPT_THREADS="default"
  264. dnl AC_ARG_ENABLE(threads,
  265. dnl AS_HELP_STRING([--enable-threads@<:@=PATH@:>@],[Enable threads for DNS lookups])
  266. dnl AS_HELP_STRING([--disable-threads],[Disable threads for DNS lookups]),
  267. dnl OPT_THREADS=$enableval)
  268. dnl case "$OPT_THREADS" in
  269. dnl no)
  270. dnl dnl --disable-threads option used
  271. dnl want_threads="no"
  272. dnl AC_MSG_RESULT([no])
  273. dnl ;;
  274. dnl default)
  275. dnl dnl configure option not specified
  276. dnl want_threads="no"
  277. dnl AC_MSG_RESULT([(assumed) no])
  278. dnl ;;
  279. dnl *)
  280. dnl dnl --enable-threads option used
  281. dnl want_threads="yes"
  282. dnl want_threads_path="$enableval"
  283. dnl AC_MSG_RESULT([yes])
  284. dnl ;;
  285. dnl esac
  286. dnl #
  287. dnl if test "$want_ares" = "assume_yes"; then
  288. dnl if test "$want_threads" = "yes"; then
  289. dnl AC_MSG_CHECKING([whether to ignore c-ares enabling assumed setting])
  290. dnl AC_MSG_RESULT([yes])
  291. dnl want_ares="no"
  292. dnl else
  293. dnl want_ares="yes"
  294. dnl fi
  295. dnl fi
  296. dnl if test "$want_threads" = "yes" && test "$want_ares" = "yes"; then
  297. dnl AC_MSG_ERROR([options --enable-ares and --enable-threads are mutually exclusive, at most one may be enabled.])
  298. dnl fi
  299. dnl ])
  300. dnl CURL_CHECK_OPTION_RT
  301. dnl -------------------------------------------------
  302. dnl Verify if configure has been invoked with option
  303. dnl --disable-rt and set shell variable dontwant_rt
  304. dnl as appropriate.
  305. AC_DEFUN([CURL_CHECK_OPTION_RT], [
  306. AC_BEFORE([$0], [CURL_CHECK_LIB_THREADS])dnl
  307. AC_MSG_CHECKING([whether to disable dependency on -lrt])
  308. OPT_RT="default"
  309. AC_ARG_ENABLE(rt,
  310. AS_HELP_STRING([--disable-rt],[disable dependency on -lrt]),
  311. OPT_RT=$enableval)
  312. case "$OPT_RT" in
  313. no)
  314. dnl --disable-rt used (reverse logic)
  315. dontwant_rt="yes"
  316. AC_MSG_RESULT([yes])
  317. ;;
  318. default)
  319. dnl configure option not specified (so not disabled)
  320. dontwant_rt="no"
  321. AC_MSG_RESULT([(assumed no)])
  322. ;;
  323. *)
  324. dnl --enable-rt option used (reverse logic)
  325. dontwant_rt="no"
  326. AC_MSG_RESULT([no])
  327. ;;
  328. esac
  329. ])
  330. dnl CURL_CHECK_OPTION_WARNINGS
  331. dnl -------------------------------------------------
  332. dnl Verify if configure has been invoked with option
  333. dnl --enable-warnings or --disable-warnings, and set
  334. dnl shell variable want_warnings as appropriate.
  335. AC_DEFUN([CURL_CHECK_OPTION_WARNINGS], [
  336. AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
  337. AC_BEFORE([$0],[CURL_CHECK_OPTION_WERROR])dnl
  338. AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
  339. AC_MSG_CHECKING([whether to enable strict compiler warnings])
  340. OPT_COMPILER_WARNINGS="default"
  341. AC_ARG_ENABLE(warnings,
  342. AS_HELP_STRING([--enable-warnings],[Enable strict compiler warnings])
  343. AS_HELP_STRING([--disable-warnings],[Disable strict compiler warnings]),
  344. OPT_COMPILER_WARNINGS=$enableval)
  345. case "$OPT_COMPILER_WARNINGS" in
  346. no)
  347. dnl --disable-warnings option used
  348. want_warnings="no"
  349. ;;
  350. default)
  351. dnl configure option not specified, so
  352. dnl use same setting as --enable-debug
  353. want_warnings="$want_debug"
  354. ;;
  355. *)
  356. dnl --enable-warnings option used
  357. want_warnings="yes"
  358. ;;
  359. esac
  360. AC_MSG_RESULT([$want_warnings])
  361. ])
  362. dnl CURL_CHECK_OPTION_WERROR
  363. dnl -------------------------------------------------
  364. dnl Verify if configure has been invoked with option
  365. dnl --enable-werror or --disable-werror, and set
  366. dnl shell variable want_werror as appropriate.
  367. AC_DEFUN([CURL_CHECK_OPTION_WERROR], [
  368. AC_BEFORE([$0],[CURL_CHECK_COMPILER])dnl
  369. AC_MSG_CHECKING([whether to enable compiler warnings as errors])
  370. OPT_COMPILER_WERROR="default"
  371. AC_ARG_ENABLE(werror,
  372. AS_HELP_STRING([--enable-werror],[Enable compiler warnings as errors])
  373. AS_HELP_STRING([--disable-werror],[Disable compiler warnings as errors]),
  374. OPT_COMPILER_WERROR=$enableval)
  375. case "$OPT_COMPILER_WERROR" in
  376. no)
  377. dnl --disable-werror option used
  378. want_werror="no"
  379. ;;
  380. default)
  381. dnl configure option not specified
  382. want_werror="no"
  383. ;;
  384. *)
  385. dnl --enable-werror option used
  386. want_werror="yes"
  387. ;;
  388. esac
  389. AC_MSG_RESULT([$want_werror])
  390. ])
  391. dnl CURL_CHECK_NONBLOCKING_SOCKET
  392. dnl -------------------------------------------------
  393. dnl Check for how to set a socket into non-blocking state.
  394. AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], [
  395. AC_REQUIRE([CURL_CHECK_FUNC_FCNTL])dnl
  396. AC_REQUIRE([CURL_CHECK_FUNC_IOCTLSOCKET])dnl
  397. AC_REQUIRE([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL])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 "$want_symbol_hiding" = "yes" &&
  430. test "$supports_symbol_hiding" = "yes"; then
  431. doing_symbol_hiding="yes"
  432. CFLAG_CURL_SYMBOL_HIDING="$symbol_hiding_CFLAGS"
  433. AC_DEFINE_UNQUOTED(CURL_EXTERN_SYMBOL, $symbol_hiding_EXTERN,
  434. [Definition to make a library symbol externally visible.])
  435. AC_MSG_RESULT([yes])
  436. else
  437. AC_MSG_RESULT([no])
  438. fi
  439. AM_CONDITIONAL(DOING_CURL_SYMBOL_HIDING, test x$doing_symbol_hiding = xyes)
  440. AC_SUBST(CFLAG_CURL_SYMBOL_HIDING)
  441. ])
  442. dnl CURL_CHECK_LIB_ARES
  443. dnl -------------------------------------------------
  444. dnl When c-ares library support has been requested, performs necessary checks
  445. dnl and adjustments needed to enable support of this library.
  446. AC_DEFUN([CURL_CHECK_LIB_ARES], [
  447. #
  448. if test "$want_ares" = "yes"; then
  449. dnl c-ares library support has been requested
  450. clean_CPPFLAGS="$CPPFLAGS"
  451. clean_LDFLAGS="$LDFLAGS"
  452. clean_LDFLAGSPC="$LDFLAGSPC"
  453. clean_LIBS="$LIBS"
  454. configure_runpath=`pwd`
  455. if test -n "$want_ares_path"; then
  456. dnl c-ares library path has been specified
  457. ARES_PCDIR="$want_ares_path/lib/pkgconfig"
  458. CURL_CHECK_PKGCONFIG(libcares, [$ARES_PCDIR])
  459. if test "$PKGCONFIG" != "no" ; then
  460. ares_LIBS=`CURL_EXPORT_PCDIR([$ARES_PCDIR])
  461. $PKGCONFIG --libs-only-l libcares`
  462. ares_LDFLAGS=`CURL_EXPORT_PCDIR([$ARES_PCDIR])
  463. $PKGCONFIG --libs-only-L libcares`
  464. ares_CPPFLAGS=`CURL_EXPORT_PCDIR([$ARES_PCDIR])
  465. $PKGCONFIG --cflags-only-I libcares`
  466. AC_MSG_NOTICE([pkg-config: ares LIBS: "$ares_LIBS"])
  467. AC_MSG_NOTICE([pkg-config: ares LDFLAGS: "$ares_LDFLAGS"])
  468. AC_MSG_NOTICE([pkg-config: ares CPPFLAGS: "$ares_CPPFLAGS"])
  469. else
  470. dnl ... path without pkg-config
  471. ares_CPPFLAGS="-I$want_ares_path/include"
  472. ares_LDFLAGS="-L$want_ares_path/lib"
  473. ares_LIBS="-lcares"
  474. fi
  475. else
  476. dnl c-ares path not specified, use defaults
  477. CURL_CHECK_PKGCONFIG(libcares)
  478. if test "$PKGCONFIG" != "no" ; then
  479. ares_LIBS=`$PKGCONFIG --libs-only-l libcares`
  480. ares_LDFLAGS=`$PKGCONFIG --libs-only-L libcares`
  481. ares_CPPFLAGS=`$PKGCONFIG --cflags-only-I libcares`
  482. AC_MSG_NOTICE([pkg-config: ares_LIBS: "$ares_LIBS"])
  483. AC_MSG_NOTICE([pkg-config: ares_LDFLAGS: "$ares_LDFLAGS"])
  484. AC_MSG_NOTICE([pkg-config: ares_CPPFLAGS: "$ares_CPPFLAGS"])
  485. else
  486. ares_CPPFLAGS=""
  487. ares_LDFLAGS=""
  488. ares_LIBS="-lcares"
  489. fi
  490. fi
  491. #
  492. CPPFLAGS="$clean_CPPFLAGS $ares_CPPFLAGS"
  493. LDFLAGS="$clean_LDFLAGS $ares_LDFLAGS"
  494. LDFLAGSPC="$clean_LDFLAGSPC $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. LDFLAGSPC="$clean_LDFLAGSPC"
  523. LIBS="$clean_LIBS"
  524. # prevent usage
  525. want_ares="no"
  526. ])
  527. if test "$want_ares" = "yes"; then
  528. dnl finally c-ares will be used
  529. AC_DEFINE(USE_ARES, 1, [Define to enable c-ares support])
  530. AC_DEFINE(CARES_NO_DEPRECATED, 1, [Ignore c-ares deprecation warnings])
  531. AC_SUBST([USE_ARES], [1])
  532. LIBCURL_PC_REQUIRES_PRIVATE="$LIBCURL_PC_REQUIRES_PRIVATE libcares"
  533. curl_res_msg="c-ares"
  534. fi
  535. fi
  536. ])
  537. dnl CURL_CHECK_OPTION_NTLM_WB
  538. dnl -------------------------------------------------
  539. dnl Verify if configure has been invoked with option
  540. dnl --enable-ntlm-wb or --disable-ntlm-wb, and set
  541. dnl shell variable want_ntlm_wb and want_ntlm_wb_file
  542. dnl as appropriate.
  543. AC_DEFUN([CURL_CHECK_OPTION_NTLM_WB], [
  544. AC_BEFORE([$0],[CURL_CHECK_NTLM_WB])dnl
  545. OPT_NTLM_WB="default"
  546. AC_ARG_ENABLE(ntlm-wb,
  547. 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)])
  548. AS_HELP_STRING([--disable-ntlm-wb],[Disable NTLM delegation to winbind's ntlm_auth helper]),
  549. OPT_NTLM_WB=$enableval)
  550. want_ntlm_wb_file="/usr/bin/ntlm_auth"
  551. case "$OPT_NTLM_WB" in
  552. no)
  553. dnl --disable-ntlm-wb option used
  554. want_ntlm_wb="no"
  555. ;;
  556. default)
  557. dnl configure option not specified
  558. want_ntlm_wb="yes"
  559. ;;
  560. *)
  561. dnl --enable-ntlm-wb option used
  562. want_ntlm_wb="yes"
  563. if test -n "$enableval" && test "$enableval" != "yes"; then
  564. want_ntlm_wb_file="$enableval"
  565. fi
  566. ;;
  567. esac
  568. ])
  569. dnl CURL_CHECK_NTLM_WB
  570. dnl -------------------------------------------------
  571. dnl Check if support for NTLM delegation to winbind's
  572. dnl ntlm_auth helper will finally be enabled depending
  573. dnl on given configure options and target platform.
  574. AC_DEFUN([CURL_CHECK_NTLM_WB], [
  575. AC_REQUIRE([CURL_CHECK_OPTION_NTLM_WB])dnl
  576. AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
  577. AC_MSG_CHECKING([whether to enable NTLM delegation to winbind's helper])
  578. if test "$curl_cv_native_windows" = "yes" ||
  579. test "x$SSL_ENABLED" = "x"; then
  580. want_ntlm_wb_file=""
  581. want_ntlm_wb="no"
  582. elif test "x$ac_cv_func_fork" != "xyes"; then
  583. dnl ntlm_wb requires fork
  584. want_ntlm_wb="no"
  585. fi
  586. AC_MSG_RESULT([$want_ntlm_wb])
  587. if test "$want_ntlm_wb" = "yes"; then
  588. AC_DEFINE(NTLM_WB_ENABLED, 1,
  589. [Define to enable NTLM delegation to winbind's ntlm_auth helper.])
  590. AC_DEFINE_UNQUOTED(NTLM_WB_FILE, "$want_ntlm_wb_file",
  591. [Define absolute filename for winbind's ntlm_auth helper.])
  592. NTLM_WB_ENABLED=1
  593. fi
  594. ])
  595. dnl CURL_CHECK_OPTION_HTTPSRR
  596. dnl -----------------------------------------------------
  597. dnl Verify whether configure has been invoked with option
  598. dnl --enable-httpsrr or --disable-httpsrr, and set
  599. dnl shell variable want_httpsrr as appropriate.
  600. AC_DEFUN([CURL_CHECK_OPTION_HTTPSRR], [
  601. AC_MSG_CHECKING([whether to enable HTTPSRR support])
  602. OPT_HTTPSRR="default"
  603. AC_ARG_ENABLE(httpsrr,
  604. AS_HELP_STRING([--enable-httpsrr],[Enable HTTPSRR support])
  605. AS_HELP_STRING([--disable-httpsrr],[Disable HTTPSRR support]),
  606. OPT_HTTPSRR=$enableval)
  607. case "$OPT_HTTPSRR" in
  608. no)
  609. dnl --disable-httpsrr option used
  610. want_httpsrr="no"
  611. curl_httpsrr_msg="no (--enable-httpsrr)"
  612. AC_MSG_RESULT([no])
  613. ;;
  614. default)
  615. dnl configure option not specified
  616. want_httpsrr="no"
  617. curl_httpsrr_msg="no (--enable-httpsrr)"
  618. AC_MSG_RESULT([no])
  619. ;;
  620. *)
  621. dnl --enable-httpsrr option used
  622. want_httpsrr="yes"
  623. curl_httpsrr_msg="enabled (--disable-httpsrr)"
  624. AC_MSG_RESULT([yes])
  625. ;;
  626. esac
  627. ])
  628. dnl CURL_CHECK_OPTION_ECH
  629. dnl -----------------------------------------------------
  630. dnl Verify whether configure has been invoked with option
  631. dnl --enable-ech or --disable-ech, and set
  632. dnl shell variable want_ech as appropriate.
  633. AC_DEFUN([CURL_CHECK_OPTION_ECH], [
  634. AC_MSG_CHECKING([whether to enable ECH support])
  635. OPT_ECH="default"
  636. AC_ARG_ENABLE(ech,
  637. AS_HELP_STRING([--enable-ech],[Enable ECH support])
  638. AS_HELP_STRING([--disable-ech],[Disable ECH support]),
  639. OPT_ECH=$enableval)
  640. case "$OPT_ECH" in
  641. no)
  642. dnl --disable-ech option used
  643. want_ech="no"
  644. curl_ech_msg="no (--enable-ech)"
  645. AC_MSG_RESULT([no])
  646. ;;
  647. default)
  648. dnl configure option not specified
  649. want_ech="no"
  650. curl_ech_msg="no (--enable-ech)"
  651. AC_MSG_RESULT([no])
  652. ;;
  653. *)
  654. dnl --enable-ech option used
  655. want_ech="yes"
  656. curl_ech_msg="enabled (--disable-ech)"
  657. AC_MSG_RESULT([yes])
  658. ;;
  659. esac
  660. ])
  661. ])