[gnome-builder] clang: make clang plugin optional



commit 0fa172e456311d120cdd8a61b90f1f5b1013be78
Author: Christian Hergert <christian hergert me>
Date:   Tue Sep 1 00:51:13 2015 -0700

    clang: make clang plugin optional
    
    If we can’t find clang or llvm-devel, just disable the plugin.
    
    We should probably try harder here to support weird
    configurations that don’t have llvm-devel installed. But that
    is possible more effort than it is worth.

 configure.ac              |   30 ++++++++++++++++--------------
 plugins/clang/Makefile.am |    4 ++++
 2 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 82db6e0..c43f5ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -243,22 +243,22 @@ LIBS="${libs_save}"
 dnl ***********************************************************************
 dnl Check for Clang, Required for C/C++ Diagnostics
 dnl ***********************************************************************
+enable_clang_plugin=no
 AC_CHECK_PROGS([LLVM_CONFIG], [llvm-config-3.5 llvm-config35 llvm-config], [])
-AS_IF([test "x$LLVM_CONFIG" = "x"],[
-       AC_MSG_ERROR([Failed to locate the llvm-config program. Please install llvm-devel.])
-])
-CLANG_INCLUDEDIR=`$LLVM_CONFIG --includedir`
-CLANG_CFLAGS="-I$CLANG_INCLUDEDIR"
-CLANG_LDFLAGS=`$LLVM_CONFIG --ldflags`
-AC_SUBST([CLANG_INCLUDEDIR])
-AC_SUBST([CLANG_CFLAGS])
-AC_SUBST([CLANG_LDFLAGS])
-CPPFLAGS_SAVE=${CPPFLAGS}
-CPPFLAGS=-I${CLANG_INCLUDEDIR}
-AC_CHECK_HEADER([clang-c/Index.h], [], [
-    AC_MSG_ERROR([Failed to locage clang-c/Index.h. Please install clang-devel.])
+AS_IF([test "x$LLVM_CONFIG" = "x"],[],[
+       CLANG_INCLUDEDIR=`$LLVM_CONFIG --includedir`
+       CLANG_CFLAGS="-I$CLANG_INCLUDEDIR"
+       CLANG_LDFLAGS=`$LLVM_CONFIG --ldflags`
+       AC_SUBST([CLANG_INCLUDEDIR])
+       AC_SUBST([CLANG_CFLAGS])
+       AC_SUBST([CLANG_LDFLAGS])
+       CPPFLAGS_SAVE=${CPPFLAGS}
+       CPPFLAGS=-I${CLANG_INCLUDEDIR}
+       AC_CHECK_HEADER([clang-c/Index.h], [enable_clang_plugin=yes], [
+           AC_MSG_RESULT([Failed to locage clang-c/Index.h. Please install clang-devel.])
+       ])
+       CPPFLAGS=${CPPFLAGS_SAVE}
 ])
-CPPFLAGS=${CPPFLAGS_SAVE}
 
 
 dnl ***********************************************************************
@@ -294,6 +294,7 @@ AM_CONDITIONAL(ENABLE_GJS_SCRIPTING, test x$enable_gjs_scripting != xno)
 
 AM_CONDITIONAL(ENABLE_TERMINAL_PLUGIN, test x$enable_terminal_plugin != xno)
 AM_CONDITIONAL(ENABLE_DEVHELP_PLUGIN, test x$enable_devhelp_plugin != xno)
+AM_CONDITIONAL(ENABLE_CLANG_PLUGIN, test x$enable_clang_plugin != xno)
 
 
 dnl ***********************************************************************
@@ -548,6 +549,7 @@ echo " Plugins"
 echo ""
 echo "  Autotools ............................ : yes"
 echo "  C Language Pack ...................... : yes"
+echo "  Clang ................................ : ${enable_clang_plugin}"
 echo "  Command Bar .......................... : yes"
 echo "  Ctags ................................ : yes"
 echo "  Devhelp .............................. : ${enable_devhelp_plugin}"
diff --git a/plugins/clang/Makefile.am b/plugins/clang/Makefile.am
index f8d62a9..82cd75d 100644
--- a/plugins/clang/Makefile.am
+++ b/plugins/clang/Makefile.am
@@ -1,3 +1,5 @@
+if ENABLE_CLANG_PLUGIN
+
 EXTRA_DIST = $(plugin_DATA)
 
 plugindir = $(libdir)/gnome-builder/plugins
@@ -45,4 +47,6 @@ libclang_plugin_la_LDFLAGS = \
        -module \
        $(NULL)
 
+endif
+
 -include $(top_srcdir)/git.mk


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]