[Asterisk-code-review] Build System: Fix --disable-xmldoc option. (asterisk[master])

Joshua Colp asteriskteam at digium.com
Tue Oct 31 15:14:54 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/6877 )

Change subject: Build System: Fix --disable-xmldoc option.
......................................................................

Build System: Fix --disable-xmldoc option.

The configure option to disable XML documentation does not currently
work.  This patch makes it effective, but also causes an ABI change by
removing the ast_xmldoc_* symbols.  Disabling xmldoc also prevents docs
from being automatically generated, but they can still be manually
generated with 'make doc/core-en_US.xml'.

ASTERISK-26639

Change-Id: Ifac562340c09f80c83e0203de098fcac93bf8c44
---
M Makefile
M configure
M configure.ac
M include/asterisk/autoconfig.h.in
M include/asterisk/xml.h
M main/config_options.c
M main/manager.c
M makeopts.in
8 files changed, 42 insertions(+), 18 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/Makefile b/Makefile
index 85a1152..8048f59 100644
--- a/Makefile
+++ b/Makefile
@@ -209,7 +209,9 @@
   ifeq ($(AST_DEVMODE_STRICT),yes)
     _ASTCFLAGS+=-Wshadow
   endif
-  ADDL_TARGETS+=validate-docs
+  ifneq ($(DISABLE_XMLDOC),yes)
+    ADDL_TARGETS+=validate-docs
+  endif
 endif
 
 ifneq ($(findstring BSD,$(OSARCH)),)
@@ -245,6 +247,14 @@
 
 ifneq ($(wildcard .svn),)
   ASTERISKVERSIONNUM:=999999
+endif
+
+ifneq ($(DISABLE_XMLDOC),yes)
+  CORE_XMLDOC=doc/core-en_US.xml
+  FULL_XMLDOC=doc/full-en_US.xml
+else
+  CORE_XMLDOC=
+  FULL_XMLDOC=
 endif
 
 _ASTCFLAGS+=$(OPTIONS)
@@ -327,9 +337,9 @@
 	@echo " +-------------------------------------------+"
 
 
-_all: makeopts $(SUBDIRS) doc/core-en_US.xml $(ADDL_TARGETS)
+_all: makeopts $(SUBDIRS) $(CORE_XMLDOC) $(ADDL_TARGETS)
 
-_full: makeopts $(SUBDIRS) doc/full-en_US.xml $(ADDL_TARGETS)
+_full: makeopts $(SUBDIRS) $(FULL_XMLDOC) $(ADDL_TARGETS)
 
 makeopts: configure
 	@echo "****"
@@ -424,7 +434,7 @@
 	rm -f doc/asterisk-ng-doxygen
 	rm -f build_tools/menuselect-deps
 
-datafiles: _all doc/core-en_US.xml
+datafiles: _all $(CORE_XMLDOC)
 	CFLAGS="$(_ASTCFLAGS) $(ASTCFLAGS)" build_tools/mkpkgconfig "$(DESTDIR)$(libdir)/pkgconfig";
 
 #	# Recursively install contents of the static-http directory, in case
@@ -436,8 +446,10 @@
 			$(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/$$x" ; \
 		fi \
 	done
+ifneq ($(DISABLE_XMLDOC),yes)
 	$(INSTALL) -m 644 doc/core-en_US.xml "$(DESTDIR)$(ASTDATADIR)/static-http";
 	$(INSTALL) -m 644 doc/appdocsxml.xslt "$(DESTDIR)$(ASTDATADIR)/static-http";
+endif
 	if [ -d doc/tex/asterisk ] ; then \
 		$(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/static-http/docs" ; \
 		for n in doc/tex/asterisk/* ; do \
@@ -566,9 +578,11 @@
 		for h in $(OLDHEADERS); do rm -f "$(DESTDIR)$(ASTHEADERDIR)/$$h"; done \
 	fi
 
+ifneq ($(DISABLE_XMLDOC),yes)
 	$(INSTALL) -m 644 doc/core-*.xml "$(DESTDIR)$(ASTDATADIR)/documentation"
 	$(INSTALL) -m 644 doc/appdocsxml.xslt "$(DESTDIR)$(ASTDATADIR)/documentation"
 	$(INSTALL) -m 644 doc/appdocsxml.dtd "$(DESTDIR)$(ASTDATADIR)/documentation"
+endif
 	$(INSTALL) -m 644 doc/asterisk.8 "$(DESTDIR)$(ASTMANDIR)/man8"
 	$(INSTALL) -m 644 doc/astdb*.8 "$(DESTDIR)$(ASTMANDIR)/man8"
 	$(INSTALL) -m 644 contrib/scripts/astgenkey.8 "$(DESTDIR)$(ASTMANDIR)/man8"
diff --git a/configure b/configure
index 588fbfd..8bcf938 100755
--- a/configure
+++ b/configure
@@ -718,6 +718,7 @@
 POW_LIB
 PBX_WORKING_FORK
 LIBOBJS
+DISABLE_XMLDOC
 CONFIG_LIBXML2
 UUID_LIB
 UUID_INCLUDE
@@ -14660,16 +14661,20 @@
 # Check whether --enable-xmldoc was given.
 if test "${enable_xmldoc+set}" = set; then :
   enableval=$enable_xmldoc; case "${enableval}" in
-		y|ye|yes) disable_xmldoc=no ;;
-		n|no)  disable_xmldoc=yes ;;
+		y|ye|yes) DISABLE_XMLDOC=no ;;
+		n|no)  DISABLE_XMLDOC=yes ;;
 		*) as_fn_error $? "bad value ${enableval} for --disable-xmldoc" "$LINENO" 5  ;;
 	esac
 else
-  disable_xmldoc=no
+  DISABLE_XMLDOC=no
 fi
 
 
-if test "${disable_xmldoc}" != "yes"; then
+
+if test "${DISABLE_XMLDOC}" != "yes"; then
+
+$as_echo "#define AST_XML_DOCS 1" >>confdefs.h
+
 
 if test "x${PBX_LIBXSLT}" != "x1" -a "${USE_LIBXSLT}" != "no"; then
    pbxlibdir=""
diff --git a/configure.ac b/configure.ac
index c729b94..3fe9044 100644
--- a/configure.ac
+++ b/configure.ac
@@ -690,12 +690,14 @@
 	[AS_HELP_STRING([--disable-xmldoc],
 		[Explicitly disable XML documentation])],
 	[case "${enableval}" in
-		y|ye|yes) disable_xmldoc=no ;;
-		n|no)  disable_xmldoc=yes ;;
+		y|ye|yes) DISABLE_XMLDOC=no ;;
+		n|no)  DISABLE_XMLDOC=yes ;;
 		*) AC_MSG_ERROR(bad value ${enableval} for --disable-xmldoc)  ;;
-	esac], [disable_xmldoc=no])
+	esac], [DISABLE_XMLDOC=no])
 
-if test "${disable_xmldoc}" != "yes"; then
+AC_SUBST([DISABLE_XMLDOC])
+if test "${DISABLE_XMLDOC}" != "yes"; then
+        AC_DEFINE([AST_XML_DOCS], 1, [Define to enable XML documentation.])
         AST_EXT_LIB_CHECK([LIBXSLT], [xslt], [xsltLoadStylesheetPI], [libxslt/xsltInternals.h], [${LIBXML2_LIB}], [${LIBXML2_INCLUDE}])
         AST_EXT_LIB_CHECK([LIBXSLT_CLEANUP], [xslt], [xsltCleanupGlobals], [libxslt/xsltInternals.h], [${LIBXML2_LIB}], [${LIBXML2_INCLUDE}])
 
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index f85ad8d..5865c0a 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -9,6 +9,9 @@
 /* Define to 1 if internal poll should be used. */
 #undef AST_POLL_COMPAT
 
+/* Define to enable XML documentation. */
+#undef AST_XML_DOCS
+
 /* Define to 1 if your system's implementation of mutexes supports comparison
    of a mutex to its initializer. */
 #undef CAN_COMPARE_MUTEX_TO_INIT_VALUE
diff --git a/include/asterisk/xml.h b/include/asterisk/xml.h
index 063e8c0..ab7b630 100644
--- a/include/asterisk/xml.h
+++ b/include/asterisk/xml.h
@@ -246,10 +246,5 @@
  */
 struct ast_xml_xpath_results *ast_xml_query(struct ast_xml_doc *doc, const char *xpath_str);
 
-/* Features using ast_xml_ */
-#ifdef HAVE_LIBXML2
-#define AST_XML_DOCS
-#endif
-
 #endif /* _ASTERISK_XML_H */
 
diff --git a/main/config_options.c b/main/config_options.c
index 8eacbda..3c0959e 100644
--- a/main/config_options.c
+++ b/main/config_options.c
@@ -80,7 +80,6 @@
 
 #ifdef AST_XML_DOCS
 static struct ao2_container *xmldocs;
-#endif /* AST_XML_DOCS */
 
 /*! \brief Value of the aco_option_type enum as strings */
 static char *aco_option_type_string[] = {
@@ -98,6 +97,7 @@
 	"Unsigned Integer",	/* OPT_UINT_T, */
 	"Boolean",			/* OPT_YESNO_T, */
 };
+#endif /* AST_XML_DOCS */
 
 void *aco_pending_config(struct aco_info *info)
 {
diff --git a/main/manager.c b/main/manager.c
index 5c0b318..079dab7 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1653,8 +1653,10 @@
 /*! \brief list of hooks registered */
 static AST_RWLIST_HEAD_STATIC(manager_hooks, manager_custom_hook);
 
+#ifdef AST_XML_DOCS
 /*! \brief A container of event documentation nodes */
 static AO2_GLOBAL_OBJ_STATIC(event_docs);
+#endif
 
 static int __attribute__((format(printf, 9, 0))) __manager_event_sessions(
 	struct ao2_container *sessions,
@@ -2305,7 +2307,9 @@
 	return ret;
 }
 
+#ifdef AST_XML_DOCS
 static void print_event_instance(struct ast_cli_args *a, struct ast_xml_doc_item *instance);
+#endif
 
 static char *handle_showmancmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
diff --git a/makeopts.in b/makeopts.in
index 7d0347d..30bc2e2 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -108,6 +108,7 @@
 
 AST_DEVMODE=@AST_DEVMODE@
 AST_DEVMODE_STRICT=@AST_DEVMODE_STRICT@
+DISABLE_XMLDOC=@DISABLE_XMLDOC@
 NOISY_BUILD=@NOISY_BUILD@
 
 AST_CODE_COVERAGE=@AST_CODE_COVERAGE@

-- 
To view, visit https://gerrit.asterisk.org/6877
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifac562340c09f80c83e0203de098fcac93bf8c44
Gerrit-Change-Number: 6877
Gerrit-PatchSet: 3
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171031/6a93b017/attachment.html>


More information about the asterisk-code-review mailing list