diff --git a/boost/Makefile.am b/boost/Makefile.am index 8cb08b179d..69198704d9 100644 --- a/boost/Makefile.am +++ b/boost/Makefile.am @@ -24,16 +24,35 @@ AM_CPPFLAGS += $(BOOST_INCLUDES) if MONOLITHIC_BOOST +if LYX_USE_STD_REGEX + +liblyxboost_a_SOURCES = \ + lyxboostsignals.cpp + +else + liblyxboost_a_SOURCES = \ lyxboost.cpp \ libs/regex/src/instances.cpp \ libs/regex/src/cpp_regex_traits.cpp \ libs/regex/src/c_regex_traits.cpp +endif #LYX_USE_STD_REGEX + +else + +if LYX_USE_STD_REGEX + +liblyxboost_a_SOURCES = \ + libs/signals/src/connection.cpp \ + libs/signals/src/named_slot_map.cpp \ + libs/signals/src/signal_base.cpp \ + libs/signals/src/slot.cpp \ + libs/signals/src/trackable.cpp + else liblyxboost_a_SOURCES = \ - \ libs/regex/src/internals.hpp \ libs/regex/src/c_regex_traits.cpp \ libs/regex/src/cpp_regex_traits.cpp \ @@ -55,4 +74,7 @@ liblyxboost_a_SOURCES = \ libs/signals/src/slot.cpp \ libs/signals/src/trackable.cpp -endif +endif #LYX_USE_STD_REGEX + + +endif #MONOLITHIC_BOOST diff --git a/boost/lyxboost.cpp b/boost/lyxboost.cpp index 9d46ac2b47..1eb28217d9 100644 --- a/boost/lyxboost.cpp +++ b/boost/lyxboost.cpp @@ -12,9 +12,4 @@ #include "libs/regex/src/regex_debug.cpp" #include "libs/regex/src/winstances.cpp" -#include "libs/signals/src/connection.cpp" -#include "libs/signals/src/named_slot_map.cpp" -#include "libs/signals/src/signal_base.cpp" -#include "libs/signals/src/slot.cpp" -#include "libs/signals/src/trackable.cpp" - +#include "lyxboostsignals.cpp" diff --git a/boost/lyxboostsignals.cpp b/boost/lyxboostsignals.cpp new file mode 100644 index 0000000000..d51078a46e --- /dev/null +++ b/boost/lyxboostsignals.cpp @@ -0,0 +1,6 @@ +#include "libs/signals/src/connection.cpp" +#include "libs/signals/src/named_slot_map.cpp" +#include "libs/signals/src/signal_base.cpp" +#include "libs/signals/src/slot.cpp" +#include "libs/signals/src/trackable.cpp" + diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index f8f01c0a7d..c40d1c6ad7 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -354,11 +354,30 @@ if test x$GXX = xyes; then lyx_flags="$lyx_flags c++11-mode" CXXFLAGS="-std=gnu++0x $CXXFLAGS" ;; - 4.7*|4.8*) + 4.7*|4.8*|4.9*) lyx_flags="$lyx_flags c++11-mode" CXXFLAGS="-std=gnu++11 $CXXFLAGS" ;; esac + lyx_std_regex=no + if test x$CLANG = xno || test $lyx_cv_lib_stdcxx = yes; then + dnl in gcc is unusable in versions less than 4.9.0 + dnl see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631 + case $gxx_version in + 4.9*) + lyx_flags="$lyx_flags stdregex" + lyx_std_regex=yes + ;; + esac + else + lyx_flags="$lyx_flags stdregex" + lyx_std_regex=yes + fi + + if test $lyx_std_regex = yes ; then + AC_DEFINE([LYX_USE_STD_REGEX], 1, [define to 1 if std::regex should be preferred to boost::regex]) + fi + AM_CONDITIONAL([LYX_USE_STD_REGEX], test $lyx_std_regex = yes) fi fi test "$lyx_pch_comp" = yes && lyx_flags="$lyx_flags pch" @@ -404,7 +423,11 @@ AC_DEFUN([LYX_USE_INCLUDED_BOOST],[ LIBS=$save_LIBS AC_LANG_POP(C++) BOOST_INCLUDES= - BOOST_LIBS="-lboost_regex${BOOST_MT} -lboost_signals${BOOST_MT}" + if test $lyx_std_regex = yes ; then + BOOST_LIBS="-lboost_signals${BOOST_MT}" + else + BOOST_LIBS="-lboost_regex${BOOST_MT} -lboost_signals${BOOST_MT}" + fi fi AC_SUBST(BOOST_INCLUDES) AC_SUBST(BOOST_LIBS) diff --git a/configure.ac b/configure.ac index e2e7fb4e50..3f317a0935 100644 --- a/configure.ac +++ b/configure.ac @@ -285,15 +285,6 @@ char * strerror(int n); #define BOOST_NO_WSTRING 1 #define BOOST_SIGNALS_NO_DEPRECATION_WARNING 1 -// in gcc is unusable in versions less than 4.9.0 -// see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631 -// clang defines __GNUC__ but how do the versions match? -#ifndef LYX_USE_STD_REGEX -# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 9) || __GNUC__ > 4 || defined(USE_LLVM_LIBCPP) -# define LYX_USE_STD_REGEX -# endif -#endif - #ifdef __CYGWIN__ # define NOMINMAX # define BOOST_POSIX 1