~ubuntu-branches/ubuntu/vivid/curl/vivid

« back to all changes in this revision

Viewing changes to m4/curl-compilers.m4

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Schuldei
  • Date: 2009-04-02 23:35:45 UTC
  • mto: (1.2.1 upstream) (3.2.3 sid)
  • mto: This revision was merged to the branch mainline in revision 38.
  • Revision ID: james.westby@ubuntu.com-20090402233545-geixkwhe3izccjt7
Tags: upstream-7.19.4
ImportĀ upstreamĀ versionĀ 7.19.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#***************************************************************************
 
2
#                                  _   _ ____  _
 
3
#  Project                     ___| | | |  _ \| |
 
4
#                             / __| | | | |_) | |
 
5
#                            | (__| |_| |  _ <| |___
 
6
#                             \___|\___/|_| \_\_____|
 
7
#
 
8
# Copyright (C) 1998 - 2008, 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 http://curl.haxx.se/docs/copyright.html.
 
13
#
 
14
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
 
15
# copies of the Software, and permit persons to whom the Software is
 
16
# furnished to do so, under the terms of the COPYING file.
 
17
#
 
18
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 
19
# KIND, either express or implied.
 
20
#
 
21
# $Id: curl-compilers.m4,v 1.46 2008-11-18 20:13:56 yangtse Exp $
 
22
#***************************************************************************
 
23
 
 
24
# File version for 'aclocal' use. Keep it a single number.
 
25
# serial 46
 
26
 
 
27
 
 
28
dnl CURL_CHECK_COMPILER
 
29
dnl -------------------------------------------------
 
30
dnl Verify if the C compiler being used is known.
 
31
 
 
32
AC_DEFUN([CURL_CHECK_COMPILER], [
 
33
  #
 
34
  compiler_id="unknown"
 
35
  compiler_num="0"
 
36
  #
 
37
  flags_dbg_all="unknown"
 
38
  flags_dbg_yes="unknown"
 
39
  flags_dbg_off="unknown"
 
40
  flags_opt_all="unknown"
 
41
  flags_opt_yes="unknown"
 
42
  flags_opt_off="unknown"
 
43
  #
 
44
  CURL_CHECK_COMPILER_DEC_C
 
45
  CURL_CHECK_COMPILER_HPUX_C
 
46
  CURL_CHECK_COMPILER_IBM_C
 
47
  CURL_CHECK_COMPILER_INTEL_C
 
48
  CURL_CHECK_COMPILER_GNU_C
 
49
  CURL_CHECK_COMPILER_LCC
 
50
  CURL_CHECK_COMPILER_SGI_MIPSPRO_C
 
51
  CURL_CHECK_COMPILER_SGI_MIPS_C
 
52
  CURL_CHECK_COMPILER_SUNPRO_C
 
53
  CURL_CHECK_COMPILER_TINY_C
 
54
  CURL_CHECK_COMPILER_WATCOM_C
 
55
  #
 
56
  if test "$compiler_id" = "unknown"; then
 
57
  cat <<_EOF 1>&2
 
58
***
 
59
*** Warning: This configure script does not have information about the
 
60
*** compiler you are using, relative to the flags required to enable or
 
61
*** disable generation of debug info, optimization options or warnings.
 
62
***
 
63
*** Whatever settings are present in CFLAGS will be used for this run.
 
64
***
 
65
*** If you wish to help the cURL project to better support your compiler
 
66
*** you can report this and the required info on the libcurl development
 
67
*** mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/
 
68
***
 
69
_EOF
 
70
  fi
 
71
])
 
72
 
 
73
 
 
74
dnl CURL_CHECK_COMPILER_DEC_C
 
75
dnl -------------------------------------------------
 
76
dnl Verify if compiler being used is DEC C.
 
77
 
 
78
AC_DEFUN([CURL_CHECK_COMPILER_DEC_C], [
 
79
  AC_MSG_CHECKING([if compiler is DEC/Compaq/HP C])
 
80
  CURL_CHECK_DEF([__DECC], [], [silent])
 
81
  CURL_CHECK_DEF([__DECC_VER], [], [silent])
 
82
  if test "$curl_cv_have_def___DECC" = "yes" &&
 
83
    test "$curl_cv_have_def___DECC_VER" = "yes"; then
 
84
    AC_MSG_RESULT([yes])
 
85
    compiler_id="DEC_C"
 
86
    flags_dbg_all="-g -g0 -g1 -g2 -g3"
 
87
    flags_dbg_yes="-g2"
 
88
    flags_dbg_off="-g0"
 
89
    flags_opt_all="-O -O0 -O1 -O2 -O3 -O4"
 
90
    flags_opt_yes="-O1"
 
91
    flags_opt_off="-O0"
 
92
  else
 
93
    AC_MSG_RESULT([no])
 
94
  fi
 
95
])
 
96
 
 
97
 
 
98
dnl CURL_CHECK_COMPILER_GNU_C
 
99
dnl -------------------------------------------------
 
100
dnl Verify if compiler being used is GNU C.
 
101
 
 
102
AC_DEFUN([CURL_CHECK_COMPILER_GNU_C], [
 
103
  AC_REQUIRE([CURL_CHECK_COMPILER_INTEL_C])dnl
 
104
  AC_MSG_CHECKING([if compiler is GNU C])
 
105
  CURL_CHECK_DEF([__GNUC__], [], [silent])
 
106
  if test "$curl_cv_have_def___GNUC__" = "yes" &&
 
107
    test "$compiler_id" = "unknown"; then
 
108
    AC_MSG_RESULT([yes])
 
109
    compiler_id="GNU_C"
 
110
    gccver=`$CC -dumpversion`
 
111
    gccvhi=`echo $gccver | cut -d . -f1`
 
112
    gccvlo=`echo $gccver | cut -d . -f2`
 
113
    compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
 
114
    flags_dbg_all="-g -g0 -g1 -g2 -g3"
 
115
    flags_dbg_all="$flags_dbg_all -ggdb"
 
116
    flags_dbg_all="$flags_dbg_all -gstabs"
 
117
    flags_dbg_all="$flags_dbg_all -gstabs+"
 
118
    flags_dbg_all="$flags_dbg_all -gcoff"
 
119
    flags_dbg_all="$flags_dbg_all -gxcoff"
 
120
    flags_dbg_all="$flags_dbg_all -gdwarf-2"
 
121
    flags_dbg_all="$flags_dbg_all -gvms"
 
122
    flags_dbg_yes="-g"
 
123
    flags_dbg_off="-g0"
 
124
    flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
 
125
    flags_opt_yes="-O2"
 
126
    flags_opt_off="-O0"
 
127
  else
 
128
    AC_MSG_RESULT([no])
 
129
  fi
 
130
])
 
131
 
 
132
 
 
133
dnl CURL_CHECK_COMPILER_HPUX_C
 
134
dnl -------------------------------------------------
 
135
dnl Verify if compiler being used is HP-UX C.
 
136
 
 
137
AC_DEFUN([CURL_CHECK_COMPILER_HPUX_C], [
 
138
  AC_MSG_CHECKING([if compiler is HP-UX C])
 
139
  CURL_CHECK_DEF([__HP_cc], [], [silent])
 
140
  if test "$curl_cv_have_def___HP_cc" = "yes"; then
 
141
    AC_MSG_RESULT([yes])
 
142
    compiler_id="HP_UX_C"
 
143
    flags_dbg_all="-g -s"
 
144
    flags_dbg_yes="-g"
 
145
    flags_dbg_off="-s"
 
146
    flags_opt_all="-O +O0 +O1 +O2 +O3 +O4"
 
147
    flags_opt_yes="+O2"
 
148
    flags_opt_off="+O0"
 
149
  else
 
150
    AC_MSG_RESULT([no])
 
151
  fi
 
152
])
 
153
 
 
154
 
 
155
dnl CURL_CHECK_COMPILER_IBM_C
 
156
dnl -------------------------------------------------
 
157
dnl Verify if compiler being used is IBM C.
 
158
 
 
159
AC_DEFUN([CURL_CHECK_COMPILER_IBM_C], [
 
160
  AC_MSG_CHECKING([if compiler is IBM C])
 
161
  CURL_CHECK_DEF([__IBMC__], [], [silent])
 
162
  if test "$curl_cv_have_def___IBMC__" = "yes"; then
 
163
    AC_MSG_RESULT([yes])
 
164
    compiler_id="IBM_C"
 
165
    flags_dbg_all="-g -g0 -g1 -g2 -g3"
 
166
    flags_dbg_yes="-g"
 
167
    flags_dbg_off=""
 
168
    flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5"
 
169
    flags_opt_all="$flags_opt_all -qnooptimize"
 
170
    flags_opt_all="$flags_opt_all -qoptimize=0"
 
171
    flags_opt_all="$flags_opt_all -qoptimize=1"
 
172
    flags_opt_all="$flags_opt_all -qoptimize=2"
 
173
    flags_opt_all="$flags_opt_all -qoptimize=3"
 
174
    flags_opt_all="$flags_opt_all -qoptimize=4"
 
175
    flags_opt_all="$flags_opt_all -qoptimize=5"
 
176
    flags_opt_yes="-O2"
 
177
    flags_opt_off="-qnooptimize"
 
178
  else
 
179
    AC_MSG_RESULT([no])
 
180
  fi
 
181
])
 
182
 
 
183
 
 
184
dnl CURL_CHECK_COMPILER_INTEL_C
 
185
dnl -------------------------------------------------
 
186
dnl Verify if compiler being used is Intel C.
 
187
 
 
188
AC_DEFUN([CURL_CHECK_COMPILER_INTEL_C], [
 
189
  AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU_C])dnl
 
190
  AC_MSG_CHECKING([if compiler is Intel C])
 
191
  CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent])
 
192
  if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then
 
193
    AC_MSG_RESULT([yes])
 
194
    compiler_num="$curl_cv_def___INTEL_COMPILER"
 
195
    CURL_CHECK_DEF([__i386__], [], [silent])
 
196
    CURL_CHECK_DEF([__unix__], [], [silent])
 
197
    if test "$curl_cv_have_def___unix__" = "yes"; then
 
198
      compiler_id="INTEL_UNIX_C"
 
199
      flags_dbg_all="-g -g0"
 
200
      flags_dbg_yes="-g"
 
201
      flags_dbg_off="-g0"
 
202
      flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
 
203
      flags_opt_yes="-O2"
 
204
      flags_opt_off="-O0"
 
205
      dnl icc 9.1 optimization on IA32 triggers SIGSEGV
 
206
      if test "$curl_cv_have_def___i386__" = "yes" &&
 
207
        test "$compiler_num" -eq "910"; then
 
208
        INTEL_UNIX_C_OPT_SIGSEGV="yes"
 
209
      else
 
210
        INTEL_UNIX_C_OPT_SIGSEGV="no"
 
211
      fi
 
212
    else
 
213
      compiler_id="INTEL_WINDOWS_C"
 
214
      flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-"
 
215
      flags_dbg_all="$flags_dbg_all /debug"
 
216
      flags_dbg_all="$flags_dbg_all /debug:none"
 
217
      flags_dbg_all="$flags_dbg_all /debug:minimal"
 
218
      flags_dbg_all="$flags_dbg_all /debug:partial"
 
219
      flags_dbg_all="$flags_dbg_all /debug:full"
 
220
      flags_dbg_all="$flags_dbg_all /debug:semantic_stepping"
 
221
      flags_dbg_all="$flags_dbg_all /debug:extended"
 
222
      flags_dbg_yes="/Zi /Oy-"
 
223
      flags_dbg_off="/debug:none /Oy-"
 
224
      flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-"
 
225
      flags_opt_yes="/O2"
 
226
      flags_opt_off="/Od"
 
227
    fi
 
228
  else
 
229
    AC_MSG_RESULT([no])
 
230
  fi
 
231
])
 
232
 
 
233
 
 
234
dnl CURL_CHECK_COMPILER_LCC
 
235
dnl -------------------------------------------------
 
236
dnl Verify if compiler being used is LCC.
 
237
 
 
238
AC_DEFUN([CURL_CHECK_COMPILER_LCC], [
 
239
  AC_MSG_CHECKING([if compiler is LCC])
 
240
  CURL_CHECK_DEF([__LCC__], [], [silent])
 
241
  if test "$curl_cv_have_def___LCC__" = "yes"; then
 
242
    AC_MSG_RESULT([yes])
 
243
    compiler_id="LCC"
 
244
    flags_dbg_all="-g"
 
245
    flags_dbg_yes="-g"
 
246
    flags_dbg_off=""
 
247
    flags_opt_all=""
 
248
    flags_opt_yes=""
 
249
    flags_opt_off=""
 
250
  else
 
251
    AC_MSG_RESULT([no])
 
252
  fi
 
253
])
 
254
 
 
255
 
 
256
dnl CURL_CHECK_COMPILER_SGI_MIPS_C
 
257
dnl -------------------------------------------------
 
258
dnl Verify if compiler being used is SGI MIPS C.
 
259
 
 
260
AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPS_C], [
 
261
  AC_REQUIRE([CURL_CHECK_COMPILER_SGI_MIPSPRO_C])dnl
 
262
  AC_MSG_CHECKING([if compiler is SGI MIPS C])
 
263
  CURL_CHECK_DEF([__GNUC__], [], [silent])
 
264
  CURL_CHECK_DEF([__sgi], [], [silent])
 
265
  if test "$curl_cv_have_def___GNUC__" = "no" &&
 
266
    test "$curl_cv_have_def___sgi" = "yes" &&
 
267
    test "$compiler_id" = "unknown"; then
 
268
    AC_MSG_RESULT([yes])
 
269
    compiler_id="SGI_MIPS_C"
 
270
    flags_dbg_all="-g -g0 -g1 -g2 -g3"
 
271
    flags_dbg_yes="-g"
 
272
    flags_dbg_off="-g0"
 
273
    flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
 
274
    flags_opt_yes="-O2"
 
275
    flags_opt_off="-O0"
 
276
  else
 
277
    AC_MSG_RESULT([no])
 
278
  fi
 
279
])
 
280
 
 
281
 
 
282
dnl CURL_CHECK_COMPILER_SGI_MIPSPRO_C
 
283
dnl -------------------------------------------------
 
284
dnl Verify if compiler being used is SGI MIPSpro C.
 
285
 
 
286
AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPSPRO_C], [
 
287
  AC_BEFORE([$0],[CURL_CHECK_COMPILER_SGI_MIPS_C])dnl
 
288
  AC_MSG_CHECKING([if compiler is SGI MIPSpro C])
 
289
  CURL_CHECK_DEF([__GNUC__], [], [silent])
 
290
  CURL_CHECK_DEF([_COMPILER_VERSION], [], [silent])
 
291
  CURL_CHECK_DEF([_SGI_COMPILER_VERSION], [], [silent])
 
292
  if test "$curl_cv_have_def___GNUC__" = "no" &&
 
293
    (test "$curl_cv_have_def__SGI_COMPILER_VERSION" = "yes" ||
 
294
     test "$curl_cv_have_def__COMPILER_VERSION" = "yes"); then
 
295
    AC_MSG_RESULT([yes])
 
296
    compiler_id="SGI_MIPSPRO_C"
 
297
    flags_dbg_all="-g -g0 -g1 -g2 -g3"
 
298
    flags_dbg_yes="-g"
 
299
    flags_dbg_off="-g0"
 
300
    flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
 
301
    flags_opt_yes="-O2"
 
302
    flags_opt_off="-O0"
 
303
  else
 
304
    AC_MSG_RESULT([no])
 
305
  fi
 
306
])
 
307
 
 
308
 
 
309
dnl CURL_CHECK_COMPILER_SUNPRO_C
 
310
dnl -------------------------------------------------
 
311
dnl Verify if compiler being used is SunPro C.
 
312
 
 
313
AC_DEFUN([CURL_CHECK_COMPILER_SUNPRO_C], [
 
314
  AC_MSG_CHECKING([if compiler is SunPro C])
 
315
  CURL_CHECK_DEF([__SUNPRO_C], [], [silent])
 
316
  if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then
 
317
    AC_MSG_RESULT([yes])
 
318
    compiler_id="SUNPRO_C"
 
319
    flags_dbg_all="-g -s"
 
320
    flags_dbg_yes="-g"
 
321
    flags_dbg_off="-s"
 
322
    flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5"
 
323
    flags_opt_yes="-xO2"
 
324
    flags_opt_off=""
 
325
  else
 
326
    AC_MSG_RESULT([no])
 
327
  fi
 
328
])
 
329
 
 
330
 
 
331
dnl CURL_CHECK_COMPILER_TINY_C
 
332
dnl -------------------------------------------------
 
333
dnl Verify if compiler being used is Tiny C.
 
334
 
 
335
AC_DEFUN([CURL_CHECK_COMPILER_TINY_C], [
 
336
  AC_MSG_CHECKING([if compiler is Tiny C])
 
337
  CURL_CHECK_DEF([__TINYC__], [], [silent])
 
338
  if test "$curl_cv_have_def___TINYC__" = "yes"; then
 
339
    AC_MSG_RESULT([yes])
 
340
    compiler_id="TINY_C"
 
341
    flags_dbg_all="-g -b"
 
342
    flags_dbg_yes="-g"
 
343
    flags_dbg_off=""
 
344
    flags_opt_all=""
 
345
    flags_opt_yes=""
 
346
    flags_opt_off=""
 
347
  else
 
348
    AC_MSG_RESULT([no])
 
349
  fi
 
350
])
 
351
 
 
352
 
 
353
dnl CURL_CHECK_COMPILER_WATCOM_C
 
354
dnl -------------------------------------------------
 
355
dnl Verify if compiler being used is Watcom C.
 
356
 
 
357
AC_DEFUN([CURL_CHECK_COMPILER_WATCOM_C], [
 
358
  AC_MSG_CHECKING([if compiler is Watcom C])
 
359
  CURL_CHECK_DEF([__WATCOMC__], [], [silent])
 
360
  if test "$curl_cv_have_def___WATCOMC__" = "yes"; then
 
361
    AC_MSG_RESULT([yes])
 
362
    CURL_CHECK_DEF([__UNIX__], [], [silent])
 
363
    if test "$curl_cv_have_def___UNIX__" = "yes"; then
 
364
      compiler_id="WATCOM_UNIX_C"
 
365
      flags_dbg_all="-g1 -g1+ -g2 -g3"
 
366
      flags_dbg_yes="-g2"
 
367
      flags_dbg_off=""
 
368
      flags_opt_all="-O0 -O1 -O2 -O3"
 
369
      flags_opt_yes="-O2"
 
370
      flags_opt_off="-O0"
 
371
    else
 
372
      compiler_id="WATCOM_WINDOWS_C"
 
373
      flags_dbg_all=""
 
374
      flags_dbg_yes=""
 
375
      flags_dbg_off=""
 
376
      flags_opt_all=""
 
377
      flags_opt_yes=""
 
378
      flags_opt_off=""
 
379
    fi
 
380
  else
 
381
    AC_MSG_RESULT([no])
 
382
  fi
 
383
])
 
384
 
 
385
 
 
386
dnl CURL_CONVERT_INCLUDE_TO_ISYSTEM
 
387
dnl -------------------------------------------------
 
388
dnl Changes standard include paths present in CFLAGS
 
389
dnl and CPPFLAGS into isystem include paths. This is
 
390
dnl done to prevent GNUC from generating warnings on
 
391
dnl headers from these locations, even though this is
 
392
dnl not reliable on ancient GNUC versions.
 
393
 
 
394
AC_DEFUN([CURL_CONVERT_INCLUDE_TO_ISYSTEM], [
 
395
  AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
 
396
  tmp_has_include="no"
 
397
  tmp_chg_FLAGS="$CFLAGS"
 
398
  for word1 in $tmp_chg_FLAGS; do
 
399
    case "$word1" in
 
400
      -I*)
 
401
        tmp_has_include="yes"
 
402
        ;;
 
403
    esac
 
404
  done
 
405
  if test "$tmp_has_include" = "yes"; then
 
406
    tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
 
407
    tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
 
408
    CFLAGS="$tmp_chg_FLAGS"
 
409
    squeeze CFLAGS
 
410
  fi
 
411
  tmp_has_include="no"
 
412
  tmp_chg_FLAGS="$CPPFLAGS"
 
413
  for word1 in $tmp_chg_FLAGS; do
 
414
    case "$word1" in
 
415
      -I*)
 
416
        tmp_has_include="yes"
 
417
        ;;
 
418
    esac
 
419
  done
 
420
  if test "$tmp_has_include" = "yes"; then
 
421
    tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
 
422
    tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
 
423
    CPPFLAGS="$tmp_chg_FLAGS"
 
424
    squeeze CPPFLAGS
 
425
  fi
 
426
])
 
427
 
 
428
 
 
429
dnl CURL_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS])
 
430
dnl -------------------------------------------------
 
431
dnl Verify if the C compiler seems to work with the
 
432
dnl settings that are 'active' at the time the test
 
433
dnl is performed.
 
434
 
 
435
AC_DEFUN([CURL_COMPILER_WORKS_IFELSE], [
 
436
  dnl compilation capability verification
 
437
  tmp_compiler_works="unknown"
 
438
  AC_COMPILE_IFELSE([
 
439
    AC_LANG_PROGRAM([[
 
440
    ]],[[
 
441
      int i = 1;
 
442
      return i;
 
443
    ]])
 
444
  ],[
 
445
    tmp_compiler_works="yes"
 
446
  ],[
 
447
    tmp_compiler_works="no"
 
448
    echo " " >&6
 
449
    sed 's/^/cc-fail: /' conftest.err >&6
 
450
    echo " " >&6
 
451
  ])
 
452
  dnl linking capability verification
 
453
  if test "$tmp_compiler_works" = "yes"; then
 
454
    AC_LINK_IFELSE([
 
455
      AC_LANG_PROGRAM([[
 
456
      ]],[[
 
457
        int i = 1;
 
458
        return i;
 
459
      ]])
 
460
    ],[
 
461
      tmp_compiler_works="yes"
 
462
    ],[
 
463
      tmp_compiler_works="no"
 
464
      echo " " >&6
 
465
      sed 's/^/link-fail: /' conftest.err >&6
 
466
      echo " " >&6
 
467
    ])
 
468
  fi
 
469
  dnl only do runtime verification when not cross-compiling
 
470
  if test "x$cross_compiling" != "xyes" &&
 
471
    test "$tmp_compiler_works" = "yes"; then
 
472
    AC_RUN_IFELSE([
 
473
      AC_LANG_PROGRAM([[
 
474
#       ifdef __STDC__
 
475
#         include <stdlib.h>
 
476
#       endif
 
477
      ]],[[
 
478
        int i = 0;
 
479
        exit(i);
 
480
      ]])
 
481
    ],[
 
482
      tmp_compiler_works="yes"
 
483
    ],[
 
484
      tmp_compiler_works="no"
 
485
      echo " " >&6
 
486
      echo "run-fail: test program exited with status $ac_status" >&6
 
487
      echo " " >&6
 
488
    ])
 
489
  fi
 
490
  dnl branch upon test result
 
491
  if test "$tmp_compiler_works" = "yes"; then
 
492
  ifelse($1,,:,[$1])
 
493
  ifelse($2,,,[else
 
494
    $2])
 
495
  fi
 
496
])
 
497
 
 
498
 
 
499
dnl CURL_SET_COMPILER_BASIC_OPTS
 
500
dnl -------------------------------------------------
 
501
dnl Sets compiler specific options/flags which do not
 
502
dnl depend on configure's debug, optimize or warnings
 
503
dnl options.
 
504
 
 
505
AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [
 
506
  AC_REQUIRE([CURL_CHECK_COMPILER])dnl
 
507
  AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
 
508
  #
 
509
  if test "$compiler_id" != "unknown"; then
 
510
    #
 
511
    if test "$compiler_id" = "GNU_C"; then
 
512
      CURL_CONVERT_INCLUDE_TO_ISYSTEM
 
513
    fi
 
514
    #
 
515
    tmp_save_CPPFLAGS="$CPPFLAGS"
 
516
    tmp_save_CFLAGS="$CFLAGS"
 
517
    tmp_CPPFLAGS=""
 
518
    tmp_CFLAGS=""
 
519
    #
 
520
    case "$compiler_id" in
 
521
        #
 
522
      DEC_C)
 
523
        #
 
524
        dnl Select strict ANSI C compiler mode
 
525
        tmp_CFLAGS="$tmp_CFLAGS -std1"
 
526
        dnl Turn off optimizer ANSI C aliasing rules
 
527
        tmp_CFLAGS="$tmp_CFLAGS -noansi_alias"
 
528
        dnl Generate warnings for missing function prototypes
 
529
        tmp_CFLAGS="$tmp_CFLAGS -warnprotos"
 
530
        dnl Change some warnings into fatal errors
 
531
        tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs"
 
532
        ;;
 
533
        #
 
534
      GNU_C)
 
535
        #
 
536
        dnl Placeholder
 
537
        tmp_CFLAGS="$tmp_CFLAGS"
 
538
        ;;
 
539
        #
 
540
      HP_UX_C)
 
541
        #
 
542
        dnl Disallow run-time dereferencing of null pointers
 
543
        tmp_CFLAGS="$tmp_CFLAGS -z"
 
544
        dnl Disable some remarks
 
545
        dnl #4227: padding struct with n bytes to align member
 
546
        dnl #4255: padding size of struct with n bytes to alignment boundary
 
547
        tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255"
 
548
        ;;
 
549
        #
 
550
      IBM_C)
 
551
        #
 
552
        dnl Ensure that compiler optimizations are always thread-safe.
 
553
        tmp_CFLAGS="$tmp_CFLAGS -qthreaded"
 
554
        dnl Disable type based strict aliasing optimizations, using worst
 
555
        dnl case aliasing assumptions when compiling. Type based aliasing
 
556
        dnl would restrict the lvalues that could be safely used to access
 
557
        dnl a data object.
 
558
        tmp_CFLAGS="$tmp_CFLAGS -qnoansialias"
 
559
        dnl Force compiler to stop after the compilation phase, without
 
560
        dnl generating an object code file when compilation has errors.
 
561
        tmp_CFLAGS="$tmp_CFLAGS -qhalt=e"
 
562
        ;;
 
563
        #
 
564
      INTEL_UNIX_C)
 
565
        #
 
566
        dnl On unix this compiler uses gcc's header files, so
 
567
        dnl we select ANSI C89 dialect plus GNU extensions.
 
568
        tmp_CFLAGS="$tmp_CFLAGS -std=gnu89"
 
569
        dnl Change some warnings into errors
 
570
        dnl #140: too many arguments in function call
 
571
        dnl #147: declaration is incompatible with 'previous one'
 
572
        dnl #165: too few arguments in function call
 
573
        dnl #266: function declared implicitly
 
574
        tmp_CPPFLAGS="$tmp_CPPFLAGS -we 140,147,165,266"
 
575
        dnl Disable some remarks
 
576
        dnl #279: controlling expression is constant
 
577
        dnl #981: operands are evaluated in unspecified order
 
578
        dnl #1469: "cc" clobber ignored
 
579
        tmp_CPPFLAGS="$tmp_CPPFLAGS -wd 279,981,1469"
 
580
        ;;
 
581
        #
 
582
      INTEL_WINDOWS_C)
 
583
        #
 
584
        dnl Placeholder
 
585
        tmp_CFLAGS="$tmp_CFLAGS"
 
586
        ;;
 
587
        #
 
588
      LCC)
 
589
        #
 
590
        dnl Disallow run-time dereferencing of null pointers
 
591
        tmp_CFLAGS="$tmp_CFLAGS -n"
 
592
        ;;
 
593
        #
 
594
      SGI_MIPS_C)
 
595
        #
 
596
        dnl Placeholder
 
597
        tmp_CFLAGS="$tmp_CFLAGS"
 
598
        ;;
 
599
        #
 
600
      SGI_MIPSPRO_C)
 
601
        #
 
602
        dnl Placeholder
 
603
        tmp_CFLAGS="$tmp_CFLAGS"
 
604
        ;;
 
605
        #
 
606
      SUNPRO_C)
 
607
        #
 
608
        dnl Placeholder
 
609
        tmp_CFLAGS="$tmp_CFLAGS"
 
610
        ;;
 
611
        #
 
612
      TINY_C)
 
613
        #
 
614
        dnl Placeholder
 
615
        tmp_CFLAGS="$tmp_CFLAGS"
 
616
        ;;
 
617
        #
 
618
      WATCOM_UNIX_C)
 
619
        #
 
620
        dnl Placeholder
 
621
        tmp_CFLAGS="$tmp_CFLAGS"
 
622
        ;;
 
623
        #
 
624
      WATCOM_WINDOWS_C)
 
625
        #
 
626
        dnl Placeholder
 
627
        tmp_CFLAGS="$tmp_CFLAGS"
 
628
        ;;
 
629
        #
 
630
    esac
 
631
    #
 
632
    squeeze tmp_CPPFLAGS
 
633
    squeeze tmp_CFLAGS
 
634
    #
 
635
    if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
 
636
      AC_MSG_CHECKING([if compiler accepts some basic options])
 
637
      CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
 
638
      CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
 
639
      squeeze CPPFLAGS
 
640
      squeeze CFLAGS
 
641
      CURL_COMPILER_WORKS_IFELSE([
 
642
        AC_MSG_RESULT([yes])
 
643
        AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
 
644
      ],[
 
645
        AC_MSG_RESULT([no])
 
646
        AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
 
647
        dnl restore initial settings
 
648
        CPPFLAGS="$tmp_save_CPPFLAGS"
 
649
        CFLAGS="$tmp_save_CFLAGS"
 
650
      ])
 
651
    fi
 
652
    #
 
653
  fi
 
654
])
 
655
 
 
656
 
 
657
dnl CURL_SET_COMPILER_DEBUG_OPTS
 
658
dnl -------------------------------------------------
 
659
dnl Sets compiler specific options/flags which depend
 
660
dnl on configure's debug option.
 
661
 
 
662
AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [
 
663
  AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
 
664
  AC_REQUIRE([CURL_CHECK_COMPILER])dnl
 
665
  AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
 
666
  #
 
667
  if test "$compiler_id" != "unknown"; then
 
668
    #
 
669
    tmp_save_CFLAGS="$CFLAGS"
 
670
    tmp_save_CPPFLAGS="$CPPFLAGS"
 
671
    #
 
672
    tmp_options=""
 
673
    tmp_CFLAGS="$CFLAGS"
 
674
    tmp_CPPFLAGS="$CPPFLAGS"
 
675
    CURL_VAR_STRIP([tmp_CFLAGS],[$flags_dbg_all])
 
676
    CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_dbg_all])
 
677
    #
 
678
    if test "$want_debug" = "yes"; then
 
679
      AC_MSG_CHECKING([if compiler accepts debug enabling options])
 
680
      tmp_options="$flags_dbg_yes"
 
681
    fi
 
682
    if test "$want_debug" = "no"; then
 
683
      AC_MSG_CHECKING([if compiler accepts debug disabling options])
 
684
      tmp_options="$flags_dbg_off"
 
685
    fi
 
686
    #
 
687
    CPPFLAGS="$tmp_CPPFLAGS"
 
688
    CFLAGS="$tmp_CFLAGS $tmp_options"
 
689
    squeeze CPPFLAGS
 
690
    squeeze CFLAGS
 
691
    CURL_COMPILER_WORKS_IFELSE([
 
692
      AC_MSG_RESULT([yes])
 
693
      AC_MSG_NOTICE([compiler options added: $tmp_options])
 
694
    ],[
 
695
      AC_MSG_RESULT([no])
 
696
      AC_MSG_WARN([compiler options rejected: $tmp_options])
 
697
      dnl restore initial settings
 
698
      CPPFLAGS="$tmp_save_CPPFLAGS"
 
699
      CFLAGS="$tmp_save_CFLAGS"
 
700
    ])
 
701
    #
 
702
  fi
 
703
])
 
704
 
 
705
 
 
706
dnl CURL_SET_COMPILER_OPTIMIZE_OPTS
 
707
dnl -------------------------------------------------
 
708
dnl Sets compiler specific options/flags which depend
 
709
dnl on configure's optimize option.
 
710
 
 
711
AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
 
712
  AC_REQUIRE([CURL_CHECK_OPTION_OPTIMIZE])dnl
 
713
  AC_REQUIRE([CURL_CHECK_COMPILER])dnl
 
714
  AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
 
715
  #
 
716
  if test "$compiler_id" != "unknown"; then
 
717
    #
 
718
    tmp_save_CFLAGS="$CFLAGS"
 
719
    tmp_save_CPPFLAGS="$CPPFLAGS"
 
720
    #
 
721
    tmp_options=""
 
722
    tmp_CFLAGS="$CFLAGS"
 
723
    tmp_CPPFLAGS="$CPPFLAGS"
 
724
    honor_optimize_option="yes"
 
725
    #
 
726
    dnl If optimization request setting has not been explicitly specified,
 
727
    dnl it has been derived from the debug setting and initially assumed.
 
728
    dnl This initially assumed optimizer setting will finally be ignored
 
729
    dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies
 
730
    dnl that an initially assumed optimizer setting might not be honored.
 
731
    #
 
732
    if test "$want_optimize" = "assume_no" ||
 
733
       test "$want_optimize" = "assume_yes"; then
 
734
      AC_MSG_CHECKING([if compiler optimizer assumed setting might be used])
 
735
      CURL_VAR_MATCH_IFELSE([tmp_CFLAGS],[$flags_opt_all],[
 
736
        honor_optimize_option="no"
 
737
      ])
 
738
      CURL_VAR_MATCH_IFELSE([tmp_CPPFLAGS],[$flags_opt_all],[
 
739
        honor_optimize_option="no"
 
740
      ])
 
741
      AC_MSG_RESULT([$honor_optimize_option])
 
742
      if test "$honor_optimize_option" = "yes"; then
 
743
        if test "$want_optimize" = "assume_yes"; then
 
744
          want_optimize="yes"
 
745
        fi
 
746
        if test "$want_optimize" = "assume_no"; then
 
747
          want_optimize="no"
 
748
        fi
 
749
      fi
 
750
    fi
 
751
    #
 
752
    if test "$honor_optimize_option" = "yes"; then
 
753
      CURL_VAR_STRIP([tmp_CFLAGS],[$flags_opt_all])
 
754
      CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_opt_all])
 
755
      if test "$want_optimize" = "yes"; then
 
756
        AC_MSG_CHECKING([if compiler accepts optimizer enabling options])
 
757
        tmp_options="$flags_opt_yes"
 
758
      fi
 
759
      if test "$want_optimize" = "no"; then
 
760
        AC_MSG_CHECKING([if compiler accepts optimizer disabling options])
 
761
        tmp_options="$flags_opt_off"
 
762
      fi
 
763
      CPPFLAGS="$tmp_CPPFLAGS"
 
764
      CFLAGS="$tmp_CFLAGS $tmp_options"
 
765
      squeeze CPPFLAGS
 
766
      squeeze CFLAGS
 
767
      CURL_COMPILER_WORKS_IFELSE([
 
768
        AC_MSG_RESULT([yes])
 
769
        AC_MSG_NOTICE([compiler options added: $tmp_options])
 
770
      ],[
 
771
        AC_MSG_RESULT([no])
 
772
        AC_MSG_WARN([compiler options rejected: $tmp_options])
 
773
        dnl restore initial settings
 
774
        CPPFLAGS="$tmp_save_CPPFLAGS"
 
775
        CFLAGS="$tmp_save_CFLAGS"
 
776
      ])
 
777
    fi
 
778
    #
 
779
  fi
 
780
])
 
781
 
 
782
 
 
783
dnl CURL_SET_COMPILER_WARNING_OPTS
 
784
dnl -------------------------------------------------
 
785
dnl Sets compiler options/flags which depend on
 
786
dnl configure's warnings given option.
 
787
 
 
788
AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
 
789
  AC_REQUIRE([CURL_CHECK_OPTION_WARNINGS])dnl
 
790
  AC_REQUIRE([CURL_CHECK_COMPILER])dnl
 
791
  AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
 
792
  #
 
793
  if test "$compiler_id" != "unknown"; then
 
794
    #
 
795
    tmp_save_CPPFLAGS="$CPPFLAGS"
 
796
    tmp_save_CFLAGS="$CFLAGS"
 
797
    tmp_CPPFLAGS=""
 
798
    tmp_CFLAGS=""
 
799
    #
 
800
    case "$compiler_id" in
 
801
        #
 
802
      DEC_C)
 
803
        #
 
804
        if test "$want_warnings" = "yes"; then
 
805
          dnl Select a higher warning level than default level2
 
806
          tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3"
 
807
        fi
 
808
        ;;
 
809
        #
 
810
      GNU_C)
 
811
        #
 
812
        if test "$want_warnings" = "yes"; then
 
813
          #
 
814
          dnl Do not enable -pedantic when cross-compiling with a gcc older
 
815
          dnl than 3.0, to avoid warnings from third party system headers.
 
816
          if test "x$cross_compiling" != "xyes" ||
 
817
            test "$compiler_num" -ge "300"; then
 
818
            tmp_CFLAGS="$tmp_CFLAGS -pedantic"
 
819
          fi
 
820
          #
 
821
          dnl Set of options we believe *ALL* gcc versions support:
 
822
          tmp_CFLAGS="$tmp_CFLAGS -Wall -W"
 
823
          #
 
824
          dnl Only gcc 1.4 or later
 
825
          if test "$compiler_num" -ge "104"; then
 
826
            tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings"
 
827
            dnl If not cross-compiling with a gcc older than 3.0
 
828
            if test "x$cross_compiling" != "xyes" ||
 
829
              test "$compiler_num" -ge "300"; then
 
830
              tmp_CFLAGS="$tmp_CFLAGS -Wunused -Wshadow"
 
831
            fi
 
832
          fi
 
833
          #
 
834
          dnl Only gcc 2.7 or later
 
835
          if test "$compiler_num" -ge "207"; then
 
836
            tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs"
 
837
            dnl If not cross-compiling with a gcc older than 3.0
 
838
            if test "x$cross_compiling" != "xyes" ||
 
839
              test "$compiler_num" -ge "300"; then
 
840
              tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
 
841
              tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes"
 
842
            fi
 
843
          fi
 
844
          #
 
845
          dnl Only gcc 2.95 or later
 
846
          if test "$compiler_num" -ge "295"; then
 
847
            tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
 
848
          fi
 
849
          #
 
850
          dnl Only gcc 2.96 or later
 
851
          if test "$compiler_num" -ge "296"; then
 
852
            tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
 
853
            tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare"
 
854
            dnl -Wundef used only if gcc is 2.96 or later since we get
 
855
            dnl lots of "`_POSIX_C_SOURCE' is not defined" in system
 
856
            dnl headers with gcc 2.95.4 on FreeBSD 4.9
 
857
            tmp_CFLAGS="$tmp_CFLAGS -Wundef"
 
858
          fi
 
859
          #
 
860
          dnl Only gcc 2.97 or later
 
861
          if test "$compiler_num" -ge "297"; then
 
862
            tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
 
863
          fi
 
864
          #
 
865
          dnl Only gcc 3.0 or later
 
866
          if test "$compiler_num" -ge "300"; then
 
867
            dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
 
868
            dnl on i686-Linux as it gives us heaps with false positives.
 
869
            dnl Also, on gcc 4.0.X it is totally unbearable and complains all
 
870
            dnl over making it unusable for generic purposes. Let's not use it.
 
871
            tmp_CFLAGS="$tmp_CFLAGS"
 
872
          fi
 
873
          #
 
874
          dnl Only gcc 3.3 or later
 
875
          if test "$compiler_num" -ge "303"; then
 
876
            tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
 
877
          fi
 
878
          #
 
879
          dnl Only gcc 3.4 or later
 
880
          if test "$compiler_num" -ge "304"; then
 
881
            tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
 
882
          fi
 
883
          #
 
884
          dnl Only gcc 4.3 or later
 
885
          if test "$compiler_num" -ge "403"; then
 
886
            tmp_CFLAGS="$tmp_CFLAGS -Wtype-limits -Wold-style-declaration"
 
887
            tmp_CFLAGS="$tmp_CFLAGS -Wmissing-parameter-type -Wempty-body"
 
888
            tmp_CFLAGS="$tmp_CFLAGS -Wclobbered -Wignored-qualifiers"
 
889
          fi
 
890
          #
 
891
        fi
 
892
        #
 
893
        dnl Do not issue warnings for code in system include paths.
 
894
        if test "$compiler_num" -ge "300"; then
 
895
          tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers"
 
896
        else
 
897
          dnl When cross-compiling with a gcc older than 3.0, disable
 
898
          dnl some warnings triggered on third party system headers.
 
899
          if test "x$cross_compiling" = "xyes"; then
 
900
            if test "$compiler_num" -ge "104"; then
 
901
              dnl gcc 1.4 or later
 
902
              tmp_CFLAGS="$tmp_CFLAGS -Wno-unused -Wno-shadow"
 
903
            fi
 
904
            if test "$compiler_num" -ge "207"; then
 
905
              dnl gcc 2.7 or later
 
906
              tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-declarations"
 
907
              tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-prototypes"
 
908
            fi
 
909
          fi
 
910
        fi
 
911
        ;;
 
912
        #
 
913
      HP_UX_C)
 
914
        #
 
915
        if test "$want_warnings" = "yes"; then
 
916
          dnl Issue all warnings
 
917
          dnl tmp_CFLAGS="$tmp_CFLAGS +w1"
 
918
          dnl Due to the HP-UX socklen_t issue it is insane to use the +w1
 
919
          dnl warning level. Until the issue is somehow fixed we will just
 
920
          dnl use the +w2 warning level.
 
921
          tmp_CFLAGS="$tmp_CFLAGS +w2"
 
922
        fi
 
923
        ;;
 
924
        #
 
925
      IBM_C)
 
926
        #
 
927
        dnl Placeholder
 
928
        tmp_CFLAGS="$tmp_CFLAGS"
 
929
        ;;
 
930
        #
 
931
      INTEL_UNIX_C)
 
932
        #
 
933
        if test "$want_warnings" = "yes"; then
 
934
          if test "$compiler_num" -gt "600"; then
 
935
            dnl Show errors, warnings, and remarks
 
936
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall -w2"
 
937
            dnl Perform extra compile-time code checking
 
938
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck"
 
939
            dnl Warn on nested comments
 
940
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcomment"
 
941
            dnl Show warnings relative to deprecated features
 
942
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wdeprecated"
 
943
            dnl Enable warnings for missing prototypes
 
944
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wmissing-prototypes"
 
945
            dnl Enable warnings for 64-bit portability issues
 
946
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wp64"
 
947
            dnl Enable warnings for questionable pointer arithmetic
 
948
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wpointer-arith"
 
949
            dnl Check for function return typw issues
 
950
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wreturn-type"
 
951
            dnl Warn on variable declarations hiding a previous one
 
952
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wshadow"
 
953
            dnl Warn when a variable is used before initialized
 
954
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wuninitialized"
 
955
            dnl Warn if a declared function is not used
 
956
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wunused-function"
 
957
          fi
 
958
        fi
 
959
        dnl Disable using EBP register in optimizations
 
960
        tmp_CFLAGS="$tmp_CFLAGS -fno-omit-frame-pointer"
 
961
        dnl Disable use of ANSI C aliasing rules in optimizations
 
962
        tmp_CFLAGS="$tmp_CFLAGS -no-ansi-alias"
 
963
        dnl Value-safe optimizations on floating-point data
 
964
        tmp_CFLAGS="$tmp_CFLAGS -fp-model precise"
 
965
        dnl Only icc 10.0 or later
 
966
        if test "$compiler_num" -ge "1000"; then
 
967
          dnl Disable vectorizer diagnostic information
 
968
          tmp_CFLAGS="$tmp_CFLAGS -vec-report0"
 
969
        fi
 
970
        dnl Disable some optimizations to debug icc 9.1 SIGSEGV
 
971
        if test "$INTEL_UNIX_C_OPT_SIGSEGV" = "yes"; then
 
972
          dnl Disable interprocedural optimizations
 
973
          tmp_CFLAGS="$tmp_CFLAGS -no-ip -no-ipo"
 
974
          dnl Separate functions for the linker
 
975
          tmp_CFLAGS="$tmp_CFLAGS -ffunction-sections"
 
976
          dnl Disable inlining of user-defined functions
 
977
          tmp_CFLAGS="$tmp_CFLAGS -Ob0"
 
978
          dnl Disable inline expansion of intrinsic functions
 
979
          tmp_CFLAGS="$tmp_CFLAGS -fno-builtin"
 
980
          dnl Disable inlining of functions
 
981
          tmp_CFLAGS="$tmp_CFLAGS -fno-inline"
 
982
          dnl Disable some IPO for single file optimizations
 
983
          tmp_CFLAGS="$tmp_CFLAGS -fno-inline-functions"
 
984
          dnl Disable inlining of standard library functions
 
985
          tmp_CFLAGS="$tmp_CFLAGS -nolib-inline"
 
986
          dnl Disable full and partial inlining when IPO
 
987
          tmp_CFLAGS="$tmp_CFLAGS -ip-no-inlining"
 
988
          dnl Enable floating-point stack integrity checks
 
989
          tmp_CFLAGS="$tmp_CFLAGS -fpstkchk"
 
990
          dnl Enable run-time detection of buffer overruns.
 
991
          tmp_CFLAGS="$tmp_CFLAGS -fstack-security-check"
 
992
          dnl Assume aliasing in the program.
 
993
          tmp_CFLAGS="$tmp_CFLAGS -falias"
 
994
          dnl Assume that arguments may be aliased.
 
995
          tmp_CFLAGS="$tmp_CFLAGS -alias-args"
 
996
          dnl Assume aliasing within functions
 
997
          tmp_CFLAGS="$tmp_CFLAGS -ffnalias"
 
998
          dnl Disable prefetch insertion optimization
 
999
          tmp_CFLAGS="$tmp_CFLAGS -no-prefetch"
 
1000
          dnl Disable loop unrolling optimization
 
1001
          tmp_CFLAGS="$tmp_CFLAGS -unroll0"
 
1002
        fi
 
1003
        ;;
 
1004
        #
 
1005
      INTEL_WINDOWS_C)
 
1006
        #
 
1007
        dnl Placeholder
 
1008
        tmp_CFLAGS="$tmp_CFLAGS"
 
1009
        ;;
 
1010
        #
 
1011
      LCC)
 
1012
        #
 
1013
        if test "$want_warnings" = "yes"; then
 
1014
          dnl Highest warning level is double -A, next is single -A.
 
1015
          dnl Due to the big number of warnings these trigger on third
 
1016
          dnl party header files it is impractical for us to use any of
 
1017
          dnl them here. If you want them simply define it in CPPFLAGS.
 
1018
          tmp_CFLAGS="$tmp_CFLAGS"
 
1019
        fi
 
1020
        ;;
 
1021
        #
 
1022
      SGI_MIPS_C)
 
1023
        #
 
1024
        if test "$want_warnings" = "yes"; then
 
1025
          dnl Perform stricter semantic and lint-like checks
 
1026
          tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
 
1027
        fi
 
1028
        ;;
 
1029
        #
 
1030
      SGI_MIPSPRO_C)
 
1031
        #
 
1032
        if test "$want_warnings" = "yes"; then
 
1033
          dnl Perform stricter semantic and lint-like checks
 
1034
          tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
 
1035
          dnl Disable some remarks
 
1036
          dnl #1209: controlling expression is constant
 
1037
          tmp_CFLAGS="$tmp_CFLAGS -woff 1209"
 
1038
        fi
 
1039
        ;;
 
1040
        #
 
1041
      SUNPRO_C)
 
1042
        #
 
1043
        if test "$want_warnings" = "yes"; then
 
1044
          dnl Perform stricter semantic and lint-like checks
 
1045
          tmp_CFLAGS="$tmp_CFLAGS -v"
 
1046
        fi
 
1047
        ;;
 
1048
        #
 
1049
      TINY_C)
 
1050
        #
 
1051
        if test "$want_warnings" = "yes"; then
 
1052
          dnl Activate all warnings
 
1053
          tmp_CFLAGS="$tmp_CFLAGS -Wall"
 
1054
          dnl Make string constants be of type const char *
 
1055
          tmp_CFLAGS="$tmp_CFLAGS -Wwrite-strings"
 
1056
          dnl Warn use of unsupported GCC features ignored by TCC
 
1057
          tmp_CFLAGS="$tmp_CFLAGS -Wunsupported"
 
1058
        fi
 
1059
        ;;
 
1060
        #
 
1061
      WATCOM_UNIX_C)
 
1062
        #
 
1063
        if test "$want_warnings" = "yes"; then
 
1064
          dnl Issue all warnings
 
1065
          tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra"
 
1066
        fi
 
1067
        ;;
 
1068
        #
 
1069
      WATCOM_WINDOWS_C)
 
1070
        #
 
1071
        dnl Placeholder
 
1072
        tmp_CFLAGS="$tmp_CFLAGS"
 
1073
        ;;
 
1074
        #
 
1075
    esac
 
1076
    #
 
1077
    squeeze tmp_CPPFLAGS
 
1078
    squeeze tmp_CFLAGS
 
1079
    #
 
1080
    if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
 
1081
      AC_MSG_CHECKING([if compiler accepts strict warning options])
 
1082
      CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
 
1083
      CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
 
1084
      squeeze CPPFLAGS
 
1085
      squeeze CFLAGS
 
1086
      CURL_COMPILER_WORKS_IFELSE([
 
1087
        AC_MSG_RESULT([yes])
 
1088
        AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
 
1089
      ],[
 
1090
        AC_MSG_RESULT([no])
 
1091
        AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
 
1092
        dnl restore initial settings
 
1093
        CPPFLAGS="$tmp_save_CPPFLAGS"
 
1094
        CFLAGS="$tmp_save_CFLAGS"
 
1095
      ])
 
1096
    fi
 
1097
    #
 
1098
  fi
 
1099
])
 
1100
 
 
1101
 
 
1102
dnl CURL_SHFUNC_SQUEEZE
 
1103
dnl -------------------------------------------------
 
1104
dnl Declares a shell function squeeze() which removes
 
1105
dnl redundant whitespace out of a shell variable.
 
1106
 
 
1107
AC_DEFUN([CURL_SHFUNC_SQUEEZE], [
 
1108
squeeze() {
 
1109
  _sqz_result=""
 
1110
  eval _sqz_input=\[$][$]1
 
1111
  for _sqz_token in $_sqz_input; do
 
1112
    if test -z "$_sqz_result"; then
 
1113
      _sqz_result="$_sqz_token"
 
1114
    else
 
1115
      _sqz_result="$_sqz_result $_sqz_token"
 
1116
    fi
 
1117
  done
 
1118
  eval [$]1=\$_sqz_result
 
1119
  return 0
 
1120
}
 
1121
])
 
1122
 
 
1123
 
 
1124
dnl CURL_PROCESS_DEBUG_BUILD_OPTS
 
1125
dnl -------------------------------------------------
 
1126
dnl Settings which depend on configure's debug given
 
1127
dnl option, and further configure the build process.
 
1128
dnl Don't use this macro for compiler dependant stuff.
 
1129
 
 
1130
AC_DEFUN([CURL_PROCESS_DEBUG_BUILD_OPTS], [
 
1131
  AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
 
1132
  AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
 
1133
  AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
 
1134
  #
 
1135
  if test "$want_debug" = "yes"; then
 
1136
    CPPFLAGS="$CPPFLAGS -DCURLDEBUG"
 
1137
    squeeze CPPFLAGS
 
1138
  fi
 
1139
  #
 
1140
])
 
1141
 
 
1142
 
 
1143
dnl CURL_CHECK_PROG_CC
 
1144
dnl -------------------------------------------------
 
1145
dnl Check for compiler program, preventing CFLAGS and
 
1146
dnl CPPFLAGS from being unexpectedly changed.
 
1147
 
 
1148
AC_DEFUN([CURL_CHECK_PROG_CC], [
 
1149
  ac_save_CFLAGS="$CFLAGS"
 
1150
  ac_save_CPPFLAGS="$CPPFLAGS"
 
1151
  AC_PROG_CC
 
1152
  CFLAGS="$ac_save_CFLAGS"
 
1153
  CPPFLAGS="$ac_save_CPPFLAGS"
 
1154
])
 
1155
 
 
1156
 
 
1157
dnl CURL_VAR_MATCH (VARNAME, VALUE)
 
1158
dnl -------------------------------------------------
 
1159
dnl Verifies if shell variable VARNAME contains VALUE.
 
1160
dnl Contents of variable VARNAME and VALUE are handled
 
1161
dnl as whitespace separated lists of words. If at least
 
1162
dnl one word of VALUE is present in VARNAME the match
 
1163
dnl is considered positive, otherwise false.
 
1164
 
 
1165
AC_DEFUN([CURL_VAR_MATCH], [
 
1166
  ac_var_match_word="no"
 
1167
  for word1 in $[$1]; do
 
1168
    for word2 in [$2]; do
 
1169
      if test "$word1" = "$word2"; then
 
1170
        ac_var_match_word="yes"
 
1171
      fi
 
1172
    done
 
1173
  done
 
1174
])
 
1175
 
 
1176
 
 
1177
dnl CURL_VAR_MATCH_IFELSE (VARNAME, VALUE,
 
1178
dnl                        [ACTION-IF-MATCH], [ACTION-IF-NOT-MATCH])
 
1179
dnl -------------------------------------------------
 
1180
dnl This performs a CURL_VAR_MATCH check and executes
 
1181
dnl first branch if the match is positive, otherwise
 
1182
dnl the second branch is executed.
 
1183
 
 
1184
AC_DEFUN([CURL_VAR_MATCH_IFELSE], [
 
1185
  CURL_VAR_MATCH([$1],[$2])
 
1186
  if test "$ac_var_match_word" = "yes"; then
 
1187
  ifelse($3,,:,[$3])
 
1188
  ifelse($4,,,[else
 
1189
    $4])
 
1190
  fi
 
1191
])
 
1192
 
 
1193
 
 
1194
dnl CURL_VAR_STRIP (VARNAME, VALUE)
 
1195
dnl -------------------------------------------------
 
1196
dnl Contents of variable VARNAME and VALUE are handled
 
1197
dnl as whitespace separated lists of words. Each word
 
1198
dnl from VALUE is removed from VARNAME when present.
 
1199
 
 
1200
AC_DEFUN([CURL_VAR_STRIP], [
 
1201
  AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
 
1202
  ac_var_stripped=""
 
1203
  for word1 in $[$1]; do
 
1204
    ac_var_strip_word="no"
 
1205
    for word2 in [$2]; do
 
1206
      if test "$word1" = "$word2"; then
 
1207
        ac_var_strip_word="yes"
 
1208
      fi
 
1209
    done
 
1210
    if test "$ac_var_strip_word" = "no"; then
 
1211
      ac_var_stripped="$ac_var_stripped $word1"
 
1212
    fi
 
1213
  done
 
1214
  dnl squeeze whitespace out of result
 
1215
  [$1]="$ac_var_stripped"
 
1216
  squeeze [$1]
 
1217
])
 
1218