summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-05-14 15:45:45 +0200
committerLuboš Luňák <l.lunak@collabora.com>2022-05-16 09:05:13 +0200
commit392f87b099509d0c0f5e553ae1c5970dca9dc235 (patch)
tree2577dcad211da4b26eca1265078daf7a74777386 /configure.ac
parent86039563de87149a01ffb980b5ec99074b98fd5e (diff)
enable libc++ debug mode again if available
Now includes a configure check for the std::to_string() crash. Change-Id: I45c3b804b7a1ff5f6520f7bdf772497f72ddee47 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134338 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac28
1 files changed, 28 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 2c65a1200f69..2f0f5a574ed6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7419,6 +7419,34 @@ AC_LANG_POP([C++])
AC_SUBST([HAVE_LIBSTDCPP])
AC_SUBST([HAVE_LIBCPP])
+HAVE_LIBCPP_DEBUG=
+if test -n "$HAVE_LIBCPP" -a -n "$ENABLE_DBGUTIL"; then
+ # Libc++ supports debug mode only if built for it, Mac libc++ isn't,
+ # and there would be undefined references to debug functions.
+ # Moreover std::to_string() has a bug (https://reviews.llvm.org/D125184).
+ AC_MSG_CHECKING([if libc++ has a usable debug mode])
+ AC_LANG_PUSH([C++])
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#define _LIBCPP_DEBUG 1
+#include <string>
+#include <vector>
+int foo(const std::vector<int>& v) { return *v.begin(); }
+int main()
+{
+ std::vector<int> v{ 1, 2 };
+ std::string s = "xxxxxxxxxxxxxxxxxxxxxxxxx" + std::to_string(10);
+ return (foo(v) + s.size()) != 0 ? 0 : 1;
+}
+]])],
+ [AC_MSG_RESULT(yes)
+ HAVE_LIBCPP_DEBUG=1
+ ],
+ [AC_MSG_RESULT(no)]
+ )
+ AC_LANG_POP([C++])
+fi
+AC_SUBST([HAVE_LIBCPP_DEBUG])
+
dnl ===================================================================
dnl Check for gperf
dnl ===================================================================