5
5
# | (__| |_| | _ <| |___
6
6
# \___|\___/|_| \_\_____|
8
# Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
8
# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
10
10
# This software is licensed as described in the file COPYING, which
11
11
# you should have received as part of this distribution. The terms
18
18
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
# KIND, either express or implied.
21
# $Id: curl-compilers.m4,v 1.53 2009-06-17 02:26:40 danf Exp $
22
21
#***************************************************************************
24
23
# File version for 'aclocal' use. Keep it a single number.
28
27
dnl CURL_CHECK_COMPILER
45
44
CURL_CHECK_COMPILER_HPUX_C
46
45
CURL_CHECK_COMPILER_IBM_C
47
46
CURL_CHECK_COMPILER_INTEL_C
47
CURL_CHECK_COMPILER_CLANG
48
48
CURL_CHECK_COMPILER_GNU_C
49
49
CURL_CHECK_COMPILER_LCC
50
50
CURL_CHECK_COMPILER_SGI_MIPSPRO_C
74
dnl CURL_CHECK_COMPILER_CLANG
75
dnl -------------------------------------------------
76
dnl Verify if compiler being used is clang.
78
AC_DEFUN([CURL_CHECK_COMPILER_CLANG], [
79
AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU_C])dnl
80
AC_MSG_CHECKING([if compiler is clang])
81
CURL_CHECK_DEF([__clang__], [], [silent])
82
if test "$curl_cv_have_def___clang__" = "yes"; then
85
clangver=`$CC -dumpversion`
86
clangvhi=`echo $clangver | cut -d . -f1`
87
clangvlo=`echo $clangver | cut -d . -f2`
88
compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
89
flags_dbg_all="-g -g0 -g1 -g2 -g3"
90
flags_dbg_all="$flags_dbg_all -ggdb"
91
flags_dbg_all="$flags_dbg_all -gstabs"
92
flags_dbg_all="$flags_dbg_all -gstabs+"
93
flags_dbg_all="$flags_dbg_all -gcoff"
94
flags_dbg_all="$flags_dbg_all -gxcoff"
95
flags_dbg_all="$flags_dbg_all -gdwarf-2"
96
flags_dbg_all="$flags_dbg_all -gvms"
99
flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4"
74
108
dnl CURL_CHECK_COMPILER_DEC_C
75
109
dnl -------------------------------------------------
76
110
dnl Verify if compiler being used is DEC C.
102
136
AC_DEFUN([CURL_CHECK_COMPILER_GNU_C], [
103
137
AC_REQUIRE([CURL_CHECK_COMPILER_INTEL_C])dnl
138
AC_REQUIRE([CURL_CHECK_COMPILER_CLANG])dnl
104
139
AC_MSG_CHECKING([if compiler is GNU C])
105
140
CURL_CHECK_DEF([__GNUC__], [], [silent])
106
141
if test "$curl_cv_have_def___GNUC__" = "yes" &&
501
536
if test "$compiler_id" != "unknown"; then
503
if test "$compiler_id" = "GNU_C"; then
538
if test "$compiler_id" = "GNU_C" ||
539
test "$compiler_id" = "CLANG"; then
504
540
CURL_CONVERT_INCLUDE_TO_ISYSTEM
512
548
case "$compiler_id" in
552
dnl Disable warnings for unused arguments, otherwise clang will
553
dnl warn about compile-time arguments used during link-time, like
554
dnl -O and -g and -pedantic.
555
tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments"
516
560
dnl Select strict ANSI C compiler mode
792
836
case "$compiler_id" in
840
if test "$want_warnings" = "yes"; then
841
dnl All versions of clang support the same warnings as at least
842
dnl gcc 4.2.1 except -Wunused.
843
tmp_CFLAGS="$tmp_CFLAGS -pedantic"
844
tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra"
845
tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings"
846
tmp_CFLAGS="$tmp_CFLAGS -Wshadow"
847
tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs"
848
tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
849
tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes"
850
tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
851
tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
852
tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare"
853
tmp_CFLAGS="$tmp_CFLAGS -Wundef"
854
tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
855
tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
856
tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
857
tmp_CFLAGS="$tmp_CFLAGS -Wcast-align"
858
tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers"
859
tmp_CFLAGS="$tmp_CFLAGS -Wshorten-64-to-32"
861
dnl Only clang 1.1 or later
862
if test "$compiler_num" -ge "101"; then
863
tmp_CFLAGS="$tmp_CFLAGS -Wunused"
796
870
if test "$want_warnings" = "yes"; then
952
1026
dnl Disable using EBP register in optimizations
953
1027
tmp_CFLAGS="$tmp_CFLAGS -fno-omit-frame-pointer"
954
1028
dnl Disable use of ANSI C aliasing rules in optimizations
955
tmp_CFLAGS="$tmp_CFLAGS -no-ansi-alias"
1029
tmp_CFLAGS="$tmp_CFLAGS -fno-strict-aliasing"
956
1030
dnl Value-safe optimizations on floating-point data
957
1031
tmp_CFLAGS="$tmp_CFLAGS -fp-model precise"
958
1032
dnl Only icc 10.0 or later