[GIT] ppl/ppl(master): Check whether the C++ compiler supports some basic C++11 features.

Module: ppl/ppl Branch: master Commit: 3b57980822808601f0a4574070d6240967056762 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=3b57980822808...
Author: Roberto Bagnara roberto.bagnara@bugseng.com Date: Fri Mar 28 22:31:33 2014 +0100
Check whether the C++ compiler supports some basic C++11 features.
---
configure.ac | 3 +- m4/ac_check_cxx11.m4 | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ ppl-config.sed | 1 + 3 files changed, 57 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac index 26c4a79..9d51bc0 100644 --- a/configure.ac +++ b/configure.ac @@ -280,7 +280,6 @@ int main() { AC_LANG_POP(C++) fi
- AC_PROG_FGREP AC_PROG_EGREP AC_PROG_SED @@ -1620,6 +1619,8 @@ then fi fi
+# Check if the C++ compiler supports C++11 features. +AC_CHECK_CXX11
AC_SUBST(LIBEXT, [$libext]) AC_SUBST(SHREXT, [$shrext_cmds]) diff --git a/m4/ac_check_cxx11.m4 b/m4/ac_check_cxx11.m4 new file mode 100644 index 0000000..342ed34 --- /dev/null +++ b/m4/ac_check_cxx11.m4 @@ -0,0 +1,54 @@ +dnl A function to check for the existence and usability of GMP. +dnl Copyright (C) 2010-2014 BUGSENG srl (http://bugseng.com) +dnl +dnl This file is part of the Parma Polyhedra Library (PPL). +dnl +dnl The PPL is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU General Public License as published by the +dnl Free Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl The PPL is distributed in the hope that it will be useful, but WITHOUT +dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software Foundation, +dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. +dnl +dnl For the most up-to-date information see the Parma Polyhedra Library +dnl site: http://bugseng.com/products/ppl/ . + +AC_DEFUN([AC_CHECK_CXX11], +[ +AC_LANG_PUSH(C++) +AC_MSG_CHECKING([if the C++ compiler supports C++11 features]) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +template <typename T> +struct check final { + static constexpr T value{ __cplusplus }; +}; + +typedef check<check<bool>> right_angle_brackets; + +int a; +decltype(a) b; + +typedef check<int> check_type; +check_type c{}; +check_type&& cr = static_cast<check_type&&>(c); + +static_assert(check_type::value == 201103L, "C++11 compiler"); +]])], + AC_MSG_RESULT(yes) + ac_cv_check_cxx11=yes, + AC_MSG_RESULT(no) + ac_cv_check_cx11=no + ) +AC_LANG_POP(C++) +if test "$ac_cv_check_cxx11" = yes; then + AC_DEFINE(HAVE_CXX11,, + [Defined if the C++compiler supports C++11 features.]) +fi +]) diff --git a/ppl-config.sed b/ppl-config.sed index 5d6d721..dd94ee3 100644 --- a/ppl-config.sed +++ b/ppl-config.sed @@ -1,3 +1,4 @@ +s/([^A-Z_])HAVE_CXX11/\1PPL_HAVE_CXX11/g s/([^A-Z_])HAVE_DECL_FFS/\1PPL_HAVE_DECL_FFS/g s/([^A-Z_])HAVE_DECL_FMA/\1PPL_HAVE_DECL_FMA/g s/([^A-Z_])HAVE_DECL_FMAF/\1PPL_HAVE_DECL_FMAF/g
participants (1)
-
Roberto Bagnara