[Libreoffice-commits] .: compilerplugins/Makefile-clang.mk config_host.mk.in configure.ac

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Dec 7 07:10:05 PST 2012


 compilerplugins/Makefile-clang.mk |    8 ++------
 config_host.mk.in                 |    3 ++-
 configure.ac                      |   15 +++++++++++++--
 3 files changed, 17 insertions(+), 9 deletions(-)

New commits:
commit a6d6d1c24ba497ac8586857baed9d4fb155a17b1
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 7 16:07:41 2012 +0100

    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

diff --git a/compilerplugins/Makefile-clang.mk b/compilerplugins/Makefile-clang.mk
index 9b24df0..4d405e9 100644
--- a/compilerplugins/Makefile-clang.mk
+++ b/compilerplugins/Makefile-clang.mk
@@ -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:
diff --git a/config_host.mk.in b/config_host.mk.in
index 12a0752..b140600 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -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@
diff --git a/configure.ac b/configure.ac
index 8186eb6..d0178d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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


More information about the Libreoffice-commits mailing list