Skip to content

Commit 1bb2fc9

Browse files
committed
[depends] Check for C++17 support
1 parent 005512e commit 1bb2fc9

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

tools/depends/configure.ac

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ AC_CONFIG_FILES([target/config.site native/config.site.native Makefile.include t
77
AC_CANONICAL_HOST
88

99
m4_include([m4/xbmc_arch.m4])
10-
m4_include([m4/ax_cxx_compile_stdcxx_14.m4])
10+
m4_include([m4/ax_cxx_compile_stdcxx_17.m4])
1111

1212
# check for not same cpu value
1313
AC_DEFUN([MC_CHECK_NOT_CPU],
@@ -129,9 +129,9 @@ if test -n "$use_toolchain"; then
129129
esac
130130
fi
131131
AC_PROG_CXX([$COMPILER_LIST])
132-
AX_CXX_COMPILE_STDCXX_14([noext],[mandatory])
133-
c14_flags=$(echo "$CFLAGS" | sed 's/-O@<:@123@:>@//g;s/-g //g;s/ //g')
134-
cxx14_flags=$(echo "$CXXFLAGS" | sed 's/-O@<:@123@:>@//g;s/-g //g;s/ //g')
132+
AX_CXX_COMPILE_STDCXX_17([noext],[mandatory])
133+
c17_flags=$(echo "$CFLAGS" | sed 's/-O@<:@123@:>@//g;s/-g //g;s/ //g')
134+
cxx17_flags=$(echo "$CXXFLAGS" | sed 's/-O@<:@123@:>@//g;s/-g //g;s/ //g')
135135
PATH="${OLD_PATH}"
136136

137137
if test "$use_ccache" = "yes"; then
@@ -605,8 +605,8 @@ if [ ! `mkdir -p $use_tarballs` ]; then
605605
fi
606606

607607
# remove unwanted optimization flags
608-
tmp_cflags=$(echo $c14_flags $platform_cflags | sed 's/-O@<:@123@:>@//g;s/-g //g;s/ \{2,\}//g')
609-
tmp_cxxflags=$(echo $cxx14_flags $platform_cxxflags | sed 's/-O@<:@123@:>@//g;s/-g //g;s/ \{2,\}//g')
608+
tmp_cflags=$(echo $c17_flags $platform_cflags | sed 's/-O@<:@123@:>@//g;s/-g //g;s/ \{2,\}//g')
609+
tmp_cxxflags=$(echo $cxx17_flags $platform_cxxflags | sed 's/-O@<:@123@:>@//g;s/-g //g;s/ \{2,\}//g')
610610

611611
release_cflags="-DNDEBUG=1"
612612

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
# ============================================================================
2-
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html
2+
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_17.html
33
# ============================================================================
44
#
55
# SYNOPSIS
66
#
7-
# AX_CXX_COMPILE_STDCXX_14([ext|noext],[mandatory|optional])
7+
# AX_CXX_COMPILE_STDCXX_17([ext|noext],[mandatory|optional])
88
#
99
# DESCRIPTION
1010
#
11-
# Check for baseline language coverage in the compiler for the C++14
11+
# Check for baseline language coverage in the compiler for the C++17
1212
# standard; if necessary, add switches to CXXFLAGS to enable support.
1313
#
1414
# The first argument, if specified, indicates whether you insist on an
15-
# extended mode (e.g. -std=gnu++14) or a strict conformance mode (e.g.
16-
# -std=c++14). If neither is specified, you get whatever works, with
15+
# extended mode (e.g. -std=gnu++17) or a strict conformance mode (e.g.
16+
# -std=c++17). If neither is specified, you get whatever works, with
1717
# preference for an extended mode.
1818
#
1919
# The second argument, if specified 'mandatory' or if left unspecified,
20-
# indicates that baseline C++14 support is required and that the macro
20+
# indicates that baseline C++17 support is required and that the macro
2121
# should error out if no mode with that support is found. If specified
2222
# 'optional', then configuration proceeds regardless, after defining
23-
# HAVE_CXX14 if and only if a supporting mode is found.
23+
# HAVE_CXX17 if and only if a supporting mode is found.
2424
#
2525
# LICENSE
2626
#
@@ -36,7 +36,7 @@
3636

3737
#serial 4
3838

39-
m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody], [[
39+
m4_define([_AX_CXX_COMPILE_STDCXX_17_testbody], [[
4040
template <typename T>
4141
struct check
4242
{
@@ -63,42 +63,42 @@ m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody], [[
6363
auto l = [](){};
6464
]])
6565

66-
AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [dnl
66+
AC_DEFUN([AX_CXX_COMPILE_STDCXX_17], [dnl
6767
m4_if([$1], [], [],
6868
[$1], [ext], [],
6969
[$1], [noext], [],
70-
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_14])])dnl
71-
m4_if([$2], [], [ax_cxx_compile_cxx14_required=true],
72-
[$2], [mandatory], [ax_cxx_compile_cxx14_required=true],
73-
[$2], [optional], [ax_cxx_compile_cxx14_required=false],
74-
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_14])])
70+
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_17])])dnl
71+
m4_if([$2], [], [ax_cxx_compile_cxx17_required=true],
72+
[$2], [mandatory], [ax_cxx_compile_cxx17_required=true],
73+
[$2], [optional], [ax_cxx_compile_cxx17_required=false],
74+
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_17])])
7575
AC_LANG_PUSH([C++])dnl
7676
ac_success=no
77-
AC_CACHE_CHECK(whether $CXX supports C++14 features by default,
78-
ax_cv_cxx_compile_cxx14,
79-
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_14_testbody])],
80-
[ax_cv_cxx_compile_cxx14=yes],
81-
[ax_cv_cxx_compile_cxx14=no])])
82-
if test x$ax_cv_cxx_compile_cxx14 = xyes; then
77+
AC_CACHE_CHECK(whether $CXX supports C++17 features by default,
78+
ax_cv_cxx_compile_cxx17,
79+
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_17_testbody])],
80+
[ax_cv_cxx_compile_cxx17=yes],
81+
[ax_cv_cxx_compile_cxx17=no])])
82+
if test x$ax_cv_cxx_compile_cxx17 = xyes; then
8383
ac_success=yes
8484
fi
8585
8686
m4_if([$1], [noext], [], [dnl
8787
if test x$ac_success = xno; then
88-
for switch in -std=gnu++14 -std=gnu++0x; do
89-
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx14_$switch])
90-
AC_CACHE_CHECK(whether $CXX supports C++14 features with $switch,
88+
for switch in -std=gnu++17 -std=gnu++0x; do
89+
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx17_$switch])
90+
AC_CACHE_CHECK(whether $CXX supports C++17 features with $switch,
9191
$cachevar,
9292
[ac_save_CXXFLAGS="$CXXFLAGS"
9393
CXXFLAGS="$CXXFLAGS $switch"
94-
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_14_testbody])],
94+
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_17_testbody])],
9595
[eval $cachevar=yes],
9696
[eval $cachevar=no])
9797
CXXFLAGS="$ac_save_CXXFLAGS"])
9898
if eval test x\$$cachevar = xyes; then
9999
CXXFLAGS="$CXXFLAGS $switch"
100-
CXX14_SWITCH="$switch"
101-
AC_SUBST(CXX14_SWITCH)
100+
CXX17_SWITCH="$switch"
101+
AC_SUBST(CXX17_SWITCH)
102102
ac_success=yes
103103
break
104104
fi
@@ -107,40 +107,40 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [dnl
107107
108108
m4_if([$1], [ext], [], [dnl
109109
if test x$ac_success = xno; then
110-
for switch in -std=c++14 -std=c++0x; do
111-
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx14_$switch])
112-
AC_CACHE_CHECK(whether $CXX supports C++14 features with $switch,
110+
for switch in -std=c++17 -std=c++0x; do
111+
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx17_$switch])
112+
AC_CACHE_CHECK(whether $CXX supports C++17 features with $switch,
113113
$cachevar,
114114
[ac_save_CXXFLAGS="$CXXFLAGS"
115115
CXXFLAGS="$CXXFLAGS $switch"
116-
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_14_testbody])],
116+
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_17_testbody])],
117117
[eval $cachevar=yes],
118118
[eval $cachevar=no])
119119
CXXFLAGS="$ac_save_CXXFLAGS"])
120120
if eval test x\$$cachevar = xyes; then
121121
CXXFLAGS="$CXXFLAGS $switch"
122-
CXX14_SWITCH="$switch"
123-
AC_SUBST(CXX14_SWITCH)
122+
CXX17_SWITCH="$switch"
123+
AC_SUBST(CXX17_SWITCH)
124124
ac_success=yes
125125
break
126126
fi
127127
done
128128
fi])
129129
AC_LANG_POP([C++])
130-
if test x$ax_cxx_compile_cxx14_required = xtrue; then
130+
if test x$ax_cxx_compile_cxx17_required = xtrue; then
131131
if test x$ac_success = xno; then
132-
AC_MSG_ERROR([*** A compiler with support for C++14 language features is required.])
132+
AC_MSG_ERROR([*** A compiler with support for C++17 language features is required.])
133133
fi
134134
else
135135
if test x$ac_success = xno; then
136-
HAVE_CXX14=0
137-
AC_MSG_NOTICE([No compiler with C++14 support was found])
136+
HAVE_CXX17=0
137+
AC_MSG_NOTICE([No compiler with C++17 support was found])
138138
else
139-
HAVE_CXX14=1
140-
AC_DEFINE(HAVE_CXX14,1,
141-
[define if the compiler supports basic C++14 syntax])
139+
HAVE_CXX17=1
140+
AC_DEFINE(HAVE_CXX17,1,
141+
[define if the compiler supports basic C++17 syntax])
142142
fi
143143
144-
AC_SUBST(HAVE_CXX14)
144+
AC_SUBST(HAVE_CXX17)
145145
fi
146146
])

0 commit comments

Comments
 (0)