1 #***************************************************************************
3 # Copyright (C) 2009-2013 by Daniel Stenberg et al
5 # Permission to use, copy, modify, and distribute this software and its
6 # documentation for any purpose and without fee is hereby granted, provided
7 # that the above copyright notice appear in all copies and that both that
8 # copyright notice and this permission notice appear in supporting
9 # documentation, and that the name of M.I.T. not be used in advertising or
10 # publicity pertaining to distribution of the software without specific,
11 # written prior permission. M.I.T. makes no representations about the
12 # suitability of this software for any purpose. It is provided "as is"
13 # without express or implied warranty.
15 #***************************************************************************
17 # File version for 'aclocal' use. Keep it a single number.
21 dnl CARES_CHECK_COMPILER
22 dnl -------------------------------------------------
23 dnl Verify if the C compiler being used is known.
25 AC_DEFUN([CARES_CHECK_COMPILER], [
30 flags_dbg_all="unknown"
31 flags_dbg_yes="unknown"
32 flags_dbg_off="unknown"
33 flags_opt_all="unknown"
34 flags_opt_yes="unknown"
35 flags_opt_off="unknown"
37 flags_prefer_cppflags="no"
39 CARES_CHECK_COMPILER_DEC_C
40 CARES_CHECK_COMPILER_HPUX_C
41 CARES_CHECK_COMPILER_IBM_C
42 CARES_CHECK_COMPILER_INTEL_C
43 CARES_CHECK_COMPILER_CLANG
44 CARES_CHECK_COMPILER_GNU_C
45 CARES_CHECK_COMPILER_LCC
46 CARES_CHECK_COMPILER_SGI_MIPSPRO_C
47 CARES_CHECK_COMPILER_SGI_MIPS_C
48 CARES_CHECK_COMPILER_SUNPRO_C
49 CARES_CHECK_COMPILER_TINY_C
50 CARES_CHECK_COMPILER_WATCOM_C
52 if test "$compiler_id" = "unknown"; then
55 *** Warning: This configure script does not have information about the
56 *** compiler you are using, relative to the flags required to enable or
57 *** disable generation of debug info, optimization options or warnings.
59 *** Whatever settings are present in CFLAGS will be used for this run.
61 *** If you wish to help the c-ares project to better support your compiler
62 *** you can report this and the required info on the c-ares development
63 *** mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/
70 dnl CARES_CHECK_COMPILER_CLANG
71 dnl -------------------------------------------------
72 dnl Verify if compiler being used is clang.
74 AC_DEFUN([CARES_CHECK_COMPILER_CLANG], [
75 AC_BEFORE([$0],[CARES_CHECK_COMPILER_GNU_C])dnl
76 AC_MSG_CHECKING([if compiler is clang])
77 CURL_CHECK_DEF([__clang__], [], [silent])
78 if test "$curl_cv_have_def___clang__" = "yes"; then
81 clangver=`$CC -dumpversion`
82 clangvhi=`echo $clangver | cut -d . -f1`
83 clangvlo=`echo $clangver | cut -d . -f2`
84 compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
85 flags_dbg_all="-g -g0 -g1 -g2 -g3"
86 flags_dbg_all="$flags_dbg_all -ggdb"
87 flags_dbg_all="$flags_dbg_all -gstabs"
88 flags_dbg_all="$flags_dbg_all -gstabs+"
89 flags_dbg_all="$flags_dbg_all -gcoff"
90 flags_dbg_all="$flags_dbg_all -gxcoff"
91 flags_dbg_all="$flags_dbg_all -gdwarf-2"
92 flags_dbg_all="$flags_dbg_all -gvms"
95 flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4"
104 dnl CARES_CHECK_COMPILER_DEC_C
105 dnl -------------------------------------------------
106 dnl Verify if compiler being used is DEC C.
108 AC_DEFUN([CARES_CHECK_COMPILER_DEC_C], [
109 AC_MSG_CHECKING([if compiler is DEC/Compaq/HP C])
110 CURL_CHECK_DEF([__DECC], [], [silent])
111 CURL_CHECK_DEF([__DECC_VER], [], [silent])
112 if test "$curl_cv_have_def___DECC" = "yes" &&
113 test "$curl_cv_have_def___DECC_VER" = "yes"; then
116 flags_dbg_all="-g -g0 -g1 -g2 -g3"
119 flags_opt_all="-O -O0 -O1 -O2 -O3 -O4"
128 dnl CARES_CHECK_COMPILER_GNU_C
129 dnl -------------------------------------------------
130 dnl Verify if compiler being used is GNU C.
132 AC_DEFUN([CARES_CHECK_COMPILER_GNU_C], [
133 AC_REQUIRE([CARES_CHECK_COMPILER_INTEL_C])dnl
134 AC_REQUIRE([CARES_CHECK_COMPILER_CLANG])dnl
135 AC_MSG_CHECKING([if compiler is GNU C])
136 CURL_CHECK_DEF([__GNUC__], [], [silent])
137 if test "$curl_cv_have_def___GNUC__" = "yes" &&
138 test "$compiler_id" = "unknown"; then
141 gccver=`$CC -dumpversion`
142 gccvhi=`echo $gccver | cut -d . -f1`
143 gccvlo=`echo $gccver | cut -d . -f2`
144 compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
145 flags_dbg_all="-g -g0 -g1 -g2 -g3"
146 flags_dbg_all="$flags_dbg_all -ggdb"
147 flags_dbg_all="$flags_dbg_all -gstabs"
148 flags_dbg_all="$flags_dbg_all -gstabs+"
149 flags_dbg_all="$flags_dbg_all -gcoff"
150 flags_dbg_all="$flags_dbg_all -gxcoff"
151 flags_dbg_all="$flags_dbg_all -gdwarf-2"
152 flags_dbg_all="$flags_dbg_all -gvms"
155 flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
158 CURL_CHECK_DEF([_WIN32], [], [silent])
165 dnl CARES_CHECK_COMPILER_HPUX_C
166 dnl -------------------------------------------------
167 dnl Verify if compiler being used is HP-UX C.
169 AC_DEFUN([CARES_CHECK_COMPILER_HPUX_C], [
170 AC_MSG_CHECKING([if compiler is HP-UX C])
171 CURL_CHECK_DEF([__HP_cc], [], [silent])
172 if test "$curl_cv_have_def___HP_cc" = "yes"; then
174 compiler_id="HP_UX_C"
175 flags_dbg_all="-g -s"
178 flags_opt_all="-O +O0 +O1 +O2 +O3 +O4"
187 dnl CARES_CHECK_COMPILER_IBM_C
188 dnl -------------------------------------------------
189 dnl Verify if compiler being used is IBM C.
191 AC_DEFUN([CARES_CHECK_COMPILER_IBM_C], [
192 AC_MSG_CHECKING([if compiler is IBM C])
193 CURL_CHECK_DEF([__IBMC__], [], [silent])
194 if test "$curl_cv_have_def___IBMC__" = "yes"; then
197 flags_dbg_all="-g -g0 -g1 -g2 -g3"
200 flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5"
201 flags_opt_all="$flags_opt_all -qnooptimize"
202 flags_opt_all="$flags_opt_all -qoptimize=0"
203 flags_opt_all="$flags_opt_all -qoptimize=1"
204 flags_opt_all="$flags_opt_all -qoptimize=2"
205 flags_opt_all="$flags_opt_all -qoptimize=3"
206 flags_opt_all="$flags_opt_all -qoptimize=4"
207 flags_opt_all="$flags_opt_all -qoptimize=5"
209 flags_opt_off="-qnooptimize"
210 flags_prefer_cppflags="yes"
217 dnl CARES_CHECK_COMPILER_INTEL_C
218 dnl -------------------------------------------------
219 dnl Verify if compiler being used is Intel C.
221 AC_DEFUN([CARES_CHECK_COMPILER_INTEL_C], [
222 AC_BEFORE([$0],[CARES_CHECK_COMPILER_GNU_C])dnl
223 AC_MSG_CHECKING([if compiler is Intel C])
224 CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent])
225 if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then
227 compiler_num="$curl_cv_def___INTEL_COMPILER"
228 CURL_CHECK_DEF([__unix__], [], [silent])
229 if test "$curl_cv_have_def___unix__" = "yes"; then
230 compiler_id="INTEL_UNIX_C"
231 flags_dbg_all="-g -g0"
234 flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
238 compiler_id="INTEL_WINDOWS_C"
239 flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-"
240 flags_dbg_all="$flags_dbg_all /debug"
241 flags_dbg_all="$flags_dbg_all /debug:none"
242 flags_dbg_all="$flags_dbg_all /debug:minimal"
243 flags_dbg_all="$flags_dbg_all /debug:partial"
244 flags_dbg_all="$flags_dbg_all /debug:full"
245 flags_dbg_all="$flags_dbg_all /debug:semantic_stepping"
246 flags_dbg_all="$flags_dbg_all /debug:extended"
247 flags_dbg_yes="/Zi /Oy-"
248 flags_dbg_off="/debug:none /Oy-"
249 flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-"
259 dnl CARES_CHECK_COMPILER_LCC
260 dnl -------------------------------------------------
261 dnl Verify if compiler being used is LCC.
263 AC_DEFUN([CARES_CHECK_COMPILER_LCC], [
264 AC_MSG_CHECKING([if compiler is LCC])
265 CURL_CHECK_DEF([__LCC__], [], [silent])
266 if test "$curl_cv_have_def___LCC__" = "yes"; then
281 dnl CARES_CHECK_COMPILER_SGI_MIPS_C
282 dnl -------------------------------------------------
283 dnl Verify if compiler being used is SGI MIPS C.
285 AC_DEFUN([CARES_CHECK_COMPILER_SGI_MIPS_C], [
286 AC_REQUIRE([CARES_CHECK_COMPILER_SGI_MIPSPRO_C])dnl
287 AC_MSG_CHECKING([if compiler is SGI MIPS C])
288 CURL_CHECK_DEF([__GNUC__], [], [silent])
289 CURL_CHECK_DEF([__sgi], [], [silent])
290 if test "$curl_cv_have_def___GNUC__" = "no" &&
291 test "$curl_cv_have_def___sgi" = "yes" &&
292 test "$compiler_id" = "unknown"; then
294 compiler_id="SGI_MIPS_C"
295 flags_dbg_all="-g -g0 -g1 -g2 -g3"
298 flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
307 dnl CARES_CHECK_COMPILER_SGI_MIPSPRO_C
308 dnl -------------------------------------------------
309 dnl Verify if compiler being used is SGI MIPSpro C.
311 AC_DEFUN([CARES_CHECK_COMPILER_SGI_MIPSPRO_C], [
312 AC_BEFORE([$0],[CARES_CHECK_COMPILER_SGI_MIPS_C])dnl
313 AC_MSG_CHECKING([if compiler is SGI MIPSpro C])
314 CURL_CHECK_DEF([__GNUC__], [], [silent])
315 CURL_CHECK_DEF([_COMPILER_VERSION], [], [silent])
316 CURL_CHECK_DEF([_SGI_COMPILER_VERSION], [], [silent])
317 if test "$curl_cv_have_def___GNUC__" = "no" &&
318 (test "$curl_cv_have_def__SGI_COMPILER_VERSION" = "yes" ||
319 test "$curl_cv_have_def__COMPILER_VERSION" = "yes"); then
321 compiler_id="SGI_MIPSPRO_C"
322 flags_dbg_all="-g -g0 -g1 -g2 -g3"
325 flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
334 dnl CARES_CHECK_COMPILER_SUNPRO_C
335 dnl -------------------------------------------------
336 dnl Verify if compiler being used is SunPro C.
338 AC_DEFUN([CARES_CHECK_COMPILER_SUNPRO_C], [
339 AC_MSG_CHECKING([if compiler is SunPro C])
340 CURL_CHECK_DEF([__SUNPRO_C], [], [silent])
341 if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then
343 compiler_id="SUNPRO_C"
344 flags_dbg_all="-g -s"
347 flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5"
356 dnl CARES_CHECK_COMPILER_TINY_C
357 dnl -------------------------------------------------
358 dnl Verify if compiler being used is Tiny C.
360 AC_DEFUN([CARES_CHECK_COMPILER_TINY_C], [
361 AC_MSG_CHECKING([if compiler is Tiny C])
362 CURL_CHECK_DEF([__TINYC__], [], [silent])
363 if test "$curl_cv_have_def___TINYC__" = "yes"; then
366 flags_dbg_all="-g -b"
378 dnl CARES_CHECK_COMPILER_WATCOM_C
379 dnl -------------------------------------------------
380 dnl Verify if compiler being used is Watcom C.
382 AC_DEFUN([CARES_CHECK_COMPILER_WATCOM_C], [
383 AC_MSG_CHECKING([if compiler is Watcom C])
384 CURL_CHECK_DEF([__WATCOMC__], [], [silent])
385 if test "$curl_cv_have_def___WATCOMC__" = "yes"; then
387 CURL_CHECK_DEF([__UNIX__], [], [silent])
388 if test "$curl_cv_have_def___UNIX__" = "yes"; then
389 compiler_id="WATCOM_UNIX_C"
390 flags_dbg_all="-g1 -g1+ -g2 -g3"
393 flags_opt_all="-O0 -O1 -O2 -O3"
397 compiler_id="WATCOM_WINDOWS_C"
411 dnl CARES_CONVERT_INCLUDE_TO_ISYSTEM
412 dnl -------------------------------------------------
413 dnl Changes standard include paths present in CFLAGS
414 dnl and CPPFLAGS into isystem include paths. This is
415 dnl done to prevent GNUC from generating warnings on
416 dnl headers from these locations, although on ancient
417 dnl GNUC versions these warnings are not silenced.
419 AC_DEFUN([CARES_CONVERT_INCLUDE_TO_ISYSTEM], [
420 AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
421 AC_REQUIRE([CARES_CHECK_COMPILER])dnl
422 if test "$compiler_id" = "GNU_C" ||
423 test "$compiler_id" = "CLANG"; then
425 tmp_chg_FLAGS="$CFLAGS"
426 for word1 in $tmp_chg_FLAGS; do
429 tmp_has_include="yes"
433 if test "$tmp_has_include" = "yes"; then
434 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
435 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
436 CFLAGS="$tmp_chg_FLAGS"
440 tmp_chg_FLAGS="$CPPFLAGS"
441 for word1 in $tmp_chg_FLAGS; do
444 tmp_has_include="yes"
448 if test "$tmp_has_include" = "yes"; then
449 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
450 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
451 CPPFLAGS="$tmp_chg_FLAGS"
458 dnl CARES_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS])
459 dnl -------------------------------------------------
460 dnl Verify if the C compiler seems to work with the
461 dnl settings that are 'active' at the time the test
464 AC_DEFUN([CARES_COMPILER_WORKS_IFELSE], [
465 dnl compilation capability verification
466 tmp_compiler_works="unknown"
474 tmp_compiler_works="yes"
476 tmp_compiler_works="no"
478 sed 's/^/cc-fail: /' conftest.err >&6
481 dnl linking capability verification
482 if test "$tmp_compiler_works" = "yes"; then
490 tmp_compiler_works="yes"
492 tmp_compiler_works="no"
494 sed 's/^/link-fail: /' conftest.err >&6
498 dnl only do runtime verification when not cross-compiling
499 if test "x$cross_compiling" != "xyes" &&
500 test "$tmp_compiler_works" = "yes"; then
511 tmp_compiler_works="yes"
513 tmp_compiler_works="no"
515 echo "run-fail: test program exited with status $ac_status" >&6
519 dnl branch upon test result
520 if test "$tmp_compiler_works" = "yes"; then
528 dnl CARES_SET_COMPILER_BASIC_OPTS
529 dnl -------------------------------------------------
530 dnl Sets compiler specific options/flags which do not
531 dnl depend on configure's debug, optimize or warnings
534 AC_DEFUN([CARES_SET_COMPILER_BASIC_OPTS], [
535 AC_REQUIRE([CARES_CHECK_COMPILER])dnl
536 AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
538 if test "$compiler_id" != "unknown"; then
540 if test "$compiler_id" = "GNU_C" ||
541 test "$compiler_id" = "CLANG"; then
542 CARES_CONVERT_INCLUDE_TO_ISYSTEM
545 tmp_save_CPPFLAGS="$CPPFLAGS"
546 tmp_save_CFLAGS="$CFLAGS"
550 case "$compiler_id" in
554 dnl Disable warnings for unused arguments, otherwise clang will
555 dnl warn about compile-time arguments used during link-time, like
556 dnl -O and -g and -pedantic.
557 tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments"
562 dnl Select strict ANSI C compiler mode
563 tmp_CFLAGS="$tmp_CFLAGS -std1"
564 dnl Turn off optimizer ANSI C aliasing rules
565 tmp_CFLAGS="$tmp_CFLAGS -noansi_alias"
566 dnl Generate warnings for missing function prototypes
567 tmp_CFLAGS="$tmp_CFLAGS -warnprotos"
568 dnl Change some warnings into fatal errors
569 tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs"
575 tmp_CFLAGS="$tmp_CFLAGS"
580 dnl Disallow run-time dereferencing of null pointers
581 tmp_CFLAGS="$tmp_CFLAGS -z"
582 dnl Disable some remarks
583 dnl #4227: padding struct with n bytes to align member
584 dnl #4255: padding size of struct with n bytes to alignment boundary
585 tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255"
590 dnl Ensure that compiler optimizations are always thread-safe.
591 tmp_CPPFLAGS="$tmp_CPPFLAGS -qthreaded"
592 dnl Disable type based strict aliasing optimizations, using worst
593 dnl case aliasing assumptions when compiling. Type based aliasing
594 dnl would restrict the lvalues that could be safely used to access
596 tmp_CPPFLAGS="$tmp_CPPFLAGS -qnoansialias"
597 dnl Force compiler to stop after the compilation phase, without
598 dnl generating an object code file when compilation has errors.
599 tmp_CPPFLAGS="$tmp_CPPFLAGS -qhalt=e"
604 dnl On unix this compiler uses gcc's header files, so
605 dnl we select ANSI C89 dialect plus GNU extensions.
606 tmp_CFLAGS="$tmp_CFLAGS -std=gnu89"
607 dnl Change some warnings into errors
608 dnl #140: too many arguments in function call
609 dnl #147: declaration is incompatible with 'previous one'
610 dnl #165: too few arguments in function call
611 dnl #266: function declared implicitly
612 tmp_CPPFLAGS="$tmp_CPPFLAGS -we 140,147,165,266"
613 dnl Disable some remarks
614 dnl #279: controlling expression is constant
615 dnl #981: operands are evaluated in unspecified order
616 dnl #1469: "cc" clobber ignored
617 tmp_CPPFLAGS="$tmp_CPPFLAGS -wd 279,981,1469"
623 tmp_CFLAGS="$tmp_CFLAGS"
628 dnl Disallow run-time dereferencing of null pointers
629 tmp_CFLAGS="$tmp_CFLAGS -n"
635 tmp_CFLAGS="$tmp_CFLAGS"
641 tmp_CFLAGS="$tmp_CFLAGS"
647 tmp_CFLAGS="$tmp_CFLAGS"
653 tmp_CFLAGS="$tmp_CFLAGS"
659 tmp_CFLAGS="$tmp_CFLAGS"
665 tmp_CFLAGS="$tmp_CFLAGS"
673 if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
674 AC_MSG_CHECKING([if compiler accepts some basic options])
675 CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
676 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
679 CARES_COMPILER_WORKS_IFELSE([
681 AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
684 AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
685 dnl restore initial settings
686 CPPFLAGS="$tmp_save_CPPFLAGS"
687 CFLAGS="$tmp_save_CFLAGS"
695 dnl CARES_SET_COMPILER_DEBUG_OPTS
696 dnl -------------------------------------------------
697 dnl Sets compiler specific options/flags which depend
698 dnl on configure's debug option.
700 AC_DEFUN([CARES_SET_COMPILER_DEBUG_OPTS], [
701 AC_REQUIRE([CARES_CHECK_OPTION_DEBUG])dnl
702 AC_REQUIRE([CARES_CHECK_COMPILER])dnl
703 AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
705 if test "$compiler_id" != "unknown"; then
707 tmp_save_CFLAGS="$CFLAGS"
708 tmp_save_CPPFLAGS="$CPPFLAGS"
712 tmp_CPPFLAGS="$CPPFLAGS"
713 CARES_VAR_STRIP([tmp_CFLAGS],[$flags_dbg_all])
714 CARES_VAR_STRIP([tmp_CPPFLAGS],[$flags_dbg_all])
716 if test "$want_debug" = "yes"; then
717 AC_MSG_CHECKING([if compiler accepts debug enabling options])
718 tmp_options="$flags_dbg_yes"
720 if test "$want_debug" = "no"; then
721 AC_MSG_CHECKING([if compiler accepts debug disabling options])
722 tmp_options="$flags_dbg_off"
725 if test "$flags_prefer_cppflags" = "yes"; then
726 CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
729 CPPFLAGS="$tmp_CPPFLAGS"
730 CFLAGS="$tmp_CFLAGS $tmp_options"
734 CARES_COMPILER_WORKS_IFELSE([
736 AC_MSG_NOTICE([compiler options added: $tmp_options])
739 AC_MSG_WARN([compiler options rejected: $tmp_options])
740 dnl restore initial settings
741 CPPFLAGS="$tmp_save_CPPFLAGS"
742 CFLAGS="$tmp_save_CFLAGS"
749 dnl CARES_SET_COMPILER_OPTIMIZE_OPTS
750 dnl -------------------------------------------------
751 dnl Sets compiler specific options/flags which depend
752 dnl on configure's optimize option.
754 AC_DEFUN([CARES_SET_COMPILER_OPTIMIZE_OPTS], [
755 AC_REQUIRE([CARES_CHECK_OPTION_OPTIMIZE])dnl
756 AC_REQUIRE([CARES_CHECK_COMPILER])dnl
757 AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
759 if test "$compiler_id" != "unknown"; then
761 tmp_save_CFLAGS="$CFLAGS"
762 tmp_save_CPPFLAGS="$CPPFLAGS"
766 tmp_CPPFLAGS="$CPPFLAGS"
767 honor_optimize_option="yes"
769 dnl If optimization request setting has not been explicitly specified,
770 dnl it has been derived from the debug setting and initially assumed.
771 dnl This initially assumed optimizer setting will finally be ignored
772 dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies
773 dnl that an initially assumed optimizer setting might not be honored.
775 if test "$want_optimize" = "assume_no" ||
776 test "$want_optimize" = "assume_yes"; then
777 AC_MSG_CHECKING([if compiler optimizer assumed setting might be used])
778 CARES_VAR_MATCH_IFELSE([tmp_CFLAGS],[$flags_opt_all],[
779 honor_optimize_option="no"
781 CARES_VAR_MATCH_IFELSE([tmp_CPPFLAGS],[$flags_opt_all],[
782 honor_optimize_option="no"
784 AC_MSG_RESULT([$honor_optimize_option])
785 if test "$honor_optimize_option" = "yes"; then
786 if test "$want_optimize" = "assume_yes"; then
789 if test "$want_optimize" = "assume_no"; then
795 if test "$honor_optimize_option" = "yes"; then
796 CARES_VAR_STRIP([tmp_CFLAGS],[$flags_opt_all])
797 CARES_VAR_STRIP([tmp_CPPFLAGS],[$flags_opt_all])
798 if test "$want_optimize" = "yes"; then
799 AC_MSG_CHECKING([if compiler accepts optimizer enabling options])
800 tmp_options="$flags_opt_yes"
802 if test "$want_optimize" = "no"; then
803 AC_MSG_CHECKING([if compiler accepts optimizer disabling options])
804 tmp_options="$flags_opt_off"
806 if test "$flags_prefer_cppflags" = "yes"; then
807 CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
810 CPPFLAGS="$tmp_CPPFLAGS"
811 CFLAGS="$tmp_CFLAGS $tmp_options"
815 CARES_COMPILER_WORKS_IFELSE([
817 AC_MSG_NOTICE([compiler options added: $tmp_options])
820 AC_MSG_WARN([compiler options rejected: $tmp_options])
821 dnl restore initial settings
822 CPPFLAGS="$tmp_save_CPPFLAGS"
823 CFLAGS="$tmp_save_CFLAGS"
831 dnl CARES_SET_COMPILER_WARNING_OPTS
832 dnl -------------------------------------------------
833 dnl Sets compiler options/flags which depend on
834 dnl configure's warnings given option.
836 AC_DEFUN([CARES_SET_COMPILER_WARNING_OPTS], [
837 AC_REQUIRE([CARES_CHECK_OPTION_WARNINGS])dnl
838 AC_REQUIRE([CARES_CHECK_COMPILER])dnl
839 AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
841 if test "$compiler_id" != "unknown"; then
843 tmp_save_CPPFLAGS="$CPPFLAGS"
844 tmp_save_CFLAGS="$CFLAGS"
848 case "$compiler_id" in
852 if test "$want_warnings" = "yes"; then
853 tmp_CFLAGS="$tmp_CFLAGS -pedantic"
854 tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra"
855 tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings"
856 tmp_CFLAGS="$tmp_CFLAGS -Wshadow"
857 tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs"
858 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
859 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes"
860 tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
861 tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
862 tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare"
863 tmp_CFLAGS="$tmp_CFLAGS -Wundef"
864 tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
865 tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
866 tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
867 tmp_CFLAGS="$tmp_CFLAGS -Wcast-align"
868 tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers"
869 tmp_CFLAGS="$tmp_CFLAGS -Wshorten-64-to-32"
871 dnl Only clang 1.1 or later
872 if test "$compiler_num" -ge "101"; then
873 tmp_CFLAGS="$tmp_CFLAGS -Wunused"
880 if test "$want_warnings" = "yes"; then
881 dnl Select a higher warning level than default level2
882 tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3"
888 if test "$want_warnings" = "yes"; then
890 dnl Do not enable -pedantic when cross-compiling with a gcc older
891 dnl than 3.0, to avoid warnings from third party system headers.
892 if test "x$cross_compiling" != "xyes" ||
893 test "$compiler_num" -ge "300"; then
894 tmp_CFLAGS="$tmp_CFLAGS -pedantic"
897 dnl Set of options we believe *ALL* gcc versions support:
898 tmp_CFLAGS="$tmp_CFLAGS -Wall -W"
900 dnl Only gcc 1.4 or later
901 if test "$compiler_num" -ge "104"; then
902 tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings"
903 dnl If not cross-compiling with a gcc older than 3.0
904 if test "x$cross_compiling" != "xyes" ||
905 test "$compiler_num" -ge "300"; then
906 tmp_CFLAGS="$tmp_CFLAGS -Wunused -Wshadow"
910 dnl Only gcc 2.7 or later
911 if test "$compiler_num" -ge "207"; then
912 tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs"
913 dnl If not cross-compiling with a gcc older than 3.0
914 if test "x$cross_compiling" != "xyes" ||
915 test "$compiler_num" -ge "300"; then
916 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
917 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes"
921 dnl Only gcc 2.95 or later
922 if test "$compiler_num" -ge "295"; then
923 tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
926 dnl Only gcc 2.96 or later
927 if test "$compiler_num" -ge "296"; then
928 tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
929 tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare"
930 dnl -Wundef used only if gcc is 2.96 or later since we get
931 dnl lots of "`_POSIX_C_SOURCE' is not defined" in system
932 dnl headers with gcc 2.95.4 on FreeBSD 4.9
933 tmp_CFLAGS="$tmp_CFLAGS -Wundef"
936 dnl Only gcc 2.97 or later
937 if test "$compiler_num" -ge "297"; then
938 tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
941 dnl Only gcc 3.0 or later
942 if test "$compiler_num" -ge "300"; then
943 dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
944 dnl on i686-Linux as it gives us heaps with false positives.
945 dnl Also, on gcc 4.0.X it is totally unbearable and complains all
946 dnl over making it unusable for generic purposes. Let's not use it.
947 tmp_CFLAGS="$tmp_CFLAGS"
950 dnl Only gcc 3.3 or later
951 if test "$compiler_num" -ge "303"; then
952 tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
955 dnl Only gcc 3.4 or later
956 if test "$compiler_num" -ge "304"; then
957 tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
960 dnl Only gcc 4.0 or later
961 if test "$compiler_num" -ge "400"; then
962 tmp_CFLAGS="$tmp_CFLAGS -Wstrict-aliasing=3"
965 dnl Only gcc 4.2 or later
966 if test "$compiler_num" -ge "402"; then
967 tmp_CFLAGS="$tmp_CFLAGS -Wcast-align"
970 dnl Only gcc 4.3 or later
971 if test "$compiler_num" -ge "403"; then
972 tmp_CFLAGS="$tmp_CFLAGS -Wtype-limits -Wold-style-declaration"
973 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-parameter-type -Wempty-body"
974 tmp_CFLAGS="$tmp_CFLAGS -Wclobbered -Wignored-qualifiers"
975 tmp_CFLAGS="$tmp_CFLAGS -Wconversion -Wno-sign-conversion -Wvla"
978 dnl Only gcc 4.5 or later
979 if test "$compiler_num" -ge "405"; then
980 dnl Only windows targets
981 if test "$curl_cv_have_def__WIN32" = "yes"; then
982 tmp_CFLAGS="$tmp_CFLAGS -Wno-pedantic-ms-format"
988 dnl Do not issue warnings for code in system include paths.
989 if test "$compiler_num" -ge "300"; then
990 tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers"
992 dnl When cross-compiling with a gcc older than 3.0, disable
993 dnl some warnings triggered on third party system headers.
994 if test "x$cross_compiling" = "xyes"; then
995 if test "$compiler_num" -ge "104"; then
997 tmp_CFLAGS="$tmp_CFLAGS -Wno-unused -Wno-shadow"
999 if test "$compiler_num" -ge "207"; then
1000 dnl gcc 2.7 or later
1001 tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-declarations"
1002 tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-prototypes"
1010 if test "$want_warnings" = "yes"; then
1011 dnl Issue all warnings
1012 tmp_CFLAGS="$tmp_CFLAGS +w1"
1019 tmp_CFLAGS="$tmp_CFLAGS"
1024 if test "$want_warnings" = "yes"; then
1025 if test "$compiler_num" -gt "600"; then
1026 dnl Show errors, warnings, and remarks
1027 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall -w2"
1028 dnl Perform extra compile-time code checking
1029 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck"
1030 dnl Warn on nested comments
1031 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcomment"
1032 dnl Show warnings relative to deprecated features
1033 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wdeprecated"
1034 dnl Enable warnings for missing prototypes
1035 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wmissing-prototypes"
1036 dnl Enable warnings for 64-bit portability issues
1037 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wp64"
1038 dnl Enable warnings for questionable pointer arithmetic
1039 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wpointer-arith"
1040 dnl Check for function return typw issues
1041 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wreturn-type"
1042 dnl Warn on variable declarations hiding a previous one
1043 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wshadow"
1044 dnl Warn when a variable is used before initialized
1045 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wuninitialized"
1046 dnl Warn if a declared function is not used
1047 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wunused-function"
1050 dnl Disable using EBP register in optimizations
1051 tmp_CFLAGS="$tmp_CFLAGS -fno-omit-frame-pointer"
1052 dnl Disable use of ANSI C aliasing rules in optimizations
1053 tmp_CFLAGS="$tmp_CFLAGS -fno-strict-aliasing"
1054 dnl Value-safe optimizations on floating-point data
1055 tmp_CFLAGS="$tmp_CFLAGS -fp-model precise"
1056 dnl Only icc 10.0 or later
1057 if test "$compiler_num" -ge "1000"; then
1058 dnl Disable vectorizer diagnostic information
1059 tmp_CFLAGS="$tmp_CFLAGS -vec-report0"
1066 tmp_CFLAGS="$tmp_CFLAGS"
1071 if test "$want_warnings" = "yes"; then
1072 dnl Highest warning level is double -A, next is single -A.
1073 dnl Due to the big number of warnings these trigger on third
1074 dnl party header files it is impractical for us to use any of
1075 dnl them here. If you want them simply define it in CPPFLAGS.
1076 tmp_CFLAGS="$tmp_CFLAGS"
1082 if test "$want_warnings" = "yes"; then
1083 dnl Perform stricter semantic and lint-like checks
1084 tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
1090 if test "$want_warnings" = "yes"; then
1091 dnl Perform stricter semantic and lint-like checks
1092 tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
1093 dnl Disable some remarks
1094 dnl #1209: controlling expression is constant
1095 tmp_CFLAGS="$tmp_CFLAGS -woff 1209"
1101 if test "$want_warnings" = "yes"; then
1102 dnl Perform stricter semantic and lint-like checks
1103 tmp_CFLAGS="$tmp_CFLAGS -v"
1109 if test "$want_warnings" = "yes"; then
1110 dnl Activate all warnings
1111 tmp_CFLAGS="$tmp_CFLAGS -Wall"
1112 dnl Make string constants be of type const char *
1113 tmp_CFLAGS="$tmp_CFLAGS -Wwrite-strings"
1114 dnl Warn use of unsupported GCC features ignored by TCC
1115 tmp_CFLAGS="$tmp_CFLAGS -Wunsupported"
1121 if test "$want_warnings" = "yes"; then
1122 dnl Issue all warnings
1123 tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra"
1130 tmp_CFLAGS="$tmp_CFLAGS"
1135 squeeze tmp_CPPFLAGS
1138 if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
1139 AC_MSG_CHECKING([if compiler accepts strict warning options])
1140 CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
1141 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
1144 CARES_COMPILER_WORKS_IFELSE([
1145 AC_MSG_RESULT([yes])
1146 AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
1149 AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
1150 dnl restore initial settings
1151 CPPFLAGS="$tmp_save_CPPFLAGS"
1152 CFLAGS="$tmp_save_CFLAGS"
1160 dnl CARES_SHFUNC_SQUEEZE
1161 dnl -------------------------------------------------
1162 dnl Declares a shell function squeeze() which removes
1163 dnl redundant whitespace out of a shell variable.
1165 AC_DEFUN([CARES_SHFUNC_SQUEEZE], [
1168 eval _sqz_input=\[$][$]1
1169 for _sqz_token in $_sqz_input; do
1170 if test -z "$_sqz_result"; then
1171 _sqz_result="$_sqz_token"
1173 _sqz_result="$_sqz_result $_sqz_token"
1176 eval [$]1=\$_sqz_result
1182 dnl CARES_CHECK_CURLDEBUG
1183 dnl -------------------------------------------------
1184 dnl Settings which depend on configure's curldebug given
1185 dnl option, and other additional configure pre-requisites.
1186 dnl Using the curl debug memory tracking feature in c-ares
1187 dnl is a hack that actually can only be used/enabled when
1188 dnl c-ares is built directly in curl's CVS tree, as a static
1189 dnl library or as a shared one on those systems on which
1190 dnl shared libraries support undefined symbols, along with
1191 dnl an equally configured libcurl.
1193 AC_DEFUN([CARES_CHECK_CURLDEBUG], [
1194 AC_REQUIRE([XC_LIBTOOL])dnl
1195 AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
1196 cares_builddir=`pwd`
1197 supports_curldebug="unknown"
1198 if test "$want_curldebug" = "yes"; then
1199 if test "x$enable_shared" != "xno" &&
1200 test "x$enable_shared" != "xyes"; then
1201 AC_MSG_WARN([unknown enable_shared setting.])
1202 supports_curldebug="no"
1204 if test "x$enable_static" != "xno" &&
1205 test "x$enable_static" != "xyes"; then
1206 AC_MSG_WARN([unknown enable_static setting.])
1207 supports_curldebug="no"
1209 if test "$supports_curldebug" != "no"; then
1210 if test "$enable_shared" = "yes" &&
1211 test "x$xc_lt_shlib_use_no_undefined" = 'xyes'; then
1212 supports_curldebug="no"
1213 AC_MSG_WARN([shared library does not support undefined symbols.])
1215 if test ! -f "$srcdir/../include/curl/curlbuild.h.dist"; then
1216 AC_MSG_WARN([c-ares source not embedded in curl's CVS tree.])
1217 supports_curldebug="no"
1218 elif test ! -f "$srcdir/../include/curl/Makefile.in"; then
1219 AC_MSG_WARN([curl's buildconf has not been run.])
1220 supports_curldebug="no"
1221 elif test ! -f "$cares_builddir/../libcurl.pc" ||
1222 test ! -f "$cares_builddir/../include/curl/curlbuild.h"; then
1223 AC_MSG_WARN([curl's configure has not been run.])
1224 supports_curldebug="no"
1225 elif test ! -f "$cares_builddir/../lib/curl_config.h"; then
1226 AC_MSG_WARN([libcurl's curl_config.h is missing.])
1227 supports_curldebug="no"
1228 elif test ! -f "$cares_builddir/../config.status"; then
1229 AC_MSG_WARN([curl's config.status is missing.])
1230 supports_curldebug="no"
1232 if test "$supports_curldebug" != "no"; then
1233 grep '^#define USE_ARES' "$cares_builddir/../lib/curl_config.h" >/dev/null
1234 if test "$?" -ne "0"; then
1235 AC_MSG_WARN([libcurl configured without c-ares support.])
1236 supports_curldebug="no"
1239 if test "$supports_curldebug" != "no"; then
1240 grep 'CPPFLAGS.*CURLDEBUG' "$cares_builddir/../config.status" >/dev/null
1241 if test "$?" -ne "0"; then
1242 AC_MSG_WARN([libcurl configured without curldebug support.])
1243 supports_curldebug="no"
1249 if test "$want_curldebug" = "yes"; then
1250 AC_MSG_CHECKING([if curl debug memory tracking can be enabled])
1251 test "$supports_curldebug" = "no" || supports_curldebug="yes"
1252 AC_MSG_RESULT([$supports_curldebug])
1253 if test "$supports_curldebug" = "no"; then
1254 AC_MSG_WARN([cannot enable curl debug memory tracking.])
1259 if test "$want_curldebug" = "yes"; then
1260 dnl TODO: Verify if the BUILDING_LIBCURL definition is still required.
1261 AC_DEFINE(BUILDING_LIBCURL, 1, [when building as static part of libcurl])
1262 CPPFLAGS="-DCURLDEBUG $CPPFLAGS"
1266 if test "$want_debug" = "yes"; then
1267 CPPFLAGS="-DDEBUGBUILD $CPPFLAGS"
1273 dnl CARES_CHECK_COMPILER_HALT_ON_ERROR
1274 dnl -------------------------------------------------
1275 dnl Verifies if the compiler actually halts after the
1276 dnl compilation phase without generating any object
1277 dnl code file, when the source compiles with errors.
1279 AC_DEFUN([CARES_CHECK_COMPILER_HALT_ON_ERROR], [
1280 AC_MSG_CHECKING([if compiler halts on compilation errors])
1284 force compilation error
1288 AC_MSG_ERROR([compiler does not halt on compilation errors.])
1290 AC_MSG_RESULT([yes])
1295 dnl CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
1296 dnl -------------------------------------------------
1297 dnl Verifies if the compiler actually halts after the
1298 dnl compilation phase without generating any object
1299 dnl code file, when the source code tries to define a
1300 dnl type for a constant array with negative dimension.
1302 AC_DEFUN([CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [
1303 AC_REQUIRE([CARES_CHECK_COMPILER_HALT_ON_ERROR])dnl
1304 AC_MSG_CHECKING([if compiler halts on negative sized arrays])
1307 typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ];
1313 AC_MSG_ERROR([compiler does not halt on negative sized arrays.])
1315 AC_MSG_RESULT([yes])
1320 dnl CARES_CHECK_COMPILER_STRUCT_MEMBER_SIZE
1321 dnl -------------------------------------------------
1322 dnl Verifies if the compiler is capable of handling the
1323 dnl size of a struct member, struct which is a function
1324 dnl result, as a compilation-time condition inside the
1325 dnl type definition of a constant array.
1327 AC_DEFUN([CARES_CHECK_COMPILER_STRUCT_MEMBER_SIZE], [
1328 AC_REQUIRE([CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE])dnl
1329 AC_MSG_CHECKING([if compiler struct member size checking works])
1330 tst_compiler_check_one_works="unknown"
1336 struct mystruct *next;
1338 struct mystruct myfunc();
1339 typedef char good_t1[sizeof(myfunc().mi) == sizeof(int) ? 1 : -1 ];
1340 typedef char good_t2[sizeof(myfunc().mc) == sizeof(char) ? 1 : -1 ];
1346 tst_compiler_check_one_works="yes"
1348 tst_compiler_check_one_works="no"
1349 sed 's/^/cc-src: /' conftest.$ac_ext >&6
1350 sed 's/^/cc-err: /' conftest.err >&6
1352 tst_compiler_check_two_works="unknown"
1358 struct mystruct *next;
1360 struct mystruct myfunc();
1361 typedef char bad_t1[sizeof(myfunc().mi) != sizeof(int) ? 1 : -1 ];
1362 typedef char bad_t2[sizeof(myfunc().mc) != sizeof(char) ? 1 : -1 ];
1368 tst_compiler_check_two_works="no"
1370 tst_compiler_check_two_works="yes"
1372 if test "$tst_compiler_check_one_works" = "yes" &&
1373 test "$tst_compiler_check_two_works" = "yes"; then
1374 AC_MSG_RESULT([yes])
1377 AC_MSG_ERROR([compiler fails struct member size checking.])
1382 dnl CARES_CHECK_COMPILER_SYMBOL_HIDING
1383 dnl -------------------------------------------------
1384 dnl Verify if compiler supports hiding library internal symbols, setting
1385 dnl shell variable supports_symbol_hiding value as appropriate, as well as
1386 dnl variables symbol_hiding_CFLAGS and symbol_hiding_EXTERN when supported.
1388 AC_DEFUN([CARES_CHECK_COMPILER_SYMBOL_HIDING], [
1389 AC_REQUIRE([CARES_CHECK_COMPILER])dnl
1390 AC_BEFORE([$0],[CARES_CONFIGURE_SYMBOL_HIDING])dnl
1391 AC_MSG_CHECKING([if compiler supports hiding library internal symbols])
1392 supports_symbol_hiding="no"
1393 symbol_hiding_CFLAGS=""
1394 symbol_hiding_EXTERN=""
1397 case "$compiler_id" in
1399 dnl All versions of clang support -fvisibility=
1400 tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
1401 tmp_CFLAGS="-fvisibility=hidden"
1402 supports_symbol_hiding="yes"
1405 dnl Only gcc 3.4 or later
1406 if test "$compiler_num" -ge "304"; then
1407 if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
1408 tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
1409 tmp_CFLAGS="-fvisibility=hidden"
1410 supports_symbol_hiding="yes"
1415 dnl Only icc 9.0 or later
1416 if test "$compiler_num" -ge "900"; then
1417 if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
1418 tmp_save_CFLAGS="$CFLAGS"
1419 CFLAGS="$CFLAGS -fvisibility=hidden"
1424 printf("icc fvisibility bug test");
1427 tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
1428 tmp_CFLAGS="-fvisibility=hidden"
1429 supports_symbol_hiding="yes"
1431 CFLAGS="$tmp_save_CFLAGS"
1436 if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
1437 tmp_EXTERN="__global"
1438 tmp_CFLAGS="-xldscope=hidden"
1439 supports_symbol_hiding="yes"
1443 if test "$supports_symbol_hiding" = "yes"; then
1444 tmp_save_CFLAGS="$CFLAGS"
1445 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
1449 $tmp_EXTERN char *dummy(char *buff);
1450 char *dummy(char *buff)
1459 char *r = dummy(&b[0]);
1464 supports_symbol_hiding="yes"
1465 if test -f conftest.err; then
1466 grep 'visibility' conftest.err >/dev/null
1467 if test "$?" -eq "0"; then
1468 supports_symbol_hiding="no"
1472 supports_symbol_hiding="no"
1474 sed 's/^/cc-src: /' conftest.$ac_ext >&6
1475 sed 's/^/cc-err: /' conftest.err >&6
1478 CFLAGS="$tmp_save_CFLAGS"
1480 if test "$supports_symbol_hiding" = "yes"; then
1481 AC_MSG_RESULT([yes])
1482 symbol_hiding_CFLAGS="$tmp_CFLAGS"
1483 symbol_hiding_EXTERN="$tmp_EXTERN"
1490 dnl CARES_CHECK_COMPILER_PROTOTYPE_MISMATCH
1491 dnl -------------------------------------------------
1492 dnl Verifies if the compiler actually halts after the
1493 dnl compilation phase without generating any object
1494 dnl code file, when the source code tries to redefine
1495 dnl a prototype which does not match previous one.
1497 AC_DEFUN([CARES_CHECK_COMPILER_PROTOTYPE_MISMATCH], [
1498 AC_REQUIRE([CARES_CHECK_COMPILER_HALT_ON_ERROR])dnl
1499 AC_MSG_CHECKING([if compiler halts on function prototype mismatch])
1502 # include <stdlib.h>
1519 AC_MSG_ERROR([compiler does not halt on function prototype mismatch.])
1521 AC_MSG_RESULT([yes])
1526 dnl CARES_VAR_MATCH (VARNAME, VALUE)
1527 dnl -------------------------------------------------
1528 dnl Verifies if shell variable VARNAME contains VALUE.
1529 dnl Contents of variable VARNAME and VALUE are handled
1530 dnl as whitespace separated lists of words. If at least
1531 dnl one word of VALUE is present in VARNAME the match
1532 dnl is considered positive, otherwise false.
1534 AC_DEFUN([CARES_VAR_MATCH], [
1535 ac_var_match_word="no"
1536 for word1 in $[$1]; do
1537 for word2 in [$2]; do
1538 if test "$word1" = "$word2"; then
1539 ac_var_match_word="yes"
1546 dnl CARES_VAR_MATCH_IFELSE (VARNAME, VALUE,
1547 dnl [ACTION-IF-MATCH], [ACTION-IF-NOT-MATCH])
1548 dnl -------------------------------------------------
1549 dnl This performs a CURL_VAR_MATCH check and executes
1550 dnl first branch if the match is positive, otherwise
1551 dnl the second branch is executed.
1553 AC_DEFUN([CARES_VAR_MATCH_IFELSE], [
1554 CARES_VAR_MATCH([$1],[$2])
1555 if test "$ac_var_match_word" = "yes"; then
1563 dnl CARES_VAR_STRIP (VARNAME, VALUE)
1564 dnl -------------------------------------------------
1565 dnl Contents of variable VARNAME and VALUE are handled
1566 dnl as whitespace separated lists of words. Each word
1567 dnl from VALUE is removed from VARNAME when present.
1569 AC_DEFUN([CARES_VAR_STRIP], [
1570 AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
1572 for word1 in $[$1]; do
1573 ac_var_strip_word="no"
1574 for word2 in [$2]; do
1575 if test "$word1" = "$word2"; then
1576 ac_var_strip_word="yes"
1579 if test "$ac_var_strip_word" = "no"; then
1580 ac_var_stripped="$ac_var_stripped $word1"
1583 dnl squeeze whitespace out of result
1584 [$1]="$ac_var_stripped"