1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2008, 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.
22 #***************************************************************************
24 # File version for 'aclocal' use. Keep it a single number.
28 dnl CURL_CHECK_COMPILER
29 dnl -------------------------------------------------
30 dnl Verify if the C compiler being used is known.
32 AC_DEFUN([CURL_CHECK_COMPILER], [
37 flags_dbg_all="unknown"
38 flags_dbg_yes="unknown"
39 flags_dbg_off="unknown"
40 flags_opt_all="unknown"
41 flags_opt_yes="unknown"
42 flags_opt_off="unknown"
44 CURL_CHECK_COMPILER_DEC
45 CURL_CHECK_COMPILER_HP
46 CURL_CHECK_COMPILER_IBM
47 CURL_CHECK_COMPILER_INTEL
48 CURL_CHECK_COMPILER_GNU
49 CURL_CHECK_COMPILER_LCC
50 CURL_CHECK_COMPILER_SGI_MIPSpro_C
51 CURL_CHECK_COMPILER_SGI_MIPS_C
52 CURL_CHECK_COMPILER_SUN
53 CURL_CHECK_COMPILER_TINYC
55 if test "$compiler_id" = "unknown"; then
58 *** Warning: This configure script does not have information about the
59 *** compiler you are using, relative to the flags required to enable or
60 *** disable generation of debug info, optimization options or warnings.
62 *** Whatever settings are present in CFLAGS will be used for this run.
64 *** If you wish to help the cURL project to better support your compiler
65 *** you can report this and the required info on the libcurl development
66 *** mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/
73 dnl CURL_CHECK_COMPILER_DEC
74 dnl -------------------------------------------------
75 dnl Verify if the C compiler being used is DEC's.
77 AC_DEFUN([CURL_CHECK_COMPILER_DEC], [
78 AC_MSG_CHECKING([whether we are using the DEC/Compaq C compiler])
79 CURL_CHECK_DEF([__DECC], [], [silent])
80 CURL_CHECK_DEF([__DECC_VER], [], [silent])
81 if test "$curl_cv_have_def___DECC" = "yes" &&
82 test "$curl_cv_have_def___DECC_VER" = "yes"; then
85 flags_dbg_all="-g -g0 -g1 -g2 -g3"
88 flags_opt_all="-O -O0 -O1 -O2 -O3 -O4"
97 dnl CURL_CHECK_COMPILER_GNU
98 dnl -------------------------------------------------
99 dnl Verify if the C compiler being used is GNU's.
101 AC_DEFUN([CURL_CHECK_COMPILER_GNU], [
102 AC_REQUIRE([CURL_CHECK_COMPILER_INTEL])dnl
104 AC_MSG_CHECKING([whether we are using the GNU C compiler])
105 CURL_CHECK_DEF([__GNUC__], [], [silent])
106 if test "$curl_cv_have_def___GNUC__" = "yes" &&
107 test "$compiler_id" = "unknown"; then
110 gccver=`$CC -dumpversion`
111 gccvhi=`echo $gccver | cut -d . -f1`
112 gccvlo=`echo $gccver | cut -d . -f2`
113 compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
114 flags_dbg_all="-g -g0 -g1 -g2 -g3"
115 flags_dbg_all="$flags_dbg_all -ggdb"
116 flags_dbg_all="$flags_dbg_all -gstabs"
117 flags_dbg_all="$flags_dbg_all -gstabs+"
118 flags_dbg_all="$flags_dbg_all -gcoff"
119 flags_dbg_all="$flags_dbg_all -gxcoff"
120 flags_dbg_all="$flags_dbg_all -gdwarf-2"
121 flags_dbg_all="$flags_dbg_all -gvms"
124 flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
133 dnl CURL_CHECK_COMPILER_HP
134 dnl -------------------------------------------------
135 dnl Verify if the C compiler being used is HP's.
137 AC_DEFUN([CURL_CHECK_COMPILER_HP], [
138 AC_MSG_CHECKING([whether we are using the HP C compiler])
139 CURL_CHECK_DEF([__HP_cc], [], [silent])
140 if test "$curl_cv_have_def___HP_cc" = "yes"; then
143 flags_dbg_all="-g -s"
146 flags_opt_all="-O +O0 +O1 +O2 +O3 +O4"
155 dnl CURL_CHECK_COMPILER_IBM
156 dnl -------------------------------------------------
157 dnl Verify if the C compiler being used is IBM's.
159 AC_DEFUN([CURL_CHECK_COMPILER_IBM], [
160 AC_MSG_CHECKING([whether we are using the IBM C compiler])
161 CURL_CHECK_DEF([__IBMC__], [], [silent])
162 if test "$curl_cv_have_def___IBMC__" = "yes"; then
165 flags_dbg_all="-g -g0 -g1 -g2 -g3"
168 flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5"
169 flags_opt_all="$flags_opt_all -qnooptimize"
170 flags_opt_all="$flags_opt_all -qoptimize=0"
171 flags_opt_all="$flags_opt_all -qoptimize=1"
172 flags_opt_all="$flags_opt_all -qoptimize=2"
173 flags_opt_all="$flags_opt_all -qoptimize=3"
174 flags_opt_all="$flags_opt_all -qoptimize=4"
175 flags_opt_all="$flags_opt_all -qoptimize=5"
177 flags_opt_off="-qnooptimize"
184 dnl CURL_CHECK_COMPILER_INTEL
185 dnl -------------------------------------------------
186 dnl Verify if the C compiler being used is Intel's.
188 AC_DEFUN([CURL_CHECK_COMPILER_INTEL], [
189 AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU])dnl
190 AC_MSG_CHECKING([whether we are using the Intel C compiler])
191 CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent])
192 if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then
194 CURL_CHECK_DEF([__unix__], [], [silent])
195 if test "$curl_cv_have_def___unix__" = "yes"; then
196 compiler_id="ICC_unix"
197 flags_dbg_all="-g -g0"
200 flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
204 compiler_id="ICC_windows"
205 flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-"
206 flags_dbg_all="$flags_dbg_all /debug"
207 flags_dbg_all="$flags_dbg_all /debug:none"
208 flags_dbg_all="$flags_dbg_all /debug:minimal"
209 flags_dbg_all="$flags_dbg_all /debug:partial"
210 flags_dbg_all="$flags_dbg_all /debug:full"
211 flags_dbg_all="$flags_dbg_all /debug:semantic_stepping"
212 flags_dbg_all="$flags_dbg_all /debug:extended"
213 flags_dbg_yes="/Zi /Oy-"
214 flags_dbg_off="/debug:none /Oy-"
215 flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-"
219 compiler_num="$curl_cv_def___INTEL_COMPILER"
226 dnl CURL_CHECK_COMPILER_LCC
227 dnl -------------------------------------------------
228 dnl Verify if the C compiler being used is LCC.
230 AC_DEFUN([CURL_CHECK_COMPILER_LCC], [
231 AC_MSG_CHECKING([whether we are using the LCC C compiler])
232 CURL_CHECK_DEF([__LCC__], [], [silent])
233 if test "$curl_cv_have_def___LCC__" = "yes"; then
248 dnl CURL_CHECK_COMPILER_SGI_MIPS_C
249 dnl -------------------------------------------------
250 dnl Verify if the C compiler being used is SGI's.
252 AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPS_C], [
253 AC_REQUIRE([CURL_CHECK_COMPILER_SGI_MIPSpro_C])dnl
254 AC_MSG_CHECKING([if compiler is SGI MIPS C])
255 CURL_CHECK_DEF([__GNUC__], [], [silent])
256 CURL_CHECK_DEF([__sgi], [], [silent])
257 if test "$curl_cv_have_def___GNUC__" = "no" &&
258 test "$curl_cv_have_def___sgi" = "yes" &&
259 test "$compiler_id" = "unknown"; then
261 compiler_id="SGI_MIPS_C"
262 flags_dbg_all="-g -g0 -g1 -g2 -g3"
265 flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
274 dnl CURL_CHECK_COMPILER_SGI_MIPSpro_C
275 dnl -------------------------------------------------
276 dnl Verify if the C compiler being used is SGI's.
278 AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPSpro_C], [
279 AC_BEFORE([$0],[CURL_CHECK_COMPILER_SGI_MIPS_C])dnl
280 AC_MSG_CHECKING([if compiler is SGI MIPSpro C])
281 CURL_CHECK_DEF([__GNUC__], [], [silent])
282 CURL_CHECK_DEF([_SGI_COMPILER_VERSION], [], [silent])
283 if test "$curl_cv_have_def___GNUC__" = "no" &&
284 test "$curl_cv_have_def__SGI_COMPILER_VERSION" = "yes"; then
286 compiler_id="SGI_MIPSpro_C"
287 flags_dbg_all="-g -g0 -g1 -g2 -g3"
290 flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
299 dnl CURL_CHECK_COMPILER_SUN
300 dnl -------------------------------------------------
301 dnl Verify if the C compiler being used is SUN's.
303 AC_DEFUN([CURL_CHECK_COMPILER_SUN], [
304 AC_MSG_CHECKING([whether we are using the SUN C compiler])
305 CURL_CHECK_DEF([__SUNPRO_C], [], [silent])
306 if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then
309 flags_dbg_all="-g -s"
312 flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5"
321 dnl CURL_CHECK_COMPILER_TINYC
322 dnl -------------------------------------------------
323 dnl Verify if the C compiler being used is TINYC.
325 AC_DEFUN([CURL_CHECK_COMPILER_TINYC], [
326 AC_MSG_CHECKING([whether we are using the TinyCC C compiler])
327 CURL_CHECK_DEF([__TINYC__], [], [silent])
328 if test "$curl_cv_have_def___TINYC__" = "yes"; then
331 flags_dbg_all="-g -b"
332 flags_dbg_yes="-g -b"
343 dnl CURL_CONVERT_INCLUDE_TO_ISYSTEM
344 dnl -------------------------------------------------
345 dnl Changes standard include paths present in CFLAGS
346 dnl and CPPFLAGS into isystem include paths. This is
347 dnl done to prevent GNUC from generating warnings on
348 dnl headers from these locations, even though this is
349 dnl not reliable on ancient GNUC versions.
351 AC_DEFUN([CURL_CONVERT_INCLUDE_TO_ISYSTEM], [
353 tmp_chg_FLAGS=$CFLAGS
354 for word1 in $tmp_chg_FLAGS; do
357 tmp_has_include="yes"
361 if test "$tmp_has_include" = "yes"; then
362 tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/^-I/ -isystem /g'`
363 tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/ -I/ -isystem /g'`
364 CFLAGS=`eval echo $tmp_chg_FLAGS`
367 tmp_chg_FLAGS=$CPPFLAGS
368 for word1 in $tmp_chg_FLAGS; do
371 tmp_has_include="yes"
375 if test "$tmp_has_include" = "yes"; then
376 tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/^-I/ -isystem /g'`
377 tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/ -I/ -isystem /g'`
378 CPPFLAGS=`eval echo $tmp_chg_FLAGS`
383 dnl CURL_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS])
384 dnl -------------------------------------------------
385 dnl Verify if the C compiler seems to work with the
386 dnl settings that are 'active' at the time the test
389 AC_DEFUN([CURL_COMPILER_WORKS_IFELSE], [
390 dnl compilation capability verification
391 tmp_compiler_works="unknown"
399 tmp_compiler_works="yes"
401 tmp_compiler_works="no"
403 sed 's/^/cc-fail> /' conftest.err >&6
406 dnl linking capability verification
407 if test "$tmp_compiler_works" = "yes"; then
415 tmp_compiler_works="yes"
417 tmp_compiler_works="no"
419 sed 's/^/ln-fail> /' conftest.err >&6
423 dnl only do runtime verification when not cross-compiling
424 if test "x$cross_compiling" != "xyes" &&
425 test "$tmp_compiler_works" = "yes"; then
436 tmp_compiler_works="yes"
438 tmp_compiler_works="no"
440 echo "rn-fail test program exited with status $ac_status" >&6
444 dnl branch upon test result
445 if test "$tmp_compiler_works" = "yes"; then
453 dnl CURL_SET_COMPILER_BASIC_OPTS
454 dnl -------------------------------------------------
455 dnl Sets compiler specific options/flags which do not
456 dnl depend on configure's debug, optimize or warnings
459 AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [
460 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
462 if test "$compiler_id" != "unknown"; then
464 if test "$compiler_id" = "GNUC"; then
465 CURL_CONVERT_INCLUDE_TO_ISYSTEM
468 tmp_save_CPPFLAGS="$CPPFLAGS"
469 tmp_save_CFLAGS="$CFLAGS"
473 case "$compiler_id" in
477 dnl Select strict ANSI C compiler mode
478 tmp_CFLAGS="$tmp_CFLAGS -std1"
479 dnl Turn off optimizer ANSI C aliasing rules
480 tmp_CFLAGS="$tmp_CFLAGS -noansi_alias"
481 dnl Generate warnings for missing function prototypes
482 tmp_CFLAGS="$tmp_CFLAGS -warnprotos"
483 dnl Change some warnings into fatal errors
484 tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs"
490 tmp_CFLAGS="$tmp_CFLAGS"
495 dnl Disallow run-time dereferencing of null pointers
496 tmp_CFLAGS="$tmp_CFLAGS -z"
497 dnl Disable some remarks
498 dnl #4227: padding struct with n bytes to align member
499 dnl #4255: padding size of struct with n bytes to alignment boundary
500 tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255"
505 dnl Ensure that compiler optimizations are always thread-safe.
506 tmp_CFLAGS="$tmp_CFLAGS -qthreaded"
507 dnl Disable type based strict aliasing optimizations, using worst
508 dnl case aliasing assumptions when compiling. Type based aliasing
509 dnl would restrict the lvalues that could be safely used to access
511 tmp_CFLAGS="$tmp_CFLAGS -qnoansialias"
512 dnl Force compiler to stop after the compilation phase, without
513 dnl generating an object code file when compilation has errors.
514 tmp_CFLAGS="$tmp_CFLAGS -qhalt=e"
519 dnl On unix this compiler uses gcc's header files, so
520 dnl we select ANSI C89 dialect plus GNU extensions.
521 tmp_CPPFLAGS="$tmp_CPPFLAGS -std=gnu89"
522 dnl Change some warnings into errors
523 dnl #140: too many arguments in function call
524 dnl #147: declaration is incompatible with 'previous one'
525 dnl #165: too few arguments in function call
526 dnl #266: function declared implicitly
527 tmp_CPPFLAGS="$tmp_CPPFLAGS -we 140,147,165,266"
528 dnl Disable some remarks
529 dnl #279: controlling expression is constant
530 dnl #981: operands are evaluated in unspecified order
531 dnl #1469: "cc" clobber ignored
532 tmp_CPPFLAGS="$tmp_CPPFLAGS -wd 279,981,1469"
533 dnl Disable use of ANSI C aliasing rules in optimizations
534 tmp_CFLAGS="$tmp_CFLAGS -no-ansi-alias"
535 dnl Disable floating point optimizations
536 tmp_CFLAGS="$tmp_CFLAGS -fp-model precise"
542 tmp_CFLAGS="$tmp_CFLAGS"
547 dnl Disallow run-time dereferencing of null pointers
548 tmp_CFLAGS="$tmp_CFLAGS -n"
554 tmp_CFLAGS="$tmp_CFLAGS"
560 tmp_CFLAGS="$tmp_CFLAGS"
566 tmp_CFLAGS="$tmp_CFLAGS"
572 tmp_CFLAGS="$tmp_CFLAGS"
577 tmp_CPPFLAGS=`eval echo $tmp_CPPFLAGS`
578 tmp_CFLAGS=`eval echo $tmp_CFLAGS`
580 if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
581 AC_MSG_CHECKING([if compiler accepts some basic options])
582 CPPFLAGS=`eval echo $tmp_save_CPPFLAGS $tmp_CPPFLAGS`
583 CFLAGS=`eval echo $tmp_save_CFLAGS $tmp_CFLAGS`
584 CURL_COMPILER_WORKS_IFELSE([
586 AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
589 AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
590 dnl restore initial settings
591 CPPFLAGS="$tmp_save_CPPFLAGS"
592 CFLAGS="$tmp_save_CFLAGS"
600 dnl CURL_SET_COMPILER_DEBUG_OPTS
601 dnl -------------------------------------------------
602 dnl Sets compiler specific options/flags which depend
603 dnl on configure's debug option.
605 AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [
606 AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
607 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
609 if test "$compiler_id" != "unknown"; then
611 tmp_save_CFLAGS="$CFLAGS"
612 tmp_save_CPPFLAGS="$CPPFLAGS"
616 tmp_CPPFLAGS="$CPPFLAGS"
617 CURL_VAR_STRIP([tmp_CFLAGS],[$flags_dbg_all])
618 CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_dbg_all])
620 if test "$want_debug" = "yes"; then
621 AC_MSG_CHECKING([if compiler accepts debug enabling options])
622 tmp_options="$flags_dbg_yes"
624 if test "$want_debug" = "no"; then
625 AC_MSG_CHECKING([if compiler accepts debug disabling options])
626 tmp_options="$flags_dbg_off"
629 CPPFLAGS=`eval echo $tmp_CPPFLAGS`
630 CFLAGS=`eval echo $tmp_CFLAGS $tmp_options`
631 CURL_COMPILER_WORKS_IFELSE([
633 AC_MSG_NOTICE([compiler options added: $tmp_options])
636 AC_MSG_WARN([compiler options rejected: $tmp_options])
637 dnl restore initial settings
638 CPPFLAGS="$tmp_save_CPPFLAGS"
639 CFLAGS="$tmp_save_CFLAGS"
646 dnl CURL_SET_COMPILER_OPTIMIZE_OPTS
647 dnl -------------------------------------------------
648 dnl Sets compiler specific options/flags which depend
649 dnl on configure's optimize option.
651 AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
652 AC_REQUIRE([CURL_CHECK_OPTION_OPTIMIZE])dnl
653 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
655 if test "$compiler_id" != "unknown"; then
657 tmp_save_CFLAGS="$CFLAGS"
658 tmp_save_CPPFLAGS="$CPPFLAGS"
662 tmp_CPPFLAGS="$CPPFLAGS"
663 honor_optimize_option="yes"
665 dnl If optimization request setting has not been explicitly specified,
666 dnl it has been derived from the debug setting and initially assumed.
667 dnl This initially assumed optimizer setting will finally be ignored
668 dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies
669 dnl that an initially assumed optimizer setting might not be honored.
671 if test "$want_optimize" = "assume_no" ||
672 test "$want_optimize" = "assume_yes"; then
673 AC_MSG_CHECKING([if compiler optimizer assumed setting might be used])
674 CURL_VAR_MATCH_IFELSE([tmp_CFLAGS],[$flags_opt_all],[
675 honor_optimize_option="no"
677 CURL_VAR_MATCH_IFELSE([tmp_CPPFLAGS],[$flags_opt_all],[
678 honor_optimize_option="no"
680 AC_MSG_RESULT([$honor_optimize_option])
681 if test "$honor_optimize_option" = "yes"; then
682 if test "$want_optimize" = "assume_yes"; then
685 if test "$want_optimize" = "assume_no"; then
691 if test "$honor_optimize_option" = "yes"; then
692 CURL_VAR_STRIP([tmp_CFLAGS],[$flags_opt_all])
693 CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_opt_all])
694 if test "$want_optimize" = "yes"; then
695 AC_MSG_CHECKING([if compiler accepts optimizer enabling options])
696 tmp_options="$flags_opt_yes"
698 if test "$want_optimize" = "no"; then
699 AC_MSG_CHECKING([if compiler accepts optimizer disabling options])
700 tmp_options="$flags_opt_off"
702 CPPFLAGS=`eval echo $tmp_CPPFLAGS`
703 CFLAGS=`eval echo $tmp_CFLAGS $tmp_options`
704 CURL_COMPILER_WORKS_IFELSE([
706 AC_MSG_NOTICE([compiler options added: $tmp_options])
709 AC_MSG_WARN([compiler options rejected: $tmp_options])
710 dnl restore initial settings
711 CPPFLAGS="$tmp_save_CPPFLAGS"
712 CFLAGS="$tmp_save_CFLAGS"
720 dnl CURL_SET_COMPILER_WARNING_OPTS
721 dnl -------------------------------------------------
722 dnl Sets compiler options/flags which depend on
723 dnl configure's warnings given option.
725 AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
726 AC_REQUIRE([CURL_CHECK_OPTION_WARNINGS])dnl
727 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
729 if test "$compiler_id" != "unknown"; then
731 tmp_save_CPPFLAGS="$CPPFLAGS"
732 tmp_save_CFLAGS="$CFLAGS"
736 case "$compiler_id" in
740 if test "$want_warnings" = "yes"; then
741 dnl Select a higher warning level than default level2
742 tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3"
748 if test "$want_warnings" = "yes"; then
749 dnl Set of options we believe *ALL* gcc versions support:
750 tmp_CFLAGS="$tmp_CFLAGS -pedantic -Wall -W -Winline -Wnested-externs"
751 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes -Wpointer-arith"
752 tmp_CFLAGS="$tmp_CFLAGS -Wwrite-strings"
753 dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
754 if test "$compiler_num" -ge "207"; then
756 tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
758 if test "$compiler_num" -gt "295"; then
759 dnl only if the compiler is newer than 2.95 since we got lots of
760 dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
761 dnl gcc 2.95.4 on FreeBSD 4.9!
762 tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long -Wno-multichar -Wshadow"
763 tmp_CFLAGS="$tmp_CFLAGS -Wsign-compare -Wundef"
765 if test "$compiler_num" -ge "296"; then
766 dnl gcc 2.96 or later
767 tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
769 if test "$compiler_num" -gt "296"; then
770 dnl this option does not exist in 2.96
771 tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
773 dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
774 dnl on i686-Linux as it gives us heaps with false positives.
775 dnl Also, on gcc 4.0.X it is totally unbearable and complains all
776 dnl over making it unusable for generic purposes. Let's not use it.
777 if test "$compiler_num" -ge "303"; then
778 dnl gcc 3.3 and later
779 tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
781 if test "$compiler_num" -ge "304"; then
782 dnl gcc 3.4 and later
783 tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
790 if test "$want_warnings" = "yes"; then
791 dnl Issue all warnings
792 dnl tmp_CFLAGS="$tmp_CFLAGS +w1"
793 dnl Due to the HP-UX socklen_t issue it is insane to use the +w1
794 dnl warning level. Until the issue is somehow fixed we will just
795 dnl use the +w2 warning level.
796 tmp_CFLAGS="$tmp_CFLAGS +w2"
803 tmp_CFLAGS="$tmp_CFLAGS"
808 if test "$want_warnings" = "yes"; then
809 if test "$compiler_num" -gt "600"; then
810 dnl Show errors, warnings, and remarks
811 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall"
812 dnl Perform extra compile-time code checking
813 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck"
821 tmp_CFLAGS="$tmp_CFLAGS"
826 if test "$want_warnings" = "yes"; then
827 dnl Highest warning level is double -A, next is single -A.
828 dnl Due to the big number of warnings this triggers on third
829 dnl party header files it is impratical for us to use this
830 dnl warning level here. If you want them define it in CFLAGS.
831 tmp_CFLAGS="$tmp_CFLAGS -A"
837 if test "$want_warnings" = "yes"; then
838 dnl Perform stricter semantic and lint-like checks
839 tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
845 if test "$want_warnings" = "yes"; then
846 dnl Perform stricter semantic and lint-like checks
847 tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
848 dnl Disable some remarks
849 dnl #1209: controlling expression is constant
850 tmp_CFLAGS="$tmp_CFLAGS -woff 1209"
856 if test "$want_warnings" = "yes"; then
857 dnl Perform stricter semantic and lint-like checks
858 tmp_CFLAGS="$tmp_CFLAGS -v"
864 if test "$want_warnings" = "yes"; then
865 dnl Activate all warnings
866 tmp_CFLAGS="$tmp_CFLAGS -Wall"
867 dnl Make string constants be of type const char *
868 tmp_CFLAGS="$tmp_CFLAGS -Wwrite-strings"
869 dnl Warn use of unsupported GCC features ignored by TCC
870 tmp_CFLAGS="$tmp_CFLAGS -Wunsupported"
876 tmp_CPPFLAGS=`eval echo $tmp_CPPFLAGS`
877 tmp_CFLAGS=`eval echo $tmp_CFLAGS`
879 if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
880 AC_MSG_CHECKING([if compiler accepts strict warning options])
881 CPPFLAGS=`eval echo $tmp_save_CPPFLAGS $tmp_CPPFLAGS`
882 CFLAGS=`eval echo $tmp_save_CFLAGS $tmp_CFLAGS`
883 CURL_COMPILER_WORKS_IFELSE([
885 AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
888 AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
889 dnl restore initial settings
890 CPPFLAGS="$tmp_save_CPPFLAGS"
891 CFLAGS="$tmp_save_CFLAGS"
899 dnl CURL_PROCESS_DEBUG_BUILD_OPTS
900 dnl -------------------------------------------------
901 dnl Settings which depend on configure's debug given
902 dnl option, and further configure the build process.
903 dnl Don't use this macro for compiler dependant stuff.
905 AC_DEFUN([CURL_PROCESS_DEBUG_BUILD_OPTS], [
906 AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
907 AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
909 if test "$want_debug" = "yes"; then
910 CPPFLAGS="$CPPFLAGS -DCURLDEBUG"
916 dnl CURL_CHECK_PROG_CC
917 dnl -------------------------------------------------
918 dnl Check for compiler program, preventing CFLAGS and
919 dnl CPPFLAGS from being unexpectedly changed.
921 AC_DEFUN([CURL_CHECK_PROG_CC], [
922 ac_save_CFLAGS="$CFLAGS"
923 ac_save_CPPFLAGS="$CPPFLAGS"
925 CFLAGS="$ac_save_CFLAGS"
926 CPPFLAGS="$ac_save_CPPFLAGS"
930 dnl CURL_VAR_MATCH (VARNAME, VALUE)
931 dnl -------------------------------------------------
932 dnl Verifies if shell variable VARNAME contains VALUE.
933 dnl Contents of variable VARNAME and VALUE are handled
934 dnl as whitespace separated lists of words. If at least
935 dnl one word of VALUE is present in VARNAME the match
936 dnl is considered positive, otherwise false.
938 AC_DEFUN([CURL_VAR_MATCH], [
939 ac_var_match_word="no"
940 for word1 in $[$1]; do
941 for word2 in [$2]; do
942 if test "$word1" = "$word2"; then
943 ac_var_match_word="yes"
950 dnl CURL_VAR_MATCH_IFELSE (VARNAME, VALUE,
951 dnl [ACTION-IF-MATCH], [ACTION-IF-NOT-MATCH])
952 dnl -------------------------------------------------
953 dnl This performs a CURL_VAR_MATCH check and executes
954 dnl first branch if the match is positive, otherwise
955 dnl the second branch is executed.
957 AC_DEFUN([CURL_VAR_MATCH_IFELSE], [
958 CURL_VAR_MATCH([$1],[$2])
959 if test "$ac_var_match_word" = "yes"; then
967 dnl CURL_VAR_STRIP (VARNAME, VALUE)
968 dnl -------------------------------------------------
969 dnl Contents of variable VARNAME and VALUE are handled
970 dnl as whitespace separated lists of words. Each word
971 dnl from VALUE is removed from VARNAME when present.
973 AC_DEFUN([CURL_VAR_STRIP], [
975 for word1 in $[$1]; do
976 ac_var_strip_word="no"
977 for word2 in [$2]; do
978 if test "$word1" = "$word2"; then
979 ac_var_strip_word="yes"
982 if test "$ac_var_strip_word" = "no"; then
983 ac_var_stripped="$ac_var_stripped $word1"
986 dnl squeeze whitespace out of result
987 [$1]=`eval echo $ac_var_stripped`