Revision 526:459cddd7e64a
| acinclude.m4 | ||
|---|---|---|
| 1 |
|
|
| 2 |
# From autoconf archive: |
|
| 3 |
|
|
| 4 |
# ============================================================================ |
|
| 5 |
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html |
|
| 6 |
# ============================================================================ |
|
| 7 |
# |
|
| 8 |
# SYNOPSIS |
|
| 9 |
# |
|
| 10 |
# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional]) |
|
| 11 |
# |
|
| 12 |
# DESCRIPTION |
|
| 13 |
# |
|
| 14 |
# Check for baseline language coverage in the compiler for the C++11 |
|
| 15 |
# standard; if necessary, add switches to CXXFLAGS to enable support. |
|
| 16 |
# |
|
| 17 |
# The first argument, if specified, indicates whether you insist on an |
|
| 18 |
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. |
|
| 19 |
# -std=c++11). If neither is specified, you get whatever works, with |
|
| 20 |
# preference for an extended mode. |
|
| 21 |
# |
|
| 22 |
# The second argument, if specified 'mandatory' or if left unspecified, |
|
| 23 |
# indicates that baseline C++11 support is required and that the macro |
|
| 24 |
# should error out if no mode with that support is found. If specified |
|
| 25 |
# 'optional', then configuration proceeds regardless, after defining |
|
| 26 |
# HAVE_CXX11 if and only if a supporting mode is found. |
|
| 27 |
# |
|
| 28 |
# LICENSE |
|
| 29 |
# |
|
| 30 |
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com> |
|
| 31 |
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com> |
|
| 32 |
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu> |
|
| 33 |
# Copyright (c) 2014 Alexey Sokolov <sokolov@google.com> |
|
| 34 |
# |
|
| 35 |
# Copying and distribution of this file, with or without modification, are |
|
| 36 |
# permitted in any medium without royalty provided the copyright notice |
|
| 37 |
# and this notice are preserved. This file is offered as-is, without any |
|
| 38 |
# warranty. |
|
| 39 |
|
|
| 40 |
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[ |
|
| 41 |
template <typename T> |
|
| 42 |
struct check |
|
| 43 |
{
|
|
| 44 |
static_assert(sizeof(int) <= sizeof(T), "not big enough"); |
|
| 45 |
}; |
|
| 46 |
|
|
| 47 |
struct Base {
|
|
| 48 |
virtual void f() {}
|
|
| 49 |
}; |
|
| 50 |
struct Child : public Base {
|
|
| 51 |
virtual void f() override {}
|
|
| 52 |
}; |
|
| 53 |
|
|
| 54 |
typedef check<check<bool>> right_angle_brackets; |
|
| 55 |
|
|
| 56 |
int a; |
|
| 57 |
decltype(a) b; |
|
| 58 |
|
|
| 59 |
typedef check<int> check_type; |
|
| 60 |
check_type c; |
|
| 61 |
check_type&& cr = static_cast<check_type&&>(c); |
|
| 62 |
|
|
| 63 |
auto d = a; |
|
| 64 |
auto l = [](){};
|
|
| 65 |
]]) |
|
| 66 |
|
|
| 67 |
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl |
|
| 68 |
m4_if([$1], [], [], |
|
| 69 |
[$1], [ext], [], |
|
| 70 |
[$1], [noext], [], |
|
| 71 |
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl |
|
| 72 |
m4_if([$2], [], [ax_cxx_compile_cxx11_required=true], |
|
| 73 |
[$2], [mandatory], [ax_cxx_compile_cxx11_required=true], |
|
| 74 |
[$2], [optional], [ax_cxx_compile_cxx11_required=false], |
|
| 75 |
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])]) |
|
| 76 |
AC_LANG_PUSH([C++])dnl |
|
| 77 |
ac_success=no |
|
| 78 |
AC_CACHE_CHECK(whether $CXX supports C++11 features by default, |
|
| 79 |
ax_cv_cxx_compile_cxx11, |
|
| 80 |
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], |
|
| 81 |
[ax_cv_cxx_compile_cxx11=yes], |
|
| 82 |
[ax_cv_cxx_compile_cxx11=no])]) |
|
| 83 |
if test x$ax_cv_cxx_compile_cxx11 = xyes; then |
|
| 84 |
ac_success=yes |
|
| 85 |
fi |
|
| 86 |
|
|
| 87 |
m4_if([$1], [noext], [], [dnl |
|
| 88 |
if test x$ac_success = xno; then |
|
| 89 |
for switch in -std=gnu++11 -std=gnu++0x; do |
|
| 90 |
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) |
|
| 91 |
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, |
|
| 92 |
$cachevar, |
|
| 93 |
[ac_save_CXXFLAGS="$CXXFLAGS" |
|
| 94 |
CXXFLAGS="$CXXFLAGS $switch" |
|
| 95 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], |
|
| 96 |
[eval $cachevar=yes], |
|
| 97 |
[eval $cachevar=no]) |
|
| 98 |
CXXFLAGS="$ac_save_CXXFLAGS"]) |
|
| 99 |
if eval test x\$$cachevar = xyes; then |
|
| 100 |
CXXFLAGS="$CXXFLAGS $switch" |
|
| 101 |
ac_success=yes |
|
| 102 |
break |
|
| 103 |
fi |
|
| 104 |
done |
|
| 105 |
fi]) |
|
| 106 |
|
|
| 107 |
m4_if([$1], [ext], [], [dnl |
|
| 108 |
if test x$ac_success = xno; then |
|
| 109 |
for switch in -std=c++11 -std=c++0x; do |
|
| 110 |
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) |
|
| 111 |
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, |
|
| 112 |
$cachevar, |
|
| 113 |
[ac_save_CXXFLAGS="$CXXFLAGS" |
|
| 114 |
CXXFLAGS="$CXXFLAGS $switch" |
|
| 115 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], |
|
| 116 |
[eval $cachevar=yes], |
|
| 117 |
[eval $cachevar=no]) |
|
| 118 |
CXXFLAGS="$ac_save_CXXFLAGS"]) |
|
| 119 |
if eval test x\$$cachevar = xyes; then |
|
| 120 |
CXXFLAGS="$CXXFLAGS $switch" |
|
| 121 |
ac_success=yes |
|
| 122 |
break |
|
| 123 |
fi |
|
| 124 |
done |
|
| 125 |
fi]) |
|
| 126 |
AC_LANG_POP([C++]) |
|
| 127 |
if test x$ax_cxx_compile_cxx11_required = xtrue; then |
|
| 128 |
if test x$ac_success = xno; then |
|
| 129 |
AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.]) |
|
| 130 |
fi |
|
| 131 |
else |
|
| 132 |
if test x$ac_success = xno; then |
|
| 133 |
HAVE_CXX11=0 |
|
| 134 |
AC_MSG_NOTICE([No compiler with C++11 support was found]) |
|
| 135 |
else |
|
| 136 |
HAVE_CXX11=1 |
|
| 137 |
AC_DEFINE(HAVE_CXX11,1, |
|
| 138 |
[define if the compiler supports basic C++11 syntax]) |
|
| 139 |
fi |
|
| 140 |
|
|
| 141 |
AC_SUBST(HAVE_CXX11) |
|
| 142 |
fi |
|
| 143 |
]) |
|
| configure | ||
|---|---|---|
| 630 | 630 |
PKG_CONFIG_LIBDIR |
| 631 | 631 |
PKG_CONFIG_PATH |
| 632 | 632 |
PKG_CONFIG |
| 633 |
HAVE_CXX11 |
|
| 633 | 634 |
EGREP |
| 634 | 635 |
GREP |
| 635 | 636 |
CPP |
| ... | ... | |
| 3670 | 3671 |
esac |
| 3671 | 3672 |
|
| 3672 | 3673 |
|
| 3674 |
# We now require C++11 |
|
| 3675 |
|
|
| 3676 |
ax_cxx_compile_cxx11_required=true |
|
| 3677 |
ac_ext=cpp |
|
| 3678 |
ac_cpp='$CXXCPP $CPPFLAGS' |
|
| 3679 |
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' |
|
| 3680 |
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' |
|
| 3681 |
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu |
|
| 3682 |
ac_success=no |
|
| 3683 |
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5
|
|
| 3684 |
$as_echo_n "checking whether $CXX supports C++11 features by default... " >&6; } |
|
| 3685 |
if ${ax_cv_cxx_compile_cxx11+:} false; then :
|
|
| 3686 |
$as_echo_n "(cached) " >&6 |
|
| 3687 |
else |
|
| 3688 |
cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
|
| 3689 |
/* end confdefs.h. */ |
|
| 3690 |
|
|
| 3691 |
template <typename T> |
|
| 3692 |
struct check |
|
| 3693 |
{
|
|
| 3694 |
static_assert(sizeof(int) <= sizeof(T), "not big enough"); |
|
| 3695 |
}; |
|
| 3696 |
|
|
| 3697 |
struct Base {
|
|
| 3698 |
virtual void f() {}
|
|
| 3699 |
}; |
|
| 3700 |
struct Child : public Base {
|
|
| 3701 |
virtual void f() override {}
|
|
| 3702 |
}; |
|
| 3703 |
|
|
| 3704 |
typedef check<check<bool>> right_angle_brackets; |
|
| 3705 |
|
|
| 3706 |
int a; |
|
| 3707 |
decltype(a) b; |
|
| 3708 |
|
|
| 3709 |
typedef check<int> check_type; |
|
| 3710 |
check_type c; |
|
| 3711 |
check_type&& cr = static_cast<check_type&&>(c); |
|
| 3712 |
|
|
| 3713 |
auto d = a; |
|
| 3714 |
auto l = [](){};
|
|
| 3715 |
|
|
| 3716 |
_ACEOF |
|
| 3717 |
if ac_fn_cxx_try_compile "$LINENO"; then : |
|
| 3718 |
ax_cv_cxx_compile_cxx11=yes |
|
| 3719 |
else |
|
| 3720 |
ax_cv_cxx_compile_cxx11=no |
|
| 3721 |
fi |
|
| 3722 |
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext |
|
| 3723 |
fi |
|
| 3724 |
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5
|
|
| 3725 |
$as_echo "$ax_cv_cxx_compile_cxx11" >&6; } |
|
| 3726 |
if test x$ax_cv_cxx_compile_cxx11 = xyes; then |
|
| 3727 |
ac_success=yes |
|
| 3728 |
fi |
|
| 3729 |
|
|
| 3730 |
|
|
| 3731 |
|
|
| 3732 |
if test x$ac_success = xno; then |
|
| 3733 |
for switch in -std=c++11 -std=c++0x; do |
|
| 3734 |
cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` |
|
| 3735 |
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5
|
|
| 3736 |
$as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; } |
|
| 3737 |
if eval \${$cachevar+:} false; then :
|
|
| 3738 |
$as_echo_n "(cached) " >&6 |
|
| 3739 |
else |
|
| 3740 |
ac_save_CXXFLAGS="$CXXFLAGS" |
|
| 3741 |
CXXFLAGS="$CXXFLAGS $switch" |
|
| 3742 |
cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
|
| 3743 |
/* end confdefs.h. */ |
|
| 3744 |
|
|
| 3745 |
template <typename T> |
|
| 3746 |
struct check |
|
| 3747 |
{
|
|
| 3748 |
static_assert(sizeof(int) <= sizeof(T), "not big enough"); |
|
| 3749 |
}; |
|
| 3750 |
|
|
| 3751 |
struct Base {
|
|
| 3752 |
virtual void f() {}
|
|
| 3753 |
}; |
|
| 3754 |
struct Child : public Base {
|
|
| 3755 |
virtual void f() override {}
|
|
| 3756 |
}; |
|
| 3757 |
|
|
| 3758 |
typedef check<check<bool>> right_angle_brackets; |
|
| 3759 |
|
|
| 3760 |
int a; |
|
| 3761 |
decltype(a) b; |
|
| 3762 |
|
|
| 3763 |
typedef check<int> check_type; |
|
| 3764 |
check_type c; |
|
| 3765 |
check_type&& cr = static_cast<check_type&&>(c); |
|
| 3766 |
|
|
| 3767 |
auto d = a; |
|
| 3768 |
auto l = [](){};
|
|
| 3769 |
|
|
| 3770 |
_ACEOF |
|
| 3771 |
if ac_fn_cxx_try_compile "$LINENO"; then : |
|
| 3772 |
eval $cachevar=yes |
|
| 3773 |
else |
|
| 3774 |
eval $cachevar=no |
|
| 3775 |
fi |
|
| 3776 |
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext |
|
| 3777 |
CXXFLAGS="$ac_save_CXXFLAGS" |
|
| 3778 |
fi |
|
| 3779 |
eval ac_res=\$$cachevar |
|
| 3780 |
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
|
| 3781 |
$as_echo "$ac_res" >&6; } |
|
| 3782 |
if eval test x\$$cachevar = xyes; then |
|
| 3783 |
CXXFLAGS="$CXXFLAGS $switch" |
|
| 3784 |
ac_success=yes |
|
| 3785 |
break |
|
| 3786 |
fi |
|
| 3787 |
done |
|
| 3788 |
fi |
|
| 3789 |
ac_ext=c |
|
| 3790 |
ac_cpp='$CPP $CPPFLAGS' |
|
| 3791 |
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' |
|
| 3792 |
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' |
|
| 3793 |
ac_compiler_gnu=$ac_cv_c_compiler_gnu |
|
| 3794 |
|
|
| 3795 |
if test x$ax_cxx_compile_cxx11_required = xtrue; then |
|
| 3796 |
if test x$ac_success = xno; then |
|
| 3797 |
as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5 |
|
| 3798 |
fi |
|
| 3799 |
else |
|
| 3800 |
if test x$ac_success = xno; then |
|
| 3801 |
HAVE_CXX11=0 |
|
| 3802 |
{ $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5
|
|
| 3803 |
$as_echo "$as_me: No compiler with C++11 support was found" >&6;} |
|
| 3804 |
else |
|
| 3805 |
HAVE_CXX11=1 |
|
| 3806 |
|
|
| 3807 |
$as_echo "#define HAVE_CXX11 1" >>confdefs.h |
|
| 3808 |
|
|
| 3809 |
fi |
|
| 3810 |
|
|
| 3811 |
|
|
| 3812 |
fi |
|
| 3813 |
|
|
| 3814 |
|
|
| 3673 | 3815 |
if pkg-config --modversion vamp-sdk >/dev/null 2>&1; then |
| 3674 | 3816 |
echo "WARNING: A version of the Vamp plugin SDK is already installed." |
| 3675 | 3817 |
echo " Expect worries and sorrows if you install a new version" |
| ... | ... | |
| 3956 | 4098 |
*[\ \ ]-fPIC\ -Wall[\ \ ]*) ;; |
| 3957 | 4099 |
*) CFLAGS="$CFLAGS -fPIC -Wall -Wextra" ;; |
| 3958 | 4100 |
esac |
| 3959 |
CXXFLAGS="$CXXFLAGS -std=c++98"
|
|
| 4101 |
CXXFLAGS="$CXXFLAGS -std=c++11"
|
|
| 3960 | 4102 |
fi |
| 3961 | 4103 |
|
| 3962 | 4104 |
|
| configure.ac | ||
|---|---|---|
| 6 | 6 |
AC_HEADER_STDC |
| 7 | 7 |
AC_C_BIGENDIAN |
| 8 | 8 |
|
| 9 |
# We now require C++11 |
|
| 10 |
AX_CXX_COMPILE_STDCXX_11(noext) |
|
| 11 |
|
|
| 9 | 12 |
if pkg-config --modversion vamp-sdk >/dev/null 2>&1; then |
| 10 | 13 |
echo "WARNING: A version of the Vamp plugin SDK is already installed." |
| 11 | 14 |
echo " Expect worries and sorrows if you install a new version" |
| ... | ... | |
| 50 | 53 |
*[\ \ ]-fPIC\ -Wall[\ \ ]*) ;; |
| 51 | 54 |
*) CFLAGS="$CFLAGS -fPIC -Wall -Wextra" ;; |
| 52 | 55 |
esac |
| 53 |
CXXFLAGS="$CXXFLAGS -std=c++98"
|
|
| 56 |
CXXFLAGS="$CXXFLAGS -std=c++11"
|
|
| 54 | 57 |
fi |
| 55 | 58 |
changequote([,])dnl |
| 56 | 59 |
|
Also available in: Unified diff