2
0

curl-confopts.m4 22 KB

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