• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) 1998 - 2021, 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
23# File version for 'aclocal' use. Keep it a single number.
24# serial 19
25
26dnl CURL_CHECK_OPTION_THREADED_RESOLVER
27dnl -------------------------------------------------
28dnl Verify if configure has been invoked with option
29dnl --enable-threaded-resolver or --disable-threaded-resolver, and
30dnl set shell variable want_thres as appropriate.
31
32AC_DEFUN([CURL_CHECK_OPTION_THREADED_RESOLVER], [
33  AC_MSG_CHECKING([whether to enable the threaded resolver])
34  OPT_THRES="default"
35  AC_ARG_ENABLE(threaded_resolver,
36AS_HELP_STRING([--enable-threaded-resolver],[Enable threaded resolver])
37AS_HELP_STRING([--disable-threaded-resolver],[Disable threaded resolver]),
38  OPT_THRES=$enableval)
39  case "$OPT_THRES" in
40    no)
41      dnl --disable-threaded-resolver option used
42      want_thres="no"
43      ;;
44    *)
45      dnl configure option not specified
46      want_thres="yes"
47      ;;
48  esac
49  AC_MSG_RESULT([$want_thres])
50])
51
52dnl CURL_CHECK_OPTION_ARES
53dnl -------------------------------------------------
54dnl Verify if configure has been invoked with option
55dnl --enable-ares or --disable-ares, and
56dnl set shell variable want_ares as appropriate.
57
58AC_DEFUN([CURL_CHECK_OPTION_ARES], [
59dnl   AC_BEFORE([$0],[CURL_CHECK_OPTION_THREADS])dnl
60  AC_BEFORE([$0],[CURL_CHECK_LIB_ARES])dnl
61  AC_MSG_CHECKING([whether to enable c-ares for DNS lookups])
62  OPT_ARES="default"
63  AC_ARG_ENABLE(ares,
64AS_HELP_STRING([--enable-ares@<:@=PATH@:>@],[Enable c-ares for DNS lookups])
65AS_HELP_STRING([--disable-ares],[Disable c-ares for DNS lookups]),
66  OPT_ARES=$enableval)
67  case "$OPT_ARES" in
68    no)
69      dnl --disable-ares option used
70      want_ares="no"
71      ;;
72    default)
73      dnl configure option not specified
74      want_ares="no"
75      ;;
76    *)
77      dnl --enable-ares option used
78      want_ares="yes"
79      if test -n "$enableval" && test "$enableval" != "yes"; then
80        want_ares_path="$enableval"
81      fi
82      ;;
83  esac
84  AC_MSG_RESULT([$want_ares])
85])
86
87
88dnl CURL_CHECK_OPTION_CURLDEBUG
89dnl -------------------------------------------------
90dnl Verify if configure has been invoked with option
91dnl --enable-curldebug or --disable-curldebug, and set
92dnl shell variable want_curldebug value as appropriate.
93
94AC_DEFUN([CURL_CHECK_OPTION_CURLDEBUG], [
95  AC_BEFORE([$0],[CURL_CHECK_CURLDEBUG])dnl
96  AC_MSG_CHECKING([whether to enable curl debug memory tracking])
97  OPT_CURLDEBUG_BUILD="default"
98  AC_ARG_ENABLE(curldebug,
99AS_HELP_STRING([--enable-curldebug],[Enable curl debug memory tracking])
100AS_HELP_STRING([--disable-curldebug],[Disable curl debug memory tracking]),
101  OPT_CURLDEBUG_BUILD=$enableval)
102  case "$OPT_CURLDEBUG_BUILD" in
103    no)
104      dnl --disable-curldebug option used
105      want_curldebug="no"
106      AC_MSG_RESULT([no])
107      ;;
108    default)
109      dnl configure's curldebug option not specified. Initially we will
110      dnl handle this as a request to use the same setting as option
111      dnl --enable-debug. IOW, initially, for debug-enabled builds
112      dnl this will be handled as a request to enable curldebug if
113      dnl possible, and for debug-disabled builds this will be handled
114      dnl as a request to disable curldebug.
115      if test "$want_debug" = "yes"; then
116        AC_MSG_RESULT([(assumed) yes])
117        AC_DEFINE(CURLDEBUG, 1, [to enable curl debug memory tracking])
118      else
119        AC_MSG_RESULT([no])
120      fi
121      want_curldebug_assumed="yes"
122      want_curldebug="$want_debug"
123      ;;
124    *)
125      dnl --enable-curldebug option used.
126      dnl The use of this option value is a request to enable curl's
127      dnl debug memory tracking for the libcurl library. This can only
128      dnl be done when some requisites are simultaneously satisfied.
129      dnl Later on, these requisites are verified and if they are not
130      dnl fully satisfied the option will be ignored and act as if
131      dnl --disable-curldebug had been given setting shell variable
132      dnl want_curldebug to 'no'.
133      want_curldebug="yes"
134      AC_DEFINE(CURLDEBUG, 1, [to enable curl debug memory tracking])
135      AC_MSG_RESULT([yes])
136      ;;
137  esac
138])
139
140
141dnl CURL_CHECK_OPTION_DEBUG
142dnl -------------------------------------------------
143dnl Verify if configure has been invoked with option
144dnl --enable-debug or --disable-debug, and set shell
145dnl variable want_debug value as appropriate.
146
147AC_DEFUN([CURL_CHECK_OPTION_DEBUG], [
148  AC_BEFORE([$0],[CURL_CHECK_OPTION_WARNINGS])dnl
149  AC_BEFORE([$0],[CURL_CHECK_OPTION_CURLDEBUG])dnl
150  AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
151  AC_MSG_CHECKING([whether to enable debug build options])
152  OPT_DEBUG_BUILD="default"
153  AC_ARG_ENABLE(debug,
154AS_HELP_STRING([--enable-debug],[Enable debug build options])
155AS_HELP_STRING([--disable-debug],[Disable debug build options]),
156  OPT_DEBUG_BUILD=$enableval)
157  case "$OPT_DEBUG_BUILD" in
158    no)
159      dnl --disable-debug option used
160      want_debug="no"
161      ;;
162    default)
163      dnl configure option not specified
164      want_debug="no"
165      ;;
166    *)
167      dnl --enable-debug option used
168      want_debug="yes"
169      AC_DEFINE(DEBUGBUILD, 1, [enable debug build options])
170      ;;
171  esac
172  AC_MSG_RESULT([$want_debug])
173])
174
175dnl CURL_CHECK_OPTION_OPTIMIZE
176dnl -------------------------------------------------
177dnl Verify if configure has been invoked with option
178dnl --enable-optimize or --disable-optimize, and set
179dnl shell variable want_optimize value as appropriate.
180
181AC_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,
187AS_HELP_STRING([--enable-optimize],[Enable compiler optimizations])
188AS_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
230
231dnl CURL_CHECK_OPTION_SYMBOL_HIDING
232dnl -------------------------------------------------
233dnl Verify if configure has been invoked with option
234dnl --enable-symbol-hiding or --disable-symbol-hiding,
235dnl setting shell variable want_symbol_hiding value.
236
237AC_DEFUN([CURL_CHECK_OPTION_SYMBOL_HIDING], [
238  AC_BEFORE([$0],[CURL_CHECK_COMPILER_SYMBOL_HIDING])dnl
239  AC_MSG_CHECKING([whether to enable hiding of library internal symbols])
240  OPT_SYMBOL_HIDING="default"
241  AC_ARG_ENABLE(symbol-hiding,
242AS_HELP_STRING([--enable-symbol-hiding],[Enable hiding of library internal symbols])
243AS_HELP_STRING([--disable-symbol-hiding],[Disable hiding of library internal symbols]),
244  OPT_SYMBOL_HIDING=$enableval)
245  case "$OPT_SYMBOL_HIDING" in
246    no)
247      dnl --disable-symbol-hiding option used.
248      dnl This is an indication to not attempt hiding of library internal
249      dnl symbols. Default symbol visibility will be used, which normally
250      dnl exposes all library internal symbols.
251      want_symbol_hiding="no"
252      AC_MSG_RESULT([no])
253      ;;
254    default)
255      dnl configure's symbol-hiding option not specified.
256      dnl Handle this as if --enable-symbol-hiding option was given.
257      want_symbol_hiding="yes"
258      AC_MSG_RESULT([yes])
259      ;;
260    *)
261      dnl --enable-symbol-hiding option used.
262      dnl This is an indication to attempt hiding of library internal
263      dnl symbols. This is only supported on some compilers/linkers.
264      want_symbol_hiding="yes"
265      AC_MSG_RESULT([yes])
266      ;;
267  esac
268])
269
270
271dnl CURL_CHECK_OPTION_THREADS
272dnl -------------------------------------------------
273dnl Verify if configure has been invoked with option
274dnl --enable-threads or --disable-threads, and
275dnl set shell variable want_threads as appropriate.
276
277dnl AC_DEFUN([CURL_CHECK_OPTION_THREADS], [
278dnl   AC_BEFORE([$0],[CURL_CHECK_LIB_THREADS])dnl
279dnl   AC_MSG_CHECKING([whether to enable threads for DNS lookups])
280dnl   OPT_THREADS="default"
281dnl   AC_ARG_ENABLE(threads,
282dnl AS_HELP_STRING([--enable-threads@<:@=PATH@:>@],[Enable threads for DNS lookups])
283dnl AS_HELP_STRING([--disable-threads],[Disable threads for DNS lookups]),
284dnl   OPT_THREADS=$enableval)
285dnl   case "$OPT_THREADS" in
286dnl     no)
287dnl       dnl --disable-threads option used
288dnl       want_threads="no"
289dnl       AC_MSG_RESULT([no])
290dnl       ;;
291dnl     default)
292dnl       dnl configure option not specified
293dnl       want_threads="no"
294dnl       AC_MSG_RESULT([(assumed) no])
295dnl       ;;
296dnl     *)
297dnl       dnl --enable-threads option used
298dnl       want_threads="yes"
299dnl       want_threads_path="$enableval"
300dnl       AC_MSG_RESULT([yes])
301dnl       ;;
302dnl   esac
303dnl   #
304dnl   if test "$want_ares" = "assume_yes"; then
305dnl     if test "$want_threads" = "yes"; then
306dnl       AC_MSG_CHECKING([whether to ignore c-ares enabling assumed setting])
307dnl       AC_MSG_RESULT([yes])
308dnl       want_ares="no"
309dnl     else
310dnl       want_ares="yes"
311dnl     fi
312dnl   fi
313dnl   if test "$want_threads" = "yes" && test "$want_ares" = "yes"; then
314dnl     AC_MSG_ERROR([options --enable-ares and --enable-threads are mutually exclusive, at most one may be enabled.])
315dnl   fi
316dnl ])
317
318dnl CURL_CHECK_OPTION_RT
319dnl -------------------------------------------------
320dnl Verify if configure has been invoked with option
321dnl --disable-rt and set shell variable dontwant_rt
322dnl as appropriate.
323
324AC_DEFUN([CURL_CHECK_OPTION_RT], [
325  AC_BEFORE([$0], [CURL_CHECK_LIB_THREADS])dnl
326  AC_MSG_CHECKING([whether to disable dependency on -lrt])
327  OPT_RT="default"
328  AC_ARG_ENABLE(rt,
329 AS_HELP_STRING([--disable-rt],[disable dependency on -lrt]),
330  OPT_RT=$enableval)
331  case "$OPT_RT" in
332    no)
333      dnl --disable-rt used (reverse logic)
334      dontwant_rt="yes"
335      AC_MSG_RESULT([yes])
336      ;;
337    default)
338      dnl configure option not specified (so not disabled)
339      dontwant_rt="no"
340      AC_MSG_RESULT([(assumed no)])
341      ;;
342    *)
343      dnl --enable-rt option used (reverse logic)
344      dontwant_rt="no"
345      AC_MSG_RESULT([no])
346      ;;
347  esac
348])
349
350dnl CURL_CHECK_OPTION_WARNINGS
351dnl -------------------------------------------------
352dnl Verify if configure has been invoked with option
353dnl --enable-warnings or --disable-warnings, and set
354dnl shell variable want_warnings as appropriate.
355
356AC_DEFUN([CURL_CHECK_OPTION_WARNINGS], [
357  AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
358  AC_BEFORE([$0],[CURL_CHECK_OPTION_WERROR])dnl
359  AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
360  AC_MSG_CHECKING([whether to enable strict compiler warnings])
361  OPT_COMPILER_WARNINGS="default"
362  AC_ARG_ENABLE(warnings,
363AS_HELP_STRING([--enable-warnings],[Enable strict compiler warnings])
364AS_HELP_STRING([--disable-warnings],[Disable strict compiler warnings]),
365  OPT_COMPILER_WARNINGS=$enableval)
366  case "$OPT_COMPILER_WARNINGS" in
367    no)
368      dnl --disable-warnings option used
369      want_warnings="no"
370      ;;
371    default)
372      dnl configure option not specified, so
373      dnl use same setting as --enable-debug
374      want_warnings="$want_debug"
375      ;;
376    *)
377      dnl --enable-warnings option used
378      want_warnings="yes"
379      ;;
380  esac
381  AC_MSG_RESULT([$want_warnings])
382])
383
384dnl CURL_CHECK_OPTION_WERROR
385dnl -------------------------------------------------
386dnl Verify if configure has been invoked with option
387dnl --enable-werror or --disable-werror, and set
388dnl shell variable want_werror as appropriate.
389
390AC_DEFUN([CURL_CHECK_OPTION_WERROR], [
391  AC_BEFORE([$0],[CURL_CHECK_COMPILER])dnl
392  AC_MSG_CHECKING([whether to enable compiler warnings as errors])
393  OPT_COMPILER_WERROR="default"
394  AC_ARG_ENABLE(werror,
395AS_HELP_STRING([--enable-werror],[Enable compiler warnings as errors])
396AS_HELP_STRING([--disable-werror],[Disable compiler warnings as errors]),
397  OPT_COMPILER_WERROR=$enableval)
398  case "$OPT_COMPILER_WERROR" in
399    no)
400      dnl --disable-werror option used
401      want_werror="no"
402      ;;
403    default)
404      dnl configure option not specified
405      want_werror="no"
406      ;;
407    *)
408      dnl --enable-werror option used
409      want_werror="yes"
410      ;;
411  esac
412  AC_MSG_RESULT([$want_werror])
413])
414
415
416dnl CURL_CHECK_NONBLOCKING_SOCKET
417dnl -------------------------------------------------
418dnl Check for how to set a socket into non-blocking state.
419
420AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], [
421  AC_REQUIRE([CURL_CHECK_FUNC_FCNTL])dnl
422  AC_REQUIRE([CURL_CHECK_FUNC_IOCTL])dnl
423  AC_REQUIRE([CURL_CHECK_FUNC_IOCTLSOCKET])dnl
424  AC_REQUIRE([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL])dnl
425  AC_REQUIRE([CURL_CHECK_FUNC_SETSOCKOPT])dnl
426  #
427  tst_method="unknown"
428
429  AC_MSG_CHECKING([how to set a socket into non-blocking mode])
430  if test "x$curl_cv_func_fcntl_o_nonblock" = "xyes"; then
431    tst_method="fcntl O_NONBLOCK"
432  elif test "x$curl_cv_func_ioctl_fionbio" = "xyes"; then
433    tst_method="ioctl FIONBIO"
434  elif test "x$curl_cv_func_ioctlsocket_fionbio" = "xyes"; then
435    tst_method="ioctlsocket FIONBIO"
436  elif test "x$curl_cv_func_ioctlsocket_camel_fionbio" = "xyes"; then
437    tst_method="IoctlSocket FIONBIO"
438  elif test "x$curl_cv_func_setsockopt_so_nonblock" = "xyes"; then
439    tst_method="setsockopt SO_NONBLOCK"
440  fi
441  AC_MSG_RESULT([$tst_method])
442  if test "$tst_method" = "unknown"; then
443    AC_MSG_WARN([cannot determine non-blocking socket method.])
444  fi
445])
446
447
448dnl CURL_CONFIGURE_SYMBOL_HIDING
449dnl -------------------------------------------------
450dnl Depending on --enable-symbol-hiding or --disable-symbol-hiding
451dnl configure option, and compiler capability to actually honor such
452dnl option, this will modify compiler flags as appropriate and also
453dnl provide needed definitions for configuration and Makefile.am files.
454dnl This macro should not be used until all compilation tests have
455dnl been done to prevent interferences on other tests.
456
457AC_DEFUN([CURL_CONFIGURE_SYMBOL_HIDING], [
458  AC_MSG_CHECKING([whether hiding of library internal symbols will actually happen])
459  CFLAG_CURL_SYMBOL_HIDING=""
460  doing_symbol_hiding="no"
461  if test x"$curl_cv_native_windows" != "xyes" &&
462    test "$want_symbol_hiding" = "yes" &&
463    test "$supports_symbol_hiding" = "yes"; then
464    doing_symbol_hiding="yes"
465    CFLAG_CURL_SYMBOL_HIDING="$symbol_hiding_CFLAGS"
466    AC_DEFINE_UNQUOTED(CURL_EXTERN_SYMBOL, $symbol_hiding_EXTERN,
467      [Definition to make a library symbol externally visible.])
468    AC_MSG_RESULT([yes])
469  else
470    AC_MSG_RESULT([no])
471  fi
472  AM_CONDITIONAL(DOING_CURL_SYMBOL_HIDING, test x$doing_symbol_hiding = xyes)
473  AC_SUBST(CFLAG_CURL_SYMBOL_HIDING)
474])
475
476
477dnl CURL_CHECK_LIB_ARES
478dnl -------------------------------------------------
479dnl When c-ares library support has been requested,
480dnl performs necessary checks and adjustsments needed
481dnl to enable support of this library.
482
483AC_DEFUN([CURL_CHECK_LIB_ARES], [
484  #
485  if test "$want_ares" = "yes"; then
486    dnl c-ares library support has been requested
487    clean_CPPFLAGS="$CPPFLAGS"
488    clean_LDFLAGS="$LDFLAGS"
489    clean_LIBS="$LIBS"
490    embedded_ares="unknown"
491    configure_runpath=`pwd`
492    embedded_ares_builddir="$configure_runpath/ares"
493    if test -n "$want_ares_path"; then
494      dnl c-ares library path has been specified
495      ARES_PCDIR="$want_ares_path/lib/pkgconfig"
496      CURL_CHECK_PKGCONFIG(libcares, [$ARES_PCDIR])
497      if test "$PKGCONFIG" != "no" ; then
498        ares_LIBS=`CURL_EXPORT_PCDIR([$ARES_PCDIR])
499          $PKGCONFIG --libs-only-l libcares`
500        ares_LDFLAGS=`CURL_EXPORT_PCDIR([$ARES_PCDIR])
501          $PKGCONFIG --libs-only-L libcares`
502        ares_CPPFLAGS=`CURL_EXPORT_PCDIR([$ARES_PCDIR])
503          $PKGCONFIG --cflags-only-I libcares`
504        AC_MSG_NOTICE([pkg-config: ares LIBS: "$ares_LIBS"])
505        AC_MSG_NOTICE([pkg-config: ares LDFLAGS: "$ares_LDFLAGS"])
506        AC_MSG_NOTICE([pkg-config: ares CPPFLAGS: "$ares_CPPFLAGS"])
507      else
508        dnl ... path without pkg-config
509        ares_CPPFLAGS="-I$want_ares_path/include"
510        ares_LDFLAGS="-L$want_ares_path/lib"
511        ares_LIBS="-lcares"
512      fi
513    else
514      dnl c-ares library path has not been given
515      if test -d "$srcdir/ares"; then
516        dnl c-ares sources embedded in curl tree
517        embedded_ares="yes"
518        AC_CONFIG_SUBDIRS(ares)
519        dnl c-ares has installable configured header files, path
520        dnl inclusion fully done in makefiles for in-tree builds.
521        ares_CPPFLAGS=""
522        ares_LDFLAGS="-L$embedded_ares_builddir"
523        ares_LIBS="-lcares"
524      else
525        dnl c-ares path not specified, use defaults
526        CURL_CHECK_PKGCONFIG(libcares)
527        if test "$PKGCONFIG" != "no" ; then
528          ares_LIBS=`$PKGCONFIG --libs-only-l libcares`
529          ares_LDFLAGS=`$PKGCONFIG --libs-only-L libcares`
530          ares_CPPFLAGS=`$PKGCONFIG --cflags-only-I libcares`
531          AC_MSG_NOTICE([pkg-config: ares_LIBS: "$ares_LIBS"])
532          AC_MSG_NOTICE([pkg-config: ares_LDFLAGS: "$ares_LDFLAGS"])
533          AC_MSG_NOTICE([pkg-config: ares_CPPFLAGS: "$ares_CPPFLAGS"])
534        else
535          ares_CPPFLAGS=""
536          ares_LDFLAGS=""
537          ares_LIBS="-lcares"
538        fi
539      fi
540    fi
541    #
542    CPPFLAGS="$clean_CPPFLAGS $ares_CPPFLAGS"
543    LDFLAGS="$clean_LDFLAGS $ares_LDFLAGS"
544    LIBS="$ares_LIBS $clean_LIBS"
545    #
546    if test "$embedded_ares" != "yes"; then
547      dnl check if c-ares new enough when not using an embedded
548      dnl source tree one which normally has not been built yet.
549      AC_MSG_CHECKING([that c-ares is good and recent enough])
550      AC_LINK_IFELSE([
551        AC_LANG_PROGRAM([[
552#include <ares.h>
553          /* set of dummy functions in case c-ares was built with debug */
554          void curl_dofree() { }
555          void curl_sclose() { }
556          void curl_domalloc() { }
557          void curl_docalloc() { }
558          void curl_socket() { }
559        ]],[[
560          ares_channel channel;
561          ares_cancel(channel); /* added in 1.2.0 */
562          ares_process_fd(channel, 0, 0); /* added in 1.4.0 */
563          ares_dup(&channel, channel); /* added in 1.6.0 */
564        ]])
565      ],[
566        AC_MSG_RESULT([yes])
567      ],[
568        AC_MSG_RESULT([no])
569        AC_MSG_ERROR([c-ares library defective or too old])
570        dnl restore initial settings
571        CPPFLAGS="$clean_CPPFLAGS"
572        LDFLAGS="$clean_LDFLAGS"
573        LIBS="$clean_LIBS"
574        # prevent usage
575        want_ares="no"
576      ])
577    fi
578    if test "$want_ares" = "yes"; then
579      dnl finally c-ares will be used
580      AC_DEFINE(USE_ARES, 1, [Define to enable c-ares support])
581      AC_SUBST([USE_ARES], [1])
582      curl_res_msg="c-ares"
583    fi
584  fi
585])
586
587
588dnl CURL_CHECK_OPTION_NTLM_WB
589dnl -------------------------------------------------
590dnl Verify if configure has been invoked with option
591dnl --enable-ntlm-wb or --disable-ntlm-wb, and set
592dnl shell variable want_ntlm_wb and want_ntlm_wb_file
593dnl as appropriate.
594
595AC_DEFUN([CURL_CHECK_OPTION_NTLM_WB], [
596  AC_BEFORE([$0],[CURL_CHECK_NTLM_WB])dnl
597  OPT_NTLM_WB="default"
598  AC_ARG_ENABLE(ntlm-wb,
599AS_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)])
600AS_HELP_STRING([--disable-ntlm-wb],[Disable NTLM delegation to winbind's ntlm_auth helper]),
601  OPT_NTLM_WB=$enableval)
602  want_ntlm_wb_file="/usr/bin/ntlm_auth"
603  case "$OPT_NTLM_WB" in
604    no)
605      dnl --disable-ntlm-wb option used
606      want_ntlm_wb="no"
607      ;;
608    default)
609      dnl configure option not specified
610      want_ntlm_wb="yes"
611      ;;
612    *)
613      dnl --enable-ntlm-wb option used
614      want_ntlm_wb="yes"
615      if test -n "$enableval" && test "$enableval" != "yes"; then
616        want_ntlm_wb_file="$enableval"
617      fi
618      ;;
619  esac
620])
621
622
623dnl CURL_CHECK_NTLM_WB
624dnl -------------------------------------------------
625dnl Check if support for NTLM delegation to winbind's
626dnl ntlm_auth helper will finally be enabled depending
627dnl on given configure options and target platform.
628
629AC_DEFUN([CURL_CHECK_NTLM_WB], [
630  AC_REQUIRE([CURL_CHECK_OPTION_NTLM_WB])dnl
631  AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
632  AC_MSG_CHECKING([whether to enable NTLM delegation to winbind's helper])
633  if test "$curl_cv_native_windows" = "yes" ||
634    test "x$SSL_ENABLED" = "x"; then
635    want_ntlm_wb_file=""
636    want_ntlm_wb="no"
637  fi
638  AC_MSG_RESULT([$want_ntlm_wb])
639  if test "$want_ntlm_wb" = "yes"; then
640    AC_DEFINE(NTLM_WB_ENABLED, 1,
641      [Define to enable NTLM delegation to winbind's ntlm_auth helper.])
642    AC_DEFINE_UNQUOTED(NTLM_WB_FILE, "$want_ntlm_wb_file",
643      [Define absolute filename for winbind's ntlm_auth helper.])
644    NTLM_WB_ENABLED=1
645  fi
646])
647
648dnl CURL_CHECK_OPTION_ECH
649dnl -----------------------------------------------------
650dnl Verify whether configure has been invoked with option
651dnl --enable-ech or --disable-ech, and set
652dnl shell variable want_ech as appropriate.
653
654AC_DEFUN([CURL_CHECK_OPTION_ECH], [
655  AC_MSG_CHECKING([whether to enable ECH support])
656  OPT_ECH="default"
657  AC_ARG_ENABLE(ech,
658AS_HELP_STRING([--enable-ech],[Enable ECH support])
659AS_HELP_STRING([--disable-ech],[Disable ECH support]),
660  OPT_ECH=$enableval)
661  case "$OPT_ECH" in
662    no)
663      dnl --disable-ech option used
664      want_ech="no"
665      curl_ech_msg="no      (--enable-ech)"
666      AC_MSG_RESULT([no])
667      ;;
668    default)
669      dnl configure option not specified
670      want_ech="no"
671      curl_ech_msg="no      (--enable-ech)"
672      AC_MSG_RESULT([no])
673      ;;
674    *)
675      dnl --enable-ech option used
676      want_ech="yes"
677      curl_ech_msg="enabled (--disable-ech)"
678      experimental="ech"
679      AC_MSG_RESULT([yes])
680      ;;
681  esac
682])
683