CLANGPLUGIN_CPPFLAGS did not actually work

...it just appeared to work on machines that happen to have /usr/bin/clang.  So
hoist CLANGDIR/CLANGBUILD from compilerplugins/Makefile-clang.mk to configure.ac
instead.

Change-Id: Ie5d9c6bb8e9d0caa1583d78c8693f06b69873095
This commit is contained in:
Stephan Bergmann 2012-12-07 16:07:41 +01:00
parent 45237f8023
commit a6d6d1c24b
3 changed files with 17 additions and 9 deletions

View file

@ -22,10 +22,6 @@ CLANGSRC= \
# Compile flags ('make CLANGCXXFLAGS=-g' if you need to debug the plugin)
CLANGCXXFLAGS=-O2 -Wall -g
# The prefix where Clang resides, override to where Clang resides if using a source build.
CLANGDIR=/usr
# The build directory (different from CLANGDIR if using a Clang out-of-source build)
CLANGBUILD=/usr
# The uninteresting rest.
@ -56,7 +52,7 @@ CLANGOBJS=
define clangbuildsrc
$(3): $(2) $(SRCDIR)/compilerplugins/Makefile-clang.mk $(CLANGOUTDIR)/clang-timestamp
@echo [build CXX] $(subst $(SRCDIR)/,,$(2))
$(CXX) $(CLANGPLUGIN_CPPFLAGS) $(CLANGCXXFLAGS) $(CLANGDEFS) $(CLANGINCLUDES) -DSRCDIR=$(SRCDIR) $(2) -fPIC -c -o $(3) -MMD -MT $(3) -MP -MF $(CLANGOUTDIR)/$(1).d
$(CXX) $(CLANGCXXFLAGS) $(CLANGDEFS) $(CLANGINCLUDES) -DSRCDIR=$(SRCDIR) $(2) -fPIC -c -o $(3) -MMD -MT $(3) -MP -MF $(CLANGOUTDIR)/$(1).d
-include $(CLANGOUTDIR)/$(1).d
@ -71,7 +67,7 @@ $(CLANGOUTDIR)/plugin.so: $(CLANGOBJS)
$(CXX) -shared $(CLANGOBJS) -o $@
# Clang most probably doesn't maintain binary compatibility, so rebuild when clang changes.
$(CLANGOUTDIR)/clang-timestamp: $(CLANGBUILD)/bin/clang
$(CLANGOUTDIR)/clang-timestamp: $(CLANGDIR)/bin/clang
touch $@ -r $^
# vim: set noet sw=4 ts=4:

View file

@ -53,7 +53,8 @@ export CDR_CFLAGS=$(gb_SPACE)@CDR_CFLAGS@
export CDR_LIBS=$(gb_SPACE)@CDR_LIBS@
@x_CFLAGS@ export CFLAGS=@CFLAGS@
export CHECK_PARALLELISM?=@CHECK_PARALLELISM@
export CLANGPLUGIN_CPPFLAGS=@CLANGPLUGIN_CPPFLAGS@
export CLANGBUILD=@CLANGBUILD@
export CLANGDIR=@CLANGDIR@
export CLUCENE_CFLAGS=$(gb_SPACE)@CLUCENE_CFLAGS@
export CLUCENE_LIBS=$(gb_SPACE)@CLUCENE_LIBS@
export CMIS_CFLAGS=$(gb_SPACE)@CMIS_CFLAGS@

View file

@ -5296,9 +5296,19 @@ if test "$COM_GCC_IS_CLANG" = "TRUE"; then
compiler_plugins=no
fi
if test "$compiler_plugins" != "no"; then
dnl The prefix where Clang resides, override to where Clang resides if
dnl using a source build:
if test -z "$CLANGDIR"; then
CLANGDIR=/usr
fi
dnl The build directory (different from CLANGDIR if using a Clang out-
dnl of-source build):
if test -z "$CLANGBUILD"; then
CLANGBUILD=/usr
fi
AC_LANG_PUSH([C++])
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $CLANGPLUGIN_CPPFLAGS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -I$CLANGDIR/tools/clang/include -I$CLANGBUILD/include -I$CLANGBUILD/tools/clang/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
[COMPILER_PLUGINS=TRUE],
[
@ -5318,7 +5328,8 @@ else
fi
fi
AC_SUBST(COMPILER_PLUGINS)
AC_SUBST(CLANGPLUGIN_CPPFLAGS)
AC_SUBST(CLANGDIR)
AC_SUBST(CLANGBUILD)
dnl ===================================================================
dnl Set the MinGW sys-root