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 http://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.
27 dnl CURL_CHECK_COMPILER
28 dnl -------------------------------------------------
29 dnl Verify if the C compiler being used is known.
31 AC_DEFUN([CURL_CHECK_COMPILER], [
36 flags_dbg_all="unknown"
37 flags_dbg_yes="unknown"
38 flags_dbg_off="unknown"
39 flags_opt_all="unknown"
40 flags_opt_yes="unknown"
41 flags_opt_off="unknown"
43 flags_prefer_cppflags="no"
45 CURL_CHECK_COMPILER_DEC_C
46 CURL_CHECK_COMPILER_HPUX_C
47 CURL_CHECK_COMPILER_IBM_C
48 CURL_CHECK_COMPILER_INTEL_C
49 CURL_CHECK_COMPILER_CLANG
50 CURL_CHECK_COMPILER_GNU_C
51 CURL_CHECK_COMPILER_LCC
52 CURL_CHECK_COMPILER_SGI_MIPSPRO_C
53 CURL_CHECK_COMPILER_SGI_MIPS_C
54 CURL_CHECK_COMPILER_SUNPRO_C
55 CURL_CHECK_COMPILER_TINY_C
56 CURL_CHECK_COMPILER_WATCOM_C
58 if test "$compiler_id" = "unknown"; then
61 *** Warning: This configure script does not have information about the
62 *** compiler you are using, relative to the flags required to enable or
63 *** disable generation of debug info, optimization options or warnings.
65 *** Whatever settings are present in CFLAGS will be used for this run.
67 *** If you wish to help the cURL project to better support your compiler
68 *** you can report this and the required info on the libcurl development
69 *** mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/
76 dnl CURL_CHECK_COMPILER_CLANG
77 dnl -------------------------------------------------
78 dnl Verify if compiler being used is clang.
80 AC_DEFUN([CURL_CHECK_COMPILER_CLANG], [
81 AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU_C])dnl
82 AC_MSG_CHECKING([if compiler is clang])
83 CURL_CHECK_DEF([__clang__], [], [silent])
84 if test "$curl_cv_have_def___clang__" = "yes"; then
87 clangver=`$CC -dumpversion`
88 clangvhi=`echo $clangver | cut -d . -f1`
89 clangvlo=`echo $clangver | cut -d . -f2`
90 compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
91 flags_dbg_all="-g -g0 -g1 -g2 -g3"
92 flags_dbg_all="$flags_dbg_all -ggdb"
93 flags_dbg_all="$flags_dbg_all -gstabs"
94 flags_dbg_all="$flags_dbg_all -gstabs+"
95 flags_dbg_all="$flags_dbg_all -gcoff"
96 flags_dbg_all="$flags_dbg_all -gxcoff"
97 flags_dbg_all="$flags_dbg_all -gdwarf-2"
98 flags_dbg_all="$flags_dbg_all -gvms"
101 flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4"
110 dnl CURL_CHECK_COMPILER_DEC_C
111 dnl -------------------------------------------------
112 dnl Verify if compiler being used is DEC C.
114 AC_DEFUN([CURL_CHECK_COMPILER_DEC_C], [
115 AC_MSG_CHECKING([if compiler is DEC/Compaq/HP C])
116 CURL_CHECK_DEF([__DECC], [], [silent])
117 CURL_CHECK_DEF([__DECC_VER], [], [silent])
118 if test "$curl_cv_have_def___DECC" = "yes" &&
119 test "$curl_cv_have_def___DECC_VER" = "yes"; then
122 flags_dbg_all="-g -g0 -g1 -g2 -g3"
125 flags_opt_all="-O -O0 -O1 -O2 -O3 -O4"
134 dnl CURL_CHECK_COMPILER_GNU_C
135 dnl -------------------------------------------------
136 dnl Verify if compiler being used is GNU C.
138 AC_DEFUN([CURL_CHECK_COMPILER_GNU_C], [
139 AC_REQUIRE([CURL_CHECK_COMPILER_INTEL_C])dnl
140 AC_REQUIRE([CURL_CHECK_COMPILER_CLANG])dnl
141 AC_MSG_CHECKING([if compiler is GNU C])
142 CURL_CHECK_DEF([__GNUC__], [], [silent])
143 if test "$curl_cv_have_def___GNUC__" = "yes" &&
144 test "$compiler_id" = "unknown"; then
147 gccver=`$CC -dumpversion`
148 gccvhi=`echo $gccver | cut -d . -f1`
149 gccvlo=`echo $gccver | cut -d . -f2`
150 compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
151 flags_dbg_all="-g -g0 -g1 -g2 -g3"
152 flags_dbg_all="$flags_dbg_all -ggdb"
153 flags_dbg_all="$flags_dbg_all -gstabs"
154 flags_dbg_all="$flags_dbg_all -gstabs+"
155 flags_dbg_all="$flags_dbg_all -gcoff"
156 flags_dbg_all="$flags_dbg_all -gxcoff"
157 flags_dbg_all="$flags_dbg_all -gdwarf-2"
158 flags_dbg_all="$flags_dbg_all -gvms"
161 flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
164 CURL_CHECK_DEF([_WIN32], [], [silent])
171 dnl CURL_CHECK_COMPILER_HPUX_C
172 dnl -------------------------------------------------
173 dnl Verify if compiler being used is HP-UX C.
175 AC_DEFUN([CURL_CHECK_COMPILER_HPUX_C], [
176 AC_MSG_CHECKING([if compiler is HP-UX C])
177 CURL_CHECK_DEF([__HP_cc], [], [silent])
178 if test "$curl_cv_have_def___HP_cc" = "yes"; then
180 compiler_id="HP_UX_C"
181 flags_dbg_all="-g -s"
184 flags_opt_all="-O +O0 +O1 +O2 +O3 +O4"
193 dnl CURL_CHECK_COMPILER_IBM_C
194 dnl -------------------------------------------------
195 dnl Verify if compiler being used is IBM C.
197 AC_DEFUN([CURL_CHECK_COMPILER_IBM_C], [
198 AC_MSG_CHECKING([if compiler is IBM C])
199 CURL_CHECK_DEF([__IBMC__], [], [silent])
200 if test "$curl_cv_have_def___IBMC__" = "yes"; then
203 flags_dbg_all="-g -g0 -g1 -g2 -g3"
206 flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5"
207 flags_opt_all="$flags_opt_all -qnooptimize"
208 flags_opt_all="$flags_opt_all -qoptimize=0"
209 flags_opt_all="$flags_opt_all -qoptimize=1"
210 flags_opt_all="$flags_opt_all -qoptimize=2"
211 flags_opt_all="$flags_opt_all -qoptimize=3"
212 flags_opt_all="$flags_opt_all -qoptimize=4"
213 flags_opt_all="$flags_opt_all -qoptimize=5"
215 flags_opt_off="-qnooptimize"
216 flags_prefer_cppflags="yes"
223 dnl CURL_CHECK_COMPILER_INTEL_C
224 dnl -------------------------------------------------
225 dnl Verify if compiler being used is Intel C.
227 AC_DEFUN([CURL_CHECK_COMPILER_INTEL_C], [
228 AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU_C])dnl
229 AC_MSG_CHECKING([if compiler is Intel C])
230 CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent])
231 if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then
233 compiler_num="$curl_cv_def___INTEL_COMPILER"
234 CURL_CHECK_DEF([__unix__], [], [silent])
235 if test "$curl_cv_have_def___unix__" = "yes"; then
236 compiler_id="INTEL_UNIX_C"
237 flags_dbg_all="-g -g0"
240 flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
244 compiler_id="INTEL_WINDOWS_C"
245 flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-"
246 flags_dbg_all="$flags_dbg_all /debug"
247 flags_dbg_all="$flags_dbg_all /debug:none"
248 flags_dbg_all="$flags_dbg_all /debug:minimal"
249 flags_dbg_all="$flags_dbg_all /debug:partial"
250 flags_dbg_all="$flags_dbg_all /debug:full"
251 flags_dbg_all="$flags_dbg_all /debug:semantic_stepping"
252 flags_dbg_all="$flags_dbg_all /debug:extended"
253 flags_dbg_yes="/Zi /Oy-"
254 flags_dbg_off="/debug:none /Oy-"
255 flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-"
265 dnl CURL_CHECK_COMPILER_LCC
266 dnl -------------------------------------------------
267 dnl Verify if compiler being used is LCC.
269 AC_DEFUN([CURL_CHECK_COMPILER_LCC], [
270 AC_MSG_CHECKING([if compiler is LCC])
271 CURL_CHECK_DEF([__LCC__], [], [silent])
272 if test "$curl_cv_have_def___LCC__" = "yes"; then
287 dnl CURL_CHECK_COMPILER_SGI_MIPS_C
288 dnl -------------------------------------------------
289 dnl Verify if compiler being used is SGI MIPS C.
291 AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPS_C], [
292 AC_REQUIRE([CURL_CHECK_COMPILER_SGI_MIPSPRO_C])dnl
293 AC_MSG_CHECKING([if compiler is SGI MIPS C])
294 CURL_CHECK_DEF([__GNUC__], [], [silent])
295 CURL_CHECK_DEF([__sgi], [], [silent])
296 if test "$curl_cv_have_def___GNUC__" = "no" &&
297 test "$curl_cv_have_def___sgi" = "yes" &&
298 test "$compiler_id" = "unknown"; then
300 compiler_id="SGI_MIPS_C"
301 flags_dbg_all="-g -g0 -g1 -g2 -g3"
304 flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
313 dnl CURL_CHECK_COMPILER_SGI_MIPSPRO_C
314 dnl -------------------------------------------------
315 dnl Verify if compiler being used is SGI MIPSpro C.
317 AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPSPRO_C], [
318 AC_BEFORE([$0],[CURL_CHECK_COMPILER_SGI_MIPS_C])dnl
319 AC_MSG_CHECKING([if compiler is SGI MIPSpro C])
320 CURL_CHECK_DEF([__GNUC__], [], [silent])
321 CURL_CHECK_DEF([_COMPILER_VERSION], [], [silent])
322 CURL_CHECK_DEF([_SGI_COMPILER_VERSION], [], [silent])
323 if test "$curl_cv_have_def___GNUC__" = "no" &&
324 (test "$curl_cv_have_def__SGI_COMPILER_VERSION" = "yes" ||
325 test "$curl_cv_have_def__COMPILER_VERSION" = "yes"); then
327 compiler_id="SGI_MIPSPRO_C"
328 flags_dbg_all="-g -g0 -g1 -g2 -g3"
331 flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
340 dnl CURL_CHECK_COMPILER_SUNPRO_C
341 dnl -------------------------------------------------
342 dnl Verify if compiler being used is SunPro C.
344 AC_DEFUN([CURL_CHECK_COMPILER_SUNPRO_C], [
345 AC_MSG_CHECKING([if compiler is SunPro C])
346 CURL_CHECK_DEF([__SUNPRO_C], [], [silent])
347 if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then
349 compiler_id="SUNPRO_C"
350 flags_dbg_all="-g -s"
353 flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5"
362 dnl CURL_CHECK_COMPILER_TINY_C
363 dnl -------------------------------------------------
364 dnl Verify if compiler being used is Tiny C.
366 AC_DEFUN([CURL_CHECK_COMPILER_TINY_C], [
367 AC_MSG_CHECKING([if compiler is Tiny C])
368 CURL_CHECK_DEF([__TINYC__], [], [silent])
369 if test "$curl_cv_have_def___TINYC__" = "yes"; then
372 flags_dbg_all="-g -b"
384 dnl CURL_CHECK_COMPILER_WATCOM_C
385 dnl -------------------------------------------------
386 dnl Verify if compiler being used is Watcom C.
388 AC_DEFUN([CURL_CHECK_COMPILER_WATCOM_C], [
389 AC_MSG_CHECKING([if compiler is Watcom C])
390 CURL_CHECK_DEF([__WATCOMC__], [], [silent])
391 if test "$curl_cv_have_def___WATCOMC__" = "yes"; then
393 CURL_CHECK_DEF([__UNIX__], [], [silent])
394 if test "$curl_cv_have_def___UNIX__" = "yes"; then
395 compiler_id="WATCOM_UNIX_C"
396 flags_dbg_all="-g1 -g1+ -g2 -g3"
399 flags_opt_all="-O0 -O1 -O2 -O3"
403 compiler_id="WATCOM_WINDOWS_C"
417 dnl CURL_CONVERT_INCLUDE_TO_ISYSTEM
418 dnl -------------------------------------------------
419 dnl Changes standard include paths present in CFLAGS
420 dnl and CPPFLAGS into isystem include paths. This is
421 dnl done to prevent GNUC from generating warnings on
422 dnl headers from these locations, although on ancient
423 dnl GNUC versions these warnings are not silenced.
425 AC_DEFUN([CURL_CONVERT_INCLUDE_TO_ISYSTEM], [
426 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
427 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
428 if test "$compiler_id" = "GNU_C" ||
429 test "$compiler_id" = "CLANG"; then
431 tmp_chg_FLAGS="$CFLAGS"
432 for word1 in $tmp_chg_FLAGS; do
435 tmp_has_include="yes"
439 if test "$tmp_has_include" = "yes"; then
440 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
441 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
442 CFLAGS="$tmp_chg_FLAGS"
446 tmp_chg_FLAGS="$CPPFLAGS"
447 for word1 in $tmp_chg_FLAGS; do
450 tmp_has_include="yes"
454 if test "$tmp_has_include" = "yes"; then
455 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
456 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
457 CPPFLAGS="$tmp_chg_FLAGS"
464 dnl CURL_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS])
465 dnl -------------------------------------------------
466 dnl Verify if the C compiler seems to work with the
467 dnl settings that are 'active' at the time the test
470 AC_DEFUN([CURL_COMPILER_WORKS_IFELSE], [
471 dnl compilation capability verification
472 tmp_compiler_works="unknown"
480 tmp_compiler_works="yes"
482 tmp_compiler_works="no"
484 sed 's/^/cc-fail: /' conftest.err >&6
487 dnl linking capability verification
488 if test "$tmp_compiler_works" = "yes"; then
496 tmp_compiler_works="yes"
498 tmp_compiler_works="no"
500 sed 's/^/link-fail: /' conftest.err >&6
504 dnl only do runtime verification when not cross-compiling
505 if test "x$cross_compiling" != "xyes" &&
506 test "$tmp_compiler_works" = "yes"; then
517 tmp_compiler_works="yes"
519 tmp_compiler_works="no"
521 echo "run-fail: test program exited with status $ac_status" >&6
525 dnl branch upon test result
526 if test "$tmp_compiler_works" = "yes"; then
534 dnl CURL_SET_COMPILER_BASIC_OPTS
535 dnl -------------------------------------------------
536 dnl Sets compiler specific options/flags which do not
537 dnl depend on configure's debug, optimize or warnings
540 AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [
541 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
542 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
544 if test "$compiler_id" != "unknown"; then
546 if test "$compiler_id" = "GNU_C" ||
547 test "$compiler_id" = "CLANG"; then
548 CURL_CONVERT_INCLUDE_TO_ISYSTEM
551 tmp_save_CPPFLAGS="$CPPFLAGS"
552 tmp_save_CFLAGS="$CFLAGS"
556 case "$compiler_id" in
560 dnl Disable warnings for unused arguments, otherwise clang will
561 dnl warn about compile-time arguments used during link-time, like
562 dnl -O and -g and -pedantic.
563 tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments"
568 dnl Select strict ANSI C compiler mode
569 tmp_CFLAGS="$tmp_CFLAGS -std1"
570 dnl Turn off optimizer ANSI C aliasing rules
571 tmp_CFLAGS="$tmp_CFLAGS -noansi_alias"
572 dnl Generate warnings for missing function prototypes
573 tmp_CFLAGS="$tmp_CFLAGS -warnprotos"
574 dnl Change some warnings into fatal errors
575 tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs"
581 tmp_CFLAGS="$tmp_CFLAGS"
586 dnl Disallow run-time dereferencing of null pointers
587 tmp_CFLAGS="$tmp_CFLAGS -z"
588 dnl Disable some remarks
589 dnl #4227: padding struct with n bytes to align member
590 dnl #4255: padding size of struct with n bytes to alignment boundary
591 tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255"
596 dnl Ensure that compiler optimizations are always thread-safe.
597 tmp_CPPFLAGS="$tmp_CPPFLAGS -qthreaded"
598 dnl Disable type based strict aliasing optimizations, using worst
599 dnl case aliasing assumptions when compiling. Type based aliasing
600 dnl would restrict the lvalues that could be safely used to access
602 tmp_CPPFLAGS="$tmp_CPPFLAGS -qnoansialias"
603 dnl Force compiler to stop after the compilation phase, without
604 dnl generating an object code file when compilation has errors.
605 tmp_CPPFLAGS="$tmp_CPPFLAGS -qhalt=e"
610 dnl On unix this compiler uses gcc's header files, so
611 dnl we select ANSI C89 dialect plus GNU extensions.
612 tmp_CFLAGS="$tmp_CFLAGS -std=gnu89"
613 dnl Change some warnings into errors
614 dnl #140: too many arguments in function call
615 dnl #147: declaration is incompatible with 'previous one'
616 dnl #165: too few arguments in function call
617 dnl #266: function declared implicitly
618 tmp_CPPFLAGS="$tmp_CPPFLAGS -we140,147,165,266"
619 dnl Disable some remarks
620 dnl #279: controlling expression is constant
621 dnl #981: operands are evaluated in unspecified order
622 dnl #1469: "cc" clobber ignored
623 tmp_CPPFLAGS="$tmp_CPPFLAGS -wd279,981,1469"
629 tmp_CFLAGS="$tmp_CFLAGS"
634 dnl Disallow run-time dereferencing of null pointers
635 tmp_CFLAGS="$tmp_CFLAGS -n"
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"
671 tmp_CFLAGS="$tmp_CFLAGS"
679 if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
680 AC_MSG_CHECKING([if compiler accepts some basic options])
681 CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
682 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
685 CURL_COMPILER_WORKS_IFELSE([
687 AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
690 AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
691 dnl restore initial settings
692 CPPFLAGS="$tmp_save_CPPFLAGS"
693 CFLAGS="$tmp_save_CFLAGS"
701 dnl CURL_SET_COMPILER_DEBUG_OPTS
702 dnl -------------------------------------------------
703 dnl Sets compiler specific options/flags which depend
704 dnl on configure's debug option.
706 AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [
707 AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
708 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
709 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
711 if test "$compiler_id" != "unknown"; then
713 tmp_save_CFLAGS="$CFLAGS"
714 tmp_save_CPPFLAGS="$CPPFLAGS"
718 tmp_CPPFLAGS="$CPPFLAGS"
719 CURL_VAR_STRIP([tmp_CFLAGS],[$flags_dbg_all])
720 CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_dbg_all])
722 if test "$want_debug" = "yes"; then
723 AC_MSG_CHECKING([if compiler accepts debug enabling options])
724 tmp_options="$flags_dbg_yes"
726 if test "$want_debug" = "no"; then
727 AC_MSG_CHECKING([if compiler accepts debug disabling options])
728 tmp_options="$flags_dbg_off"
731 if test "$flags_prefer_cppflags" = "yes"; then
732 CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
735 CPPFLAGS="$tmp_CPPFLAGS"
736 CFLAGS="$tmp_CFLAGS $tmp_options"
740 CURL_COMPILER_WORKS_IFELSE([
742 AC_MSG_NOTICE([compiler options added: $tmp_options])
745 AC_MSG_WARN([compiler options rejected: $tmp_options])
746 dnl restore initial settings
747 CPPFLAGS="$tmp_save_CPPFLAGS"
748 CFLAGS="$tmp_save_CFLAGS"
755 dnl CURL_SET_COMPILER_OPTIMIZE_OPTS
756 dnl -------------------------------------------------
757 dnl Sets compiler specific options/flags which depend
758 dnl on configure's optimize option.
760 AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
761 AC_REQUIRE([CURL_CHECK_OPTION_OPTIMIZE])dnl
762 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
763 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
765 if test "$compiler_id" != "unknown"; then
767 tmp_save_CFLAGS="$CFLAGS"
768 tmp_save_CPPFLAGS="$CPPFLAGS"
772 tmp_CPPFLAGS="$CPPFLAGS"
773 honor_optimize_option="yes"
775 dnl If optimization request setting has not been explicitly specified,
776 dnl it has been derived from the debug setting and initially assumed.
777 dnl This initially assumed optimizer setting will finally be ignored
778 dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies
779 dnl that an initially assumed optimizer setting might not be honored.
781 if test "$want_optimize" = "assume_no" ||
782 test "$want_optimize" = "assume_yes"; then
783 AC_MSG_CHECKING([if compiler optimizer assumed setting might be used])
784 CURL_VAR_MATCH_IFELSE([tmp_CFLAGS],[$flags_opt_all],[
785 honor_optimize_option="no"
787 CURL_VAR_MATCH_IFELSE([tmp_CPPFLAGS],[$flags_opt_all],[
788 honor_optimize_option="no"
790 AC_MSG_RESULT([$honor_optimize_option])
791 if test "$honor_optimize_option" = "yes"; then
792 if test "$want_optimize" = "assume_yes"; then
795 if test "$want_optimize" = "assume_no"; then
801 if test "$honor_optimize_option" = "yes"; then
802 CURL_VAR_STRIP([tmp_CFLAGS],[$flags_opt_all])
803 CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_opt_all])
804 if test "$want_optimize" = "yes"; then
805 AC_MSG_CHECKING([if compiler accepts optimizer enabling options])
806 tmp_options="$flags_opt_yes"
808 if test "$want_optimize" = "no"; then
809 AC_MSG_CHECKING([if compiler accepts optimizer disabling options])
810 tmp_options="$flags_opt_off"
812 if test "$flags_prefer_cppflags" = "yes"; then
813 CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
816 CPPFLAGS="$tmp_CPPFLAGS"
817 CFLAGS="$tmp_CFLAGS $tmp_options"
821 CURL_COMPILER_WORKS_IFELSE([
823 AC_MSG_NOTICE([compiler options added: $tmp_options])
826 AC_MSG_WARN([compiler options rejected: $tmp_options])
827 dnl restore initial settings
828 CPPFLAGS="$tmp_save_CPPFLAGS"
829 CFLAGS="$tmp_save_CFLAGS"
837 dnl CURL_SET_COMPILER_WARNING_OPTS
838 dnl -------------------------------------------------
839 dnl Sets compiler options/flags which depend on
840 dnl configure's warnings given option.
842 AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
843 AC_REQUIRE([CURL_CHECK_OPTION_WARNINGS])dnl
844 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
845 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
847 if test "$compiler_id" != "unknown"; then
849 tmp_save_CPPFLAGS="$CPPFLAGS"
850 tmp_save_CFLAGS="$CFLAGS"
854 case "$compiler_id" in
858 if test "$want_warnings" = "yes"; then
859 tmp_CFLAGS="$tmp_CFLAGS -pedantic"
860 tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra"
861 tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings"
862 tmp_CFLAGS="$tmp_CFLAGS -Wshadow"
863 tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs"
864 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
865 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes"
866 tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
867 tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
868 tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare"
869 tmp_CFLAGS="$tmp_CFLAGS -Wundef"
870 tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
871 tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
872 tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
873 tmp_CFLAGS="$tmp_CFLAGS -Wcast-align"
874 tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers"
875 tmp_CFLAGS="$tmp_CFLAGS -Wshorten-64-to-32"
877 dnl Only clang 1.1 or later
878 if test "$compiler_num" -ge "101"; then
879 tmp_CFLAGS="$tmp_CFLAGS -Wunused"
886 if test "$want_warnings" = "yes"; then
887 dnl Select a higher warning level than default level2
888 tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3"
894 if test "$want_warnings" = "yes"; then
896 dnl Do not enable -pedantic when cross-compiling with a gcc older
897 dnl than 3.0, to avoid warnings from third party system headers.
898 if test "x$cross_compiling" != "xyes" ||
899 test "$compiler_num" -ge "300"; then
900 tmp_CFLAGS="$tmp_CFLAGS -pedantic"
903 dnl Set of options we believe *ALL* gcc versions support:
904 tmp_CFLAGS="$tmp_CFLAGS -Wall -W"
906 dnl Only gcc 1.4 or later
907 if test "$compiler_num" -ge "104"; then
908 tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings"
909 dnl If not cross-compiling with a gcc older than 3.0
910 if test "x$cross_compiling" != "xyes" ||
911 test "$compiler_num" -ge "300"; then
912 tmp_CFLAGS="$tmp_CFLAGS -Wunused -Wshadow"
916 dnl Only gcc 2.7 or later
917 if test "$compiler_num" -ge "207"; then
918 tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs"
919 dnl If not cross-compiling with a gcc older than 3.0
920 if test "x$cross_compiling" != "xyes" ||
921 test "$compiler_num" -ge "300"; then
922 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
923 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes"
927 dnl Only gcc 2.95 or later
928 if test "$compiler_num" -ge "295"; then
929 tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
932 dnl Only gcc 2.96 or later
933 if test "$compiler_num" -ge "296"; then
934 tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
935 tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare"
936 dnl -Wundef used only if gcc is 2.96 or later since we get
937 dnl lots of "`_POSIX_C_SOURCE' is not defined" in system
938 dnl headers with gcc 2.95.4 on FreeBSD 4.9
939 tmp_CFLAGS="$tmp_CFLAGS -Wundef"
942 dnl Only gcc 2.97 or later
943 if test "$compiler_num" -ge "297"; then
944 tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
947 dnl Only gcc 3.0 or later
948 if test "$compiler_num" -ge "300"; then
949 dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
950 dnl on i686-Linux as it gives us heaps with false positives.
951 dnl Also, on gcc 4.0.X it is totally unbearable and complains all
952 dnl over making it unusable for generic purposes. Let's not use it.
953 tmp_CFLAGS="$tmp_CFLAGS"
956 dnl Only gcc 3.3 or later
957 if test "$compiler_num" -ge "303"; then
958 tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
961 dnl Only gcc 3.4 or later
962 if test "$compiler_num" -ge "304"; then
963 tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
966 dnl Only gcc 4.0 or later
967 if test "$compiler_num" -ge "400"; then
968 tmp_CFLAGS="$tmp_CFLAGS -Wstrict-aliasing=3"
971 dnl Only gcc 4.2 or later
972 if test "$compiler_num" -ge "402"; then
973 tmp_CFLAGS="$tmp_CFLAGS -Wcast-align"
976 dnl Only gcc 4.3 or later
977 if test "$compiler_num" -ge "403"; then
978 tmp_CFLAGS="$tmp_CFLAGS -Wtype-limits -Wold-style-declaration"
979 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-parameter-type -Wempty-body"
980 tmp_CFLAGS="$tmp_CFLAGS -Wclobbered -Wignored-qualifiers"
981 tmp_CFLAGS="$tmp_CFLAGS -Wconversion -Wno-sign-conversion -Wvla"
984 dnl Only gcc 4.5 or later
985 if test "$compiler_num" -ge "405"; then
986 dnl Only windows targets
987 if test "$curl_cv_have_def__WIN32" = "yes"; then
988 tmp_CFLAGS="$tmp_CFLAGS -Wno-pedantic-ms-format"
994 dnl Do not issue warnings for code in system include paths.
995 if test "$compiler_num" -ge "300"; then
996 tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers"
998 dnl When cross-compiling with a gcc older than 3.0, disable
999 dnl some warnings triggered on third party system headers.
1000 if test "x$cross_compiling" = "xyes"; then
1001 if test "$compiler_num" -ge "104"; then
1002 dnl gcc 1.4 or later
1003 tmp_CFLAGS="$tmp_CFLAGS -Wno-unused -Wno-shadow"
1005 if test "$compiler_num" -ge "207"; then
1006 dnl gcc 2.7 or later
1007 tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-declarations"
1008 tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-prototypes"
1016 if test "$want_warnings" = "yes"; then
1017 dnl Issue all warnings
1018 tmp_CFLAGS="$tmp_CFLAGS +w1"
1025 tmp_CFLAGS="$tmp_CFLAGS"
1030 if test "$want_warnings" = "yes"; then
1031 if test "$compiler_num" -gt "600"; then
1032 dnl Show errors, warnings, and remarks
1033 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall -w2"
1034 dnl Perform extra compile-time code checking
1035 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck"
1036 dnl Warn on nested comments
1037 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcomment"
1038 dnl Show warnings relative to deprecated features
1039 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wdeprecated"
1040 dnl Enable warnings for missing prototypes
1041 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wmissing-prototypes"
1042 dnl Enable warnings for 64-bit portability issues
1043 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wp64"
1044 dnl Enable warnings for questionable pointer arithmetic
1045 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wpointer-arith"
1046 dnl Check for function return typw issues
1047 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wreturn-type"
1048 dnl Warn on variable declarations hiding a previous one
1049 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wshadow"
1050 dnl Warn when a variable is used before initialized
1051 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wuninitialized"
1052 dnl Warn if a declared function is not used
1053 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wunused-function"
1056 dnl Disable using EBP register in optimizations
1057 tmp_CFLAGS="$tmp_CFLAGS -fno-omit-frame-pointer"
1058 dnl Disable use of ANSI C aliasing rules in optimizations
1059 tmp_CFLAGS="$tmp_CFLAGS -fno-strict-aliasing"
1060 dnl Value-safe optimizations on floating-point data
1061 tmp_CFLAGS="$tmp_CFLAGS -fp-model precise"
1062 dnl Only icc 10.0 or later
1063 if test "$compiler_num" -ge "1000"; then
1064 dnl Disable vectorizer diagnostic information
1065 tmp_CFLAGS="$tmp_CFLAGS -vec-report0"
1072 tmp_CFLAGS="$tmp_CFLAGS"
1077 if test "$want_warnings" = "yes"; then
1078 dnl Highest warning level is double -A, next is single -A.
1079 dnl Due to the big number of warnings these trigger on third
1080 dnl party header files it is impractical for us to use any of
1081 dnl them here. If you want them simply define it in CPPFLAGS.
1082 tmp_CFLAGS="$tmp_CFLAGS"
1088 if test "$want_warnings" = "yes"; then
1089 dnl Perform stricter semantic and lint-like checks
1090 tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
1096 if test "$want_warnings" = "yes"; then
1097 dnl Perform stricter semantic and lint-like checks
1098 tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
1099 dnl Disable some remarks
1100 dnl #1209: controlling expression is constant
1101 tmp_CFLAGS="$tmp_CFLAGS -woff 1209"
1107 if test "$want_warnings" = "yes"; then
1108 dnl Perform stricter semantic and lint-like checks
1109 tmp_CFLAGS="$tmp_CFLAGS -v"
1115 if test "$want_warnings" = "yes"; then
1116 dnl Activate all warnings
1117 tmp_CFLAGS="$tmp_CFLAGS -Wall"
1118 dnl Make string constants be of type const char *
1119 tmp_CFLAGS="$tmp_CFLAGS -Wwrite-strings"
1120 dnl Warn use of unsupported GCC features ignored by TCC
1121 tmp_CFLAGS="$tmp_CFLAGS -Wunsupported"
1127 if test "$want_warnings" = "yes"; then
1128 dnl Issue all warnings
1129 tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra"
1136 tmp_CFLAGS="$tmp_CFLAGS"
1141 squeeze tmp_CPPFLAGS
1144 if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
1145 AC_MSG_CHECKING([if compiler accepts strict warning options])
1146 CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
1147 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
1150 CURL_COMPILER_WORKS_IFELSE([
1151 AC_MSG_RESULT([yes])
1152 AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
1155 AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
1156 dnl restore initial settings
1157 CPPFLAGS="$tmp_save_CPPFLAGS"
1158 CFLAGS="$tmp_save_CFLAGS"
1166 dnl CURL_SHFUNC_SQUEEZE
1167 dnl -------------------------------------------------
1168 dnl Declares a shell function squeeze() which removes
1169 dnl redundant whitespace out of a shell variable.
1171 AC_DEFUN([CURL_SHFUNC_SQUEEZE], [
1174 eval _sqz_input=\[$][$]1
1175 for _sqz_token in $_sqz_input; do
1176 if test -z "$_sqz_result"; then
1177 _sqz_result="$_sqz_token"
1179 _sqz_result="$_sqz_result $_sqz_token"
1182 eval [$]1=\$_sqz_result
1188 dnl CURL_CHECK_CURLDEBUG
1189 dnl -------------------------------------------------
1190 dnl Settings which depend on configure's curldebug given
1191 dnl option, and other additional configure pre-requisites.
1192 dnl Actually the curl debug memory tracking feature can
1193 dnl only be used/enabled when libcurl is built as a static
1194 dnl library or as a shared one on those systems on which
1195 dnl shared libraries support undefined symbols.
1197 AC_DEFUN([CURL_CHECK_CURLDEBUG], [
1198 AC_REQUIRE([XC_LIBTOOL])dnl
1199 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
1200 supports_curldebug="unknown"
1201 if test "$want_curldebug" = "yes"; then
1202 if test "x$enable_shared" != "xno" &&
1203 test "x$enable_shared" != "xyes"; then
1204 AC_MSG_WARN([unknown enable_shared setting.])
1205 supports_curldebug="no"
1207 if test "x$enable_static" != "xno" &&
1208 test "x$enable_static" != "xyes"; then
1209 AC_MSG_WARN([unknown enable_static setting.])
1210 supports_curldebug="no"
1212 if test "$supports_curldebug" != "no"; then
1213 if test "$enable_shared" = "yes" &&
1214 test "x$xc_lt_shlib_use_no_undefined" = 'xyes'; then
1215 supports_curldebug="no"
1216 AC_MSG_WARN([shared library does not support undefined symbols.])
1221 if test "$want_curldebug" = "yes"; then
1222 AC_MSG_CHECKING([if curl debug memory tracking can be enabled])
1223 test "$supports_curldebug" = "no" || supports_curldebug="yes"
1224 AC_MSG_RESULT([$supports_curldebug])
1225 if test "$supports_curldebug" = "no"; then
1226 AC_MSG_WARN([cannot enable curl debug memory tracking.])
1231 if test "$want_curldebug" = "yes"; then
1232 CPPFLAGS="-DCURLDEBUG $CPPFLAGS"
1235 if test "$want_debug" = "yes"; then
1236 CPPFLAGS="-DDEBUGBUILD $CPPFLAGS"
1243 dnl CURL_CHECK_COMPILER_HALT_ON_ERROR
1244 dnl -------------------------------------------------
1245 dnl Verifies if the compiler actually halts after the
1246 dnl compilation phase without generating any object
1247 dnl code file, when the source compiles with errors.
1249 AC_DEFUN([CURL_CHECK_COMPILER_HALT_ON_ERROR], [
1250 AC_MSG_CHECKING([if compiler halts on compilation errors])
1254 force compilation error
1258 AC_MSG_ERROR([compiler does not halt on compilation errors.])
1260 AC_MSG_RESULT([yes])
1265 dnl CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
1266 dnl -------------------------------------------------
1267 dnl Verifies if the compiler actually halts after the
1268 dnl compilation phase without generating any object
1269 dnl code file, when the source code tries to define a
1270 dnl type for a constant array with negative dimension.
1272 AC_DEFUN([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [
1273 AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])dnl
1274 AC_MSG_CHECKING([if compiler halts on negative sized arrays])
1277 typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ];
1283 AC_MSG_ERROR([compiler does not halt on negative sized arrays.])
1285 AC_MSG_RESULT([yes])
1290 dnl CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE
1291 dnl -------------------------------------------------
1292 dnl Verifies if the compiler is capable of handling the
1293 dnl size of a struct member, struct which is a function
1294 dnl result, as a compilation-time condition inside the
1295 dnl type definition of a constant array.
1297 AC_DEFUN([CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE], [
1298 AC_REQUIRE([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE])dnl
1299 AC_MSG_CHECKING([if compiler struct member size checking works])
1300 tst_compiler_check_one_works="unknown"
1306 struct mystruct *next;
1308 struct mystruct myfunc();
1309 typedef char good_t1[sizeof(myfunc().mi) == sizeof(int) ? 1 : -1 ];
1310 typedef char good_t2[sizeof(myfunc().mc) == sizeof(char) ? 1 : -1 ];
1316 tst_compiler_check_one_works="yes"
1318 tst_compiler_check_one_works="no"
1319 sed 's/^/cc-src: /' conftest.$ac_ext >&6
1320 sed 's/^/cc-err: /' conftest.err >&6
1322 tst_compiler_check_two_works="unknown"
1328 struct mystruct *next;
1330 struct mystruct myfunc();
1331 typedef char bad_t1[sizeof(myfunc().mi) != sizeof(int) ? 1 : -1 ];
1332 typedef char bad_t2[sizeof(myfunc().mc) != sizeof(char) ? 1 : -1 ];
1338 tst_compiler_check_two_works="no"
1340 tst_compiler_check_two_works="yes"
1342 if test "$tst_compiler_check_one_works" = "yes" &&
1343 test "$tst_compiler_check_two_works" = "yes"; then
1344 AC_MSG_RESULT([yes])
1347 AC_MSG_ERROR([compiler fails struct member size checking.])
1352 dnl CURL_CHECK_COMPILER_SYMBOL_HIDING
1353 dnl -------------------------------------------------
1354 dnl Verify if compiler supports hiding library internal symbols, setting
1355 dnl shell variable supports_symbol_hiding value as appropriate, as well as
1356 dnl variables symbol_hiding_CFLAGS and symbol_hiding_EXTERN when supported.
1358 AC_DEFUN([CURL_CHECK_COMPILER_SYMBOL_HIDING], [
1359 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
1360 AC_BEFORE([$0],[CURL_CONFIGURE_SYMBOL_HIDING])dnl
1361 AC_MSG_CHECKING([if compiler supports hiding library internal symbols])
1362 supports_symbol_hiding="no"
1363 symbol_hiding_CFLAGS=""
1364 symbol_hiding_EXTERN=""
1367 case "$compiler_id" in
1369 dnl All versions of clang support -fvisibility=
1370 tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
1371 tmp_CFLAGS="-fvisibility=hidden"
1372 supports_symbol_hiding="yes"
1375 dnl Only gcc 3.4 or later
1376 if test "$compiler_num" -ge "304"; then
1377 if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
1378 tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
1379 tmp_CFLAGS="-fvisibility=hidden"
1380 supports_symbol_hiding="yes"
1385 dnl Only icc 9.0 or later
1386 if test "$compiler_num" -ge "900"; then
1387 if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
1388 tmp_save_CFLAGS="$CFLAGS"
1389 CFLAGS="$CFLAGS -fvisibility=hidden"
1394 printf("icc fvisibility bug test");
1397 tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
1398 tmp_CFLAGS="-fvisibility=hidden"
1399 supports_symbol_hiding="yes"
1401 CFLAGS="$tmp_save_CFLAGS"
1406 if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
1407 tmp_EXTERN="__global"
1408 tmp_CFLAGS="-xldscope=hidden"
1409 supports_symbol_hiding="yes"
1413 if test "$supports_symbol_hiding" = "yes"; then
1414 tmp_save_CFLAGS="$CFLAGS"
1415 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
1419 $tmp_EXTERN char *dummy(char *buff);
1420 char *dummy(char *buff)
1429 char *r = dummy(&b[0]);
1434 supports_symbol_hiding="yes"
1435 if test -f conftest.err; then
1436 grep 'visibility' conftest.err >/dev/null
1437 if test "$?" -eq "0"; then
1438 supports_symbol_hiding="no"
1442 supports_symbol_hiding="no"
1444 sed 's/^/cc-src: /' conftest.$ac_ext >&6
1445 sed 's/^/cc-err: /' conftest.err >&6
1448 CFLAGS="$tmp_save_CFLAGS"
1450 if test "$supports_symbol_hiding" = "yes"; then
1451 AC_MSG_RESULT([yes])
1452 symbol_hiding_CFLAGS="$tmp_CFLAGS"
1453 symbol_hiding_EXTERN="$tmp_EXTERN"
1460 dnl CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
1461 dnl -------------------------------------------------
1462 dnl Verifies if the compiler actually halts after the
1463 dnl compilation phase without generating any object
1464 dnl code file, when the source code tries to redefine
1465 dnl a prototype which does not match previous one.
1467 AC_DEFUN([CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH], [
1468 AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])dnl
1469 AC_MSG_CHECKING([if compiler halts on function prototype mismatch])
1472 # include <stdlib.h>
1489 AC_MSG_ERROR([compiler does not halt on function prototype mismatch.])
1491 AC_MSG_RESULT([yes])
1496 dnl CURL_VAR_MATCH (VARNAME, VALUE)
1497 dnl -------------------------------------------------
1498 dnl Verifies if shell variable VARNAME contains VALUE.
1499 dnl Contents of variable VARNAME and VALUE are handled
1500 dnl as whitespace separated lists of words. If at least
1501 dnl one word of VALUE is present in VARNAME the match
1502 dnl is considered positive, otherwise false.
1504 AC_DEFUN([CURL_VAR_MATCH], [
1505 ac_var_match_word="no"
1506 for word1 in $[$1]; do
1507 for word2 in [$2]; do
1508 if test "$word1" = "$word2"; then
1509 ac_var_match_word="yes"
1516 dnl CURL_VAR_MATCH_IFELSE (VARNAME, VALUE,
1517 dnl [ACTION-IF-MATCH], [ACTION-IF-NOT-MATCH])
1518 dnl -------------------------------------------------
1519 dnl This performs a CURL_VAR_MATCH check and executes
1520 dnl first branch if the match is positive, otherwise
1521 dnl the second branch is executed.
1523 AC_DEFUN([CURL_VAR_MATCH_IFELSE], [
1524 CURL_VAR_MATCH([$1],[$2])
1525 if test "$ac_var_match_word" = "yes"; then
1533 dnl CURL_VAR_STRIP (VARNAME, VALUE)
1534 dnl -------------------------------------------------
1535 dnl Contents of variable VARNAME and VALUE are handled
1536 dnl as whitespace separated lists of words. Each word
1537 dnl from VALUE is removed from VARNAME when present.
1539 AC_DEFUN([CURL_VAR_STRIP], [
1540 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
1542 for word1 in $[$1]; do
1543 ac_var_strip_word="no"
1544 for word2 in [$2]; do
1545 if test "$word1" = "$word2"; then
1546 ac_var_strip_word="yes"
1549 if test "$ac_var_strip_word" = "no"; then
1550 ac_var_stripped="$ac_var_stripped $word1"
1553 dnl squeeze whitespace out of result
1554 [$1]="$ac_var_stripped"