]> git.lyx.org Git - features.git/blobdiff - config/lyxinclude.m4
Do not honor stdlib-debug when c++library is not gcc's libstdc++
[features.git] / config / lyxinclude.m4
index 369ecaefbb8e2fda55bede36284a3668b9983ea5..0e9b426061af5f7d8dc276f24ec8679117c08450 100644 (file)
@@ -409,11 +409,12 @@ if test x$GXX = xyes; then
   dnl Warnings are for preprocessor too
   if test x$enable_warnings = xyes ; then
       AM_CPPFLAGS="$AM_CPPFLAGS -Wall -Wextra"
-      case $gxx_version in
-         9.*|10.*|clang-10*)
-             AM_CXXFLAGS="$AM_CXXFLAGS -Wno-deprecated-copy";;
-         *);;
-      esac
+      dnl Shut off warning -Wdeprecated-copy, which triggers too much
+      dnl note that g++ always accepts -Wno-xxx, even when -Wxxx is an error.
+      AC_LANG_PUSH(C++)
+      AX_CHECK_COMPILE_FLAG([-Wno-deprecated-copy],
+       [AM_CXXFLAGS="$AM_CXXFLAGS -Wno-deprecated-copy"], [], [-Werror])
+      AC_LANG_POP(C++)
     fi
   case $gxx_version in
       2.*|3.*|4.@<:@0-6@:>@) AC_MSG_ERROR([gcc >= 4.7 is required]);;
@@ -421,14 +422,14 @@ if test x$GXX = xyes; then
   if test x$enable_stdlib_debug = xyes ; then
     dnl FIXME: for clang/libc++, one should define _LIBCPP_DEBUG2=0
     dnl See http://clang-developers.42468.n3.nabble.com/libc-debug-mode-td3336742.html
-    case $gxx_version in
-      *)
+    if test x$lyx_cv_lib_stdcxx = 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
+    else
+       enable_stdlib_debug=no
+    fi
   fi
 fi