1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
10 # This software is licensed as described in the file COPYING, which
11 # you should have received as part of this distribution. The terms
12 # are also available at https://curl.haxx.se/docs/copyright.html.
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.
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
21 #***************************************************************************
23 # File version for 'aclocal' use. Keep it a single number.
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.
32 AC_DEFUN([CURL_CHECK_OPTION_THREADED_RESOLVER], [
33 AC_MSG_CHECKING([whether to enable the threaded resolver])
35 AC_ARG_ENABLE(threaded_resolver,
36 AC_HELP_STRING([--enable-threaded-resolver],[Enable threaded resolver])
37 AC_HELP_STRING([--disable-threaded-resolver],[Disable threaded resolver]),
41 dnl --enable-threaded-resolver option used
45 dnl configure option not specified
49 AC_MSG_RESULT([$want_thres])
52 dnl CURL_CHECK_OPTION_ARES
53 dnl -------------------------------------------------
54 dnl Verify if configure has been invoked with option
55 dnl --enable-ares or --disable-ares, and
56 dnl set shell variable want_ares as appropriate.
58 AC_DEFUN([CURL_CHECK_OPTION_ARES], [
59 dnl 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])
64 AC_HELP_STRING([--enable-ares@<:@=PATH@:>@],[Enable c-ares for DNS lookups])
65 AC_HELP_STRING([--disable-ares],[Disable c-ares for DNS lookups]),
69 dnl --disable-ares option used
73 dnl configure option not specified
77 dnl --enable-ares option used
79 if test -n "$enableval" && test "$enableval" != "yes"; then
80 want_ares_path="$enableval"
84 AC_MSG_RESULT([$want_ares])
88 dnl CURL_CHECK_OPTION_CURLDEBUG
89 dnl -------------------------------------------------
90 dnl Verify if configure has been invoked with option
91 dnl --enable-curldebug or --disable-curldebug, and set
92 dnl shell variable want_curldebug value as appropriate.
94 AC_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,
99 AC_HELP_STRING([--enable-curldebug],[Enable curl debug memory tracking])
100 AC_HELP_STRING([--disable-curldebug],[Disable curl debug memory tracking]),
101 OPT_CURLDEBUG_BUILD=$enableval)
102 case "$OPT_CURLDEBUG_BUILD" in
104 dnl --disable-curldebug option used
109 dnl configure's curldebug option not specified. Initially we will
110 dnl handle this as a 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])
120 want_curldebug_assumed="yes"
121 want_curldebug="$want_debug"
124 dnl --enable-curldebug option used.
125 dnl The use of this option value is a request to enable curl's
126 dnl debug memory tracking for the libcurl library. This can only
127 dnl be done when some requisites are simultaneously satisfied.
128 dnl Later on, these requisites are verified and if they are not
129 dnl fully satisfied the option will be ignored and act as if
130 dnl --disable-curldebug had been given setting shell variable
131 dnl want_curldebug to 'no'.
139 dnl CURL_CHECK_OPTION_DEBUG
140 dnl -------------------------------------------------
141 dnl Verify if configure has been invoked with option
142 dnl --enable-debug or --disable-debug, and set shell
143 dnl variable want_debug value as appropriate.
145 AC_DEFUN([CURL_CHECK_OPTION_DEBUG], [
146 AC_BEFORE([$0],[CURL_CHECK_OPTION_WARNINGS])dnl
147 AC_BEFORE([$0],[CURL_CHECK_OPTION_CURLDEBUG])dnl
148 AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
149 AC_MSG_CHECKING([whether to enable debug build options])
150 OPT_DEBUG_BUILD="default"
152 AC_HELP_STRING([--enable-debug],[Enable debug build options])
153 AC_HELP_STRING([--disable-debug],[Disable debug build options]),
154 OPT_DEBUG_BUILD=$enableval)
155 case "$OPT_DEBUG_BUILD" in
157 dnl --disable-debug option used
161 dnl configure option not specified
165 dnl --enable-debug option used
169 AC_MSG_RESULT([$want_debug])
172 dnl CURL_CHECK_OPTION_OPTIMIZE
173 dnl -------------------------------------------------
174 dnl Verify if configure has been invoked with option
175 dnl --enable-optimize or --disable-optimize, and set
176 dnl shell variable want_optimize value as appropriate.
178 AC_DEFUN([CURL_CHECK_OPTION_OPTIMIZE], [
179 AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
180 AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
181 AC_MSG_CHECKING([whether to enable compiler optimizer])
182 OPT_COMPILER_OPTIMIZE="default"
183 AC_ARG_ENABLE(optimize,
184 AC_HELP_STRING([--enable-optimize],[Enable compiler optimizations])
185 AC_HELP_STRING([--disable-optimize],[Disable compiler optimizations]),
186 OPT_COMPILER_OPTIMIZE=$enableval)
187 case "$OPT_COMPILER_OPTIMIZE" in
189 dnl --disable-optimize option used. We will handle this as
190 dnl a request to disable compiler optimizations if possible.
191 dnl If the compiler is known CFLAGS and CPPFLAGS will be
192 dnl overridden, otherwise this can not be honored.
197 dnl configure's optimize option not specified. Initially we will
198 dnl handle this as a a request contrary to configure's setting
199 dnl for --enable-debug. IOW, initially, for debug-enabled builds
200 dnl this will be handled as a request to disable optimizations if
201 dnl possible, and for debug-disabled builds this will be handled
202 dnl initially as a request to enable optimizations if possible.
203 dnl Finally, if the compiler is known and CFLAGS and CPPFLAGS do
204 dnl not have any optimizer flag the request will be honored, in
205 dnl any other case the request can not be honored.
206 dnl IOW, existing optimizer flags defined in CFLAGS or CPPFLAGS
207 dnl will always take precedence over any initial assumption.
208 if test "$want_debug" = "yes"; then
209 want_optimize="assume_no"
210 AC_MSG_RESULT([(assumed) no])
212 want_optimize="assume_yes"
213 AC_MSG_RESULT([(assumed) yes])
217 dnl --enable-optimize option used. We will handle this as
218 dnl a request to enable compiler optimizations if possible.
219 dnl If the compiler is known CFLAGS and CPPFLAGS will be
220 dnl overridden, otherwise this can not be honored.
228 dnl CURL_CHECK_OPTION_SYMBOL_HIDING
229 dnl -------------------------------------------------
230 dnl Verify if configure has been invoked with option
231 dnl --enable-symbol-hiding or --disable-symbol-hiding,
232 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 AC_HELP_STRING([--enable-symbol-hiding],[Enable hiding of library internal symbols])
240 AC_HELP_STRING([--disable-symbol-hiding],[Disable hiding of library internal symbols]),
241 OPT_SYMBOL_HIDING=$enableval)
242 AC_ARG_ENABLE(hidden-symbols,
243 AC_HELP_STRING([--enable-hidden-symbols],[To be deprecated, use --enable-symbol-hiding])
244 AC_HELP_STRING([--disable-hidden-symbols],[To be deprecated, use --disable-symbol-hiding]),
245 OPT_SYMBOL_HIDING=$enableval)
246 case "$OPT_SYMBOL_HIDING" in
248 dnl --disable-symbol-hiding option used.
249 dnl This is an indication to not attempt hiding of library internal
250 dnl symbols. Default symbol visibility will be used, which normally
251 dnl exposes all library internal symbols.
252 want_symbol_hiding="no"
256 dnl configure's symbol-hiding option not specified.
257 dnl Handle this as if --enable-symbol-hiding option was given.
258 want_symbol_hiding="yes"
262 dnl --enable-symbol-hiding option used.
263 dnl This is an indication to attempt hiding of library internal
264 dnl symbols. This is only supported on some compilers/linkers.
265 want_symbol_hiding="yes"
272 dnl CURL_CHECK_OPTION_THREADS
273 dnl -------------------------------------------------
274 dnl Verify if configure has been invoked with option
275 dnl --enable-threads or --disable-threads, and
276 dnl set shell variable want_threads as appropriate.
278 dnl AC_DEFUN([CURL_CHECK_OPTION_THREADS], [
279 dnl AC_BEFORE([$0],[CURL_CHECK_LIB_THREADS])dnl
280 dnl AC_MSG_CHECKING([whether to enable threads for DNS lookups])
281 dnl OPT_THREADS="default"
282 dnl AC_ARG_ENABLE(threads,
283 dnl AC_HELP_STRING([--enable-threads@<:@=PATH@:>@],[Enable threads for DNS lookups])
284 dnl AC_HELP_STRING([--disable-threads],[Disable threads for DNS lookups]),
285 dnl OPT_THREADS=$enableval)
286 dnl case "$OPT_THREADS" in
288 dnl dnl --disable-threads option used
289 dnl want_threads="no"
290 dnl AC_MSG_RESULT([no])
293 dnl dnl configure option not specified
294 dnl want_threads="no"
295 dnl AC_MSG_RESULT([(assumed) no])
298 dnl dnl --enable-threads option used
299 dnl want_threads="yes"
300 dnl want_threads_path="$enableval"
301 dnl AC_MSG_RESULT([yes])
305 dnl if test "$want_ares" = "assume_yes"; then
306 dnl if test "$want_threads" = "yes"; then
307 dnl AC_MSG_CHECKING([whether to ignore c-ares enabling assumed setting])
308 dnl AC_MSG_RESULT([yes])
314 dnl if test "$want_threads" = "yes" && test "$want_ares" = "yes"; then
315 dnl AC_MSG_ERROR([options --enable-ares and --enable-threads are mutually exclusive, at most one may be enabled.])
319 dnl CURL_CHECK_OPTION_RT
320 dnl -------------------------------------------------
321 dnl Verify if configure has been involed with option
322 dnl --disable-rt and set shell variable dontwant_rt
325 AC_DEFUN([CURL_CHECK_OPTION_RT], [
326 AC_BEFORE([$0], [CURL_CHECK_LIB_THREADS])dnl
327 AC_MSG_CHECKING([whether to disable dependency on -lrt])
330 AC_HELP_STRING([--disable-rt],[disable dependency on -lrt]),
334 dnl --disable-rt used (reverse logic)
339 dnl configure option not specified (so not disabled)
341 AC_MSG_RESULT([(assumed no)])
344 dnl --enable-rt option used (reverse logic)
349 dnl TODO: may require mutual exclusion
350 if test "$dontwant_rt" = "yes" && test "$want_thres" = "yes" ; then
351 AC_MSG_ERROR([options --disable-rt and --enable-thread-resolver are mutually exclusive, at most one can be selected.])
356 dnl CURL_CHECK_OPTION_WARNINGS
357 dnl -------------------------------------------------
358 dnl Verify if configure has been invoked with option
359 dnl --enable-warnings or --disable-warnings, and set
360 dnl shell variable want_warnings as appropriate.
362 AC_DEFUN([CURL_CHECK_OPTION_WARNINGS], [
363 AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
364 AC_BEFORE([$0],[CURL_CHECK_OPTION_WERROR])dnl
365 AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
366 AC_MSG_CHECKING([whether to enable strict compiler warnings])
367 OPT_COMPILER_WARNINGS="default"
368 AC_ARG_ENABLE(warnings,
369 AC_HELP_STRING([--enable-warnings],[Enable strict compiler warnings])
370 AC_HELP_STRING([--disable-warnings],[Disable strict compiler warnings]),
371 OPT_COMPILER_WARNINGS=$enableval)
372 case "$OPT_COMPILER_WARNINGS" in
374 dnl --disable-warnings option used
378 dnl configure option not specified, so
379 dnl use same setting as --enable-debug
380 want_warnings="$want_debug"
383 dnl --enable-warnings option used
387 AC_MSG_RESULT([$want_warnings])
390 dnl CURL_CHECK_OPTION_WERROR
391 dnl -------------------------------------------------
392 dnl Verify if configure has been invoked with option
393 dnl --enable-werror or --disable-werror, and set
394 dnl shell variable want_werror as appropriate.
396 AC_DEFUN([CURL_CHECK_OPTION_WERROR], [
397 AC_BEFORE([$0],[CURL_CHECK_COMPILER])dnl
398 AC_MSG_CHECKING([whether to enable compiler warnings as errors])
399 OPT_COMPILER_WERROR="default"
400 AC_ARG_ENABLE(werror,
401 AC_HELP_STRING([--enable-werror],[Enable compiler warnings as errors])
402 AC_HELP_STRING([--disable-werror],[Disable compiler warnings as errors]),
403 OPT_COMPILER_WERROR=$enableval)
404 case "$OPT_COMPILER_WERROR" in
406 dnl --disable-werror option used
410 dnl configure option not specified
414 dnl --enable-werror option used
418 AC_MSG_RESULT([$want_werror])
422 dnl CURL_CHECK_NONBLOCKING_SOCKET
423 dnl -------------------------------------------------
424 dnl Check for how to set a socket into non-blocking state.
426 AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], [
427 AC_REQUIRE([CURL_CHECK_FUNC_FCNTL])dnl
428 AC_REQUIRE([CURL_CHECK_FUNC_IOCTL])dnl
429 AC_REQUIRE([CURL_CHECK_FUNC_IOCTLSOCKET])dnl
430 AC_REQUIRE([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL])dnl
431 AC_REQUIRE([CURL_CHECK_FUNC_SETSOCKOPT])dnl
435 AC_MSG_CHECKING([how to set a socket into non-blocking mode])
436 if test "x$ac_cv_func_fcntl_o_nonblock" = "xyes"; then
437 tst_method="fcntl O_NONBLOCK"
438 elif test "x$ac_cv_func_ioctl_fionbio" = "xyes"; then
439 tst_method="ioctl FIONBIO"
440 elif test "x$ac_cv_func_ioctlsocket_fionbio" = "xyes"; then
441 tst_method="ioctlsocket FIONBIO"
442 elif test "x$ac_cv_func_ioctlsocket_camel_fionbio" = "xyes"; then
443 tst_method="IoctlSocket FIONBIO"
444 elif test "x$ac_cv_func_setsockopt_so_nonblock" = "xyes"; then
445 tst_method="setsockopt SO_NONBLOCK"
447 AC_MSG_RESULT([$tst_method])
448 if test "$tst_method" = "unknown"; then
449 AC_MSG_WARN([cannot determine non-blocking socket method.])
454 dnl CURL_CONFIGURE_SYMBOL_HIDING
455 dnl -------------------------------------------------
456 dnl Depending on --enable-symbol-hiding or --disable-symbol-hiding
457 dnl configure option, and compiler capability to actually honor such
458 dnl option, this will modify compiler flags as appropriate and also
459 dnl provide needed definitions for configuration and Makefile.am files.
460 dnl This macro should not be used until all compilation tests have
461 dnl been done to prevent interferences on other tests.
463 AC_DEFUN([CURL_CONFIGURE_SYMBOL_HIDING], [
464 AC_MSG_CHECKING([whether hiding of library internal symbols will actually happen])
465 CFLAG_CURL_SYMBOL_HIDING=""
466 doing_symbol_hiding="no"
467 if test x"$ac_cv_native_windows" != "xyes" &&
468 test "$want_symbol_hiding" = "yes" &&
469 test "$supports_symbol_hiding" = "yes"; then
470 doing_symbol_hiding="yes"
471 CFLAG_CURL_SYMBOL_HIDING="$symbol_hiding_CFLAGS"
472 AC_DEFINE_UNQUOTED(CURL_EXTERN_SYMBOL, $symbol_hiding_EXTERN,
473 [Definition to make a library symbol externally visible.])
478 AM_CONDITIONAL(DOING_CURL_SYMBOL_HIDING, test x$doing_symbol_hiding = xyes)
479 AC_SUBST(CFLAG_CURL_SYMBOL_HIDING)
483 dnl CURL_CHECK_LIB_ARES
484 dnl -------------------------------------------------
485 dnl When c-ares library support has been requested,
486 dnl performs necessary checks and adjustsments needed
487 dnl to enable support of this library.
489 AC_DEFUN([CURL_CHECK_LIB_ARES], [
491 if test "$want_ares" = "yes"; then
492 dnl c-ares library support has been requested
493 clean_CPPFLAGS="$CPPFLAGS"
494 clean_LDFLAGS="$LDFLAGS"
496 embedded_ares="unknown"
497 configure_runpath=`pwd`
498 embedded_ares_builddir="$configure_runpath/ares"
499 if test -n "$want_ares_path"; then
500 dnl c-ares library path has been specified
501 ares_CPPFLAGS="-I$want_ares_path/include"
502 ares_LDFLAGS="-L$want_ares_path/lib"
505 dnl c-ares library path has not been given
506 if test -d "$srcdir/ares"; then
507 dnl c-ares sources embedded in curl tree
509 AC_CONFIG_SUBDIRS(ares)
510 dnl c-ares has installable configured header files, path
511 dnl inclusion fully done in makefiles for in-tree builds.
513 ares_LDFLAGS="-L$embedded_ares_builddir"
516 dnl c-ares path not specified, use defaults
523 CPPFLAGS="$ares_CPPFLAGS $clean_CPPFLAGS"
524 LDFLAGS="$ares_LDFLAGS $clean_LDFLAGS"
525 LIBS="$ares_LIBS $clean_LIBS"
527 if test "$embedded_ares" != "yes"; then
528 dnl check if c-ares new enough when not using an embedded
529 dnl source tree one which normally has not been built yet.
530 AC_MSG_CHECKING([that c-ares is good and recent enough])
534 /* set of dummy functions in case c-ares was built with debug */
535 void curl_dofree() { }
536 void curl_sclose() { }
537 void curl_domalloc() { }
538 void curl_docalloc() { }
539 void curl_socket() { }
541 ares_channel channel;
542 ares_cancel(channel); /* added in 1.2.0 */
543 ares_process_fd(channel, 0, 0); /* added in 1.4.0 */
544 ares_dup(&channel, channel); /* added in 1.6.0 */
550 AC_MSG_ERROR([c-ares library defective or too old])
551 dnl restore initial settings
552 CPPFLAGS="$clean_CPPFLAGS"
553 LDFLAGS="$clean_LDFLAGS"
559 if test "$want_ares" = "yes"; then
560 dnl finally c-ares will be used
561 AC_DEFINE(USE_ARES, 1, [Define to enable c-ares support])
562 AC_SUBST([USE_ARES], [1])
563 curl_res_msg="c-ares"
569 dnl CURL_CHECK_OPTION_NTLM_WB
570 dnl -------------------------------------------------
571 dnl Verify if configure has been invoked with option
572 dnl --enable-ntlm-wb or --disable-ntlm-wb, and set
573 dnl shell variable want_ntlm_wb and want_ntlm_wb_file
576 AC_DEFUN([CURL_CHECK_OPTION_NTLM_WB], [
577 AC_BEFORE([$0],[CURL_CHECK_NTLM_WB])dnl
578 OPT_NTLM_WB="default"
579 AC_ARG_ENABLE(ntlm-wb,
580 AC_HELP_STRING([--enable-ntlm-wb@<:@=FILE@:>@],[Enable NTLM delegation to winbind's ntlm_auth helper, where FILE is ntlm_auth's absolute filename (default: /usr/bin/ntlm_auth)])
581 AC_HELP_STRING([--disable-ntlm-wb],[Disable NTLM delegation to winbind's ntlm_auth helper]),
582 OPT_NTLM_WB=$enableval)
583 want_ntlm_wb_file="/usr/bin/ntlm_auth"
584 case "$OPT_NTLM_WB" in
586 dnl --disable-ntlm-wb option used
590 dnl configure option not specified
594 dnl --enable-ntlm-wb option used
596 if test -n "$enableval" && test "$enableval" != "yes"; then
597 want_ntlm_wb_file="$enableval"
604 dnl CURL_CHECK_NTLM_WB
605 dnl -------------------------------------------------
606 dnl Check if support for NTLM delegation to winbind's
607 dnl ntlm_auth helper will finally be enabled depending
608 dnl on given configure options and target platform.
610 AC_DEFUN([CURL_CHECK_NTLM_WB], [
611 AC_REQUIRE([CURL_CHECK_OPTION_NTLM_WB])dnl
612 AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
613 AC_MSG_CHECKING([whether to enable NTLM delegation to winbind's helper])
614 if test "$ac_cv_native_windows" = "yes" ||
615 test "x$SSL_ENABLED" = "x"; then
619 AC_MSG_RESULT([$want_ntlm_wb])
620 if test "$want_ntlm_wb" = "yes"; then
621 AC_DEFINE(NTLM_WB_ENABLED, 1,
622 [Define to enable NTLM delegation to winbind's ntlm_auth helper.])
623 AC_DEFINE_UNQUOTED(NTLM_WB_FILE, "$want_ntlm_wb_file",
624 [Define absolute filename for winbind's ntlm_auth helper.])