~ubuntu-branches/ubuntu/natty/curl/natty-security

« back to all changes in this revision

Viewing changes to m4/curl-compilers.m4

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2010-06-20 13:56:28 UTC
  • mfrom: (3.4.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100620135628-e30tp9jldq6hq985
Tags: 7.21.0-1ubuntu1
* Merge from debian unstable.  Remaining changes: LP: #596334
  - Keep build deps in main:
    - Drop build dependencies: stunnel, libssh2-1-dev
    - Add build-dependency on openssh-server
    - Drop libssh2-1-dev from libcurl4-openssl-dev's Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
#                            | (__| |_| |  _ <| |___
6
6
#                             \___|\___/|_| \_\_____|
7
7
#
8
 
# Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
 
8
# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
9
9
#
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.
20
20
#
21
 
# $Id: curl-compilers.m4,v 1.53 2009-06-17 02:26:40 danf Exp $
22
21
#***************************************************************************
23
22
 
24
23
# File version for 'aclocal' use. Keep it a single number.
25
 
# serial 52
 
24
# serial 55
26
25
 
27
26
 
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
71
71
])
72
72
 
73
73
 
 
74
dnl CURL_CHECK_COMPILER_CLANG
 
75
dnl -------------------------------------------------
 
76
dnl Verify if compiler being used is clang.
 
77
 
 
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
 
83
    AC_MSG_RESULT([yes])
 
84
    compiler_id="CLANG"
 
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"
 
97
    flags_dbg_yes="-g"
 
98
    flags_dbg_off="-g0"
 
99
    flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4"
 
100
    flags_opt_yes="-Os"
 
101
    flags_opt_off="-O0"
 
102
  else
 
103
    AC_MSG_RESULT([no])
 
104
  fi
 
105
])
 
106
 
 
107
 
74
108
dnl CURL_CHECK_COMPILER_DEC_C
75
109
dnl -------------------------------------------------
76
110
dnl Verify if compiler being used is DEC C.
101
135
 
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" &&
500
535
  #
501
536
  if test "$compiler_id" != "unknown"; then
502
537
    #
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
505
541
    fi
506
542
    #
511
547
    #
512
548
    case "$compiler_id" in
513
549
        #
 
550
      CLANG)
 
551
        #
 
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"
 
556
        ;;
 
557
        #
514
558
      DEC_C)
515
559
        #
516
560
        dnl Select strict ANSI C compiler mode
791
835
    #
792
836
    case "$compiler_id" in
793
837
        #
 
838
      CLANG)
 
839
        #
 
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"
 
860
          #
 
861
          dnl Only clang 1.1 or later
 
862
          if test "$compiler_num" -ge "101"; then
 
863
            tmp_CFLAGS="$tmp_CFLAGS -Wunused"
 
864
          fi
 
865
        fi
 
866
        ;;
 
867
        #
794
868
      DEC_C)
795
869
        #
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