1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2017, 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.
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: https://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 fullclangver=`$CC -v 2>&1 | grep version`
88 clangver=`echo $fullclangver | grep "based on LLVM " | "$SED" 's/.*(based on LLVM \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*)/\1/'`
89 if test -z "$clangver"; then
90 if echo $fullclangver | grep "Apple LLVM version " >/dev/null; then
91 dnl Starting with XCode 7 / clang 3.7, Apple clang won't tell its upstream version
94 clangver=`echo $fullclangver | "$SED" 's/.*version \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*/\1/'`
97 clangvhi=`echo $clangver | cut -d . -f1`
98 clangvlo=`echo $clangver | cut -d . -f2`
99 compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
100 flags_dbg_all="-g -g0 -g1 -g2 -g3"
101 flags_dbg_all="$flags_dbg_all -ggdb"
102 flags_dbg_all="$flags_dbg_all -gstabs"
103 flags_dbg_all="$flags_dbg_all -gstabs+"
104 flags_dbg_all="$flags_dbg_all -gcoff"
105 flags_dbg_all="$flags_dbg_all -gxcoff"
106 flags_dbg_all="$flags_dbg_all -gdwarf-2"
107 flags_dbg_all="$flags_dbg_all -gvms"
109 flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4"
118 dnl CURL_CHECK_COMPILER_DEC_C
119 dnl -------------------------------------------------
120 dnl Verify if compiler being used is DEC C.
122 AC_DEFUN([CURL_CHECK_COMPILER_DEC_C], [
123 AC_MSG_CHECKING([if compiler is DEC/Compaq/HP C])
124 CURL_CHECK_DEF([__DECC], [], [silent])
125 CURL_CHECK_DEF([__DECC_VER], [], [silent])
126 if test "$curl_cv_have_def___DECC" = "yes" &&
127 test "$curl_cv_have_def___DECC_VER" = "yes"; then
130 flags_dbg_all="-g -g0 -g1 -g2 -g3"
132 flags_opt_all="-O -O0 -O1 -O2 -O3 -O4"
141 dnl CURL_CHECK_COMPILER_GNU_C
142 dnl -------------------------------------------------
143 dnl Verify if compiler being used is GNU C.
145 AC_DEFUN([CURL_CHECK_COMPILER_GNU_C], [
146 AC_REQUIRE([CURL_CHECK_COMPILER_INTEL_C])dnl
147 AC_REQUIRE([CURL_CHECK_COMPILER_CLANG])dnl
148 AC_MSG_CHECKING([if compiler is GNU C])
149 CURL_CHECK_DEF([__GNUC__], [], [silent])
150 if test "$curl_cv_have_def___GNUC__" = "yes" &&
151 test "$compiler_id" = "unknown"; then
154 gccver=`$CC -dumpversion`
155 gccvhi=`echo $gccver | cut -d . -f1`
156 gccvlo=`echo $gccver | cut -d . -f2`
157 compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
158 flags_dbg_all="-g -g0 -g1 -g2 -g3"
159 flags_dbg_all="$flags_dbg_all -ggdb"
160 flags_dbg_all="$flags_dbg_all -gstabs"
161 flags_dbg_all="$flags_dbg_all -gstabs+"
162 flags_dbg_all="$flags_dbg_all -gcoff"
163 flags_dbg_all="$flags_dbg_all -gxcoff"
164 flags_dbg_all="$flags_dbg_all -gdwarf-2"
165 flags_dbg_all="$flags_dbg_all -gvms"
167 flags_opt_all="-O -O0 -O1 -O2 -O3 -Os -Og -Ofast"
170 CURL_CHECK_DEF([_WIN32], [], [silent])
177 dnl CURL_CHECK_COMPILER_HPUX_C
178 dnl -------------------------------------------------
179 dnl Verify if compiler being used is HP-UX C.
181 AC_DEFUN([CURL_CHECK_COMPILER_HPUX_C], [
182 AC_MSG_CHECKING([if compiler is HP-UX C])
183 CURL_CHECK_DEF([__HP_cc], [], [silent])
184 if test "$curl_cv_have_def___HP_cc" = "yes"; then
186 compiler_id="HP_UX_C"
187 flags_dbg_all="-g -s"
190 flags_opt_all="-O +O0 +O1 +O2 +O3 +O4"
199 dnl CURL_CHECK_COMPILER_IBM_C
200 dnl -------------------------------------------------
201 dnl Verify if compiler being used is IBM C.
203 AC_DEFUN([CURL_CHECK_COMPILER_IBM_C], [
204 AC_MSG_CHECKING([if compiler is IBM C])
205 CURL_CHECK_DEF([__IBMC__], [], [silent])
206 if test "$curl_cv_have_def___IBMC__" = "yes"; then
209 flags_dbg_all="-g -g0 -g1 -g2 -g3"
211 flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5"
212 flags_opt_all="$flags_opt_all -qnooptimize"
213 flags_opt_all="$flags_opt_all -qoptimize=0"
214 flags_opt_all="$flags_opt_all -qoptimize=1"
215 flags_opt_all="$flags_opt_all -qoptimize=2"
216 flags_opt_all="$flags_opt_all -qoptimize=3"
217 flags_opt_all="$flags_opt_all -qoptimize=4"
218 flags_opt_all="$flags_opt_all -qoptimize=5"
220 flags_opt_off="-qnooptimize"
221 flags_prefer_cppflags="yes"
228 dnl CURL_CHECK_COMPILER_INTEL_C
229 dnl -------------------------------------------------
230 dnl Verify if compiler being used is Intel C.
232 AC_DEFUN([CURL_CHECK_COMPILER_INTEL_C], [
233 AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU_C])dnl
234 AC_MSG_CHECKING([if compiler is Intel C])
235 CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent])
236 if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then
238 compiler_num="$curl_cv_def___INTEL_COMPILER"
239 CURL_CHECK_DEF([__unix__], [], [silent])
240 if test "$curl_cv_have_def___unix__" = "yes"; then
241 compiler_id="INTEL_UNIX_C"
242 flags_dbg_all="-g -g0"
244 flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
248 compiler_id="INTEL_WINDOWS_C"
249 flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-"
250 flags_dbg_all="$flags_dbg_all /debug"
251 flags_dbg_all="$flags_dbg_all /debug:none"
252 flags_dbg_all="$flags_dbg_all /debug:minimal"
253 flags_dbg_all="$flags_dbg_all /debug:partial"
254 flags_dbg_all="$flags_dbg_all /debug:full"
255 flags_dbg_all="$flags_dbg_all /debug:semantic_stepping"
256 flags_dbg_all="$flags_dbg_all /debug:extended"
257 flags_dbg_yes="/Zi /Oy-"
258 flags_dbg_off="/debug:none /Oy-"
259 flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-"
269 dnl CURL_CHECK_COMPILER_LCC
270 dnl -------------------------------------------------
271 dnl Verify if compiler being used is LCC.
273 AC_DEFUN([CURL_CHECK_COMPILER_LCC], [
274 AC_MSG_CHECKING([if compiler is LCC])
275 CURL_CHECK_DEF([__LCC__], [], [silent])
276 if test "$curl_cv_have_def___LCC__" = "yes"; then
290 dnl CURL_CHECK_COMPILER_SGI_MIPS_C
291 dnl -------------------------------------------------
292 dnl Verify if compiler being used is SGI MIPS C.
294 AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPS_C], [
295 AC_REQUIRE([CURL_CHECK_COMPILER_SGI_MIPSPRO_C])dnl
296 AC_MSG_CHECKING([if compiler is SGI MIPS C])
297 CURL_CHECK_DEF([__GNUC__], [], [silent])
298 CURL_CHECK_DEF([__sgi], [], [silent])
299 if test "$curl_cv_have_def___GNUC__" = "no" &&
300 test "$curl_cv_have_def___sgi" = "yes" &&
301 test "$compiler_id" = "unknown"; then
303 compiler_id="SGI_MIPS_C"
304 flags_dbg_all="-g -g0 -g1 -g2 -g3"
306 flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
315 dnl CURL_CHECK_COMPILER_SGI_MIPSPRO_C
316 dnl -------------------------------------------------
317 dnl Verify if compiler being used is SGI MIPSpro C.
319 AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPSPRO_C], [
320 AC_BEFORE([$0],[CURL_CHECK_COMPILER_SGI_MIPS_C])dnl
321 AC_MSG_CHECKING([if compiler is SGI MIPSpro C])
322 CURL_CHECK_DEF([__GNUC__], [], [silent])
323 CURL_CHECK_DEF([_COMPILER_VERSION], [], [silent])
324 CURL_CHECK_DEF([_SGI_COMPILER_VERSION], [], [silent])
325 if test "$curl_cv_have_def___GNUC__" = "no" &&
326 (test "$curl_cv_have_def__SGI_COMPILER_VERSION" = "yes" ||
327 test "$curl_cv_have_def__COMPILER_VERSION" = "yes"); then
329 compiler_id="SGI_MIPSPRO_C"
330 flags_dbg_all="-g -g0 -g1 -g2 -g3"
332 flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
341 dnl CURL_CHECK_COMPILER_SUNPRO_C
342 dnl -------------------------------------------------
343 dnl Verify if compiler being used is SunPro C.
345 AC_DEFUN([CURL_CHECK_COMPILER_SUNPRO_C], [
346 AC_MSG_CHECKING([if compiler is SunPro C])
347 CURL_CHECK_DEF([__SUNPRO_C], [], [silent])
348 if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then
350 compiler_id="SUNPRO_C"
351 flags_dbg_all="-g -s"
354 flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5"
363 dnl CURL_CHECK_COMPILER_TINY_C
364 dnl -------------------------------------------------
365 dnl Verify if compiler being used is Tiny C.
367 AC_DEFUN([CURL_CHECK_COMPILER_TINY_C], [
368 AC_MSG_CHECKING([if compiler is Tiny C])
369 CURL_CHECK_DEF([__TINYC__], [], [silent])
370 if test "$curl_cv_have_def___TINYC__" = "yes"; then
373 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"
398 flags_opt_all="-O0 -O1 -O2 -O3"
402 compiler_id="WATCOM_WINDOWS_C"
415 dnl CURL_CONVERT_INCLUDE_TO_ISYSTEM
416 dnl -------------------------------------------------
417 dnl Changes standard include paths present in CFLAGS
418 dnl and CPPFLAGS into isystem include paths. This is
419 dnl done to prevent GNUC from generating warnings on
420 dnl headers from these locations, although on ancient
421 dnl GNUC versions these warnings are not silenced.
423 AC_DEFUN([CURL_CONVERT_INCLUDE_TO_ISYSTEM], [
424 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
425 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
426 if test "$compiler_id" = "GNU_C" ||
427 test "$compiler_id" = "CLANG"; then
429 tmp_chg_FLAGS="$CFLAGS"
430 for word1 in $tmp_chg_FLAGS; do
433 tmp_has_include="yes"
437 if test "$tmp_has_include" = "yes"; then
438 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
439 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
440 CFLAGS="$tmp_chg_FLAGS"
444 tmp_chg_FLAGS="$CPPFLAGS"
445 for word1 in $tmp_chg_FLAGS; do
448 tmp_has_include="yes"
452 if test "$tmp_has_include" = "yes"; then
453 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
454 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
455 CPPFLAGS="$tmp_chg_FLAGS"
462 dnl CURL_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS])
463 dnl -------------------------------------------------
464 dnl Verify if the C compiler seems to work with the
465 dnl settings that are 'active' at the time the test
468 AC_DEFUN([CURL_COMPILER_WORKS_IFELSE], [
469 dnl compilation capability verification
470 tmp_compiler_works="unknown"
478 tmp_compiler_works="yes"
480 tmp_compiler_works="no"
482 sed 's/^/cc-fail: /' conftest.err >&6
485 dnl linking capability verification
486 if test "$tmp_compiler_works" = "yes"; then
494 tmp_compiler_works="yes"
496 tmp_compiler_works="no"
498 sed 's/^/link-fail: /' conftest.err >&6
502 dnl only do runtime verification when not cross-compiling
503 if test "x$cross_compiling" != "xyes" &&
504 test "$tmp_compiler_works" = "yes"; then
515 tmp_compiler_works="yes"
517 tmp_compiler_works="no"
519 echo "run-fail: test program exited with status $ac_status" >&6
523 dnl branch upon test result
524 if test "$tmp_compiler_works" = "yes"; then
532 dnl CURL_SET_COMPILER_BASIC_OPTS
533 dnl -------------------------------------------------
534 dnl Sets compiler specific options/flags which do not
535 dnl depend on configure's debug, optimize or warnings
538 AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [
539 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
540 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
542 if test "$compiler_id" != "unknown"; then
544 if test "$compiler_id" = "GNU_C" ||
545 test "$compiler_id" = "CLANG"; then
546 CURL_CONVERT_INCLUDE_TO_ISYSTEM
549 tmp_save_CPPFLAGS="$CPPFLAGS"
550 tmp_save_CFLAGS="$CFLAGS"
554 case "$compiler_id" in
558 dnl Disable warnings for unused arguments, otherwise clang will
559 dnl warn about compile-time arguments used during link-time, like
560 dnl -O and -g and -pedantic.
561 tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments"
566 dnl Select strict ANSI C compiler mode
567 tmp_CFLAGS="$tmp_CFLAGS -std1"
568 dnl Turn off optimizer ANSI C aliasing rules
569 tmp_CFLAGS="$tmp_CFLAGS -noansi_alias"
570 dnl Generate warnings for missing function prototypes
571 tmp_CFLAGS="$tmp_CFLAGS -warnprotos"
572 dnl Change some warnings into fatal errors
573 tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs"
578 dnl turn implicit-function-declaration warning into error,
579 dnl at least gcc 2.95 and later support this
580 if test "$compiler_num" -ge "295"; then
581 tmp_CFLAGS="$tmp_CFLAGS -Werror-implicit-function-declaration"
587 dnl Disallow run-time dereferencing of null pointers
588 tmp_CFLAGS="$tmp_CFLAGS -z"
589 dnl Disable some remarks
590 dnl #4227: padding struct with n bytes to align member
591 dnl #4255: padding size of struct with n bytes to alignment boundary
592 tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255"
597 dnl Ensure that compiler optimizations are always thread-safe.
598 tmp_CPPFLAGS="$tmp_CPPFLAGS -qthreaded"
599 dnl Disable type based strict aliasing optimizations, using worst
600 dnl case aliasing assumptions when compiling. Type based aliasing
601 dnl would restrict the lvalues that could be safely used to access
603 tmp_CPPFLAGS="$tmp_CPPFLAGS -qnoansialias"
604 dnl Force compiler to stop after the compilation phase, without
605 dnl generating an object code file when compilation has errors.
606 tmp_CPPFLAGS="$tmp_CPPFLAGS -qhalt=e"
611 dnl On unix this compiler uses gcc's header files, so
612 dnl we select ANSI C89 dialect plus GNU extensions.
613 tmp_CFLAGS="$tmp_CFLAGS -std=gnu89"
614 dnl Change some warnings into errors
615 dnl #140: too many arguments in function call
616 dnl #147: declaration is incompatible with 'previous one'
617 dnl #165: too few arguments in function call
618 dnl #266: function declared implicitly
619 tmp_CPPFLAGS="$tmp_CPPFLAGS -we140,147,165,266"
620 dnl Disable some remarks
621 dnl #279: controlling expression is constant
622 dnl #981: operands are evaluated in unspecified order
623 dnl #1469: "cc" clobber ignored
624 tmp_CPPFLAGS="$tmp_CPPFLAGS -wd279,981,1469"
630 tmp_CFLAGS="$tmp_CFLAGS"
635 dnl Disallow run-time dereferencing of null pointers
636 tmp_CFLAGS="$tmp_CFLAGS -n"
642 tmp_CFLAGS="$tmp_CFLAGS"
648 tmp_CFLAGS="$tmp_CFLAGS"
654 tmp_CFLAGS="$tmp_CFLAGS"
660 tmp_CFLAGS="$tmp_CFLAGS"
666 tmp_CFLAGS="$tmp_CFLAGS"
672 tmp_CFLAGS="$tmp_CFLAGS"
680 if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
681 AC_MSG_CHECKING([if compiler accepts some basic options])
682 CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
683 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
686 CURL_COMPILER_WORKS_IFELSE([
688 AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
691 AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
692 dnl restore initial settings
693 CPPFLAGS="$tmp_save_CPPFLAGS"
694 CFLAGS="$tmp_save_CFLAGS"
702 dnl CURL_SET_COMPILER_DEBUG_OPTS
703 dnl -------------------------------------------------
704 dnl Sets compiler specific options/flags which depend
705 dnl on configure's debug option.
707 AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [
708 AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
709 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
710 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
712 if test "$compiler_id" != "unknown"; then
714 tmp_save_CFLAGS="$CFLAGS"
715 tmp_save_CPPFLAGS="$CPPFLAGS"
719 tmp_CPPFLAGS="$CPPFLAGS"
720 CURL_VAR_STRIP([tmp_CFLAGS],[$flags_dbg_all])
721 CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_dbg_all])
723 if test "$want_debug" = "yes"; then
724 AC_MSG_CHECKING([if compiler accepts debug enabling options])
725 tmp_options="$flags_dbg_yes"
727 if test "$want_debug" = "no"; then
728 AC_MSG_CHECKING([if compiler accepts debug disabling options])
729 tmp_options="$flags_dbg_off"
732 if test "$flags_prefer_cppflags" = "yes"; then
733 CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
736 CPPFLAGS="$tmp_CPPFLAGS"
737 CFLAGS="$tmp_CFLAGS $tmp_options"
741 CURL_COMPILER_WORKS_IFELSE([
743 AC_MSG_NOTICE([compiler options added: $tmp_options])
746 AC_MSG_WARN([compiler options rejected: $tmp_options])
747 dnl restore initial settings
748 CPPFLAGS="$tmp_save_CPPFLAGS"
749 CFLAGS="$tmp_save_CFLAGS"
756 dnl CURL_SET_COMPILER_OPTIMIZE_OPTS
757 dnl -------------------------------------------------
758 dnl Sets compiler specific options/flags which depend
759 dnl on configure's optimize option.
761 AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
762 AC_REQUIRE([CURL_CHECK_OPTION_OPTIMIZE])dnl
763 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
764 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
766 if test "$compiler_id" != "unknown"; then
768 tmp_save_CFLAGS="$CFLAGS"
769 tmp_save_CPPFLAGS="$CPPFLAGS"
773 tmp_CPPFLAGS="$CPPFLAGS"
774 honor_optimize_option="yes"
776 dnl If optimization request setting has not been explicitly specified,
777 dnl it has been derived from the debug setting and initially assumed.
778 dnl This initially assumed optimizer setting will finally be ignored
779 dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies
780 dnl that an initially assumed optimizer setting might not be honored.
782 if test "$want_optimize" = "assume_no" ||
783 test "$want_optimize" = "assume_yes"; then
784 AC_MSG_CHECKING([if compiler optimizer assumed setting might be used])
785 CURL_VAR_MATCH_IFELSE([tmp_CFLAGS],[$flags_opt_all],[
786 honor_optimize_option="no"
788 CURL_VAR_MATCH_IFELSE([tmp_CPPFLAGS],[$flags_opt_all],[
789 honor_optimize_option="no"
791 AC_MSG_RESULT([$honor_optimize_option])
792 if test "$honor_optimize_option" = "yes"; then
793 if test "$want_optimize" = "assume_yes"; then
796 if test "$want_optimize" = "assume_no"; then
802 if test "$honor_optimize_option" = "yes"; then
803 CURL_VAR_STRIP([tmp_CFLAGS],[$flags_opt_all])
804 CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_opt_all])
805 if test "$want_optimize" = "yes"; then
806 AC_MSG_CHECKING([if compiler accepts optimizer enabling options])
807 tmp_options="$flags_opt_yes"
809 if test "$want_optimize" = "no"; then
810 AC_MSG_CHECKING([if compiler accepts optimizer disabling options])
811 tmp_options="$flags_opt_off"
813 if test "$flags_prefer_cppflags" = "yes"; then
814 CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
817 CPPFLAGS="$tmp_CPPFLAGS"
818 CFLAGS="$tmp_CFLAGS $tmp_options"
822 CURL_COMPILER_WORKS_IFELSE([
824 AC_MSG_NOTICE([compiler options added: $tmp_options])
827 AC_MSG_WARN([compiler options rejected: $tmp_options])
828 dnl restore initial settings
829 CPPFLAGS="$tmp_save_CPPFLAGS"
830 CFLAGS="$tmp_save_CFLAGS"
838 dnl CURL_SET_COMPILER_WARNING_OPTS
839 dnl -------------------------------------------------
840 dnl Sets compiler options/flags which depend on
841 dnl configure's warnings given option.
843 AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
844 AC_REQUIRE([CURL_CHECK_OPTION_WARNINGS])dnl
845 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
846 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
848 if test "$compiler_id" != "unknown"; then
850 tmp_save_CPPFLAGS="$CPPFLAGS"
851 tmp_save_CFLAGS="$CFLAGS"
855 case "$compiler_id" in
859 if test "$want_warnings" = "yes"; then
860 tmp_CFLAGS="$tmp_CFLAGS -pedantic"
861 tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra"
862 tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings"
863 tmp_CFLAGS="$tmp_CFLAGS -Wshadow"
864 tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs"
865 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
866 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes"
867 tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
868 tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
869 tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare"
870 tmp_CFLAGS="$tmp_CFLAGS -Wundef"
871 tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
872 tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
873 tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
874 tmp_CFLAGS="$tmp_CFLAGS -Wcast-align"
875 tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers"
876 tmp_CFLAGS="$tmp_CFLAGS -Wshorten-64-to-32"
878 dnl Only clang 1.1 or later
879 if test "$compiler_num" -ge "101"; then
880 tmp_CFLAGS="$tmp_CFLAGS -Wunused"
883 dnl Only clang 2.8 or later
884 if test "$compiler_num" -ge "208"; then
885 tmp_CFLAGS="$tmp_CFLAGS -Wvla"
888 dnl Only clang 2.9 or later
889 if test "$compiler_num" -ge "209"; then
890 tmp_CFLAGS="$tmp_CFLAGS -Wshift-sign-overflow"
893 dnl Only clang 3.2 or later
894 if test "$compiler_num" -ge "302"; then
897 dnl skip missing-variable-declarations warnings for cygwin and
898 dnl mingw because the libtool wrapper executable causes them
901 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-variable-declarations"
906 dnl Only clang 3.6 or later
907 if test "$compiler_num" -ge "306"; then
908 tmp_CFLAGS="$tmp_CFLAGS -Wdouble-promotion"
911 dnl Only clang 3.9 or later
912 if test "$compiler_num" -ge "309"; then
913 tmp_CFLAGS="$tmp_CFLAGS -Wcomma"
914 # avoid the varargs warning, fixed in 4.0
915 # https://bugs.llvm.org/show_bug.cgi?id=29140
916 if test "$compiler_num" -lt "400"; then
917 tmp_CFLAGS="$tmp_CFLAGS -Wno-varargs"
925 if test "$want_warnings" = "yes"; then
926 dnl Select a higher warning level than default level2
927 tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3"
933 if test "$want_warnings" = "yes"; then
935 dnl Do not enable -pedantic when cross-compiling with a gcc older
936 dnl than 3.0, to avoid warnings from third party system headers.
937 if test "x$cross_compiling" != "xyes" ||
938 test "$compiler_num" -ge "300"; then
939 tmp_CFLAGS="$tmp_CFLAGS -pedantic"
942 dnl Set of options we believe *ALL* gcc versions support:
943 tmp_CFLAGS="$tmp_CFLAGS -Wall -W"
945 dnl Only gcc 1.4 or later
946 if test "$compiler_num" -ge "104"; then
947 tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings"
948 dnl If not cross-compiling with a gcc older than 3.0
949 if test "x$cross_compiling" != "xyes" ||
950 test "$compiler_num" -ge "300"; then
951 tmp_CFLAGS="$tmp_CFLAGS -Wunused -Wshadow"
955 dnl Only gcc 2.7 or later
956 if test "$compiler_num" -ge "207"; then
957 tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs"
958 dnl If not cross-compiling with a gcc older than 3.0
959 if test "x$cross_compiling" != "xyes" ||
960 test "$compiler_num" -ge "300"; then
961 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
962 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes"
966 dnl Only gcc 2.95 or later
967 if test "$compiler_num" -ge "295"; then
968 tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
971 dnl Only gcc 2.96 or later
972 if test "$compiler_num" -ge "296"; then
973 tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
974 tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare"
975 dnl -Wundef used only if gcc is 2.96 or later since we get
976 dnl lots of "`_POSIX_C_SOURCE' is not defined" in system
977 dnl headers with gcc 2.95.4 on FreeBSD 4.9
978 tmp_CFLAGS="$tmp_CFLAGS -Wundef"
981 dnl Only gcc 2.97 or later
982 if test "$compiler_num" -ge "297"; then
983 tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
986 dnl Only gcc 3.0 or later
987 if test "$compiler_num" -ge "300"; then
988 dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
989 dnl on i686-Linux as it gives us heaps with false positives.
990 dnl Also, on gcc 4.0.X it is totally unbearable and complains all
991 dnl over making it unusable for generic purposes. Let's not use it.
992 tmp_CFLAGS="$tmp_CFLAGS"
995 dnl Only gcc 3.3 or later
996 if test "$compiler_num" -ge "303"; then
997 tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
1000 dnl Only gcc 3.4 or later
1001 if test "$compiler_num" -ge "304"; then
1002 tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
1005 dnl Only gcc 4.0 or later
1006 if test "$compiler_num" -ge "400"; then
1007 tmp_CFLAGS="$tmp_CFLAGS -Wstrict-aliasing=3"
1010 dnl Only gcc 4.2 or later
1011 if test "$compiler_num" -ge "402"; then
1012 tmp_CFLAGS="$tmp_CFLAGS -Wcast-align"
1015 dnl Only gcc 4.3 or later
1016 if test "$compiler_num" -ge "403"; then
1017 tmp_CFLAGS="$tmp_CFLAGS -Wtype-limits -Wold-style-declaration"
1018 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-parameter-type -Wempty-body"
1019 tmp_CFLAGS="$tmp_CFLAGS -Wclobbered -Wignored-qualifiers"
1020 tmp_CFLAGS="$tmp_CFLAGS -Wconversion -Wno-sign-conversion -Wvla"
1023 dnl Only gcc 4.5 or later
1024 if test "$compiler_num" -ge "405"; then
1025 dnl Only windows targets
1026 if test "$curl_cv_have_def__WIN32" = "yes"; then
1027 tmp_CFLAGS="$tmp_CFLAGS -Wno-pedantic-ms-format"
1031 dnl Only gcc 4.6 or later
1032 if test "$compiler_num" -ge "406"; then
1033 tmp_CFLAGS="$tmp_CFLAGS -Wdouble-promotion"
1038 dnl Do not issue warnings for code in system include paths.
1039 if test "$compiler_num" -ge "300"; then
1040 tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers"
1042 dnl When cross-compiling with a gcc older than 3.0, disable
1043 dnl some warnings triggered on third party system headers.
1044 if test "x$cross_compiling" = "xyes"; then
1045 if test "$compiler_num" -ge "104"; then
1046 dnl gcc 1.4 or later
1047 tmp_CFLAGS="$tmp_CFLAGS -Wno-unused -Wno-shadow"
1049 if test "$compiler_num" -ge "207"; then
1050 dnl gcc 2.7 or later
1051 tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-declarations"
1052 tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-prototypes"
1060 if test "$want_warnings" = "yes"; then
1061 dnl Issue all warnings
1062 tmp_CFLAGS="$tmp_CFLAGS +w1"
1069 tmp_CFLAGS="$tmp_CFLAGS"
1074 if test "$want_warnings" = "yes"; then
1075 if test "$compiler_num" -gt "600"; then
1076 dnl Show errors, warnings, and remarks
1077 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall -w2"
1078 dnl Perform extra compile-time code checking
1079 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck"
1080 dnl Warn on nested comments
1081 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcomment"
1082 dnl Show warnings relative to deprecated features
1083 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wdeprecated"
1084 dnl Enable warnings for missing prototypes
1085 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wmissing-prototypes"
1086 dnl Enable warnings for 64-bit portability issues
1087 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wp64"
1088 dnl Enable warnings for questionable pointer arithmetic
1089 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wpointer-arith"
1090 dnl Check for function return typw issues
1091 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wreturn-type"
1092 dnl Warn on variable declarations hiding a previous one
1093 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wshadow"
1094 dnl Warn when a variable is used before initialized
1095 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wuninitialized"
1096 dnl Warn if a declared function is not used
1097 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wunused-function"
1100 dnl Disable using EBP register in optimizations
1101 tmp_CFLAGS="$tmp_CFLAGS -fno-omit-frame-pointer"
1102 dnl Disable use of ANSI C aliasing rules in optimizations
1103 tmp_CFLAGS="$tmp_CFLAGS -fno-strict-aliasing"
1104 dnl Value-safe optimizations on floating-point data
1105 tmp_CFLAGS="$tmp_CFLAGS -fp-model precise"
1106 dnl Only icc 10.0 or later
1107 if test "$compiler_num" -ge "1000"; then
1108 dnl Disable vectorizer diagnostic information
1109 tmp_CFLAGS="$tmp_CFLAGS -vec-report0"
1116 tmp_CFLAGS="$tmp_CFLAGS"
1121 if test "$want_warnings" = "yes"; then
1122 dnl Highest warning level is double -A, next is single -A.
1123 dnl Due to the big number of warnings these trigger on third
1124 dnl party header files it is impractical for us to use any of
1125 dnl them here. If you want them simply define it in CPPFLAGS.
1126 tmp_CFLAGS="$tmp_CFLAGS"
1132 if test "$want_warnings" = "yes"; then
1133 dnl Perform stricter semantic and lint-like checks
1134 tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
1140 if test "$want_warnings" = "yes"; then
1141 dnl Perform stricter semantic and lint-like checks
1142 tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
1143 dnl Disable some remarks
1144 dnl #1209: controlling expression is constant
1145 tmp_CFLAGS="$tmp_CFLAGS -woff 1209"
1151 if test "$want_warnings" = "yes"; then
1152 dnl Perform stricter semantic and lint-like checks
1153 tmp_CFLAGS="$tmp_CFLAGS -v"
1159 if test "$want_warnings" = "yes"; then
1160 dnl Activate all warnings
1161 tmp_CFLAGS="$tmp_CFLAGS -Wall"
1162 dnl Make string constants be of type const char *
1163 tmp_CFLAGS="$tmp_CFLAGS -Wwrite-strings"
1164 dnl Warn use of unsupported GCC features ignored by TCC
1165 tmp_CFLAGS="$tmp_CFLAGS -Wunsupported"
1171 if test "$want_warnings" = "yes"; then
1172 dnl Issue all warnings
1173 tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra"
1180 tmp_CFLAGS="$tmp_CFLAGS"
1185 squeeze tmp_CPPFLAGS
1188 if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
1189 AC_MSG_CHECKING([if compiler accepts strict warning options])
1190 CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
1191 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
1194 CURL_COMPILER_WORKS_IFELSE([
1195 AC_MSG_RESULT([yes])
1196 AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
1199 AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
1200 dnl restore initial settings
1201 CPPFLAGS="$tmp_save_CPPFLAGS"
1202 CFLAGS="$tmp_save_CFLAGS"
1210 dnl CURL_SHFUNC_SQUEEZE
1211 dnl -------------------------------------------------
1212 dnl Declares a shell function squeeze() which removes
1213 dnl redundant whitespace out of a shell variable.
1215 AC_DEFUN([CURL_SHFUNC_SQUEEZE], [
1218 eval _sqz_input=\[$][$]1
1219 for _sqz_token in $_sqz_input; do
1220 if test -z "$_sqz_result"; then
1221 _sqz_result="$_sqz_token"
1223 _sqz_result="$_sqz_result $_sqz_token"
1226 eval [$]1=\$_sqz_result
1232 dnl CURL_CHECK_CURLDEBUG
1233 dnl -------------------------------------------------
1234 dnl Settings which depend on configure's curldebug given
1235 dnl option, and other additional configure pre-requisites.
1236 dnl Actually the curl debug memory tracking feature can
1237 dnl only be used/enabled when libcurl is built as a static
1238 dnl library or as a shared one on those systems on which
1239 dnl shared libraries support undefined symbols.
1241 AC_DEFUN([CURL_CHECK_CURLDEBUG], [
1242 AC_REQUIRE([XC_LIBTOOL])dnl
1243 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
1244 supports_curldebug="unknown"
1245 if test "$want_curldebug" = "yes"; then
1246 if test "x$enable_shared" != "xno" &&
1247 test "x$enable_shared" != "xyes"; then
1248 AC_MSG_WARN([unknown enable_shared setting.])
1249 supports_curldebug="no"
1251 if test "x$enable_static" != "xno" &&
1252 test "x$enable_static" != "xyes"; then
1253 AC_MSG_WARN([unknown enable_static setting.])
1254 supports_curldebug="no"
1256 if test "$supports_curldebug" != "no"; then
1257 if test "$enable_shared" = "yes" &&
1258 test "x$xc_lt_shlib_use_no_undefined" = 'xyes'; then
1259 supports_curldebug="no"
1260 AC_MSG_WARN([shared library does not support undefined symbols.])
1265 if test "$want_curldebug" = "yes"; then
1266 AC_MSG_CHECKING([if curl debug memory tracking can be enabled])
1267 test "$supports_curldebug" = "no" || supports_curldebug="yes"
1268 AC_MSG_RESULT([$supports_curldebug])
1269 if test "$supports_curldebug" = "no"; then
1270 AC_MSG_WARN([cannot enable curl debug memory tracking.])
1275 if test "$want_curldebug" = "yes"; then
1276 CPPFLAGS="-DCURLDEBUG $CPPFLAGS"
1279 if test "$want_debug" = "yes"; then
1280 CPPFLAGS="-DDEBUGBUILD $CPPFLAGS"
1287 dnl CURL_CHECK_COMPILER_HALT_ON_ERROR
1288 dnl -------------------------------------------------
1289 dnl Verifies if the compiler actually halts after the
1290 dnl compilation phase without generating any object
1291 dnl code file, when the source compiles with errors.
1293 AC_DEFUN([CURL_CHECK_COMPILER_HALT_ON_ERROR], [
1294 AC_MSG_CHECKING([if compiler halts on compilation errors])
1298 force compilation error
1302 AC_MSG_ERROR([compiler does not halt on compilation errors.])
1304 AC_MSG_RESULT([yes])
1309 dnl CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
1310 dnl -------------------------------------------------
1311 dnl Verifies if the compiler actually halts after the
1312 dnl compilation phase without generating any object
1313 dnl code file, when the source code tries to define a
1314 dnl type for a constant array with negative dimension.
1316 AC_DEFUN([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [
1317 AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])dnl
1318 AC_MSG_CHECKING([if compiler halts on negative sized arrays])
1321 typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ];
1327 AC_MSG_ERROR([compiler does not halt on negative sized arrays.])
1329 AC_MSG_RESULT([yes])
1334 dnl CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE
1335 dnl -------------------------------------------------
1336 dnl Verifies if the compiler is capable of handling the
1337 dnl size of a struct member, struct which is a function
1338 dnl result, as a compilation-time condition inside the
1339 dnl type definition of a constant array.
1341 AC_DEFUN([CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE], [
1342 AC_REQUIRE([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE])dnl
1343 AC_MSG_CHECKING([if compiler struct member size checking works])
1344 tst_compiler_check_one_works="unknown"
1350 struct mystruct *next;
1352 struct mystruct myfunc();
1353 typedef char good_t1[sizeof(myfunc().mi) == sizeof(int) ? 1 : -1 ];
1354 typedef char good_t2[sizeof(myfunc().mc) == sizeof(char) ? 1 : -1 ];
1360 tst_compiler_check_one_works="yes"
1362 tst_compiler_check_one_works="no"
1363 sed 's/^/cc-src: /' conftest.$ac_ext >&6
1364 sed 's/^/cc-err: /' conftest.err >&6
1366 tst_compiler_check_two_works="unknown"
1372 struct mystruct *next;
1374 struct mystruct myfunc();
1375 typedef char bad_t1[sizeof(myfunc().mi) != sizeof(int) ? 1 : -1 ];
1376 typedef char bad_t2[sizeof(myfunc().mc) != sizeof(char) ? 1 : -1 ];
1382 tst_compiler_check_two_works="no"
1384 tst_compiler_check_two_works="yes"
1386 if test "$tst_compiler_check_one_works" = "yes" &&
1387 test "$tst_compiler_check_two_works" = "yes"; then
1388 AC_MSG_RESULT([yes])
1391 AC_MSG_ERROR([compiler fails struct member size checking.])
1396 dnl CURL_CHECK_COMPILER_SYMBOL_HIDING
1397 dnl -------------------------------------------------
1398 dnl Verify if compiler supports hiding library internal symbols, setting
1399 dnl shell variable supports_symbol_hiding value as appropriate, as well as
1400 dnl variables symbol_hiding_CFLAGS and symbol_hiding_EXTERN when supported.
1402 AC_DEFUN([CURL_CHECK_COMPILER_SYMBOL_HIDING], [
1403 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
1404 AC_BEFORE([$0],[CURL_CONFIGURE_SYMBOL_HIDING])dnl
1405 AC_MSG_CHECKING([if compiler supports hiding library internal symbols])
1406 supports_symbol_hiding="no"
1407 symbol_hiding_CFLAGS=""
1408 symbol_hiding_EXTERN=""
1411 case "$compiler_id" in
1413 dnl All versions of clang support -fvisibility=
1414 tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
1415 tmp_CFLAGS="-fvisibility=hidden"
1416 supports_symbol_hiding="yes"
1419 dnl Only gcc 3.4 or later
1420 if test "$compiler_num" -ge "304"; then
1421 if $CC --help --verbose 2>/dev/null | grep fvisibility= >/dev/null ; then
1422 tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
1423 tmp_CFLAGS="-fvisibility=hidden"
1424 supports_symbol_hiding="yes"
1429 dnl Only icc 9.0 or later
1430 if test "$compiler_num" -ge "900"; then
1431 if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
1432 tmp_save_CFLAGS="$CFLAGS"
1433 CFLAGS="$CFLAGS -fvisibility=hidden"
1438 printf("icc fvisibility bug test");
1441 tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
1442 tmp_CFLAGS="-fvisibility=hidden"
1443 supports_symbol_hiding="yes"
1445 CFLAGS="$tmp_save_CFLAGS"
1450 if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
1451 tmp_EXTERN="__global"
1452 tmp_CFLAGS="-xldscope=hidden"
1453 supports_symbol_hiding="yes"
1457 if test "$supports_symbol_hiding" = "yes"; then
1458 tmp_save_CFLAGS="$CFLAGS"
1459 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
1463 $tmp_EXTERN char *dummy(char *buff);
1464 char *dummy(char *buff)
1473 char *r = dummy(&b[0]);
1478 supports_symbol_hiding="yes"
1479 if test -f conftest.err; then
1480 grep 'visibility' conftest.err >/dev/null
1481 if test "$?" -eq "0"; then
1482 supports_symbol_hiding="no"
1486 supports_symbol_hiding="no"
1488 sed 's/^/cc-src: /' conftest.$ac_ext >&6
1489 sed 's/^/cc-err: /' conftest.err >&6
1492 CFLAGS="$tmp_save_CFLAGS"
1494 if test "$supports_symbol_hiding" = "yes"; then
1495 AC_MSG_RESULT([yes])
1496 symbol_hiding_CFLAGS="$tmp_CFLAGS"
1497 symbol_hiding_EXTERN="$tmp_EXTERN"
1504 dnl CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
1505 dnl -------------------------------------------------
1506 dnl Verifies if the compiler actually halts after the
1507 dnl compilation phase without generating any object
1508 dnl code file, when the source code tries to redefine
1509 dnl a prototype which does not match previous one.
1511 AC_DEFUN([CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH], [
1512 AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])dnl
1513 AC_MSG_CHECKING([if compiler halts on function prototype mismatch])
1516 # include <stdlib.h>
1533 AC_MSG_ERROR([compiler does not halt on function prototype mismatch.])
1535 AC_MSG_RESULT([yes])
1540 dnl CURL_VAR_MATCH (VARNAME, VALUE)
1541 dnl -------------------------------------------------
1542 dnl Verifies if shell variable VARNAME contains VALUE.
1543 dnl Contents of variable VARNAME and VALUE are handled
1544 dnl as whitespace separated lists of words. If at least
1545 dnl one word of VALUE is present in VARNAME the match
1546 dnl is considered positive, otherwise false.
1548 AC_DEFUN([CURL_VAR_MATCH], [
1549 ac_var_match_word="no"
1550 for word1 in $[$1]; do
1551 for word2 in [$2]; do
1552 if test "$word1" = "$word2"; then
1553 ac_var_match_word="yes"
1560 dnl CURL_VAR_MATCH_IFELSE (VARNAME, VALUE,
1561 dnl [ACTION-IF-MATCH], [ACTION-IF-NOT-MATCH])
1562 dnl -------------------------------------------------
1563 dnl This performs a CURL_VAR_MATCH check and executes
1564 dnl first branch if the match is positive, otherwise
1565 dnl the second branch is executed.
1567 AC_DEFUN([CURL_VAR_MATCH_IFELSE], [
1568 CURL_VAR_MATCH([$1],[$2])
1569 if test "$ac_var_match_word" = "yes"; then
1577 dnl CURL_VAR_STRIP (VARNAME, VALUE)
1578 dnl -------------------------------------------------
1579 dnl Contents of variable VARNAME and VALUE are handled
1580 dnl as whitespace separated lists of words. Each word
1581 dnl from VALUE is removed from VARNAME when present.
1583 AC_DEFUN([CURL_VAR_STRIP], [
1584 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
1586 for word1 in $[$1]; do
1587 ac_var_strip_word="no"
1588 for word2 in [$2]; do
1589 if test "$word1" = "$word2"; then
1590 ac_var_strip_word="yes"
1593 if test "$ac_var_strip_word" = "no"; then
1594 ac_var_stripped="$ac_var_stripped $word1"
1597 dnl squeeze whitespace out of result
1598 [$1]="$ac_var_stripped"