1#*************************************************************************** 2# _ _ ____ _ 3# Project ___| | | | _ \| | 4# / __| | | | |_) | | 5# | (__| |_| | _ <| |___ 6# \___|\___/|_| \_\_____| 7# 8# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. 9# 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.se/docs/copyright.html. 13# 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. 17# 18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19# KIND, either express or implied. 20# 21#*************************************************************************** 22 23# File version for 'aclocal' use. Keep it a single number. 24# serial 67 25 26 27dnl CURL_CHECK_COMPILER 28dnl ------------------------------------------------- 29dnl Verify if the C compiler being used is known. 30 31AC_DEFUN([CURL_CHECK_COMPILER], [ 32 # 33 compiler_id="unknown" 34 compiler_num="0" 35 # 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" 42 # 43 flags_prefer_cppflags="no" 44 # 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 57 # 58 if test "$compiler_id" = "unknown"; then 59 cat <<_EOF 1>&2 60*** 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. 64*** 65*** Whatever settings are present in CFLAGS will be used for this run. 66*** 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/ 70*** 71_EOF 72 fi 73]) 74 75 76dnl CURL_CHECK_COMPILER_CLANG 77dnl ------------------------------------------------- 78dnl Verify if compiler being used is clang. 79 80AC_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 85 AC_MSG_RESULT([yes]) 86 AC_MSG_CHECKING([if compiler is xlclang]) 87 CURL_CHECK_DEF([__ibmxl__], [], [silent]) 88 if test "$curl_cv_have_def___ibmxl__" = "yes" ; then 89 dnl IBM's almost-compatible clang version 90 AC_MSG_RESULT([yes]) 91 compiler_id="XLCLANG" 92 else 93 AC_MSG_RESULT([no]) 94 compiler_id="CLANG" 95 fi 96 fullclangver=`$CC -v 2>&1 | grep version` 97 clangver=`echo $fullclangver | grep "based on LLVM " | "$SED" 's/.*(based on LLVM \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*)/\1/'` 98 if test -z "$clangver"; then 99 if echo $fullclangver | grep "Apple LLVM version " >/dev/null; then 100 dnl Starting with XCode 7 / clang 3.7, Apple clang won't tell its upstream version 101 clangver="3.7" 102 else 103 clangver=`echo $fullclangver | "$SED" 's/.*version \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*/\1/'` 104 fi 105 fi 106 clangvhi=`echo $clangver | cut -d . -f1` 107 clangvlo=`echo $clangver | cut -d . -f2` 108 compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null` 109 flags_dbg_all="-g -g0 -g1 -g2 -g3" 110 flags_dbg_all="$flags_dbg_all -ggdb" 111 flags_dbg_all="$flags_dbg_all -gstabs" 112 flags_dbg_all="$flags_dbg_all -gstabs+" 113 flags_dbg_all="$flags_dbg_all -gcoff" 114 flags_dbg_all="$flags_dbg_all -gxcoff" 115 flags_dbg_all="$flags_dbg_all -gdwarf-2" 116 flags_dbg_all="$flags_dbg_all -gvms" 117 flags_dbg_yes="-g" 118 flags_dbg_off="" 119 flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4" 120 flags_opt_yes="-Os" 121 flags_opt_off="-O0" 122 else 123 AC_MSG_RESULT([no]) 124 fi 125]) 126 127 128dnl CURL_CHECK_COMPILER_DEC_C 129dnl ------------------------------------------------- 130dnl Verify if compiler being used is DEC C. 131 132AC_DEFUN([CURL_CHECK_COMPILER_DEC_C], [ 133 AC_MSG_CHECKING([if compiler is DEC/Compaq/HP C]) 134 CURL_CHECK_DEF([__DECC], [], [silent]) 135 CURL_CHECK_DEF([__DECC_VER], [], [silent]) 136 if test "$curl_cv_have_def___DECC" = "yes" && 137 test "$curl_cv_have_def___DECC_VER" = "yes"; then 138 AC_MSG_RESULT([yes]) 139 compiler_id="DEC_C" 140 flags_dbg_all="-g -g0 -g1 -g2 -g3" 141 flags_dbg_yes="-g2" 142 flags_dbg_off="" 143 flags_opt_all="-O -O0 -O1 -O2 -O3 -O4" 144 flags_opt_yes="-O1" 145 flags_opt_off="-O0" 146 else 147 AC_MSG_RESULT([no]) 148 fi 149]) 150 151 152dnl CURL_CHECK_COMPILER_GNU_C 153dnl ------------------------------------------------- 154dnl Verify if compiler being used is GNU C 155dnl 156dnl $compiler_num will be set to MAJOR * 100 + MINOR for gcc less than version 157dnl 7 and just $MAJOR * 100 for gcc version 7 and later. 158dnl 159dnl Examples: 160dnl Version 1.2.3 => 102 161dnl Version 2.95 => 295 162dnl Version 4.7 => 407 163dnl Version 9.2.1 => 900 164dnl 165AC_DEFUN([CURL_CHECK_COMPILER_GNU_C], [ 166 AC_REQUIRE([CURL_CHECK_COMPILER_INTEL_C])dnl 167 AC_REQUIRE([CURL_CHECK_COMPILER_CLANG])dnl 168 AC_MSG_CHECKING([if compiler is GNU C]) 169 CURL_CHECK_DEF([__GNUC__], [], [silent]) 170 if test "$curl_cv_have_def___GNUC__" = "yes" && 171 test "$compiler_id" = "unknown"; then 172 AC_MSG_RESULT([yes]) 173 compiler_id="GNU_C" 174 gccver=`$CC -dumpversion` 175 gccvhi=`echo $gccver | cut -d . -f1` 176 gccvlo=`echo $gccver | cut -d . -f2` 177 compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null` 178 flags_dbg_all="-g -g0 -g1 -g2 -g3" 179 flags_dbg_all="$flags_dbg_all -ggdb" 180 flags_dbg_all="$flags_dbg_all -gstabs" 181 flags_dbg_all="$flags_dbg_all -gstabs+" 182 flags_dbg_all="$flags_dbg_all -gcoff" 183 flags_dbg_all="$flags_dbg_all -gxcoff" 184 flags_dbg_all="$flags_dbg_all -gdwarf-2" 185 flags_dbg_all="$flags_dbg_all -gvms" 186 flags_dbg_yes="-g" 187 flags_dbg_off="" 188 flags_opt_all="-O -O0 -O1 -O2 -O3 -Os -Og -Ofast" 189 flags_opt_yes="-O2" 190 flags_opt_off="-O0" 191 CURL_CHECK_DEF([_WIN32], [], [silent]) 192 else 193 AC_MSG_RESULT([no]) 194 fi 195]) 196 197 198dnl CURL_CHECK_COMPILER_HPUX_C 199dnl ------------------------------------------------- 200dnl Verify if compiler being used is HP-UX C. 201 202AC_DEFUN([CURL_CHECK_COMPILER_HPUX_C], [ 203 AC_MSG_CHECKING([if compiler is HP-UX C]) 204 CURL_CHECK_DEF([__HP_cc], [], [silent]) 205 if test "$curl_cv_have_def___HP_cc" = "yes"; then 206 AC_MSG_RESULT([yes]) 207 compiler_id="HP_UX_C" 208 flags_dbg_all="-g -s" 209 flags_dbg_yes="-g" 210 flags_dbg_off="-s" 211 flags_opt_all="-O +O0 +O1 +O2 +O3 +O4" 212 flags_opt_yes="+O2" 213 flags_opt_off="+O0" 214 else 215 AC_MSG_RESULT([no]) 216 fi 217]) 218 219 220dnl CURL_CHECK_COMPILER_IBM_C 221dnl ------------------------------------------------- 222dnl Verify if compiler being used is IBM C. 223 224AC_DEFUN([CURL_CHECK_COMPILER_IBM_C], [ 225 AC_MSG_CHECKING([if compiler is IBM C]) 226 CURL_CHECK_DEF([__IBMC__], [], [silent]) 227 if test "$curl_cv_have_def___IBMC__" = "yes"; then 228 AC_MSG_RESULT([yes]) 229 compiler_id="IBM_C" 230 flags_dbg_all="-g -g0 -g1 -g2 -g3" 231 flags_dbg_yes="-g" 232 flags_dbg_off="" 233 flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5" 234 flags_opt_all="$flags_opt_all -qnooptimize" 235 flags_opt_all="$flags_opt_all -qoptimize=0" 236 flags_opt_all="$flags_opt_all -qoptimize=1" 237 flags_opt_all="$flags_opt_all -qoptimize=2" 238 flags_opt_all="$flags_opt_all -qoptimize=3" 239 flags_opt_all="$flags_opt_all -qoptimize=4" 240 flags_opt_all="$flags_opt_all -qoptimize=5" 241 flags_opt_yes="-O2" 242 flags_opt_off="-qnooptimize" 243 flags_prefer_cppflags="yes" 244 else 245 AC_MSG_RESULT([no]) 246 fi 247]) 248 249 250dnl CURL_CHECK_COMPILER_INTEL_C 251dnl ------------------------------------------------- 252dnl Verify if compiler being used is Intel C. 253 254AC_DEFUN([CURL_CHECK_COMPILER_INTEL_C], [ 255 AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU_C])dnl 256 AC_MSG_CHECKING([if compiler is Intel C]) 257 CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent]) 258 if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then 259 AC_MSG_RESULT([yes]) 260 compiler_num="$curl_cv_def___INTEL_COMPILER" 261 CURL_CHECK_DEF([__unix__], [], [silent]) 262 if test "$curl_cv_have_def___unix__" = "yes"; then 263 compiler_id="INTEL_UNIX_C" 264 flags_dbg_all="-g -g0" 265 flags_dbg_yes="-g" 266 flags_dbg_off="" 267 flags_opt_all="-O -O0 -O1 -O2 -O3 -Os" 268 flags_opt_yes="-O2" 269 flags_opt_off="-O0" 270 else 271 compiler_id="INTEL_WINDOWS_C" 272 flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-" 273 flags_dbg_all="$flags_dbg_all /debug" 274 flags_dbg_all="$flags_dbg_all /debug:none" 275 flags_dbg_all="$flags_dbg_all /debug:minimal" 276 flags_dbg_all="$flags_dbg_all /debug:partial" 277 flags_dbg_all="$flags_dbg_all /debug:full" 278 flags_dbg_all="$flags_dbg_all /debug:semantic_stepping" 279 flags_dbg_all="$flags_dbg_all /debug:extended" 280 flags_dbg_yes="/Zi /Oy-" 281 flags_dbg_off="/debug:none /Oy-" 282 flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-" 283 flags_opt_yes="/O2" 284 flags_opt_off="/Od" 285 fi 286 else 287 AC_MSG_RESULT([no]) 288 fi 289]) 290 291 292dnl CURL_CHECK_COMPILER_LCC 293dnl ------------------------------------------------- 294dnl Verify if compiler being used is LCC. 295 296AC_DEFUN([CURL_CHECK_COMPILER_LCC], [ 297 AC_MSG_CHECKING([if compiler is LCC]) 298 CURL_CHECK_DEF([__LCC__], [], [silent]) 299 if test "$curl_cv_have_def___LCC__" = "yes"; then 300 AC_MSG_RESULT([yes]) 301 compiler_id="LCC" 302 flags_dbg_all="-g" 303 flags_dbg_yes="-g" 304 flags_dbg_off="" 305 flags_opt_all="" 306 flags_opt_yes="" 307 flags_opt_off="" 308 else 309 AC_MSG_RESULT([no]) 310 fi 311]) 312 313 314dnl CURL_CHECK_COMPILER_SGI_MIPS_C 315dnl ------------------------------------------------- 316dnl Verify if compiler being used is SGI MIPS C. 317 318AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPS_C], [ 319 AC_REQUIRE([CURL_CHECK_COMPILER_SGI_MIPSPRO_C])dnl 320 AC_MSG_CHECKING([if compiler is SGI MIPS C]) 321 CURL_CHECK_DEF([__GNUC__], [], [silent]) 322 CURL_CHECK_DEF([__sgi], [], [silent]) 323 if test "$curl_cv_have_def___GNUC__" = "no" && 324 test "$curl_cv_have_def___sgi" = "yes" && 325 test "$compiler_id" = "unknown"; then 326 AC_MSG_RESULT([yes]) 327 compiler_id="SGI_MIPS_C" 328 flags_dbg_all="-g -g0 -g1 -g2 -g3" 329 flags_dbg_yes="-g" 330 flags_dbg_off="" 331 flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast" 332 flags_opt_yes="-O2" 333 flags_opt_off="-O0" 334 else 335 AC_MSG_RESULT([no]) 336 fi 337]) 338 339 340dnl CURL_CHECK_COMPILER_SGI_MIPSPRO_C 341dnl ------------------------------------------------- 342dnl Verify if compiler being used is SGI MIPSpro C. 343 344AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPSPRO_C], [ 345 AC_BEFORE([$0],[CURL_CHECK_COMPILER_SGI_MIPS_C])dnl 346 AC_MSG_CHECKING([if compiler is SGI MIPSpro C]) 347 CURL_CHECK_DEF([__GNUC__], [], [silent]) 348 CURL_CHECK_DEF([_COMPILER_VERSION], [], [silent]) 349 CURL_CHECK_DEF([_SGI_COMPILER_VERSION], [], [silent]) 350 if test "$curl_cv_have_def___GNUC__" = "no" && 351 (test "$curl_cv_have_def__SGI_COMPILER_VERSION" = "yes" || 352 test "$curl_cv_have_def__COMPILER_VERSION" = "yes"); then 353 AC_MSG_RESULT([yes]) 354 compiler_id="SGI_MIPSPRO_C" 355 flags_dbg_all="-g -g0 -g1 -g2 -g3" 356 flags_dbg_yes="-g" 357 flags_dbg_off="" 358 flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast" 359 flags_opt_yes="-O2" 360 flags_opt_off="-O0" 361 else 362 AC_MSG_RESULT([no]) 363 fi 364]) 365 366 367dnl CURL_CHECK_COMPILER_SUNPRO_C 368dnl ------------------------------------------------- 369dnl Verify if compiler being used is SunPro C. 370 371AC_DEFUN([CURL_CHECK_COMPILER_SUNPRO_C], [ 372 AC_MSG_CHECKING([if compiler is SunPro C]) 373 CURL_CHECK_DEF([__SUNPRO_C], [], [silent]) 374 if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then 375 AC_MSG_RESULT([yes]) 376 compiler_id="SUNPRO_C" 377 flags_dbg_all="-g -s" 378 flags_dbg_yes="-g" 379 flags_dbg_off="-s" 380 flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5" 381 flags_opt_yes="-xO2" 382 flags_opt_off="" 383 else 384 AC_MSG_RESULT([no]) 385 fi 386]) 387 388 389dnl CURL_CHECK_COMPILER_TINY_C 390dnl ------------------------------------------------- 391dnl Verify if compiler being used is Tiny C. 392 393AC_DEFUN([CURL_CHECK_COMPILER_TINY_C], [ 394 AC_MSG_CHECKING([if compiler is Tiny C]) 395 CURL_CHECK_DEF([__TINYC__], [], [silent]) 396 if test "$curl_cv_have_def___TINYC__" = "yes"; then 397 AC_MSG_RESULT([yes]) 398 compiler_id="TINY_C" 399 flags_dbg_all="-g -b" 400 flags_dbg_yes="-g" 401 flags_dbg_off="" 402 flags_opt_all="" 403 flags_opt_yes="" 404 flags_opt_off="" 405 else 406 AC_MSG_RESULT([no]) 407 fi 408]) 409 410 411dnl CURL_CHECK_COMPILER_WATCOM_C 412dnl ------------------------------------------------- 413dnl Verify if compiler being used is Watcom C. 414 415AC_DEFUN([CURL_CHECK_COMPILER_WATCOM_C], [ 416 AC_MSG_CHECKING([if compiler is Watcom C]) 417 CURL_CHECK_DEF([__WATCOMC__], [], [silent]) 418 if test "$curl_cv_have_def___WATCOMC__" = "yes"; then 419 AC_MSG_RESULT([yes]) 420 CURL_CHECK_DEF([__UNIX__], [], [silent]) 421 if test "$curl_cv_have_def___UNIX__" = "yes"; then 422 compiler_id="WATCOM_UNIX_C" 423 flags_dbg_all="-g1 -g1+ -g2 -g3" 424 flags_dbg_yes="-g2" 425 flags_dbg_off="" 426 flags_opt_all="-O0 -O1 -O2 -O3" 427 flags_opt_yes="-O2" 428 flags_opt_off="-O0" 429 else 430 compiler_id="WATCOM_WINDOWS_C" 431 flags_dbg_all="" 432 flags_dbg_yes="" 433 flags_dbg_off="" 434 flags_opt_all="" 435 flags_opt_yes="" 436 flags_opt_off="" 437 fi 438 else 439 AC_MSG_RESULT([no]) 440 fi 441]) 442 443 444dnl CURL_CONVERT_INCLUDE_TO_ISYSTEM 445dnl ------------------------------------------------- 446dnl Changes standard include paths present in CFLAGS 447dnl and CPPFLAGS into isystem include paths. This is 448dnl done to prevent GNUC from generating warnings on 449dnl headers from these locations, although on ancient 450dnl GNUC versions these warnings are not silenced. 451 452AC_DEFUN([CURL_CONVERT_INCLUDE_TO_ISYSTEM], [ 453 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl 454 AC_REQUIRE([CURL_CHECK_COMPILER])dnl 455 AC_MSG_CHECKING([convert -I options to -isystem]) 456 if test "$compiler_id" = "GNU_C" || 457 test "$compiler_id" = "CLANG"; then 458 AC_MSG_RESULT([yes]) 459 tmp_has_include="no" 460 tmp_chg_FLAGS="$CFLAGS" 461 for word1 in $tmp_chg_FLAGS; do 462 case "$word1" in 463 -I*) 464 tmp_has_include="yes" 465 ;; 466 esac 467 done 468 if test "$tmp_has_include" = "yes"; then 469 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'` 470 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'` 471 CFLAGS="$tmp_chg_FLAGS" 472 squeeze CFLAGS 473 fi 474 tmp_has_include="no" 475 tmp_chg_FLAGS="$CPPFLAGS" 476 for word1 in $tmp_chg_FLAGS; do 477 case "$word1" in 478 -I*) 479 tmp_has_include="yes" 480 ;; 481 esac 482 done 483 if test "$tmp_has_include" = "yes"; then 484 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'` 485 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'` 486 CPPFLAGS="$tmp_chg_FLAGS" 487 squeeze CPPFLAGS 488 fi 489 else 490 AC_MSG_RESULT([no]) 491 fi 492]) 493 494 495dnl CURL_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS]) 496dnl ------------------------------------------------- 497dnl Verify if the C compiler seems to work with the 498dnl settings that are 'active' at the time the test 499dnl is performed. 500 501AC_DEFUN([CURL_COMPILER_WORKS_IFELSE], [ 502 dnl compilation capability verification 503 tmp_compiler_works="unknown" 504 AC_COMPILE_IFELSE([ 505 AC_LANG_PROGRAM([[ 506 ]],[[ 507 int i = 1; 508 return i; 509 ]]) 510 ],[ 511 tmp_compiler_works="yes" 512 ],[ 513 tmp_compiler_works="no" 514 echo " " >&6 515 sed 's/^/cc-fail: /' conftest.err >&6 516 echo " " >&6 517 ]) 518 dnl linking capability verification 519 if test "$tmp_compiler_works" = "yes"; then 520 AC_LINK_IFELSE([ 521 AC_LANG_PROGRAM([[ 522 ]],[[ 523 int i = 1; 524 return i; 525 ]]) 526 ],[ 527 tmp_compiler_works="yes" 528 ],[ 529 tmp_compiler_works="no" 530 echo " " >&6 531 sed 's/^/link-fail: /' conftest.err >&6 532 echo " " >&6 533 ]) 534 fi 535 dnl only do runtime verification when not cross-compiling 536 if test "x$cross_compiling" != "xyes" && 537 test "$tmp_compiler_works" = "yes"; then 538 CURL_RUN_IFELSE([ 539 AC_LANG_PROGRAM([[ 540# ifdef __STDC__ 541# include <stdlib.h> 542# endif 543 ]],[[ 544 int i = 0; 545 exit(i); 546 ]]) 547 ],[ 548 tmp_compiler_works="yes" 549 ],[ 550 tmp_compiler_works="no" 551 echo " " >&6 552 echo "run-fail: test program exited with status $ac_status" >&6 553 echo " " >&6 554 ]) 555 fi 556 dnl branch upon test result 557 if test "$tmp_compiler_works" = "yes"; then 558 ifelse($1,,:,[$1]) 559 ifelse($2,,,[else 560 $2]) 561 fi 562]) 563 564 565dnl CURL_SET_COMPILER_BASIC_OPTS 566dnl ------------------------------------------------- 567dnl Sets compiler specific options/flags which do not 568dnl depend on configure's debug, optimize or warnings 569dnl options. 570 571AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [ 572 AC_REQUIRE([CURL_CHECK_COMPILER])dnl 573 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl 574 # 575 if test "$compiler_id" != "unknown"; then 576 # 577 tmp_save_CPPFLAGS="$CPPFLAGS" 578 tmp_save_CFLAGS="$CFLAGS" 579 tmp_CPPFLAGS="" 580 tmp_CFLAGS="" 581 # 582 case "$compiler_id" in 583 # 584 CLANG) 585 # 586 dnl Disable warnings for unused arguments, otherwise clang will 587 dnl warn about compile-time arguments used during link-time, like 588 dnl -O and -g and -pedantic. 589 tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments" 590 ;; 591 # 592 DEC_C) 593 # 594 dnl Select strict ANSI C compiler mode 595 tmp_CFLAGS="$tmp_CFLAGS -std1" 596 dnl Turn off optimizer ANSI C aliasing rules 597 tmp_CFLAGS="$tmp_CFLAGS -noansi_alias" 598 dnl Generate warnings for missing function prototypes 599 tmp_CFLAGS="$tmp_CFLAGS -warnprotos" 600 dnl Change some warnings into fatal errors 601 tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs" 602 ;; 603 # 604 GNU_C) 605 # 606 dnl turn implicit-function-declaration warning into error, 607 dnl at least gcc 2.95 and later support this 608 if test "$compiler_num" -ge "295"; then 609 tmp_CFLAGS="$tmp_CFLAGS -Werror-implicit-function-declaration" 610 fi 611 ;; 612 # 613 HP_UX_C) 614 # 615 dnl Disallow run-time dereferencing of null pointers 616 tmp_CFLAGS="$tmp_CFLAGS -z" 617 dnl Disable some remarks 618 dnl #4227: padding struct with n bytes to align member 619 dnl #4255: padding size of struct with n bytes to alignment boundary 620 tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255" 621 ;; 622 # 623 IBM_C) 624 # 625 dnl Ensure that compiler optimizations are always thread-safe. 626 tmp_CPPFLAGS="$tmp_CPPFLAGS -qthreaded" 627 dnl Disable type based strict aliasing optimizations, using worst 628 dnl case aliasing assumptions when compiling. Type based aliasing 629 dnl would restrict the lvalues that could be safely used to access 630 dnl a data object. 631 tmp_CPPFLAGS="$tmp_CPPFLAGS -qnoansialias" 632 dnl Force compiler to stop after the compilation phase, without 633 dnl generating an object code file when compilation has errors. 634 tmp_CPPFLAGS="$tmp_CPPFLAGS -qhalt=e" 635 ;; 636 # 637 INTEL_UNIX_C) 638 # 639 dnl On unix this compiler uses gcc's header files, so 640 dnl we select ANSI C89 dialect plus GNU extensions. 641 tmp_CFLAGS="$tmp_CFLAGS -std=gnu89" 642 dnl Change some warnings into errors 643 dnl #140: too many arguments in function call 644 dnl #147: declaration is incompatible with 'previous one' 645 dnl #165: too few arguments in function call 646 dnl #266: function declared implicitly 647 tmp_CPPFLAGS="$tmp_CPPFLAGS -we140,147,165,266" 648 dnl Disable some remarks 649 dnl #279: controlling expression is constant 650 dnl #981: operands are evaluated in unspecified order 651 dnl #1469: "cc" clobber ignored 652 tmp_CPPFLAGS="$tmp_CPPFLAGS -wd279,981,1469" 653 ;; 654 # 655 INTEL_WINDOWS_C) 656 # 657 dnl Placeholder 658 tmp_CFLAGS="$tmp_CFLAGS" 659 ;; 660 # 661 LCC) 662 # 663 dnl Disallow run-time dereferencing of null pointers 664 tmp_CFLAGS="$tmp_CFLAGS -n" 665 ;; 666 # 667 SGI_MIPS_C) 668 # 669 dnl Placeholder 670 tmp_CFLAGS="$tmp_CFLAGS" 671 ;; 672 # 673 SGI_MIPSPRO_C) 674 # 675 dnl Placeholder 676 tmp_CFLAGS="$tmp_CFLAGS" 677 ;; 678 # 679 SUNPRO_C) 680 # 681 dnl Placeholder 682 tmp_CFLAGS="$tmp_CFLAGS" 683 ;; 684 # 685 TINY_C) 686 # 687 dnl Placeholder 688 tmp_CFLAGS="$tmp_CFLAGS" 689 ;; 690 # 691 WATCOM_UNIX_C) 692 # 693 dnl Placeholder 694 tmp_CFLAGS="$tmp_CFLAGS" 695 ;; 696 # 697 WATCOM_WINDOWS_C) 698 # 699 dnl Placeholder 700 tmp_CFLAGS="$tmp_CFLAGS" 701 ;; 702 # 703 esac 704 # 705 squeeze tmp_CPPFLAGS 706 squeeze tmp_CFLAGS 707 # 708 if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then 709 AC_MSG_CHECKING([if compiler accepts some basic options]) 710 CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS" 711 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" 712 squeeze CPPFLAGS 713 squeeze CFLAGS 714 CURL_COMPILER_WORKS_IFELSE([ 715 AC_MSG_RESULT([yes]) 716 AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS]) 717 ],[ 718 AC_MSG_RESULT([no]) 719 AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS]) 720 dnl restore initial settings 721 CPPFLAGS="$tmp_save_CPPFLAGS" 722 CFLAGS="$tmp_save_CFLAGS" 723 ]) 724 fi 725 # 726 fi 727]) 728 729 730dnl CURL_SET_COMPILER_DEBUG_OPTS 731dnl ------------------------------------------------- 732dnl Sets compiler specific options/flags which depend 733dnl on configure's debug option. 734 735AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [ 736 AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl 737 AC_REQUIRE([CURL_CHECK_COMPILER])dnl 738 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl 739 # 740 if test "$compiler_id" != "unknown"; then 741 # 742 tmp_save_CFLAGS="$CFLAGS" 743 tmp_save_CPPFLAGS="$CPPFLAGS" 744 # 745 tmp_options="" 746 tmp_CFLAGS="$CFLAGS" 747 tmp_CPPFLAGS="$CPPFLAGS" 748 CURL_VAR_STRIP([tmp_CFLAGS],[$flags_dbg_all]) 749 CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_dbg_all]) 750 # 751 if test "$want_debug" = "yes"; then 752 AC_MSG_CHECKING([if compiler accepts debug enabling options]) 753 tmp_options="$flags_dbg_yes" 754 fi 755 if test "$want_debug" = "no"; then 756 AC_MSG_CHECKING([if compiler accepts debug disabling options]) 757 tmp_options="$flags_dbg_off" 758 fi 759 # 760 if test "$flags_prefer_cppflags" = "yes"; then 761 CPPFLAGS="$tmp_CPPFLAGS $tmp_options" 762 CFLAGS="$tmp_CFLAGS" 763 else 764 CPPFLAGS="$tmp_CPPFLAGS" 765 CFLAGS="$tmp_CFLAGS $tmp_options" 766 fi 767 squeeze CPPFLAGS 768 squeeze CFLAGS 769 CURL_COMPILER_WORKS_IFELSE([ 770 AC_MSG_RESULT([yes]) 771 AC_MSG_NOTICE([compiler options added: $tmp_options]) 772 ],[ 773 AC_MSG_RESULT([no]) 774 AC_MSG_WARN([compiler options rejected: $tmp_options]) 775 dnl restore initial settings 776 CPPFLAGS="$tmp_save_CPPFLAGS" 777 CFLAGS="$tmp_save_CFLAGS" 778 ]) 779 # 780 fi 781]) 782 783 784dnl CURL_SET_COMPILER_OPTIMIZE_OPTS 785dnl ------------------------------------------------- 786dnl Sets compiler specific options/flags which depend 787dnl on configure's optimize option. 788 789AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [ 790 AC_REQUIRE([CURL_CHECK_OPTION_OPTIMIZE])dnl 791 AC_REQUIRE([CURL_CHECK_COMPILER])dnl 792 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl 793 # 794 if test "$compiler_id" != "unknown"; then 795 # 796 tmp_save_CFLAGS="$CFLAGS" 797 tmp_save_CPPFLAGS="$CPPFLAGS" 798 # 799 tmp_options="" 800 tmp_CFLAGS="$CFLAGS" 801 tmp_CPPFLAGS="$CPPFLAGS" 802 honor_optimize_option="yes" 803 # 804 dnl If optimization request setting has not been explicitly specified, 805 dnl it has been derived from the debug setting and initially assumed. 806 dnl This initially assumed optimizer setting will finally be ignored 807 dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies 808 dnl that an initially assumed optimizer setting might not be honored. 809 # 810 if test "$want_optimize" = "assume_no" || 811 test "$want_optimize" = "assume_yes"; then 812 AC_MSG_CHECKING([if compiler optimizer assumed setting might be used]) 813 CURL_VAR_MATCH_IFELSE([tmp_CFLAGS],[$flags_opt_all],[ 814 honor_optimize_option="no" 815 ]) 816 CURL_VAR_MATCH_IFELSE([tmp_CPPFLAGS],[$flags_opt_all],[ 817 honor_optimize_option="no" 818 ]) 819 AC_MSG_RESULT([$honor_optimize_option]) 820 if test "$honor_optimize_option" = "yes"; then 821 if test "$want_optimize" = "assume_yes"; then 822 want_optimize="yes" 823 fi 824 if test "$want_optimize" = "assume_no"; then 825 want_optimize="no" 826 fi 827 fi 828 fi 829 # 830 if test "$honor_optimize_option" = "yes"; then 831 CURL_VAR_STRIP([tmp_CFLAGS],[$flags_opt_all]) 832 CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_opt_all]) 833 if test "$want_optimize" = "yes"; then 834 AC_MSG_CHECKING([if compiler accepts optimizer enabling options]) 835 tmp_options="$flags_opt_yes" 836 fi 837 if test "$want_optimize" = "no"; then 838 AC_MSG_CHECKING([if compiler accepts optimizer disabling options]) 839 tmp_options="$flags_opt_off" 840 fi 841 if test "$flags_prefer_cppflags" = "yes"; then 842 CPPFLAGS="$tmp_CPPFLAGS $tmp_options" 843 CFLAGS="$tmp_CFLAGS" 844 else 845 CPPFLAGS="$tmp_CPPFLAGS" 846 CFLAGS="$tmp_CFLAGS $tmp_options" 847 fi 848 squeeze CPPFLAGS 849 squeeze CFLAGS 850 CURL_COMPILER_WORKS_IFELSE([ 851 AC_MSG_RESULT([yes]) 852 AC_MSG_NOTICE([compiler options added: $tmp_options]) 853 ],[ 854 AC_MSG_RESULT([no]) 855 AC_MSG_WARN([compiler options rejected: $tmp_options]) 856 dnl restore initial settings 857 CPPFLAGS="$tmp_save_CPPFLAGS" 858 CFLAGS="$tmp_save_CFLAGS" 859 ]) 860 fi 861 # 862 fi 863]) 864 865 866dnl CURL_SET_COMPILER_WARNING_OPTS 867dnl ------------------------------------------------- 868dnl Sets compiler options/flags which depend on 869dnl configure's warnings given option. 870 871AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [ 872 AC_REQUIRE([CURL_CHECK_OPTION_WARNINGS])dnl 873 AC_REQUIRE([CURL_CHECK_COMPILER])dnl 874 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl 875 # 876 if test "$compiler_id" != "unknown"; then 877 # 878 tmp_save_CPPFLAGS="$CPPFLAGS" 879 tmp_save_CFLAGS="$CFLAGS" 880 tmp_CPPFLAGS="" 881 tmp_CFLAGS="" 882 # 883 case "$compiler_id" in 884 # 885 CLANG) 886 # 887 if test "$want_warnings" = "yes"; then 888 tmp_CFLAGS="$tmp_CFLAGS -pedantic" 889 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [all extra]) 890 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [pointer-arith write-strings]) 891 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [shadow]) 892 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [inline nested-externs]) 893 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-declarations]) 894 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-prototypes]) 895 tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long" 896 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [float-equal]) 897 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [no-multichar sign-compare]) 898 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [undef]) 899 tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral" 900 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [endif-labels strict-prototypes]) 901 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [declaration-after-statement]) 902 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-align]) 903 tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers" 904 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [shorten-64-to-32]) 905 # 906 dnl Only clang 1.1 or later 907 if test "$compiler_num" -ge "101"; then 908 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused]) 909 fi 910 # 911 dnl Only clang 2.8 or later 912 if test "$compiler_num" -ge "208"; then 913 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [vla]) 914 fi 915 # 916 dnl Only clang 2.9 or later 917 if test "$compiler_num" -ge "209"; then 918 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [shift-sign-overflow]) 919 fi 920 # 921 dnl Only clang 3.2 or later 922 if test "$compiler_num" -ge "302"; then 923 case $host_os in 924 cygwin* | mingw*) 925 dnl skip missing-variable-declarations warnings for cygwin and 926 dnl mingw because the libtool wrapper executable causes them 927 ;; 928 *) 929 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-variable-declarations]) 930 ;; 931 esac 932 fi 933 # 934 dnl Only clang 3.6 or later 935 if test "$compiler_num" -ge "306"; then 936 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [double-promotion]) 937 fi 938 # 939 dnl Only clang 3.9 or later 940 if test "$compiler_num" -ge "309"; then 941 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [comma]) 942 # avoid the varargs warning, fixed in 4.0 943 # https://bugs.llvm.org/show_bug.cgi?id=29140 944 if test "$compiler_num" -lt "400"; then 945 tmp_CFLAGS="$tmp_CFLAGS -Wno-varargs" 946 fi 947 fi 948 dnl clang 7 or later 949 if test "$compiler_num" -ge "700"; then 950 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [assign-enum]) 951 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [extra-semi-stmt]) 952 fi 953 fi 954 ;; 955 # 956 DEC_C) 957 # 958 if test "$want_warnings" = "yes"; then 959 dnl Select a higher warning level than default level2 960 tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3" 961 fi 962 ;; 963 # 964 GNU_C) 965 # 966 if test "$want_warnings" = "yes"; then 967 # 968 dnl Do not enable -pedantic when cross-compiling with a gcc older 969 dnl than 3.0, to avoid warnings from third party system headers. 970 if test "x$cross_compiling" != "xyes" || 971 test "$compiler_num" -ge "300"; then 972 tmp_CFLAGS="$tmp_CFLAGS -pedantic" 973 fi 974 # 975 dnl Set of options we believe *ALL* gcc versions support: 976 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [all]) 977 tmp_CFLAGS="$tmp_CFLAGS -W" 978 # 979 dnl Only gcc 1.4 or later 980 if test "$compiler_num" -ge "104"; then 981 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [pointer-arith write-strings]) 982 dnl If not cross-compiling with a gcc older than 3.0 983 if test "x$cross_compiling" != "xyes" || 984 test "$compiler_num" -ge "300"; then 985 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused shadow]) 986 fi 987 fi 988 # 989 dnl Only gcc 2.7 or later 990 if test "$compiler_num" -ge "207"; then 991 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [inline nested-externs]) 992 dnl If not cross-compiling with a gcc older than 3.0 993 if test "x$cross_compiling" != "xyes" || 994 test "$compiler_num" -ge "300"; then 995 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-declarations]) 996 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-prototypes]) 997 fi 998 fi 999 # 1000 dnl Only gcc 2.95 or later 1001 if test "$compiler_num" -ge "295"; then 1002 tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long" 1003 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [bad-function-cast]) 1004 fi 1005 # 1006 dnl Only gcc 2.96 or later 1007 if test "$compiler_num" -ge "296"; then 1008 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [float-equal]) 1009 tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar" 1010 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [sign-compare]) 1011 dnl -Wundef used only if gcc is 2.96 or later since we get 1012 dnl lots of "`_POSIX_C_SOURCE' is not defined" in system 1013 dnl headers with gcc 2.95.4 on FreeBSD 4.9 1014 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [undef]) 1015 fi 1016 # 1017 dnl Only gcc 2.97 or later 1018 if test "$compiler_num" -ge "297"; then 1019 tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral" 1020 fi 1021 # 1022 dnl Only gcc 3.0 or later 1023 if test "$compiler_num" -ge "300"; then 1024 dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on 1025 dnl on i686-Linux as it gives us heaps with false positives. 1026 dnl Also, on gcc 4.0.X it is totally unbearable and complains all 1027 dnl over making it unusable for generic purposes. Let's not use it. 1028 tmp_CFLAGS="$tmp_CFLAGS" 1029 fi 1030 # 1031 dnl Only gcc 3.3 or later 1032 if test "$compiler_num" -ge "303"; then 1033 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [endif-labels strict-prototypes]) 1034 fi 1035 # 1036 dnl Only gcc 3.4 or later 1037 if test "$compiler_num" -ge "304"; then 1038 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [declaration-after-statement]) 1039 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [old-style-definition]) 1040 fi 1041 # 1042 dnl Only gcc 4.0 or later 1043 if test "$compiler_num" -ge "400"; then 1044 tmp_CFLAGS="$tmp_CFLAGS -Wstrict-aliasing=3" 1045 fi 1046 # 1047 dnl Only gcc 4.2 or later 1048 if test "$compiler_num" -ge "402"; then 1049 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-align]) 1050 fi 1051 # 1052 dnl Only gcc 4.3 or later 1053 if test "$compiler_num" -ge "403"; then 1054 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [type-limits old-style-declaration]) 1055 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-parameter-type empty-body]) 1056 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [clobbered ignored-qualifiers]) 1057 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [conversion]) 1058 tmp_CFLAGS="$tmp_CFLAGS -Wno-sign-conversion" 1059 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [vla]) 1060 dnl required for -Warray-bounds, included in -Wall 1061 tmp_CFLAGS="$tmp_CFLAGS -ftree-vrp" 1062 fi 1063 # 1064 dnl Only gcc 4.5 or later 1065 if test "$compiler_num" -ge "405"; then 1066 dnl Only windows targets 1067 if test "$curl_cv_have_def__WIN32" = "yes"; then 1068 tmp_CFLAGS="$tmp_CFLAGS -Wno-pedantic-ms-format" 1069 fi 1070 fi 1071 # 1072 dnl Only gcc 4.6 or later 1073 if test "$compiler_num" -ge "406"; then 1074 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [double-promotion]) 1075 fi 1076 # 1077 dnl only gcc 4.8 or later 1078 if test "$compiler_num" -ge "408"; then 1079 tmp_CFLAGS="$tmp_CFLAGS -Wformat=2" 1080 fi 1081 # 1082 dnl Only gcc 5 or later 1083 if test "$compiler_num" -ge "500"; then 1084 tmp_CFLAGS="$tmp_CFLAGS -Warray-bounds=2" 1085 fi 1086 # 1087 dnl Only gcc 6 or later 1088 if test "$compiler_num" -ge "600"; then 1089 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [shift-negative-value]) 1090 tmp_CFLAGS="$tmp_CFLAGS -Wshift-overflow=2" 1091 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [null-dereference]) 1092 tmp_CFLAGS="$tmp_CFLAGS -fdelete-null-pointer-checks" 1093 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [duplicated-cond]) 1094 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-const-variable]) 1095 fi 1096 # 1097 dnl Only gcc 7 or later 1098 if test "$compiler_num" -ge "700"; then 1099 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [duplicated-branches]) 1100 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [restrict]) 1101 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [alloc-zero]) 1102 tmp_CFLAGS="$tmp_CFLAGS -Wformat-overflow=2" 1103 tmp_CFLAGS="$tmp_CFLAGS -Wformat-truncation=2" 1104 tmp_CFLAGS="$tmp_CFLAGS -Wimplicit-fallthrough=4" 1105 fi 1106 # 1107 fi 1108 # 1109 dnl Do not issue warnings for code in system include paths. 1110 if test "$compiler_num" -ge "300"; then 1111 tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers" 1112 else 1113 dnl When cross-compiling with a gcc older than 3.0, disable 1114 dnl some warnings triggered on third party system headers. 1115 if test "x$cross_compiling" = "xyes"; then 1116 if test "$compiler_num" -ge "104"; then 1117 dnl gcc 1.4 or later 1118 tmp_CFLAGS="$tmp_CFLAGS -Wno-unused -Wno-shadow" 1119 fi 1120 if test "$compiler_num" -ge "207"; then 1121 dnl gcc 2.7 or later 1122 tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-declarations" 1123 tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-prototypes" 1124 fi 1125 fi 1126 fi 1127 dnl Only gcc 10 or later 1128 if test "$compiler_num" -ge "1000"; then 1129 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [enum-conversion]) 1130 fi 1131 ;; 1132 # 1133 HP_UX_C) 1134 # 1135 if test "$want_warnings" = "yes"; then 1136 dnl Issue all warnings 1137 tmp_CFLAGS="$tmp_CFLAGS +w1" 1138 fi 1139 ;; 1140 # 1141 IBM_C) 1142 # 1143 dnl Placeholder 1144 tmp_CFLAGS="$tmp_CFLAGS" 1145 ;; 1146 # 1147 INTEL_UNIX_C) 1148 # 1149 if test "$want_warnings" = "yes"; then 1150 if test "$compiler_num" -gt "600"; then 1151 dnl Show errors, warnings, and remarks 1152 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall -w2" 1153 dnl Perform extra compile-time code checking 1154 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck" 1155 dnl Warn on nested comments 1156 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcomment" 1157 dnl Show warnings relative to deprecated features 1158 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wdeprecated" 1159 dnl Enable warnings for missing prototypes 1160 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wmissing-prototypes" 1161 dnl Enable warnings for 64-bit portability issues 1162 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wp64" 1163 dnl Enable warnings for questionable pointer arithmetic 1164 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wpointer-arith" 1165 dnl Check for function return typw issues 1166 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wreturn-type" 1167 dnl Warn on variable declarations hiding a previous one 1168 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wshadow" 1169 dnl Warn when a variable is used before initialized 1170 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wuninitialized" 1171 dnl Warn if a declared function is not used 1172 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wunused-function" 1173 fi 1174 fi 1175 dnl Disable using EBP register in optimizations 1176 tmp_CFLAGS="$tmp_CFLAGS -fno-omit-frame-pointer" 1177 dnl Disable use of ANSI C aliasing rules in optimizations 1178 tmp_CFLAGS="$tmp_CFLAGS -fno-strict-aliasing" 1179 dnl Value-safe optimizations on floating-point data 1180 tmp_CFLAGS="$tmp_CFLAGS -fp-model precise" 1181 ;; 1182 # 1183 INTEL_WINDOWS_C) 1184 # 1185 dnl Placeholder 1186 tmp_CFLAGS="$tmp_CFLAGS" 1187 ;; 1188 # 1189 LCC) 1190 # 1191 if test "$want_warnings" = "yes"; then 1192 dnl Highest warning level is double -A, next is single -A. 1193 dnl Due to the big number of warnings these trigger on third 1194 dnl party header files it is impractical for us to use any of 1195 dnl them here. If you want them simply define it in CPPFLAGS. 1196 tmp_CFLAGS="$tmp_CFLAGS" 1197 fi 1198 ;; 1199 # 1200 SGI_MIPS_C) 1201 # 1202 if test "$want_warnings" = "yes"; then 1203 dnl Perform stricter semantic and lint-like checks 1204 tmp_CFLAGS="$tmp_CFLAGS -fullwarn" 1205 fi 1206 ;; 1207 # 1208 SGI_MIPSPRO_C) 1209 # 1210 if test "$want_warnings" = "yes"; then 1211 dnl Perform stricter semantic and lint-like checks 1212 tmp_CFLAGS="$tmp_CFLAGS -fullwarn" 1213 dnl Disable some remarks 1214 dnl #1209: controlling expression is constant 1215 tmp_CFLAGS="$tmp_CFLAGS -woff 1209" 1216 fi 1217 ;; 1218 # 1219 SUNPRO_C) 1220 # 1221 if test "$want_warnings" = "yes"; then 1222 dnl Perform stricter semantic and lint-like checks 1223 tmp_CFLAGS="$tmp_CFLAGS -v" 1224 fi 1225 ;; 1226 # 1227 TINY_C) 1228 # 1229 if test "$want_warnings" = "yes"; then 1230 dnl Activate all warnings 1231 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [all]) 1232 dnl Make string constants be of type const char * 1233 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [write-strings]) 1234 dnl Warn use of unsupported GCC features ignored by TCC 1235 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unsupported]) 1236 fi 1237 ;; 1238 # 1239 WATCOM_UNIX_C) 1240 # 1241 if test "$want_warnings" = "yes"; then 1242 dnl Issue all warnings 1243 tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra" 1244 fi 1245 ;; 1246 # 1247 WATCOM_WINDOWS_C) 1248 # 1249 dnl Placeholder 1250 tmp_CFLAGS="$tmp_CFLAGS" 1251 ;; 1252 # 1253 esac 1254 # 1255 squeeze tmp_CPPFLAGS 1256 squeeze tmp_CFLAGS 1257 # 1258 if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then 1259 AC_MSG_CHECKING([if compiler accepts strict warning options]) 1260 CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS" 1261 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" 1262 squeeze CPPFLAGS 1263 squeeze CFLAGS 1264 CURL_COMPILER_WORKS_IFELSE([ 1265 AC_MSG_RESULT([yes]) 1266 AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS]) 1267 ],[ 1268 AC_MSG_RESULT([no]) 1269 AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS]) 1270 dnl restore initial settings 1271 CPPFLAGS="$tmp_save_CPPFLAGS" 1272 CFLAGS="$tmp_save_CFLAGS" 1273 ]) 1274 fi 1275 # 1276 fi 1277]) 1278 1279 1280dnl CURL_SHFUNC_SQUEEZE 1281dnl ------------------------------------------------- 1282dnl Declares a shell function squeeze() which removes 1283dnl redundant whitespace out of a shell variable. 1284 1285AC_DEFUN([CURL_SHFUNC_SQUEEZE], [ 1286squeeze() { 1287 _sqz_result="" 1288 eval _sqz_input=\[$][$]1 1289 for _sqz_token in $_sqz_input; do 1290 if test -z "$_sqz_result"; then 1291 _sqz_result="$_sqz_token" 1292 else 1293 _sqz_result="$_sqz_result $_sqz_token" 1294 fi 1295 done 1296 eval [$]1=\$_sqz_result 1297 return 0 1298} 1299]) 1300 1301 1302dnl CURL_CHECK_CURLDEBUG 1303dnl ------------------------------------------------- 1304dnl Settings which depend on configure's curldebug given 1305dnl option, and other additional configure pre-requisites. 1306dnl Actually the curl debug memory tracking feature can 1307dnl only be used/enabled when libcurl is built as a static 1308dnl library or as a shared one on those systems on which 1309dnl shared libraries support undefined symbols. 1310 1311AC_DEFUN([CURL_CHECK_CURLDEBUG], [ 1312 AC_REQUIRE([XC_LIBTOOL])dnl 1313 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl 1314 supports_curldebug="unknown" 1315 if test "$want_curldebug" = "yes"; then 1316 if test "x$enable_shared" != "xno" && 1317 test "x$enable_shared" != "xyes"; then 1318 AC_MSG_WARN([unknown enable_shared setting.]) 1319 supports_curldebug="no" 1320 fi 1321 if test "x$enable_static" != "xno" && 1322 test "x$enable_static" != "xyes"; then 1323 AC_MSG_WARN([unknown enable_static setting.]) 1324 supports_curldebug="no" 1325 fi 1326 if test "$supports_curldebug" != "no"; then 1327 if test "$enable_shared" = "yes" && 1328 test "x$xc_lt_shlib_use_no_undefined" = 'xyes'; then 1329 supports_curldebug="no" 1330 AC_MSG_WARN([shared library does not support undefined symbols.]) 1331 fi 1332 fi 1333 fi 1334 # 1335 if test "$want_curldebug" = "yes"; then 1336 AC_MSG_CHECKING([if curl debug memory tracking can be enabled]) 1337 test "$supports_curldebug" = "no" || supports_curldebug="yes" 1338 AC_MSG_RESULT([$supports_curldebug]) 1339 if test "$supports_curldebug" = "no"; then 1340 AC_MSG_WARN([cannot enable curl debug memory tracking.]) 1341 want_curldebug="no" 1342 fi 1343 fi 1344]) 1345 1346 1347 1348dnl CURL_CHECK_COMPILER_HALT_ON_ERROR 1349dnl ------------------------------------------------- 1350dnl Verifies if the compiler actually halts after the 1351dnl compilation phase without generating any object 1352dnl code file, when the source compiles with errors. 1353 1354AC_DEFUN([CURL_CHECK_COMPILER_HALT_ON_ERROR], [ 1355 AC_MSG_CHECKING([if compiler halts on compilation errors]) 1356 AC_COMPILE_IFELSE([ 1357 AC_LANG_PROGRAM([[ 1358 ]],[[ 1359 force compilation error 1360 ]]) 1361 ],[ 1362 AC_MSG_RESULT([no]) 1363 AC_MSG_ERROR([compiler does not halt on compilation errors.]) 1364 ],[ 1365 AC_MSG_RESULT([yes]) 1366 ]) 1367]) 1368 1369 1370dnl CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE 1371dnl ------------------------------------------------- 1372dnl Verifies if the compiler actually halts after the 1373dnl compilation phase without generating any object 1374dnl code file, when the source code tries to define a 1375dnl type for a constant array with negative dimension. 1376 1377AC_DEFUN([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [ 1378 AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])dnl 1379 AC_MSG_CHECKING([if compiler halts on negative sized arrays]) 1380 AC_COMPILE_IFELSE([ 1381 AC_LANG_PROGRAM([[ 1382 typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ]; 1383 ]],[[ 1384 bad_t dummy; 1385 ]]) 1386 ],[ 1387 AC_MSG_RESULT([no]) 1388 AC_MSG_ERROR([compiler does not halt on negative sized arrays.]) 1389 ],[ 1390 AC_MSG_RESULT([yes]) 1391 ]) 1392]) 1393 1394 1395dnl CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE 1396dnl ------------------------------------------------- 1397dnl Verifies if the compiler is capable of handling the 1398dnl size of a struct member, struct which is a function 1399dnl result, as a compilation-time condition inside the 1400dnl type definition of a constant array. 1401 1402AC_DEFUN([CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE], [ 1403 AC_REQUIRE([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE])dnl 1404 AC_MSG_CHECKING([if compiler struct member size checking works]) 1405 tst_compiler_check_one_works="unknown" 1406 AC_COMPILE_IFELSE([ 1407 AC_LANG_PROGRAM([[ 1408 struct mystruct { 1409 int mi; 1410 char mc; 1411 struct mystruct *next; 1412 }; 1413 struct mystruct myfunc(); 1414 typedef char good_t1[sizeof(myfunc().mi) == sizeof(int) ? 1 : -1 ]; 1415 typedef char good_t2[sizeof(myfunc().mc) == sizeof(char) ? 1 : -1 ]; 1416 ]],[[ 1417 good_t1 dummy1; 1418 good_t2 dummy2; 1419 ]]) 1420 ],[ 1421 tst_compiler_check_one_works="yes" 1422 ],[ 1423 tst_compiler_check_one_works="no" 1424 sed 's/^/cc-src: /' conftest.$ac_ext >&6 1425 sed 's/^/cc-err: /' conftest.err >&6 1426 ]) 1427 tst_compiler_check_two_works="unknown" 1428 AC_COMPILE_IFELSE([ 1429 AC_LANG_PROGRAM([[ 1430 struct mystruct { 1431 int mi; 1432 char mc; 1433 struct mystruct *next; 1434 }; 1435 struct mystruct myfunc(); 1436 typedef char bad_t1[sizeof(myfunc().mi) != sizeof(int) ? 1 : -1 ]; 1437 typedef char bad_t2[sizeof(myfunc().mc) != sizeof(char) ? 1 : -1 ]; 1438 ]],[[ 1439 bad_t1 dummy1; 1440 bad_t2 dummy2; 1441 ]]) 1442 ],[ 1443 tst_compiler_check_two_works="no" 1444 ],[ 1445 tst_compiler_check_two_works="yes" 1446 ]) 1447 if test "$tst_compiler_check_one_works" = "yes" && 1448 test "$tst_compiler_check_two_works" = "yes"; then 1449 AC_MSG_RESULT([yes]) 1450 else 1451 AC_MSG_RESULT([no]) 1452 AC_MSG_ERROR([compiler fails struct member size checking.]) 1453 fi 1454]) 1455 1456 1457dnl CURL_CHECK_COMPILER_SYMBOL_HIDING 1458dnl ------------------------------------------------- 1459dnl Verify if compiler supports hiding library internal symbols, setting 1460dnl shell variable supports_symbol_hiding value as appropriate, as well as 1461dnl variables symbol_hiding_CFLAGS and symbol_hiding_EXTERN when supported. 1462 1463AC_DEFUN([CURL_CHECK_COMPILER_SYMBOL_HIDING], [ 1464 AC_REQUIRE([CURL_CHECK_COMPILER])dnl 1465 AC_BEFORE([$0],[CURL_CONFIGURE_SYMBOL_HIDING])dnl 1466 AC_MSG_CHECKING([if compiler supports hiding library internal symbols]) 1467 supports_symbol_hiding="no" 1468 symbol_hiding_CFLAGS="" 1469 symbol_hiding_EXTERN="" 1470 tmp_CFLAGS="" 1471 tmp_EXTERN="" 1472 case "$compiler_id" in 1473 CLANG) 1474 dnl All versions of clang support -fvisibility= 1475 tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))" 1476 tmp_CFLAGS="-fvisibility=hidden" 1477 supports_symbol_hiding="yes" 1478 ;; 1479 GNU_C) 1480 dnl Only gcc 3.4 or later 1481 if test "$compiler_num" -ge "304"; then 1482 if $CC --help --verbose 2>/dev/null | grep fvisibility= >/dev/null ; then 1483 tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))" 1484 tmp_CFLAGS="-fvisibility=hidden" 1485 supports_symbol_hiding="yes" 1486 fi 1487 fi 1488 ;; 1489 INTEL_UNIX_C) 1490 dnl Only icc 9.0 or later 1491 if test "$compiler_num" -ge "900"; then 1492 if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then 1493 tmp_save_CFLAGS="$CFLAGS" 1494 CFLAGS="$CFLAGS -fvisibility=hidden" 1495 AC_LINK_IFELSE([ 1496 AC_LANG_PROGRAM([[ 1497# include <stdio.h> 1498 ]],[[ 1499 printf("icc fvisibility bug test"); 1500 ]]) 1501 ],[ 1502 tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))" 1503 tmp_CFLAGS="-fvisibility=hidden" 1504 supports_symbol_hiding="yes" 1505 ]) 1506 CFLAGS="$tmp_save_CFLAGS" 1507 fi 1508 fi 1509 ;; 1510 SUNPRO_C) 1511 if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then 1512 tmp_EXTERN="__global" 1513 tmp_CFLAGS="-xldscope=hidden" 1514 supports_symbol_hiding="yes" 1515 fi 1516 ;; 1517 esac 1518 if test "$supports_symbol_hiding" = "yes"; then 1519 tmp_save_CFLAGS="$CFLAGS" 1520 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" 1521 squeeze CFLAGS 1522 AC_COMPILE_IFELSE([ 1523 AC_LANG_PROGRAM([[ 1524 $tmp_EXTERN char *dummy(char *buff); 1525 char *dummy(char *buff) 1526 { 1527 if(buff) 1528 return ++buff; 1529 else 1530 return buff; 1531 } 1532 ]],[[ 1533 char b[16]; 1534 char *r = dummy(&b[0]); 1535 if(r) 1536 return (int)*r; 1537 ]]) 1538 ],[ 1539 supports_symbol_hiding="yes" 1540 if test -f conftest.err; then 1541 grep 'visibility' conftest.err >/dev/null 1542 if test "$?" -eq "0"; then 1543 supports_symbol_hiding="no" 1544 fi 1545 fi 1546 ],[ 1547 supports_symbol_hiding="no" 1548 echo " " >&6 1549 sed 's/^/cc-src: /' conftest.$ac_ext >&6 1550 sed 's/^/cc-err: /' conftest.err >&6 1551 echo " " >&6 1552 ]) 1553 CFLAGS="$tmp_save_CFLAGS" 1554 fi 1555 if test "$supports_symbol_hiding" = "yes"; then 1556 AC_MSG_RESULT([yes]) 1557 symbol_hiding_CFLAGS="$tmp_CFLAGS" 1558 symbol_hiding_EXTERN="$tmp_EXTERN" 1559 else 1560 AC_MSG_RESULT([no]) 1561 fi 1562]) 1563 1564 1565dnl CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH 1566dnl ------------------------------------------------- 1567dnl Verifies if the compiler actually halts after the 1568dnl compilation phase without generating any object 1569dnl code file, when the source code tries to redefine 1570dnl a prototype which does not match previous one. 1571 1572AC_DEFUN([CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH], [ 1573 AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])dnl 1574 AC_MSG_CHECKING([if compiler halts on function prototype mismatch]) 1575 AC_COMPILE_IFELSE([ 1576 AC_LANG_PROGRAM([[ 1577# include <stdlib.h> 1578 int rand(int n); 1579 int rand(int n) 1580 { 1581 if(n) 1582 return ++n; 1583 else 1584 return n; 1585 } 1586 ]],[[ 1587 int i[2]={0,0}; 1588 int j = rand(i[0]); 1589 if(j) 1590 return j; 1591 ]]) 1592 ],[ 1593 AC_MSG_RESULT([no]) 1594 AC_MSG_ERROR([compiler does not halt on function prototype mismatch.]) 1595 ],[ 1596 AC_MSG_RESULT([yes]) 1597 ]) 1598]) 1599 1600 1601dnl CURL_VAR_MATCH (VARNAME, VALUE) 1602dnl ------------------------------------------------- 1603dnl Verifies if shell variable VARNAME contains VALUE. 1604dnl Contents of variable VARNAME and VALUE are handled 1605dnl as whitespace separated lists of words. If at least 1606dnl one word of VALUE is present in VARNAME the match 1607dnl is considered positive, otherwise false. 1608 1609AC_DEFUN([CURL_VAR_MATCH], [ 1610 ac_var_match_word="no" 1611 for word1 in $[$1]; do 1612 for word2 in [$2]; do 1613 if test "$word1" = "$word2"; then 1614 ac_var_match_word="yes" 1615 fi 1616 done 1617 done 1618]) 1619 1620 1621dnl CURL_VAR_MATCH_IFELSE (VARNAME, VALUE, 1622dnl [ACTION-IF-MATCH], [ACTION-IF-NOT-MATCH]) 1623dnl ------------------------------------------------- 1624dnl This performs a CURL_VAR_MATCH check and executes 1625dnl first branch if the match is positive, otherwise 1626dnl the second branch is executed. 1627 1628AC_DEFUN([CURL_VAR_MATCH_IFELSE], [ 1629 CURL_VAR_MATCH([$1],[$2]) 1630 if test "$ac_var_match_word" = "yes"; then 1631 ifelse($3,,:,[$3]) 1632 ifelse($4,,,[else 1633 $4]) 1634 fi 1635]) 1636 1637 1638dnl CURL_VAR_STRIP (VARNAME, VALUE) 1639dnl ------------------------------------------------- 1640dnl Contents of variable VARNAME and VALUE are handled 1641dnl as whitespace separated lists of words. Each word 1642dnl from VALUE is removed from VARNAME when present. 1643 1644AC_DEFUN([CURL_VAR_STRIP], [ 1645 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl 1646 ac_var_stripped="" 1647 for word1 in $[$1]; do 1648 ac_var_strip_word="no" 1649 for word2 in [$2]; do 1650 if test "$word1" = "$word2"; then 1651 ac_var_strip_word="yes" 1652 fi 1653 done 1654 if test "$ac_var_strip_word" = "no"; then 1655 ac_var_stripped="$ac_var_stripped $word1" 1656 fi 1657 done 1658 dnl squeeze whitespace out of result 1659 [$1]="$ac_var_stripped" 1660 squeeze [$1] 1661]) 1662 1663dnl CURL_ADD_COMPILER_WARNINGS (WARNING-LIST, NEW-WARNINGS) 1664dnl ------------------------------------------------------- 1665dnl Contents of variable WARNING-LIST and NEW-WARNINGS are 1666dnl handled as whitespace separated lists of words. 1667dnl Add each compiler warning from NEW-WARNINGS that has not 1668dnl been disabled via CFLAGS to WARNING-LIST. 1669 1670AC_DEFUN([CURL_ADD_COMPILER_WARNINGS], [ 1671 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl 1672 ac_var_added_warnings="" 1673 for warning in [$2]; do 1674 CURL_VAR_MATCH(CFLAGS, [-Wno-$warning -W$warning]) 1675 if test "$ac_var_match_word" = "no"; then 1676 ac_var_added_warnings="$ac_var_added_warnings -W$warning" 1677 fi 1678 done 1679 dnl squeeze whitespace out of result 1680 [$1]="$[$1] $ac_var_added_warnings" 1681 squeeze [$1] 1682]) 1683