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