From 65aeaac24dcad9bfbe7fecf54eab84c57a39857c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Fri, 1 Nov 2019 22:03:11 +0100 Subject: [PATCH] find Clang headers also if it's Clang built from source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2253bdce982028277b30d7bf911201675be45ca4 Reviewed-on: https://gerrit.libreoffice.org/81919 Tested-by: Jenkins Reviewed-by: Luboš Luňák --- configure.ac | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/configure.ac b/configure.ac index 464129d6cc95..1711ea8a3623 100644 --- a/configure.ac +++ b/configure.ac @@ -7028,6 +7028,17 @@ if test "$COM_IS_CLANG" = "TRUE"; then if test -z "$CLANGLIBDIR"; then CLANGLIBDIR=$($LLVM_CONFIG --libdir) fi + # Try if clang is built from source (in which case its includes are not together with llvm includes). + # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang + clangsrcdir=$(dirname $($LLVM_CONFIG --src-root)) + if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then + COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include" + fi + # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang + clangobjdir=$($LLVM_CONFIG --obj-root) + if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then + COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include" + fi fi AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS]) AC_LANG_PUSH([C++])