Artifactspublic-v0

curl

master
ply4 git calls44 ms300 KiB3 cachedprotocol v2
1713 lines57 KiBRaw
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.
14# You may opt to use, copy, modify, merge, publish, distribute and/or sell
15# copies of the Software, and permit persons to whom the Software is
16# furnished to do so, under the terms of the COPYING file.
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
21# SPDX-License-Identifier: curl
23#***************************************************************************
25dnl File version for 'aclocal' use. Keep it a single number.
26dnl serial 67
28dnl CURL_CHECK_COMPILER
29dnl -------------------------------------------------
30dnl Verify if the C compiler being used is known.
32AC_DEFUN([CURL_CHECK_COMPILER], [
34 compiler_id="unknown"
35 compiler_ver=""
36 compiler_num="0"
38 flags_dbg_yes="unknown"
39 flags_opt_all="unknown"
40 flags_opt_yes="unknown"
41 flags_opt_off="unknown"
43 flags_prefer_cppflags="no"
45 CURL_CHECK_COMPILER_DEC_C
46 CURL_CHECK_COMPILER_HPUX_C
47 CURL_CHECK_COMPILER_IBM_C
48 CURL_CHECK_COMPILER_INTEL_C
49 CURL_CHECK_COMPILER_CLANG
50 CURL_CHECK_COMPILER_GNU_C
51 case $host in
52 mips-sgi-irix*)
53 CURL_CHECK_COMPILER_SGI_MIPSPRO_C
54 CURL_CHECK_COMPILER_SGI_MIPS_C
55 ;;
56 esac
57 CURL_CHECK_COMPILER_SUNPRO_C
58 CURL_CHECK_COMPILER_TINY_C
60 if test "$compiler_id" = "unknown"; then
61 cat <<_EOF 1>&2
62***
63*** Warning: This configure script does not have information about the
64*** compiler you are using, relative to the flags required to enable or
65*** disable generation of debug info, optimization options or warnings.
66***
67*** Whatever settings are present in CFLAGS are used for this run.
68***
69*** If you wish to help the curl project to better support your compiler
70*** you can report this and the required info on the libcurl development
71*** mailing list: https://lists.haxx.se/listinfo/curl-library/
72***
73_EOF
74 fi
75])
78dnl CURL_CHECK_COMPILER_CLANG
79dnl -------------------------------------------------
80dnl Verify if compiler being used is clang.
82AC_DEFUN([CURL_CHECK_COMPILER_CLANG], [
83 AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU_C])
84 AC_MSG_CHECKING([if compiler is clang])
85 CURL_CHECK_DEF([__clang__], [], [silent])
86 if test "$curl_cv_have_def___clang__" = "yes"; then
87 AC_MSG_RESULT([yes])
88 AC_MSG_CHECKING([if compiler is xlclang])
89 CURL_CHECK_DEF([__ibmxl__], [], [silent])
90 if test "$curl_cv_have_def___ibmxl__" = "yes"; then
91 dnl IBM's almost-compatible clang version
92 AC_MSG_RESULT([yes])
93 compiler_id="XLCLANG"
94 else
95 AC_MSG_RESULT([no])
96 compiler_id="CLANG"
97 fi
98 AC_MSG_CHECKING([if compiler is Apple clang])
99 fullclangver=`$CC -v 2>&1 | grep version`
100 if echo $fullclangver | grep 'Apple' >/dev/null; then
101 AC_MSG_RESULT([yes])
102 appleclang=1
103 compiler_id="APPLECLANG"
104 else
105 AC_MSG_RESULT([no])
106 appleclang=0
107 fi
108 AC_MSG_CHECKING([compiler version])
109 clangver=`echo $fullclangver | grep "based on LLVM " | "$SED" 's/.*(based on LLVM \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*)/\1/'`
110 if test -z "$clangver"; then
111 clangver=`echo $fullclangver | "$SED" 's/.*version \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*/\1/'`
112 oldapple=0
113 else
114 oldapple=1
115 fi
116 clangvhi=`echo $clangver | cut -d . -f1`
117 clangvlo=`echo $clangver | cut -d . -f2`
118 compiler_ver="$clangver"
119 compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
120 if test "$appleclang" = "1" && test "$oldapple" = "0"; then
121 dnl Starting with Xcode 7 / clang 3.7, Apple clang does not tell its upstream version
122 if test "$compiler_num" -ge '2604'; then compiler_num='2101'
123 elif test "$compiler_num" -ge '1700'; then compiler_num='1901'
124 elif test "$compiler_num" -ge '1600'; then compiler_num='1700'
125 elif test "$compiler_num" -ge '1500'; then compiler_num='1600'
126 elif test "$compiler_num" -ge '1400'; then compiler_num='1400'
127 elif test "$compiler_num" -ge '1301'; then compiler_num='1300'
128 elif test "$compiler_num" -ge '1300'; then compiler_num='1200'
129 elif test "$compiler_num" -ge '1200'; then compiler_num='1000'
130 elif test "$compiler_num" -ge '1100'; then compiler_num='800'
131 elif test "$compiler_num" -ge '1000'; then compiler_num='600'
132 elif test "$compiler_num" -ge '901'; then compiler_num='500'
133 elif test "$compiler_num" -ge '900'; then compiler_num='400'
134 elif test "$compiler_num" -ge '801'; then compiler_num='309'
135 elif test "$compiler_num" -ge '703'; then compiler_num='308'
136 else compiler_num='307'
137 fi
138 fi
139 AC_MSG_RESULT([clang '$compiler_num' (raw: '$fullclangver' / '$clangver')])
140 flags_dbg_yes="-g"
141 flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4"
142 flags_opt_yes="-O2"
143 flags_opt_off="-O0"
144 else
145 AC_MSG_RESULT([no])
146 fi
147])
150dnl CURL_CHECK_COMPILER_DEC_C
151dnl -------------------------------------------------
152dnl Verify if compiler being used is DEC C.
154AC_DEFUN([CURL_CHECK_COMPILER_DEC_C], [
155 AC_MSG_CHECKING([if compiler is DEC/Compaq/HP C])
156 CURL_CHECK_DEF([__DECC], [], [silent])
157 CURL_CHECK_DEF([__DECC_VER], [], [silent])
158 if test "$curl_cv_have_def___DECC" = "yes" &&
159 test "$curl_cv_have_def___DECC_VER" = "yes"; then
160 AC_MSG_RESULT([yes])
161 compiler_id="DEC_C"
162 flags_dbg_yes="-g2"
163 flags_opt_all="-O -O0 -O1 -O2 -O3 -O4"
164 flags_opt_yes="-O1"
165 flags_opt_off="-O0"
166 else
167 AC_MSG_RESULT([no])
168 fi
169])
172dnl CURL_CHECK_COMPILER_GNU_C
173dnl -------------------------------------------------
174dnl Verify if compiler being used is GNU C
175dnl
176dnl $compiler_num is set to MAJOR * 100 + MINOR for gcc less than version
177dnl 7 and $MAJOR * 100 for gcc version 7 and later.
178dnl
179dnl Examples:
180dnl Version 1.2.3 => 102
181dnl Version 2.95 => 295
182dnl Version 4.7 => 407
183dnl Version 9.2.1 => 900
184dnl
185AC_DEFUN([CURL_CHECK_COMPILER_GNU_C], [
186 AC_REQUIRE([CURL_CHECK_COMPILER_INTEL_C])
187 AC_REQUIRE([CURL_CHECK_COMPILER_CLANG])
188 AC_MSG_CHECKING([if compiler is GNU C])
189 CURL_CHECK_DEF([__GNUC__], [], [silent])
190 if test "$curl_cv_have_def___GNUC__" = "yes" &&
191 test "$compiler_id" = "unknown"; then
192 AC_MSG_RESULT([yes])
193 compiler_id="GNU_C"
194 AC_MSG_CHECKING([compiler version])
195 dnl strip '-suffix' parts, e.g. Ubuntu Windows cross-gcc returns '10-win32'
196 gccver=`$CC -dumpversion | "$SED" 's/-.\{1,\}$//'`
197 gccvhi=`echo $gccver | cut -d . -f1`
198 if echo $gccver | grep -F '.' >/dev/null; then
199 gccvlo=`echo $gccver | cut -d . -f2`
200 else
201 gccvlo="0"
202 fi
203 compiler_ver="$gccver"
204 compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
205 AC_MSG_RESULT([gcc '$compiler_num' (raw: '$gccver')])
206 flags_dbg_yes="-g"
207 flags_opt_all="-O -O0 -O1 -O2 -O3 -Os -Og -Ofast"
208 flags_opt_yes="-O2"
209 flags_opt_off="-O0"
210 else
211 AC_MSG_RESULT([no])
212 fi
213])
216dnl CURL_CHECK_COMPILER_HPUX_C
217dnl -------------------------------------------------
218dnl Verify if compiler being used is HP-UX C.
220AC_DEFUN([CURL_CHECK_COMPILER_HPUX_C], [
221 AC_MSG_CHECKING([if compiler is HP-UX C])
222 CURL_CHECK_DEF([__HP_cc], [], [silent])
223 if test "$curl_cv_have_def___HP_cc" = "yes"; then
224 AC_MSG_RESULT([yes])
225 compiler_id="HP_UX_C"
226 flags_dbg_yes="-g"
227 flags_opt_all="-O +O0 +O1 +O2 +O3 +O4"
228 flags_opt_yes="+O2"
229 flags_opt_off="+O0"
230 else
231 AC_MSG_RESULT([no])
232 fi
233])
236dnl CURL_CHECK_COMPILER_IBM_C
237dnl -------------------------------------------------
238dnl Verify if compiler being used is IBM C.
240AC_DEFUN([CURL_CHECK_COMPILER_IBM_C], [
241 AC_MSG_CHECKING([if compiler is IBM C])
242 CURL_CHECK_DEF([__IBMC__], [], [silent])
243 if test "$curl_cv_have_def___IBMC__" = "yes"; then
244 AC_MSG_RESULT([yes])
245 compiler_id="IBM_C"
246 flags_dbg_yes="-g"
247 flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5"
248 flags_opt_all="$flags_opt_all -qnooptimize"
249 flags_opt_all="$flags_opt_all -qoptimize=0"
250 flags_opt_all="$flags_opt_all -qoptimize=1"
251 flags_opt_all="$flags_opt_all -qoptimize=2"
252 flags_opt_all="$flags_opt_all -qoptimize=3"
253 flags_opt_all="$flags_opt_all -qoptimize=4"
254 flags_opt_all="$flags_opt_all -qoptimize=5"
255 flags_opt_yes="-O2"
256 flags_opt_off="-qnooptimize"
257 flags_prefer_cppflags="yes"
258 else
259 AC_MSG_RESULT([no])
260 fi
261])
264dnl CURL_CHECK_COMPILER_INTEL_C
265dnl -------------------------------------------------
266dnl Verify if compiler being used is Intel C.
268AC_DEFUN([CURL_CHECK_COMPILER_INTEL_C], [
269 AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU_C])
270 AC_MSG_CHECKING([if compiler is Intel C])
271 CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent])
272 if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then
273 AC_MSG_RESULT([yes])
274 AC_MSG_CHECKING([compiler version])
275 compiler_num="$curl_cv_def___INTEL_COMPILER"
276 compiler_ver=`echo "$compiler_num" | cut -c -2 | $SED 's/^0//'`.`echo "$compiler_num" | cut -c 3-4 | $SED 's/^0//'`
277 AC_MSG_RESULT([Intel C '$compiler_num'])
278 CURL_CHECK_DEF([__unix__], [], [silent])
279 if test "$curl_cv_have_def___unix__" = "yes"; then
280 compiler_id="INTEL_UNIX_C"
281 flags_dbg_yes="-g"
282 flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
283 flags_opt_yes="-O2"
284 flags_opt_off="-O0"
285 else
286 compiler_id="INTEL_WINDOWS_C"
287 flags_dbg_yes="/Zi /Oy-"
288 flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-"
289 flags_opt_yes="/O2"
290 flags_opt_off="/Od"
291 fi
292 else
293 AC_MSG_RESULT([no])
294 fi
295])
298dnl CURL_CHECK_COMPILER_SGI_MIPS_C
299dnl -------------------------------------------------
300dnl Verify if compiler being used is SGI MIPS C.
302AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPS_C], [
303 AC_REQUIRE([CURL_CHECK_COMPILER_SGI_MIPSPRO_C])
304 AC_MSG_CHECKING([if compiler is SGI MIPS C])
305 CURL_CHECK_DEF([__GNUC__], [], [silent])
306 CURL_CHECK_DEF([__sgi], [], [silent])
307 if test "$curl_cv_have_def___GNUC__" = "no" &&
308 test "$curl_cv_have_def___sgi" = "yes" &&
309 test "$compiler_id" = "unknown"; then
310 AC_MSG_RESULT([yes])
311 compiler_id="SGI_MIPS_C"
312 flags_dbg_yes="-g"
313 flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
314 flags_opt_yes="-O2"
315 flags_opt_off="-O0"
316 else
317 AC_MSG_RESULT([no])
318 fi
319])
322dnl CURL_CHECK_COMPILER_SGI_MIPSPRO_C
323dnl -------------------------------------------------
324dnl Verify if compiler being used is SGI MIPSpro C.
326AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPSPRO_C], [
327 AC_BEFORE([$0],[CURL_CHECK_COMPILER_SGI_MIPS_C])
328 AC_MSG_CHECKING([if compiler is SGI MIPSpro C])
329 CURL_CHECK_DEF([__GNUC__], [], [silent])
330 CURL_CHECK_DEF([_COMPILER_VERSION], [], [silent])
331 CURL_CHECK_DEF([_SGI_COMPILER_VERSION], [], [silent])
332 if test "$curl_cv_have_def___GNUC__" = "no" &&
333 (test "$curl_cv_have_def__SGI_COMPILER_VERSION" = "yes" ||
334 test "$curl_cv_have_def__COMPILER_VERSION" = "yes"); then
335 AC_MSG_RESULT([yes])
336 compiler_id="SGI_MIPSPRO_C"
337 flags_dbg_yes="-g"
338 flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
339 flags_opt_yes="-O2"
340 flags_opt_off="-O0"
341 else
342 AC_MSG_RESULT([no])
343 fi
344])
347dnl CURL_CHECK_COMPILER_SUNPRO_C
348dnl -------------------------------------------------
349dnl Verify if compiler being used is SunPro C.
351AC_DEFUN([CURL_CHECK_COMPILER_SUNPRO_C], [
352 AC_MSG_CHECKING([if compiler is SunPro C])
353 CURL_CHECK_DEF([__SUNPRO_C], [], [silent])
354 if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then
355 AC_MSG_RESULT([yes])
356 compiler_id="SUNPRO_C"
357 flags_dbg_yes="-g"
358 flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5"
359 flags_opt_yes="-xO2"
360 flags_opt_off=""
361 else
362 AC_MSG_RESULT([no])
363 fi
364])
367dnl CURL_CHECK_COMPILER_TINY_C
368dnl -------------------------------------------------
369dnl Verify if compiler being used is Tiny C.
371AC_DEFUN([CURL_CHECK_COMPILER_TINY_C], [
372 AC_MSG_CHECKING([if compiler is Tiny C])
373 CURL_CHECK_DEF([__TINYC__], [], [silent])
374 if test "$curl_cv_have_def___TINYC__" = "yes"; then
375 AC_MSG_RESULT([yes])
376 compiler_id="TINY_C"
377 flags_dbg_yes="-g"
378 flags_opt_all=""
379 flags_opt_yes=""
380 flags_opt_off=""
381 else
382 AC_MSG_RESULT([no])
383 fi
384])
386dnl CURL_CONVERT_INCLUDE_TO_ISYSTEM
387dnl -------------------------------------------------
388dnl Changes standard include paths present in CFLAGS
389dnl and CPPFLAGS into isystem include paths. This is
390dnl done to prevent GNUC from generating warnings on
391dnl headers from these locations, although on ancient
392dnl GNUC versions these warnings are not silenced.
394AC_DEFUN([CURL_CONVERT_INCLUDE_TO_ISYSTEM], [
395 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])
396 AC_REQUIRE([CURL_CHECK_COMPILER])
397 AC_MSG_CHECKING([convert -I options to -isystem])
398 if test "$compiler_id" = "GNU_C" ||
399 test "$compiler_id" = "CLANG" ||
400 test "$compiler_id" = "APPLECLANG"; then
401 AC_MSG_RESULT([yes])
402 tmp_has_include="no"
403 tmp_chg_FLAGS="$CFLAGS"
404 for word1 in $tmp_chg_FLAGS; do
405 case "$word1" in
406 -I*)
407 tmp_has_include="yes"
408 ;;
409 esac
410 done
411 if test "$tmp_has_include" = "yes"; then
412 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
413 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
414 CFLAGS="$tmp_chg_FLAGS"
415 squeeze CFLAGS
416 fi
417 tmp_has_include="no"
418 tmp_chg_FLAGS="$CPPFLAGS"
419 for word1 in $tmp_chg_FLAGS; do
420 case "$word1" in
421 -I*)
422 tmp_has_include="yes"
423 ;;
424 esac
425 done
426 if test "$tmp_has_include" = "yes"; then
427 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
428 tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
429 CPPFLAGS="$tmp_chg_FLAGS"
430 squeeze CPPFLAGS
431 fi
432 else
433 AC_MSG_RESULT([no])
434 fi
435])
438dnl CURL_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS])
439dnl -------------------------------------------------
440dnl Verify if the C compiler seems to work with the
441dnl settings that are 'active' at the time the test
442dnl is performed.
444AC_DEFUN([CURL_COMPILER_WORKS_IFELSE], [
445 dnl compilation capability verification
446 tmp_compiler_works="unknown"
447 AC_COMPILE_IFELSE([
448 AC_LANG_PROGRAM([[
449 ]],[[
450 int i = 1;
451 return i;
452 ]])
453 ],[
454 tmp_compiler_works="yes"
455 ],[
456 tmp_compiler_works="no"
457 echo " " >&6
458 $SED 's/^/cc-fail: /' conftest.err >&6
459 echo " " >&6
460 ])
461 dnl linking capability verification
462 if test "$tmp_compiler_works" = "yes"; then
463 AC_LINK_IFELSE([
464 AC_LANG_PROGRAM([[
465 ]],[[
466 int i = 1;
467 return i;
468 ]])
469 ],[
470 tmp_compiler_works="yes"
471 ],[
472 tmp_compiler_works="no"
473 echo " " >&6
474 $SED 's/^/link-fail: /' conftest.err >&6
475 echo " " >&6
476 ])
477 fi
478 dnl only do runtime verification when not cross-compiling
479 if test "$cross_compiling" != "yes" &&
480 test "$tmp_compiler_works" = "yes"; then
481 CURL_RUN_IFELSE([
482 AC_LANG_PROGRAM([[
483 #ifdef __STDC__
484 # include <stdlib.h>
485 #endif
486 ]],[[
487 int i = 0;
488 return i;
489 ]])
490 ],[
491 tmp_compiler_works="yes"
492 ],[
493 tmp_compiler_works="no"
494 echo " " >&6
495 echo "run-fail: test program exited with status $ac_status" >&6
496 echo " " >&6
497 ])
498 fi
499 dnl branch upon test result
500 if test "$tmp_compiler_works" = "yes"; then
501 ifelse($1,,:,[$1])
502 ifelse($2,,,[else
503 $2])
504 fi
505])
508dnl CURL_SET_COMPILER_BASIC_OPTS
509dnl -------------------------------------------------
510dnl Sets compiler specific options/flags which do not
511dnl depend on configure's debug, optimize or warnings
512dnl options.
514AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [
515 AC_REQUIRE([CURL_CHECK_COMPILER])
516 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])
518 if test "$compiler_id" != "unknown"; then
520 tmp_save_CPPFLAGS="$CPPFLAGS"
521 tmp_save_CFLAGS="$CFLAGS"
522 tmp_CPPFLAGS=""
523 tmp_CFLAGS=""
525 case "$compiler_id" in
527 CLANG|APPLECLANG)
529 dnl Disable warnings for unused arguments, otherwise clang warns
530 dnl about compile-time arguments used during link-time, like
531 dnl -O and -g and -pedantic.
532 tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments"
533 tmp_CFLAGS="$tmp_CFLAGS -Werror-implicit-function-declaration"
534 ;;
536 DEC_C)
538 dnl Select strict ANSI C compiler mode
539 tmp_CFLAGS="$tmp_CFLAGS -std1"
540 dnl Turn off optimizer ANSI C aliasing rules
541 tmp_CFLAGS="$tmp_CFLAGS -noansi_alias"
542 dnl Generate warnings for missing function prototypes
543 tmp_CFLAGS="$tmp_CFLAGS -warnprotos"
544 dnl Change some warnings into fatal errors
545 tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs"
546 ;;
548 GNU_C)
550 dnl turn implicit-function-declaration warning into error,
551 dnl at least gcc 2.95 and later support this
552 if test "$compiler_num" -ge "295"; then
553 tmp_CFLAGS="$tmp_CFLAGS -Werror-implicit-function-declaration"
554 fi
555 ;;
557 HP_UX_C)
559 dnl Disallow runtime dereferencing of null pointers
560 tmp_CFLAGS="$tmp_CFLAGS -z"
561 dnl Disable some remarks
562 dnl #4227: padding struct with n bytes to align member
563 dnl #4255: padding size of struct with n bytes to alignment boundary
564 tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255"
565 ;;
567 IBM_C)
569 dnl Ensure that compiler optimizations are always thread-safe.
570 tmp_CPPFLAGS="$tmp_CPPFLAGS -qthreaded"
571 dnl Disable type based strict aliasing optimizations, using worst
572 dnl case aliasing assumptions when compiling. Type based aliasing
573 dnl would restrict the lvalues that could be safely used to access
574 dnl a data object.
575 tmp_CPPFLAGS="$tmp_CPPFLAGS -qnoansialias"
576 dnl Force compiler to stop after the compilation phase, without
577 dnl generating an object code file when compilation has errors.
578 tmp_CPPFLAGS="$tmp_CPPFLAGS -qhalt=e"
579 ;;
581 INTEL_UNIX_C)
583 dnl On Unix this compiler uses gcc's header files, so
584 dnl we select ANSI C89 dialect plus GNU extensions.
585 tmp_CFLAGS="$tmp_CFLAGS -std=gnu89"
586 dnl Change some warnings into errors
587 dnl #140: too many arguments in function call
588 dnl #147: declaration is incompatible with 'previous one'
589 dnl #165: too few arguments in function call
590 dnl #266: function declared implicitly
591 tmp_CPPFLAGS="$tmp_CPPFLAGS -diag-error 140,147,165,266"
592 dnl Disable some remarks
593 dnl #279: controlling expression is constant
594 dnl #981: operands are evaluated in unspecified order
595 dnl #1025: zero extending result of unary operation
596 dnl #1469: "cc" clobber ignored
597 dnl #2259: non-pointer conversion from X to Y may lose significant bits
598 tmp_CPPFLAGS="$tmp_CPPFLAGS -diag-disable 279,981,1025,1469,2259"
599 ;;
601 INTEL_WINDOWS_C)
603 dnl Placeholder
604 tmp_CFLAGS="$tmp_CFLAGS"
605 ;;
607 SGI_MIPS_C)
609 dnl Placeholder
610 tmp_CFLAGS="$tmp_CFLAGS"
611 ;;
613 SGI_MIPSPRO_C)
615 dnl Placeholder
616 tmp_CFLAGS="$tmp_CFLAGS"
617 ;;
619 SUNPRO_C)
621 dnl Placeholder
622 tmp_CFLAGS="$tmp_CFLAGS"
623 ;;
625 TINY_C)
627 dnl Placeholder
628 tmp_CFLAGS="$tmp_CFLAGS"
629 ;;
631 esac
633 squeeze tmp_CPPFLAGS
634 squeeze tmp_CFLAGS
636 if test -n "$tmp_CFLAGS" || test -n "$tmp_CPPFLAGS"; then
637 AC_MSG_CHECKING([if compiler accepts some basic options])
638 CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
639 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
640 squeeze CPPFLAGS
641 squeeze CFLAGS
642 CURL_COMPILER_WORKS_IFELSE([
643 AC_MSG_RESULT([yes])
644 AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
645 ],[
646 AC_MSG_RESULT([no])
647 AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
648 dnl restore initial settings
649 CPPFLAGS="$tmp_save_CPPFLAGS"
650 CFLAGS="$tmp_save_CFLAGS"
651 ])
652 fi
653 fi
654])
657dnl CURL_SET_COMPILER_DEBUG_OPTS
658dnl -------------------------------------------------
659dnl Sets compiler specific options/flags which depend
660dnl on configure's debug option.
662AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [
663 AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])
664 AC_REQUIRE([CURL_CHECK_COMPILER])
665 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])
667 if test "$compiler_id" != "unknown"; then
669 tmp_save_CFLAGS="$CFLAGS"
670 tmp_save_CPPFLAGS="$CPPFLAGS"
672 tmp_options=""
673 tmp_CFLAGS="$CFLAGS"
674 tmp_CPPFLAGS="$CPPFLAGS"
676 if test "$want_debug" = "yes"; then
677 AC_MSG_CHECKING([if compiler accepts debug enabling options])
678 tmp_options="$flags_dbg_yes"
679 fi
681 if test "$flags_prefer_cppflags" = "yes"; then
682 CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
683 CFLAGS="$tmp_CFLAGS"
684 else
685 CPPFLAGS="$tmp_CPPFLAGS"
686 CFLAGS="$tmp_CFLAGS $tmp_options"
687 fi
688 squeeze CPPFLAGS
689 squeeze CFLAGS
690 fi
691])
694dnl CURL_SET_COMPILER_OPTIMIZE_OPTS
695dnl -------------------------------------------------
696dnl Sets compiler specific options/flags which depend
697dnl on configure's optimize option.
699AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
700 AC_REQUIRE([CURL_CHECK_OPTION_OPTIMIZE])
701 AC_REQUIRE([CURL_CHECK_COMPILER])
702 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])
704 if test "$compiler_id" != "unknown"; then
706 tmp_save_CFLAGS="$CFLAGS"
707 tmp_save_CPPFLAGS="$CPPFLAGS"
709 tmp_options=""
710 tmp_CFLAGS="$CFLAGS"
711 tmp_CPPFLAGS="$CPPFLAGS"
712 honor_optimize_option="yes"
714 dnl If optimization request setting has not been explicitly specified,
715 dnl it has been derived from the debug setting and initially assumed.
716 dnl This initially assumed optimizer setting are finally ignored
717 dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies
718 dnl that an initially assumed optimizer setting might not be honored.
720 if test "$want_optimize" = "assume_no" ||
721 test "$want_optimize" = "assume_yes"; then
722 AC_MSG_CHECKING([if compiler optimizer assumed setting might be used])
723 CURL_VAR_MATCH_IFELSE([tmp_CFLAGS],[$flags_opt_all],[
724 honor_optimize_option="no"
725 ])
726 CURL_VAR_MATCH_IFELSE([tmp_CPPFLAGS],[$flags_opt_all],[
727 honor_optimize_option="no"
728 ])
729 AC_MSG_RESULT([$honor_optimize_option])
730 if test "$honor_optimize_option" = "yes"; then
731 if test "$want_optimize" = "assume_yes"; then
732 want_optimize="yes"
733 fi
734 if test "$want_optimize" = "assume_no"; then
735 want_optimize="no"
736 fi
737 fi
738 fi
740 if test "$honor_optimize_option" = "yes"; then
741 CURL_VAR_STRIP([tmp_CFLAGS],[$flags_opt_all])
742 CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_opt_all])
743 if test "$want_optimize" = "yes"; then
744 AC_MSG_CHECKING([if compiler accepts optimizer enabling options])
745 tmp_options="$flags_opt_yes"
746 fi
747 if test "$want_optimize" = "no"; then
748 AC_MSG_CHECKING([if compiler accepts optimizer disabling options])
749 tmp_options="$flags_opt_off"
750 fi
751 if test "$flags_prefer_cppflags" = "yes"; then
752 CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
753 CFLAGS="$tmp_CFLAGS"
754 else
755 CPPFLAGS="$tmp_CPPFLAGS"
756 CFLAGS="$tmp_CFLAGS $tmp_options"
757 fi
758 squeeze CPPFLAGS
759 squeeze CFLAGS
760 CURL_COMPILER_WORKS_IFELSE([
761 AC_MSG_RESULT([yes])
762 AC_MSG_NOTICE([compiler options added: $tmp_options])
763 ],[
764 AC_MSG_RESULT([no])
765 AC_MSG_WARN([compiler options rejected: $tmp_options])
766 dnl restore initial settings
767 CPPFLAGS="$tmp_save_CPPFLAGS"
768 CFLAGS="$tmp_save_CFLAGS"
769 ])
770 fi
771 fi
772])
775dnl CURL_SET_COMPILER_WARNING_OPTS
776dnl -------------------------------------------------
777dnl Sets compiler options/flags which depend on
778dnl configure's warnings given option.
780AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
781 AC_REQUIRE([CURL_CHECK_OPTION_WARNINGS])
782 AC_REQUIRE([CURL_CHECK_COMPILER])
783 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])
785 if test "$compiler_id" != "unknown"; then
787 tmp_save_CPPFLAGS="$CPPFLAGS"
788 tmp_save_CFLAGS="$CFLAGS"
789 tmp_CPPFLAGS=""
790 tmp_CFLAGS=""
792 case "$compiler_id" in
794 CLANG|APPLECLANG)
796 if test "$want_warnings" = "yes"; then
797 if test "$compiler_num" -ge "302"; then
798 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [pedantic])
799 else
800 tmp_CFLAGS="$tmp_CFLAGS -pedantic"
801 fi
802 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [all extra])
803 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [pointer-arith write-strings])
804 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [shadow])
805 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [nested-externs])
806 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-declarations])
807 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-prototypes])
808 tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
809 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [float-equal])
810 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [sign-compare])
811 tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar"
812 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [undef])
813 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [endif-labels strict-prototypes])
814 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [declaration-after-statement])
815 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-align])
816 tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers"
817 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [shorten-64-to-32])
819 dnl Only clang 1.1 or later
820 if test "$compiler_num" -ge "101"; then
821 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused])
822 fi
824 dnl Only clang 2.7 or later
825 if test "$compiler_num" -ge "207"; then
826 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [address])
827 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [attributes])
828 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [bad-function-cast])
829 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-qual])
830 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [conversion])
831 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [div-by-zero format-security])
832 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [empty-body])
833 tmp_CFLAGS="$tmp_CFLAGS -Wformat=2"
834 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-field-initializers])
835 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-noreturn])
836 tmp_CFLAGS="$tmp_CFLAGS -Wno-switch-default"
837 tmp_CFLAGS="$tmp_CFLAGS -Wno-switch-enum" # Not used because this basically disallows default case
838 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [old-style-definition])
839 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [redundant-decls])
840 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [type-limits])
841 # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-macros]) # Not practical
842 # tmp_CFLAGS="$tmp_CFLAGS -Wno-error=unused-macros"
843 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unreachable-code unused-parameter])
844 fi
846 dnl Only clang 2.8 or later
847 if test "$compiler_num" -ge "208"; then
848 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [ignored-qualifiers])
849 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [vla])
850 fi
852 dnl Only clang 2.9 or later
853 if test "$compiler_num" -ge "209"; then
854 tmp_CFLAGS="$tmp_CFLAGS -Wno-sign-conversion"
855 tmp_CFLAGS="$tmp_CFLAGS -Wno-padded" # Not used because we cannot change public structs
856 tmp_CFLAGS="$tmp_CFLAGS -Wno-used-but-marked-unused" # for typecheck-gcc.h with clang 14+, dependency headers
857 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [shift-sign-overflow])
858 fi
860 dnl Only clang 3.0 or later
861 if test "$compiler_num" -ge "300"; then
862 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [conditional-uninitialized])
863 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [language-extension-token])
864 fi
866 dnl Only clang 3.1 or later
867 if test "$compiler_num" -ge "301"; then
868 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [format-non-iso])
869 tmp_CFLAGS="$tmp_CFLAGS -Wno-covered-switch-default" # Annoying to fix or silence
870 tmp_CFLAGS="$tmp_CFLAGS -Wno-disabled-macro-expansion" # for std headers, and curl/curl.h (rare combos)
871 fi
873 dnl Only clang 3.2 or later
874 if test "$compiler_num" -ge "302"; then
875 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [enum-conversion])
876 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [sometimes-uninitialized])
877 case $host_os in
878 cygwin* | mingw*)
879 dnl skip missing-variable-declarations warnings for Cygwin and
880 dnl MinGW because the libtool wrapper executable causes them
881 ;;
882 *)
883 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-variable-declarations])
884 ;;
885 esac
886 fi
888 dnl Only clang 3.3 or later
889 if test "$compiler_num" -ge "303"; then
890 tmp_CFLAGS="$tmp_CFLAGS -Wno-documentation-unknown-command"
891 fi
893 dnl Only clang 3.4 or later
894 if test "$compiler_num" -ge "304"; then
895 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [header-guard])
896 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-const-variable])
897 fi
899 dnl Only clang 3.5 or later
900 if test "$compiler_num" -ge "305"; then
901 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [pragmas])
902 # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unreachable-code-break]) # Not used: Silent in "unity" builds
903 fi
905 dnl Only clang 3.6 or later
906 if test "$compiler_num" -ge "306"; then
907 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [double-promotion])
908 fi
910 dnl Only clang 3.9 or later
911 if test "$compiler_num" -ge "309"; then
912 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [comma])
913 dnl avoid the varargs warning, fixed in 4.0
914 dnl https://bugs.llvm.org/show_bug.cgi?id=29140
915 if test "$compiler_num" -lt "400"; then
916 tmp_CFLAGS="$tmp_CFLAGS -Wno-varargs"
917 fi
918 fi
920 dnl clang 7 or later
921 if test "$compiler_num" -ge "700"; then
922 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [assign-enum])
923 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [extra-semi-stmt])
924 fi
926 dnl clang 10 or later
927 if test "$compiler_num" -ge "1000"; then
928 tmp_CFLAGS="$tmp_CFLAGS -Wimplicit-fallthrough" # we have silencing markup for clang 10.0 and above only
929 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [xor-used-as-pow])
930 fi
932 dnl clang 13 or later
933 if test "$compiler_num" -ge "1300"; then
934 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-function-type])
935 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [reserved-identifier]) # Keep it before -Wno-reserved-macro-identifier
936 tmp_CFLAGS="$tmp_CFLAGS -Wno-reserved-macro-identifier" # Sometimes such external macros need to be set
937 fi
939 dnl clang 16 or later
940 if test "$compiler_num" -ge "1600"; then
941 tmp_CFLAGS="$tmp_CFLAGS -Wno-unsafe-buffer-usage"
942 fi
944 dnl clang 17 or later
945 if test "$compiler_num" -ge "1700"; then
946 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-function-type-strict]) # with Apple clang it requires 16.0 or above
947 fi
949 dnl clang 19 or later
950 if test "$compiler_num" -ge "1901"; then
951 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [format-signedness])
952 fi
954 dnl clang 20 or later
955 if test "$compiler_num" -ge "2001"; then
956 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [array-compare])
957 fi
959 dnl clang 21 or later
960 if test "$compiler_num" -ge "2101"; then
961 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [c++-hidden-decl])
962 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [implicit-int-enum-cast])
963 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [jump-misses-init])
964 tmp_CFLAGS="$tmp_CFLAGS -Wno-implicit-void-ptr-cast"
965 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [tentative-definition-compat])
966 if test "$curl_cv_native_windows" = "yes"; then
967 tmp_CFLAGS="$tmp_CFLAGS -Wno-c++-keyword" # `wchar_t` triggers it on Windows
968 else
969 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [c++-keyword])
970 fi
971 fi
973 case "$CFLAGS" in
974 *-std=c89*|*-std=c90*|*-std=gnu89*|*-std=gnu90*)
975 if test "$compiler_num" -ge "300"; then
976 tmp_CFLAGS="$tmp_CFLAGS -Wno-c99-extensions" # Avoid: warning: '_Bool' is a C99 extension
977 fi
978 if test "$compiler_num" -ge "309"; then
979 tmp_CFLAGS="$tmp_CFLAGS -Wno-comma" # Silly
980 fi
981 ;;
982 esac
983 fi
984 ;;
986 DEC_C)
988 if test "$want_warnings" = "yes"; then
989 dnl Select a higher warning level than default level2
990 tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3"
991 fi
992 ;;
994 GNU_C)
996 dnl Leave disabled for GCC <4.6, because they lack #pragma features to silence locally.
997 if test "$want_warnings" = "yes" && test "$compiler_num" -ge "406"; then
999 dnl Do not enable -pedantic when cross-compiling with a gcc older
1000 dnl than 3.0, to avoid warnings from third party system headers.
1001 if test "$cross_compiling" != "yes" ||
1002 test "$compiler_num" -ge "300"; then
1003 if test "$compiler_num" -ge "408"; then
1004 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [pedantic])
1005 else
1006 tmp_CFLAGS="$tmp_CFLAGS -pedantic"
1007 fi
1008 fi
1010 dnl Set of options we believe *ALL* gcc versions support:
1011 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [all])
1012 tmp_CFLAGS="$tmp_CFLAGS -W"
1014 dnl Only gcc 1.4 or later
1015 if test "$compiler_num" -ge "104"; then
1016 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [pointer-arith write-strings])
1017 dnl If not cross-compiling with a gcc older than 3.0
1018 if test "$cross_compiling" != "yes" ||
1019 test "$compiler_num" -ge "300"; then
1020 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused shadow])
1021 fi
1022 fi
1024 dnl Only gcc 2.7 or later
1025 if test "$compiler_num" -ge "207"; then
1026 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [nested-externs])
1027 dnl If not cross-compiling with a gcc older than 3.0
1028 if test "$cross_compiling" != "yes" ||
1029 test "$compiler_num" -ge "300"; then
1030 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-declarations])
1031 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-prototypes])
1032 fi
1033 fi
1035 dnl Only gcc 2.95 or later
1036 if test "$compiler_num" -ge "295"; then
1037 tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
1038 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [bad-function-cast])
1039 fi
1041 dnl Only gcc 2.96 or later
1042 if test "$compiler_num" -ge "296"; then
1043 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [float-equal])
1044 tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar"
1045 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [sign-compare])
1046 dnl -Wundef used only if gcc is 2.96 or later since we get
1047 dnl lots of "`_POSIX_C_SOURCE' is not defined" in system
1048 dnl headers with gcc 2.95.4 on FreeBSD 4.9
1049 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [undef])
1050 fi
1052 dnl Only gcc 3.0 or later
1053 if test "$compiler_num" -ge "300"; then
1054 dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
1055 dnl on i686-Linux as it gives us heaps with false positives.
1056 dnl Also, on gcc 4.0.X it is totally unbearable and complains all
1057 dnl over making it unusable for generic purposes. Let's not use it.
1058 tmp_CFLAGS="$tmp_CFLAGS"
1059 fi
1061 dnl Only gcc 3.3 or later
1062 if test "$compiler_num" -ge "303"; then
1063 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [endif-labels strict-prototypes])
1064 fi
1066 dnl Only gcc 3.4 or later
1067 if test "$compiler_num" -ge "304"; then
1068 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [declaration-after-statement])
1069 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [old-style-definition])
1070 fi
1072 dnl Only gcc 4.0 or later
1073 if test "$compiler_num" -ge "400"; then
1074 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-qual])
1075 tmp_CFLAGS="$tmp_CFLAGS -Wstrict-aliasing=3"
1076 fi
1078 dnl Only gcc 4.1 or later
1079 if test "$compiler_num" -ge "401"; then
1080 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [attributes])
1081 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [div-by-zero format-security])
1082 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-field-initializers])
1083 case $host in
1084 *-*-msys*)
1085 ;;
1086 *)
1087 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-noreturn]) # Seen to clash with libtool-generated stub code
1088 ;;
1089 esac
1090 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unreachable-code unused-parameter])
1091 tmp_CFLAGS="$tmp_CFLAGS -Wno-padded" # Not used because we cannot change public structs
1092 tmp_CFLAGS="$tmp_CFLAGS -Wno-switch-default"
1093 tmp_CFLAGS="$tmp_CFLAGS -Wno-switch-enum" # Not used because this basically disallows default case
1094 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [pragmas])
1095 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [redundant-decls])
1096 # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-macros]) # Not practical
1097 # tmp_CFLAGS="$tmp_CFLAGS -Wno-error=unused-macros"
1098 fi
1100 dnl Only gcc 4.2 or later
1101 if test "$compiler_num" -ge "402"; then
1102 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-align])
1103 fi
1105 dnl Only gcc 4.3 or later
1106 if test "$compiler_num" -ge "403"; then
1107 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [address])
1108 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [type-limits old-style-declaration])
1109 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-parameter-type empty-body])
1110 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [clobbered ignored-qualifiers])
1111 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [conversion])
1112 tmp_CFLAGS="$tmp_CFLAGS -Wno-sign-conversion"
1113 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [vla])
1114 dnl required for -Warray-bounds, included in -Wall
1115 tmp_CFLAGS="$tmp_CFLAGS -ftree-vrp"
1116 fi
1118 dnl Only gcc 4.4 or later
1119 if test "$compiler_num" -ge "404"; then
1120 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [logical-op])
1121 fi
1123 dnl Only gcc 4.5 or later
1124 if test "$compiler_num" -ge "405"; then
1125 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [jump-misses-init])
1126 dnl Only Windows targets
1127 if test "$curl_cv_native_windows" = "yes"; then
1128 tmp_CFLAGS="$tmp_CFLAGS -Wno-pedantic-ms-format"
1129 fi
1130 case $host_os in
1131 cygwin*)
1132 dnl Silence warning in 'lt_fatal' libtool function
1133 tmp_CFLAGS="$tmp_CFLAGS -Wno-suggest-attribute=noreturn"
1134 ;;
1135 esac
1136 fi
1138 dnl Only gcc 4.6 or later
1139 if test "$compiler_num" -ge "406"; then
1140 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [double-promotion])
1141 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [trampolines])
1142 fi
1144 dnl only gcc 4.8 or later
1145 if test "$compiler_num" -ge "408"; then
1146 tmp_CFLAGS="$tmp_CFLAGS -Wformat=2"
1147 fi
1149 dnl Only gcc 5 or later
1150 if test "$compiler_num" -ge "500"; then
1151 tmp_CFLAGS="$tmp_CFLAGS -Warray-bounds=2"
1152 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [format-signedness])
1153 fi
1155 dnl Only gcc 6 or later
1156 if test "$compiler_num" -ge "600"; then
1157 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [shift-negative-value])
1158 tmp_CFLAGS="$tmp_CFLAGS -Wshift-overflow=2"
1159 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [null-dereference])
1160 tmp_CFLAGS="$tmp_CFLAGS -fdelete-null-pointer-checks"
1161 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [duplicated-cond])
1162 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-const-variable])
1163 fi
1165 dnl Only gcc 7 or later
1166 if test "$compiler_num" -ge "700"; then
1167 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [duplicated-branches])
1168 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [restrict])
1169 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [alloc-zero])
1170 tmp_CFLAGS="$tmp_CFLAGS -Wformat-truncation=2"
1171 tmp_CFLAGS="$tmp_CFLAGS -Wimplicit-fallthrough"
1172 fi
1174 dnl Only gcc 10 or later
1175 if test "$compiler_num" -ge "1000"; then
1176 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [arith-conversion])
1177 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [enum-conversion])
1178 fi
1180 dnl Only gcc 12 or later
1181 if test "$compiler_num" -ge "1200"; then
1182 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [array-compare])
1183 fi
1185 dnl Only gcc 13 or later
1186 if test "$compiler_num" -ge "1300"; then
1187 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [enum-int-mismatch])
1188 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [xor-used-as-pow])
1189 fi
1191 dnl Only gcc 15 or later
1192 if test "$compiler_num" -ge "1500"; then
1193 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [leading-whitespace=spaces])
1194 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [trailing-whitespace=any])
1195 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unterminated-string-initialization])
1196 fi
1197 fi
1199 dnl Do not issue warnings for code in system include paths.
1200 if test "$compiler_num" -ge "300"; then
1201 tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers"
1202 else
1203 dnl When cross-compiling with a gcc older than 3.0, disable
1204 dnl some warnings triggered on third party system headers.
1205 if test "$cross_compiling" = "yes"; then
1206 if test "$compiler_num" -ge "104"; then
1207 dnl gcc 1.4 or later
1208 tmp_CFLAGS="$tmp_CFLAGS -Wno-unused -Wno-shadow"
1209 fi
1210 if test "$compiler_num" -ge "207"; then
1211 dnl gcc 2.7 or later
1212 tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-declarations"
1213 tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-prototypes"
1214 fi
1215 fi
1216 fi
1217 if test "$compiler_num" -ge "400" && test "$compiler_num" -lt "407"; then
1218 dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84685
1219 tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-field-initializers"
1220 fi
1221 if test "$compiler_num" -ge "403" && test "$compiler_num" -lt "408"; then
1222 dnl Avoid false positives
1223 tmp_CFLAGS="$tmp_CFLAGS -Wno-type-limits"
1224 fi
1225 if test "$compiler_num" -ge "501" && test "$compiler_num" -lt "505"; then
1226 dnl Avoid false positives
1227 tmp_CFLAGS="$tmp_CFLAGS -Wno-conversion"
1228 fi
1229 ;;
1231 HP_UX_C)
1233 if test "$want_warnings" = "yes"; then
1234 dnl Issue all warnings
1235 tmp_CFLAGS="$tmp_CFLAGS +w1"
1236 fi
1237 ;;
1239 IBM_C)
1241 dnl Placeholder
1242 tmp_CFLAGS="$tmp_CFLAGS"
1243 ;;
1245 INTEL_UNIX_C)
1247 if test "$want_warnings" = "yes"; then
1248 if test "$compiler_num" -gt "600"; then
1249 dnl Show errors, warnings, and remarks
1250 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall -w2"
1251 dnl Perform extra compile-time code checking
1252 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck"
1253 dnl Warn on nested comments
1254 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcomment"
1255 dnl Show warnings relative to deprecated features
1256 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wdeprecated"
1257 dnl Enable warnings for missing prototypes
1258 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wmissing-prototypes"
1259 dnl Enable warnings for 64-bit portability issues
1260 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wp64"
1261 dnl Enable warnings for questionable pointer arithmetic
1262 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wpointer-arith"
1263 dnl Check for function return type issues
1264 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wreturn-type"
1265 dnl Warn on variable declarations hiding a previous one
1266 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wshadow"
1267 dnl Warn when a variable is used before initialized
1268 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wuninitialized"
1269 dnl Warn if a declared function is not used
1270 tmp_CPPFLAGS="$tmp_CPPFLAGS -Wunused-function"
1271 fi
1272 fi
1273 dnl Disable using EBP register in optimizations
1274 tmp_CFLAGS="$tmp_CFLAGS -fno-omit-frame-pointer"
1275 dnl Disable use of ANSI C aliasing rules in optimizations
1276 tmp_CFLAGS="$tmp_CFLAGS -fno-strict-aliasing"
1277 dnl Value-safe optimizations on floating-point data
1278 tmp_CFLAGS="$tmp_CFLAGS -fp-model precise"
1279 ;;
1281 INTEL_WINDOWS_C)
1283 dnl Placeholder
1284 tmp_CFLAGS="$tmp_CFLAGS"
1285 ;;
1287 SGI_MIPS_C)
1289 if test "$want_warnings" = "yes"; then
1290 dnl Perform stricter semantic and lint-like checks
1291 tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
1292 fi
1293 ;;
1295 SGI_MIPSPRO_C)
1297 if test "$want_warnings" = "yes"; then
1298 dnl Perform stricter semantic and lint-like checks
1299 tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
1300 dnl Disable some remarks
1301 dnl #1209: controlling expression is constant
1302 tmp_CFLAGS="$tmp_CFLAGS -woff 1209"
1303 fi
1304 ;;
1306 SUNPRO_C)
1308 if test "$want_warnings" = "yes"; then
1309 dnl Perform stricter semantic and lint-like checks
1310 tmp_CFLAGS="$tmp_CFLAGS -v"
1311 fi
1312 ;;
1314 TINY_C)
1316 if test "$want_warnings" = "yes"; then
1317 dnl Activate all warnings
1318 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [all])
1319 dnl Make string constants be of type const char *
1320 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [write-strings])
1321 dnl Warn use of unsupported GCC features ignored by TCC
1322 CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unsupported])
1323 fi
1324 ;;
1326 esac
1328 squeeze tmp_CPPFLAGS
1329 squeeze tmp_CFLAGS
1331 if test -n "$tmp_CFLAGS" || test -n "$tmp_CPPFLAGS"; then
1332 AC_MSG_CHECKING([if compiler accepts strict warning options])
1333 CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
1334 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
1335 squeeze CPPFLAGS
1336 squeeze CFLAGS
1337 CURL_COMPILER_WORKS_IFELSE([
1338 AC_MSG_RESULT([yes])
1339 AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
1340 ],[
1341 AC_MSG_RESULT([no])
1342 AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
1343 dnl restore initial settings
1344 CPPFLAGS="$tmp_save_CPPFLAGS"
1345 CFLAGS="$tmp_save_CFLAGS"
1346 ])
1347 fi
1348 fi
1352dnl CURL_SHFUNC_SQUEEZE
1353dnl -------------------------------------------------
1354dnl Declares a shell function squeeze() which removes
1355dnl redundant whitespace out of a shell variable.
1357AC_DEFUN([CURL_SHFUNC_SQUEEZE], [
1358squeeze() {
1359 _sqz_result=""
1360 eval _sqz_input=\[$][$]1
1361 for _sqz_token in $_sqz_input; do
1362 if test -z "$_sqz_result"; then
1363 _sqz_result="$_sqz_token"
1364 else
1365 _sqz_result="$_sqz_result $_sqz_token"
1366 fi
1367 done
1368 eval [$]1=\$_sqz_result
1369 return 0
1374dnl CURL_CHECK_COMPILER_HALT_ON_ERROR
1375dnl -------------------------------------------------
1376dnl Verifies if the compiler actually halts after the
1377dnl compilation phase without generating any object
1378dnl code file, when the source compiles with errors.
1380AC_DEFUN([CURL_CHECK_COMPILER_HALT_ON_ERROR], [
1381 AC_MSG_CHECKING([if compiler halts on compilation errors])
1382 AC_COMPILE_IFELSE([
1383 AC_LANG_PROGRAM([[
1384 ]],[[
1385 #error force compilation error
1386 ]])
1387 ],[
1388 AC_MSG_RESULT([no])
1389 AC_MSG_ERROR([compiler does not halt on compilation errors.])
1390 ],[
1391 AC_MSG_RESULT([yes])
1392 ])
1396dnl CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
1397dnl -------------------------------------------------
1398dnl Verifies if the compiler actually halts after the
1399dnl compilation phase without generating any object
1400dnl code file, when the source code tries to define a
1401dnl type for a constant array with negative dimension.
1403AC_DEFUN([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [
1404 AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])
1405 AC_MSG_CHECKING([if compiler halts on negative sized arrays])
1406 AC_COMPILE_IFELSE([
1407 AC_LANG_PROGRAM([[
1408 typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1];
1409 ]],[[
1410 bad_t dummy;
1411 (void)dummy;
1412 ]])
1413 ],[
1414 AC_MSG_RESULT([no])
1415 AC_MSG_ERROR([compiler does not halt on negative sized arrays.])
1416 ],[
1417 AC_MSG_RESULT([yes])
1418 ])
1422dnl CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE
1423dnl -------------------------------------------------
1424dnl Verifies if the compiler is capable of handling the
1425dnl size of a struct member, struct which is a function
1426dnl result, as a compilation-time condition inside the
1427dnl type definition of a constant array.
1429AC_DEFUN([CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE], [
1430 AC_REQUIRE([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE])
1431 AC_MSG_CHECKING([if compiler struct member size checking works])
1432 tst_compiler_check_one_works="unknown"
1433 AC_COMPILE_IFELSE([
1434 AC_LANG_PROGRAM([[
1435 struct mystruct {
1436 int mi;
1437 char mc;
1438 struct mystruct *next;
1439 };
1440 struct mystruct myfunc();
1441 typedef char good_t1[sizeof(myfunc().mi) == sizeof(int) ? 1 : -1];
1442 typedef char good_t2[sizeof(myfunc().mc) == sizeof(char) ? 1 : -1];
1443 ]],[[
1444 good_t1 dummy1;
1445 good_t2 dummy2;
1446 (void)dummy1;
1447 (void)dummy2;
1448 ]])
1449 ],[
1450 tst_compiler_check_one_works="yes"
1451 ],[
1452 tst_compiler_check_one_works="no"
1453 $SED 's/^/cc-src: /' conftest.$ac_ext >&6
1454 $SED 's/^/cc-err: /' conftest.err >&6
1455 ])
1456 tst_compiler_check_two_works="unknown"
1457 AC_COMPILE_IFELSE([
1458 AC_LANG_PROGRAM([[
1459 struct mystruct {
1460 int mi;
1461 char mc;
1462 struct mystruct *next;
1463 };
1464 struct mystruct myfunc();
1465 typedef char bad_t1[sizeof(myfunc().mi) != sizeof(int) ? 1 : -1];
1466 typedef char bad_t2[sizeof(myfunc().mc) != sizeof(char) ? 1 : -1];
1467 ]],[[
1468 bad_t1 dummy1;
1469 bad_t2 dummy2;
1470 (void)dummy1;
1471 (void)dummy2;
1472 ]])
1473 ],[
1474 tst_compiler_check_two_works="no"
1475 ],[
1476 tst_compiler_check_two_works="yes"
1477 ])
1478 if test "$tst_compiler_check_one_works" = "yes" &&
1479 test "$tst_compiler_check_two_works" = "yes"; then
1480 AC_MSG_RESULT([yes])
1481 else
1482 AC_MSG_RESULT([no])
1483 AC_MSG_ERROR([compiler fails struct member size checking.])
1484 fi
1488dnl CURL_CHECK_COMPILER_SYMBOL_HIDING
1489dnl -------------------------------------------------
1490dnl Verify if compiler supports hiding library internal symbols, setting
1491dnl shell variable supports_symbol_hiding value as appropriate, as well as
1492dnl variables symbol_hiding_CFLAGS and symbol_hiding_EXTERN when supported.
1494AC_DEFUN([CURL_CHECK_COMPILER_SYMBOL_HIDING], [
1495 AC_REQUIRE([CURL_CHECK_COMPILER])
1496 AC_BEFORE([$0],[CURL_CONFIGURE_SYMBOL_HIDING])
1497 AC_MSG_CHECKING([if compiler supports hiding library internal symbols])
1498 supports_symbol_hiding="no"
1499 symbol_hiding_CFLAGS=""
1500 symbol_hiding_EXTERN=""
1501 tmp_CFLAGS=""
1502 tmp_EXTERN=""
1503 case "$compiler_id" in
1504 CLANG|APPLECLANG)
1505 dnl All versions of clang support -fvisibility=
1506 tmp_EXTERN="__attribute__((__visibility__(\"default\")))"
1507 tmp_CFLAGS="-fvisibility=hidden"
1508 supports_symbol_hiding="yes"
1509 ;;
1510 GNU_C)
1511 dnl Only gcc 3.4 or later
1512 if test "$compiler_num" -ge "304"; then
1513 if $CC --help --verbose 2>/dev/null | grep fvisibility= >/dev/null; then
1514 tmp_EXTERN="__attribute__((__visibility__(\"default\")))"
1515 tmp_CFLAGS="-fvisibility=hidden"
1516 supports_symbol_hiding="yes"
1517 fi
1518 fi
1519 ;;
1520 INTEL_UNIX_C)
1521 dnl Only icc 9.0 or later
1522 if test "$compiler_num" -ge "900"; then
1523 if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null; then
1524 tmp_save_CFLAGS="$CFLAGS"
1525 CFLAGS="$CFLAGS -fvisibility=hidden"
1526 AC_LINK_IFELSE([
1527 AC_LANG_PROGRAM([[
1528 #include <stdio.h>
1529 ]],[[
1530 printf("icc fvisibility bug test");
1531 ]])
1532 ],[
1533 tmp_EXTERN="__attribute__((__visibility__(\"default\")))"
1534 tmp_CFLAGS="-fvisibility=hidden"
1535 supports_symbol_hiding="yes"
1536 ])
1537 CFLAGS="$tmp_save_CFLAGS"
1538 fi
1539 fi
1540 ;;
1541 SUNPRO_C)
1542 if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null; then
1543 tmp_EXTERN="__global"
1544 tmp_CFLAGS="-xldscope=hidden"
1545 supports_symbol_hiding="yes"
1546 fi
1547 ;;
1548 esac
1549 if test "$supports_symbol_hiding" = "yes"; then
1550 tmp_save_CFLAGS="$CFLAGS"
1551 CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
1552 squeeze CFLAGS
1553 AC_COMPILE_IFELSE([
1554 AC_LANG_PROGRAM([[
1555 $tmp_EXTERN const char *dummy(const char *buff);
1556 const char *dummy(const char *buff)
1558 if(buff)
1559 return ++buff;
1560 else
1561 return buff;
1563 ]],[[
1564 const char *b = "example";
1565 const char *r = dummy(&b[0]);
1566 if(r)
1567 return (int)*r;
1568 ]])
1569 ],[
1570 supports_symbol_hiding="yes"
1571 if test -f conftest.err; then
1572 grep 'visibility' conftest.err >/dev/null
1573 if test "$?" -eq "0"; then
1574 supports_symbol_hiding="no"
1575 fi
1576 fi
1577 ],[
1578 supports_symbol_hiding="no"
1579 echo " " >&6
1580 $SED 's/^/cc-src: /' conftest.$ac_ext >&6
1581 $SED 's/^/cc-err: /' conftest.err >&6
1582 echo " " >&6
1583 ])
1584 CFLAGS="$tmp_save_CFLAGS"
1585 fi
1586 if test "$supports_symbol_hiding" = "yes"; then
1587 AC_MSG_RESULT([yes])
1588 symbol_hiding_CFLAGS="$tmp_CFLAGS"
1589 symbol_hiding_EXTERN="$tmp_EXTERN"
1590 else
1591 AC_MSG_RESULT([no])
1592 fi
1596dnl CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
1597dnl -------------------------------------------------
1598dnl Verifies if the compiler actually halts after the
1599dnl compilation phase without generating any object
1600dnl code file, when the source code tries to redefine
1601dnl a prototype which does not match previous one.
1603AC_DEFUN([CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH], [
1604 AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])
1605 AC_MSG_CHECKING([if compiler halts on function prototype mismatch])
1606 AC_COMPILE_IFELSE([
1607 AC_LANG_PROGRAM([[
1608 #include <stdlib.h>
1609 int rand(int n);
1610 int rand(int n)
1612 if(n)
1613 return ++n;
1614 else
1615 return n;
1617 ]],[[
1618 int i[2] ={ 0, 0 };
1619 int j = rand(i[0]);
1620 if(j)
1621 return j;
1622 ]])
1623 ],[
1624 AC_MSG_RESULT([no])
1625 AC_MSG_ERROR([compiler does not halt on function prototype mismatch.])
1626 ],[
1627 AC_MSG_RESULT([yes])
1628 ])
1632dnl CURL_VAR_MATCH (VARNAME, VALUE)
1633dnl -------------------------------------------------
1634dnl Verifies if shell variable VARNAME contains VALUE.
1635dnl Contents of variable VARNAME and VALUE are handled
1636dnl as whitespace separated lists of words. If at least
1637dnl one word of VALUE is present in VARNAME the match
1638dnl is considered positive, otherwise false.
1640AC_DEFUN([CURL_VAR_MATCH], [
1641 ac_var_match_word="no"
1642 for word1 in $[$1]; do
1643 for word2 in [$2]; do
1644 if test "$word1" = "$word2"; then
1645 ac_var_match_word="yes"
1646 fi
1647 done
1648 done
1652dnl CURL_VAR_MATCH_IFELSE (VARNAME, VALUE,
1653dnl [ACTION-IF-MATCH], [ACTION-IF-NOT-MATCH])
1654dnl -------------------------------------------------
1655dnl This performs a CURL_VAR_MATCH check and executes
1656dnl first branch if the match is positive, otherwise
1657dnl the second branch is executed.
1659AC_DEFUN([CURL_VAR_MATCH_IFELSE], [
1660 CURL_VAR_MATCH([$1],[$2])
1661 if test "$ac_var_match_word" = "yes"; then
1662 ifelse($3,,:,[$3])
1663 ifelse($4,,,[else
1664 $4])
1665 fi
1669dnl CURL_VAR_STRIP (VARNAME, VALUE)
1670dnl -------------------------------------------------
1671dnl Contents of variable VARNAME and VALUE are handled
1672dnl as whitespace separated lists of words. Each word
1673dnl from VALUE is removed from VARNAME when present.
1675AC_DEFUN([CURL_VAR_STRIP], [
1676 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])
1677 ac_var_stripped=""
1678 for word1 in $[$1]; do
1679 ac_var_strip_word="no"
1680 for word2 in [$2]; do
1681 if test "$word1" = "$word2"; then
1682 ac_var_strip_word="yes"
1683 fi
1684 done
1685 if test "$ac_var_strip_word" = "no"; then
1686 ac_var_stripped="$ac_var_stripped $word1"
1687 fi
1688 done
1689 dnl squeeze whitespace out of result
1690 [$1]="$ac_var_stripped"
1691 squeeze [$1]
1694dnl CURL_ADD_COMPILER_WARNINGS (WARNING-LIST, NEW-WARNINGS)
1695dnl -------------------------------------------------------
1696dnl Contents of variable WARNING-LIST and NEW-WARNINGS are
1697dnl handled as whitespace separated lists of words.
1698dnl Add each compiler warning from NEW-WARNINGS that has not
1699dnl been disabled via CFLAGS to WARNING-LIST.
1701AC_DEFUN([CURL_ADD_COMPILER_WARNINGS], [
1702 AC_REQUIRE([CURL_SHFUNC_SQUEEZE])
1703 ac_var_added_warnings=""
1704 for warning in [$2]; do
1705 CURL_VAR_MATCH(CFLAGS, [-Wno-$warning -W$warning])
1706 if test "$ac_var_match_word" = "no"; then
1707 ac_var_added_warnings="$ac_var_added_warnings -W$warning"
1708 fi
1709 done
1710 dnl squeeze whitespace out of result
1711 [$1]="$[$1] $ac_var_added_warnings"
1712 squeeze [$1]
Diagnostics4 git calls · 44 ms
CallStatusSizeTime044 ms
discover200152 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200149 B · hit2 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=2
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=149
git.pkt.payload.max=78
git.ls_refs.count=2
git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=38
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=10
git.pkt.data=8
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=293470
git.pkt.payload.max=65516
git.sideband.band1.bytes=293354
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=87
git.pack.bytes=293354
git.pack.ofs_delta=0
git.pack.ref_delta=1
git.pack.chain.max=1
git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0
git.pack.full=86
Open pack map
fetch20013 KiB · hit39 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=12940
git.response.cache=HIT
git.response.duration_ms=39
git.fetch.wants=7deb43c8e9947aec0be523d3afb030d4aab109ed
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=12940
git.pkt.payload.max=12919
git.sideband.band1.bytes=12918
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
Ref
refs/heads/master
Commit
31c911efe5652725e930f4d2e60c9060e5f6646d
cf-ray
a5e2fe52d8def3c9
Request
1175e38c…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format