find Clang headers also if it's Clang built from source

Change-Id: I2253bdce982028277b30d7bf911201675be45ca4
Reviewed-on: https://gerrit.libreoffice.org/81919
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
This commit is contained in:
Luboš Luňák 2019-11-01 22:03:11 +01:00
parent daa344f3e9
commit 65aeaac24d

View File

@ -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++])