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