[geany/geany-plugins] b7fb1a: Only automatically enable the utils library if a plugin uses it

Colomban Wendling git-noreply at xxxxx
Sun Oct 15 21:28:02 UTC 2017


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sun, 15 Oct 2017 21:28:02 UTC
Commit:      b7fb1a977678b89161155eb167152fc79b714293
             https://github.com/geany/geany-plugins/commit/b7fb1a977678b89161155eb167152fc79b714293

Log Message:
-----------
Only automatically enable the utils library if a plugin uses it


Modified Paths:
--------------
    Makefile.am
    build/utils.m4
    build/workbench.m4
    configure.ac

Modified: Makefile.am
3 lines changed, 3 insertions(+), 0 deletions(-)
===================================================================
@@ -2,7 +2,10 @@ ACLOCAL_AMFLAGS = -I build/cache -I build -I build/bundled -I geanypy/m4 --insta
 AM_DISTCHECK_CONFIGURE_FLAGS = --with-geany-libdir='$${libdir}'
 
 SUBDIRS = po
+
+if ENABLE_UTILSLIB
 SUBDIRS += utils
+endif
 
 if ENABLE_ADDONS
 SUBDIRS += addons


Modified: build/utils.m4
39 lines changed, 27 insertions(+), 12 deletions(-)
===================================================================
@@ -1,19 +1,34 @@
-AC_DEFUN([GP_CHECK_UTILSLIB],
+AC_DEFUN([_GP_UTILSLIB_ARG],
 [
-dnl
-dnl TODO: only build the library if any plugins using it are enabled
-dnl
     AC_ARG_ENABLE([utilslib],
               [AS_HELP_STRING([--enable-utilslib],
                               [Whether to use the utilities library [[default=auto]]])],
               [enable_utilslib=$enableval],
               [enable_utilslib=auto])
-    AS_IF([test "x$enable_utilslib" != "xno"], [
-        enable_utilslib=yes
-        GP_STATUS_FEATURE_ADD([Utility library], [$enable_utilslib])
-        AC_CONFIG_FILES([
-            utils/Makefile
-            utils/src/Makefile
-        ])
-    ])
+])
+
+dnl GP_CHECK_UTILSLIB(PluginName)
+dnl Check for utils library
+AC_DEFUN([GP_CHECK_UTILSLIB],
+[
+    AC_REQUIRE([_GP_UTILSLIB_ARG])
+    AS_IF([test "$m4_tolower(AS_TR_SH(enable_$1))" != no &&
+           test "$enable_utilslib" != yes],
+          [AS_IF([test "$enable_utilslib" = "no"],
+                 [AS_IF([test "$m4_tolower(AS_TR_SH(enable_$1))" = yes],
+                        [AC_MSG_ERROR([Plugin $1 depends on utilslib which is disabled])],
+                        [m4_tolower(AS_TR_SH(enable_$1))=no])],
+                 [enable_utilslib=yes])])
+])
+
+AC_DEFUN([GP_COMMIT_UTILSLIB_STATUS],
+[
+    AS_IF([test "$enable_utilslib" = "yes"],
+          [AC_CONFIG_FILES([
+               utils/Makefile
+               utils/src/Makefile
+           ])],
+          [enable_utilslib=no])
+    AM_CONDITIONAL([ENABLE_UTILSLIB], [test "$enable_utilslib" = "yes"])
+    GP_STATUS_FEATURE_ADD([Utility library], [$enable_utilslib])
 ])


Modified: build/workbench.m4
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -1,6 +1,7 @@
 AC_DEFUN([GP_CHECK_WORKBENCH],
 [
     GP_ARG_DISABLE([Workbench], [auto])
+    GP_CHECK_UTILSLIB([Workbench])
     GP_COMMIT_PLUGIN_STATUS([Workbench])
     AC_CONFIG_FILES([
         workbench/Makefile


Modified: configure.ac
3 lines changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -27,7 +27,6 @@ GP_CHECK_CPPCHECK
 GP_CHECK_CFLAGS
 GP_CHECK_LDFLAGS
 GP_CHECK_MINGW
-GP_CHECK_UTILSLIB
 
 dnl plugin checks
 GP_CHECK_ADDONS
@@ -75,6 +74,8 @@ GP_CHECK_WEBHELPER
 GP_CHECK_WORKBENCH
 GP_CHECK_XMLSNIPPETS
 
+GP_COMMIT_UTILSLIB_STATUS
+
 AC_CONFIG_FILES([
     Makefile
     po/Makefile.in



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list