diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-04-30 21:27:20 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-05-01 08:40:12 +0200 |
commit | 6014f363a08f2edd6086cf30b3bbb913f1c621c6 (patch) | |
tree | f933ad4116b9430089da50177332445cfea17306 /configure.ac | |
parent | 5200a73627d13e2997f81b53f61e143e77e328ee (diff) |
improve support for using libc++ on Linux and for libc++ debug mode
It seems to run slightly faster in --enable-dbgutil mode and also
builds a bit faster (at least with Clang). But libc++ on Mac
isn't built with debug mode support.
Change-Id: Idf5dba9c4a56aba1f4163aa518a78d34b6837149
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133664
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index cdef1a6507e5..c4e71a8a12ff 100644 --- a/configure.ac +++ b/configure.ac @@ -7371,6 +7371,7 @@ dnl =================================================================== AC_MSG_CHECKING([what the C++ library is]) HAVE_LIBSTDCPP= +HAVE_LIBCPP= AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <utility> @@ -7391,6 +7392,7 @@ foo bar [CPP_LIBRARY=LIBCPP cpp_library_name="LLVM libc++" AC_DEFINE([HAVE_LIBCXX]) + HAVE_LIBCPP=TRUE ], AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <utility> @@ -7405,6 +7407,27 @@ foo bar AC_MSG_RESULT([$cpp_library_name]) 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 + AC_MSG_CHECKING([if libc++ is built with debug mode]) + AC_LANG_PUSH([C++]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#define _LIBCPP_DEBUG 1 +#include <vector> +int foo(const std::vector<int>& v) { return *v.begin(); } +]])], + [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 |