From 707bae6fed6783e84600c6143f0f4bfd7989f56f Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Thu, 24 Mar 2016 16:09:43 +0000 Subject: [PATCH] Enable C++11 compilation when using libsigc++ 2.5.1 and later (#758545) As with glibmm [1] the latest versions of libsigc++ also uses ISO C++ 2011 features. The NEWS file [2] says: 2.5.1 (unstable): * Use (and require) C++11 (Kjell Ahlstedt) * Using C++11 lambda functions to create sigc::slots: Avoid the need for SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE. (Kjell Ahlstedt) Without enabling C++11 compiler features, compilation of GParted with libsigc++ 2.5.1 and later fails with errors such as theses: /usr/include/sigc++-2.0/sigc++/trackable.h:40:3: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++0x-compat] trackable_callback(void* data, func_destroy_notify func) noexcept ^ [1] d6d7cb2bbf2fc381b890f63bbbf626eacfc8cdf8 Enable C++11 compilation when using glibmm 2.45.40 and later (#756035) [2] libsigc++ 2.5.1 NEWS file https://git.gnome.org/browse/libsigcplusplus/tree/NEWS?h=2.5.1 Bug 758545 - gparted-0.24.0 fails to build with gnome 3.18 mm packages (on Gentoo) --- configure.ac | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 414b1cff..df19abb0 100644 --- a/configure.ac +++ b/configure.ac @@ -259,15 +259,30 @@ PKG_CHECK_EXISTS( ) -dnl Check for glibmm >= 2.45.40 and if found enable required C++11 compilation. +need_cxx_compile_stdcxx_11=no +dnl Check for glibmm >= 2.45.40 which requires C++11 compilation. AC_MSG_CHECKING([for glibmm >= 2.45.40 which requires C++11 compilation]) PKG_CHECK_EXISTS( [glibmm-2.4 >= 2.45.40], - [AC_MSG_RESULT([yes]) - AX_CXX_COMPILE_STDCXX_11() + [need_cxx_compile_stdcxx_11=yes + AC_MSG_RESULT([yes]) ], [AC_MSG_RESULT([no])] ) +dnl Check for libsigc++ >= 2.5.1 which requires C++11 compilation. +AC_MSG_CHECKING([for libsigc++ >= 2.5.1 which requires C++11 compilation]) +PKG_CHECK_EXISTS( + [sigc++-2.0 >= 2.5.1], + [need_cxx_compile_stdcxx_11=yes + AC_MSG_RESULT([yes]) + ], + [AC_MSG_RESULT([no])] +) +dnl Enable C++11 compilation only if required. +if test "x$need_cxx_compile_stdcxx_11" = xyes; then + AX_CXX_COMPILE_STDCXX_11() +fi + dnl======================