[vala/wip/gnome-sdk: 2/2] build: Allow disabling the build of valadoc



commit f801447a710f4935959c1c003b4032ed868ddbe7
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Aug 27 16:03:03 2017 +0200

    build: Allow disabling the build of valadoc
    
    Allow disabling build of valadoc with configure option --disable-valadoc
    
    https://gitlab.gnome.org/GNOME/vala/issues/596

 Makefile.am     | 10 ++++++++++
 configure.ac    | 60 +++++++++++++++++++++++++++++----------------------------
 doc/Makefile.am | 16 +++++++++++++--
 3 files changed, 55 insertions(+), 31 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 88bef90ed..e4d46741f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,9 +13,19 @@ SUBDIRS = \
        doc \
        gobject-introspection \
        vapigen \
+       $(NULL)
+
+if ENABLE_VALADOC
+SUBDIRS += \
        libvaladoc \
        valadoc \
        $(NULL)
+endif
+
+DISTCHECK_CONFIGURE_FLAGS = \
+       --enable-valadoc \
+       --enable-unversioned \
+       $(NULL)
 
 if ENABLE_UNVERSIONED
 aclocaldir = $(datadir)/aclocal
diff --git a/configure.ac b/configure.ac
index 88ca0f94b..f39fd9684 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,35 +119,37 @@ PKG_CHECK_MODULES(GMODULE, gmodule-2.0 >= $GLIB_REQUIRED)
 AC_SUBST(GMODULE_CFLAGS)
 AC_SUBST(GMODULE_LIBS)
 
-PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED)
-AC_MSG_CHECKING([for CGRAPH])
-cgraph_tmp_LIBADD="$LIBADD"
-cgraph_tmp_CFLAGS="$CFLAGS"
-LIBADD="$LIBADD $LIBGVC_LIBS"
-CFLAGS="$CFLAGS $LIBGVC_CFLAGS"
-AC_RUN_IFELSE(
-       [AC_LANG_SOURCE([
-               #include <gvc.h>
-
-               int main(void) {
-                       #ifdef WITH_CGRAPH
-                               return 0;
-                       #else
-                               return -1;
-                       #endif
-               }
-       ])], [
-               AC_MSG_RESULT([yes])
-               VALAFLAGS="$VALAFLAGS -D WITH_CGRAPH"
-               have_cgraph=yes
-       ], [
-               AC_MSG_RESULT([no])
-               have_cgraph=no
-       ]
-)
-LIBADD="$cgraph_tmp_LIBADD"
-CFLAGS="$cgraph_tmp_CFLAGS"
-AM_CONDITIONAL(HAVE_CGRAPH, test "$have_cgraph" = "yes")
+AC_ARG_ENABLE(valadoc, AS_HELP_STRING([--disable-valadoc], [Disable valadoc]), enable_valadoc=$enableval, 
enable_valadoc=yes)
+if test x$enable_valadoc = xyes; then
+       PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED)
+       AC_MSG_CHECKING([for CGRAPH])
+       cgraph_tmp_LIBADD="$LIBADD"
+       cgraph_tmp_CFLAGS="$CFLAGS"
+       LIBADD="$LIBADD $LIBGVC_LIBS"
+       CFLAGS="$CFLAGS $LIBGVC_CFLAGS"
+       AC_RUN_IFELSE(
+               [AC_LANG_SOURCE([
+                       #include <gvc.h>
+                       int main(void) {
+                               #ifdef WITH_CGRAPH
+                                       return 0;
+                               #else
+                                       return -1;
+                               #endif
+                       }
+               ])], [
+                       AC_MSG_RESULT([yes])
+                       VALAFLAGS="$VALAFLAGS -D WITH_CGRAPH"
+                       have_cgraph=yes
+               ], [
+                       AC_MSG_RESULT([no])
+                       have_cgraph=no
+               ]
+       )
+       LIBADD="$cgraph_tmp_LIBADD"
+       CFLAGS="$cgraph_tmp_CFLAGS"
+fi
+AM_CONDITIONAL(ENABLE_VALADOC, test x$enable_valadoc = xyes)
 
 AC_PATH_PROG([XSLTPROC], [xsltproc], :)
 AM_CONDITIONAL(HAVE_XSLTPROC, test "$XSLTPROC" != :)
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 758ad733a..852f8c831 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -6,11 +6,16 @@ SUBDIRS = \
 
 dist_man_MANS = \
        valac.1 \
-       valadoc.1 \
        vala-gen-introspect.1 \
        vapigen.1 \
        $(NULL)
 
+if ENABLE_VALADOC
+dist_man_MANS += \
+       valadoc.1 \
+       $(NULL)
+endif
+
 EXTRA_DIST = \
        valac.h2m \
        valadoc.h2m \
@@ -19,7 +24,10 @@ EXTRA_DIST = \
        $(NULL)
 
 if HAVE_HELP2MAN
-manpages: valac.1 valadoc.1 vala-gen-introspect.1 vapigen.1
+if ENABLE_VALADOC
+manpages: valadoc.1
+endif
+manpages: valac.1 vala-gen-introspect.1 vapigen.1
        @rm $^
        $(MAKE) $(AM_MAKEFLAGS) $^
 
@@ -28,11 +36,13 @@ valac.1:
                --include $(srcdir)/valac.h2m \
                --libtool --no-info \
                --output=$@
+if ENABLE_VALADOC
 valadoc.1:
        $(HELP2MAN) $(top_builddir)/valadoc/valadoc \
                --include $(srcdir)/valadoc.h2m \
                --libtool --no-info \
                --output=$@
+endif
 vala-gen-introspect.1:
        $(HELP2MAN) $(top_builddir)/gobject-introspection/gen-introspect \
                --include $(srcdir)/vala-gen-introspect.h2m \
@@ -49,7 +59,9 @@ endif
 if ENABLE_UNVERSIONED
 install-data-hook:
        cd $(DESTDIR)$(man1dir) && $(LN_S) -f valac@PACKAGE_SUFFIX@.1 valac.1
+if ENABLE_VALADOC
        cd $(DESTDIR)$(man1dir) && $(LN_S) -f valadoc@PACKAGE_SUFFIX@.1 valadoc.1
+endif
        cd $(DESTDIR)$(man1dir) && $(LN_S) -f vala-gen-introspect@PACKAGE_SUFFIX@.1 vala-gen-introspect.1
        cd $(DESTDIR)$(man1dir) && $(LN_S) -f vapigen@PACKAGE_SUFFIX@.1 vapigen.1
 endif


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