build: fix nm-setting-docs build in various configurations
authorDan Winship <danw@gnome.org>
Fri, 27 Jun 2014 16:25:54 +0000 (12:25 -0400)
committerDan Winship <danw@gnome.org>
Fri, 27 Jun 2014 21:24:57 +0000 (17:24 -0400)
Certain build configurations (like --enable-gtk-doc
--disable-introspection) were broken with respect to nm-setting-docs.
Fix this. Also, we don't require just gobject-introspection, we need
pygobject specifically as well.

Makefile.am
cli/src/Makefile.am
cli/src/settings.c
configure.ac
docs/api/Makefile.am
docs/api/network-manager-docs.xml
libnm-util/Makefile.am
man/Makefile.am

index 2da8f19..86102ab 100644 (file)
@@ -44,16 +44,15 @@ DISTCHECK_CONFIGURE_FLAGS = \
        --enable-ifupdown \
        --enable-ifnet
 
-if HAVE_INTROSPECTION
-dist-check-introspection:
+if BUILD_SETTING_DOCS
+dist-check-setting-docs:
 else
-dist-check-introspection:
-       @echo "*** gobject-introspection is needed to run 'make dist'. ***"
-       @echo "*** It was not enabled when 'configure' ran.            ***"
+dist-check-setting-docs:
+       @echo "*** gobject-introspection and pygobject are needed to run 'make dist'. ***"
        @false
 endif
 
-dist: dist-check-introspection
+dist: dist-check-setting-docs
 
 DISTCLEANFILES = intltool-extract intltool-merge intltool-update
 
index d30725c..2dc67b5 100644 (file)
@@ -38,7 +38,7 @@ nmcli_LDADD = \
        $(top_builddir)/libnm-util/libnm-util.la \
        $(top_builddir)/libnm-glib/libnm-glib.la
 
-if HAVE_INTROSPECTION
+if BUILD_SETTING_DOCS
 settings-docs.c: settings-docs.xsl $(top_builddir)/libnm-util/nm-setting-docs.xml
        $(AM_V_GEN) xsltproc --output $@ $^
 
index c0e8841..ea78c74 100644 (file)
@@ -6368,7 +6368,7 @@ nmc_setting_get_property_allowed_values (NMSetting *setting, const char *prop)
        return NULL;
 }
 
-#ifdef HAVE_INTROSPECTION
+#if defined (BUILD_SETTING_DOCS) || defined (HAVE_SETTING_DOCS)
 #include "settings-docs.c"
 #else
 #define nmc_setting_get_property_doc(setting, prop) _("(not available)")
index e152fa0..e3102d1 100644 (file)
@@ -267,9 +267,6 @@ AC_SUBST(GUDEV_CFLAGS)
 AC_SUBST(GUDEV_LIBS)
 
 GOBJECT_INTROSPECTION_CHECK([0.9.6])
-if test -n "$INTROSPECTION_MAKEFILE"; then
-    AC_DEFINE(HAVE_INTROSPECTION, [1], [Define if you have gobject-introspection])
-fi
 
 # Qt4
 PKG_CHECK_MODULES(QT, [QtCore >= 4 QtDBus QtNetwork], [have_qt=yes],[have_qt=no])
@@ -772,6 +769,27 @@ if test "$enable_gtk_doc" != "yes" \
 fi
 AM_CONDITIONAL(INSTALL_PREGEN_MANPAGES, test "x${install_pregen_manpages}" = "xyes")
 
+# check if we can build setting property documentation
+if test -n "$INTROSPECTION_MAKEFILE" -a "$enable_gtk_doc" = "yes"; then
+    # If g-i is installed we know we have python, but we might not have pygobject
+    if python -c 'from gi.repository import GObject' >& /dev/null; then
+        AC_DEFINE(BUILD_SETTING_DOCS, [1], [Define if you we can build nm-setting-docs.xml])
+       build_setting_docs=yes
+    fi
+fi
+
+# check for pre-built setting docs
+if test "$build_setting_docs" != "yes" \
+       -a -f man/nm-settings.xml \
+       -a -f docs/api/settings-spec.xml \
+       -a -f cli/src/settings-docs.c; then
+    AC_DEFINE(HAVE_SETTING_DOCS, [1], [Define if you have pre-built settings docs])
+    have_setting_docs=yes
+fi
+
+AM_CONDITIONAL(BUILD_SETTING_DOCS, test "$build_setting_docs" = "yes")
+AM_CONDITIONAL(SETTING_DOCS_AVAILABLE, test "$build_setting_docs" = "yes" -o "$have_setting_docs" = "yes")
+
 
 AC_CONFIG_FILES([
 Makefile
index 219aff3..683340e 100644 (file)
@@ -11,7 +11,19 @@ OTHER_FILES= \
        $(top_srcdir)/tools/doc-generator.xsl \
        $(top_srcdir)/introspection/generic-types.xml
 
-GENERATED_FILES = spec.html settings-spec.xml
+GENERATED_FILES = spec.html
+
+if SETTING_DOCS_AVAILABLE
+
+settings-spec.xml: settings-spec.xsl $(top_builddir)/libnm-util/nm-setting-docs.xml
+       $(AM_V_GEN) xsltproc --output $@ $^
+
+# Top-level SGML file includes (depends on) settings-spec.xml
+$(DOC_MAIN_SGML_FILE): settings-spec.xml
+
+GENERATED_FILES += settings-spec.xml
+
+endif
 
 if ENABLE_GTK_DOC
 
@@ -20,16 +32,10 @@ spec.html: $(XMLS) $(OTHER_FILES) html-build.stamp
        mkdir -p $(builddir)/html/
        cp spec.html $(builddir)/html/
 
-settings-spec.xml: settings-spec.xsl $(top_builddir)/libnm-util/nm-setting-docs.xml
-       $(AM_V_GEN) xsltproc --output $@ $^
-
 all: $(GENERATED_FILES)
 
 endif
 
-# Top-level SGML file includes (depends on) settings-spec.xml
-$(DOC_MAIN_SGML_FILE): settings-spec.xml
-
 ####################################
 
 # The name of the module.
index fadc886..0f9c7db 100644 (file)
       setting names (like "wimax" or "bluetooth") to a dictionary of
       key/value pairs that represents each itself.
     </para>
-    <xi:include href="settings-spec.xml" />
+    <xi:include href="settings-spec.xml">
+      <xi:fallback>
+       <section>
+         <title>Configuration Settings</title>
+         <note><para>
+           (NetworkManager was built without full introspection support. Setting
+           documentation is not available.)
+         </para></note>
+       </section>
+      </xi:fallback>
+    </xi:include>
     <section id="secrets-flags">
       <title>Secret flag types</title>
       <para>
index e8c7e92..c01dadc 100644 (file)
@@ -182,6 +182,10 @@ typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
 
 CLEANFILES += $(gir_DATA) $(typelib_DATA)
 
+endif
+
+if BUILD_SETTING_DOCS
+
 noinst_DATA = nm-setting-docs.xml
 
 nm-setting-docs.xml: generate-setting-docs.py NetworkManager-1.0.gir libnm-util.la
index 8e34d56..014e737 100644 (file)
@@ -23,6 +23,10 @@ if ENABLE_GTK_DOC
 %.5: %.xml
        $(AM_V_GEN) xsltproc $(XSLTPROC_MAN_FLAGS) $<
 
+endif
+
+if BUILD_SETTING_DOCS
+
 nm-settings.xml: nm-settings.xsl $(top_builddir)/libnm-util/nm-setting-docs.xml
        $(AM_V_GEN) xsltproc \
                --output $@ \
@@ -45,10 +49,6 @@ docbook_generated_man_pages =                \
 docbook_autogenerated_man_pages =      \
        nm-settings.5
 
-generated_man_pages =                  \
-       $(docbook_generated_man_pages)  \
-       $(docbook_autogenerated_man_pages)
-
 EXTRA_DIST +=                                  \
        nm-settings.xml                         \
        nm-settings.xsl                         \
@@ -61,13 +61,17 @@ DISTCLEANFILES =                            \
 man_MANS += $(configure_generated_man_pages)
 
 if ENABLE_GTK_DOC
-man_MANS += $(generated_man_pages)
-CLEANFILES +=                                  \
-       $(docbook_autogenerated_man_pages)      \
-       $(docbook_generated_man_pages)
+man_MANS += $(docbook_generated_man_pages)
+CLEANFILES += $(docbook_generated_man_pages)
+if BUILD_SETTING_DOCS
+man_MANS += $(docbook_autogenerated_man_pages)
+CLEANFILES += $(docbook_autogenerated_man_pages)
+endif
 else
 if INSTALL_PREGEN_MANPAGES
-man_MANS += $(generated_man_pages)
+man_MANS +=                                    \
+       $(docbook_generated_man_pages)          \
+       $(docbook_autogenerated_man_pages)
 endif
 endif