]> git.lyx.org Git - lyx.git/commitdiff
Cleanup support for std::regex with autotools
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 6 Jan 2015 12:53:18 +0000 (13:53 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 6 Jan 2015 17:47:00 +0000 (18:47 +0100)
Do not link against system boost regex lib or build included boost regex when not needed.

boost/Makefile.am
boost/lyxboost.cpp
boost/lyxboostsignals.cpp [new file with mode: 0644]
config/lyxinclude.m4
configure.ac

index 8cb08b179d177380d044b206a790ceaca66ed410..69198704d99c94d1c794037e8826d237d508a075 100644 (file)
@@ -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
index 9d46ac2b47fbf1855111c9082abf72816de04d47..1eb28217d968e913fc951d6c91b314b2b6634d08 100644 (file)
@@ -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 (file)
index 0000000..d51078a
--- /dev/null
@@ -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"
+
index f8f01c0a7d0fecfaa277943731398160d55abfd2..c40d1c6ad77b7a21fc37ab7f729d8cfa488e958d 100644 (file)
@@ -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 <regex> 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)
index e2e7fb4e50c673ff51ae933cc37b0a69364e5592..3f317a09354b7fc51e6111a201a33fcd1276730f 100644 (file)
@@ -285,15 +285,6 @@ char * strerror(int n);
 #define BOOST_NO_WSTRING 1
 #define BOOST_SIGNALS_NO_DEPRECATION_WARNING 1
 
-// <regex> 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