~ubuntu-branches/ubuntu/trusty/sflphone/trusty

« back to all changes in this revision

Viewing changes to daemon/m4/ax_cxx_compile_stdcxx_11.m4

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (4.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20140128182336-jrsv0k9u6cawc068
Tags: 1.3.0-1
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ============================================================================
 
2
#  http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
 
3
# ============================================================================
 
4
#
 
5
# SYNOPSIS
 
6
#
 
7
#   AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
 
8
#
 
9
# DESCRIPTION
 
10
#
 
11
#   Check for baseline language coverage in the compiler for the C++11
 
12
#   standard; if necessary, add switches to CXXFLAGS to enable support.
 
13
#
 
14
#   The first argument, if specified, indicates whether you insist on an
 
15
#   extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
 
16
#   -std=c++11).  If neither is specified, you get whatever works, with
 
17
#   preference for an extended mode.
 
18
#
 
19
#   The second argument, if specified 'mandatory' or if left unspecified,
 
20
#   indicates that baseline C++11 support is required and that the macro
 
21
#   should error out if no mode with that support is found.  If specified
 
22
#   'optional', then configuration proceeds regardless, after defining
 
23
#   HAVE_CXX11 if and only if a supporting mode is found.
 
24
#
 
25
# LICENSE
 
26
#
 
27
#   Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
 
28
#   Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
 
29
#   Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
 
30
#
 
31
#   Copying and distribution of this file, with or without modification, are
 
32
#   permitted in any medium without royalty provided the copyright notice
 
33
#   and this notice are preserved. This file is offered as-is, without any
 
34
#   warranty.
 
35
 
 
36
#serial 3
 
37
 
 
38
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
 
39
  template <typename T>
 
40
    struct check
 
41
    {
 
42
      static_assert(sizeof(int) <= sizeof(T), "not big enough");
 
43
    };
 
44
 
 
45
    typedef check<check<bool>> right_angle_brackets;
 
46
 
 
47
    int a;
 
48
    decltype(a) b;
 
49
 
 
50
    typedef check<int> check_type;
 
51
    check_type c;
 
52
    check_type&& cr = static_cast<check_type&&>(c);
 
53
 
 
54
    auto d = a;
 
55
])
 
56
 
 
57
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
 
58
  m4_if([$1], [], [],
 
59
        [$1], [ext], [],
 
60
        [$1], [noext], [],
 
61
        [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
 
62
  m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
 
63
        [$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
 
64
        [$2], [optional], [ax_cxx_compile_cxx11_required=false],
 
65
        [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])dnl
 
66
  AC_LANG_PUSH([C++])dnl
 
67
  ac_success=no
 
68
  AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
 
69
  ax_cv_cxx_compile_cxx11,
 
70
  [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
 
71
    [ax_cv_cxx_compile_cxx11=yes],
 
72
    [ax_cv_cxx_compile_cxx11=no])])
 
73
  if test x$ax_cv_cxx_compile_cxx11 = xyes; then
 
74
    ac_success=yes
 
75
  fi
 
76
 
 
77
  m4_if([$1], [noext], [], [dnl
 
78
  if test x$ac_success = xno; then
 
79
    for switch in -std=gnu++11 -std=gnu++0x; do
 
80
      cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
 
81
      AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
 
82
                     $cachevar,
 
83
        [ac_save_CXXFLAGS="$CXXFLAGS"
 
84
         CXXFLAGS="$CXXFLAGS $switch"
 
85
         AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
 
86
          [eval $cachevar=yes],
 
87
          [eval $cachevar=no])
 
88
         CXXFLAGS="$ac_save_CXXFLAGS"])
 
89
      if eval test x\$$cachevar = xyes; then
 
90
        CXXFLAGS="$CXXFLAGS $switch"
 
91
        ac_success=yes
 
92
        break
 
93
      fi
 
94
    done
 
95
  fi])
 
96
 
 
97
  m4_if([$1], [ext], [], [dnl
 
98
  if test x$ac_success = xno; then
 
99
    for switch in -std=c++11 -std=c++0x; do
 
100
      cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
 
101
      AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
 
102
                     $cachevar,
 
103
        [ac_save_CXXFLAGS="$CXXFLAGS"
 
104
         CXXFLAGS="$CXXFLAGS $switch"
 
105
         AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
 
106
          [eval $cachevar=yes],
 
107
          [eval $cachevar=no])
 
108
         CXXFLAGS="$ac_save_CXXFLAGS"])
 
109
      if eval test x\$$cachevar = xyes; then
 
110
        CXXFLAGS="$CXXFLAGS $switch"
 
111
        ac_success=yes
 
112
        break
 
113
      fi
 
114
    done
 
115
  fi])
 
116
  AC_LANG_POP([C++])
 
117
  if test x$ax_cxx_compile_cxx11_required = xtrue; then
 
118
    if test x$ac_success = xno; then
 
119
      AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
 
120
    fi
 
121
  else
 
122
    if test x$ac_success = xno; then
 
123
      HAVE_CXX11=0
 
124
      AC_MSG_NOTICE([No compiler with C++11 support was found])
 
125
    else
 
126
      HAVE_CXX11=1
 
127
      AC_DEFINE(HAVE_CXX11,1,
 
128
                [define if the compiler supports basic C++11 syntax])
 
129
    fi
 
130
 
 
131
    AC_SUBST(HAVE_CXX11)
 
132
  fi
 
133
])