commit d9e0a842cfb2090cecbc61252c842b427eddadd4
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Thu Mar 29 12:05:50 2018 +0200

    Compile 3rdparty/hunspell in stdlib-debug mode when needed
    
    A function that returns a vector<string> will lead to a crash if the
    main code and the library have not been compiled with the same
    stdlib-debug state. See for example:
    
https://stackoverflow.com/questions/4764048/stl-and-release-debug-library-mess
    
    This is fixed by introducing a new variable STDLIB_DEBUG that contains
    the flags that trigger the debug mode (autoconf only for now).
    
    This will allow to go forward with bug #10547.
---
 3rdparty/hunspell/Makefile.am |    2 +-
 config/lyxinclude.m4          |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/3rdparty/hunspell/Makefile.am b/3rdparty/hunspell/Makefile.am
index 7e0429d..fe0502d 100644
--- a/3rdparty/hunspell/Makefile.am
+++ b/3rdparty/hunspell/Makefile.am
@@ -16,7 +16,7 @@ EXTRA_DIST = \
        1.6.2/src/hunspell/hunvisapi.h.in \
        1.6.2/src/hunspell/utf_info.cxx
 
-AM_CPPFLAGS += -DHUNSPELL_STATIC
+AM_CPPFLAGS += -DHUNSPELL_STATIC @STDLIB_DEBUG@
 
 liblyxhunspell_a_SOURCES = \
        1.6.2/src/hunspell/affentry.cxx \
diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4
index ead704b..2c1a9af 100644
--- a/config/lyxinclude.m4
+++ b/config/lyxinclude.m4
@@ -420,6 +420,7 @@ if test x$GXX = xyes; then
         lyx_flags="$lyx_flags stdlib-debug"
        AC_DEFINE(_GLIBCXX_DEBUG, 1, [libstdc++ debug mode])
        AC_DEFINE(_GLIBCXX_DEBUG_PEDANTIC, 1, [libstdc++ pedantic debug mode])
+       AC_SUBST(STDLIB_DEBUG, "-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC")
         ;;
     esac
   fi

Reply via email to