[mm-common] Make mm-common-prepare copy doc tools on request



commit e968667bbeb4f04825e7ba4898a536d7306b1387
Author: Daniel Elstner <danielk openismus com>
Date:   Mon Aug 10 15:35:55 2009 +0200

    Make mm-common-prepare copy doc tools on request
    
    * Makefile.am (dist_doctool_DATA): Install documentation utilities
    to the $(pkgdatadir)/doctool directory.
    * macros/mm-doc.m4 (MM_CONFIG_DOCTOOL_DIR): New Autoconf macro for
    locating the documentation utilities.  Either a local directory in
    the source tree can be used, or alternatively pkg-config will be
    invoked and request the install location from the glibmm-2.4 module.
    * util/mm-common-prepare.in: Scan configure.ac for calls to the new
    MM_CONFIG_DOCTOOL_DIR() macro.  If a local directory name was given,
    copy the documentation utilities into the source tree.

 Makefile.am               |   11 +++++----
 macros/mm-doc.m4          |   56 ++++++++++++++++++++++++++++++++++++++++++++-
 util/mm-common-prepare.in |   33 +++++++++++++++++++++++---
 3 files changed, 90 insertions(+), 10 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 43c97e1..a5cbeaa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,6 +34,12 @@ dist_aclocal_macro_DATA =		\
 	macros/mm-pkg.m4		\
 	macros/mm-warnings.m4
 
+doctooldir = $(pkgdatadir)/doctool
+dist_doctool_DATA =			\
+	util/doc-install.pl		\
+	util/doc-postprocess.pl		\
+	util/tagfile-to-devhelp2.xsl
+
 doxygen_tagsdir = $(pkgdatadir)/tags
 dist_doxygen_tags_DATA = tags/libstdc++.tag
 
@@ -41,11 +47,6 @@ shared_pkgconfigdir = $(datadir)/pkgconfig
 nodist_shared_pkgconfig_DATA = tags/mm-common-libstdc++.pc
 noinst_DATA = tags/mm-common-libstdc++-uninstalled.pc
 
-dist_noinst_DATA =			\
-	util/doc-install.pl		\
-	util/doc-postprocess.pl		\
-	util/tagfile-to-devhelp2.xsl
-
 dist_noinst_SCRIPTS = autogen.sh
 
 MAINTAINERCLEANFILES = $(dist_doxygen_tags_DATA)
diff --git a/macros/mm-doc.m4 b/macros/mm-doc.m4
index 40ef53b..3fb4136 100644
--- a/macros/mm-doc.m4
+++ b/macros/mm-doc.m4
@@ -15,7 +15,61 @@
 ## You should have received a copy of the GNU General Public License
 ## along with mm-common.  If not, see <http://www.gnu.org/licenses/>.
 
-#serial 20090808
+#serial 20090810
+
+## _MM_CONFIG_DOCTOOL_DIR
+##
+## Query pkg-config for the location of the documentation utilities
+## shared by the GNOME C++ bindings.  This is the code path invoked
+## from MM_CONFIG_DOCTOOL_DIR when called without a directory name.
+##
+m4_define([_MM_CONFIG_DOCTOOL_DIR],
+[dnl
+AC_PROVIDE([$0])[]dnl
+AC_REQUIRE([PKG_PROG_PKG_CONFIG])[]dnl
+dnl
+AC_MSG_CHECKING([location of documentation utilities])
+AS_IF([test -z "${$1+set}"],
+[
+  mm_doctooldir=`$PKG_CONFIG --variable doctooldir glibmm-2.4 2>&AS_MESSAGE_LOG_FD`
+  AS_IF([test "[$]?" -ne 0],
+        [AC_MSG_ERROR([[not found
+The required module glibmm could not be found on this system.  If you
+are running a binary distribution and the glibmm package is installed,
+make sure that any separate development package for glibmm is installed
+as well.  If you built glibmm yourself, it may be necessary to adjust
+the PKG_CONFIG_PATH environment variable for pkg-config to find it.
+]])])
+  AS_IF([test "x$mm_doctooldir" = x],
+        [AC_MSG_ERROR([[not found
+The glibmm module is available, but the installation of glibmm on this
+machine is missing the shared documentation utilities of the GNOME C++
+bindings.  It may be necessary to upgrade to a more recent release of
+glibmm in order to build $PACKAGE_NAME.
+]])])
+  MMDOCTOOLDIR=$mm_doctooldir[]dnl
+])
+AC_MSG_RESULT([$MMDOCTOOLDIR])[]dnl
+])
+
+## MM_CONFIG_DOCTOOL_DIR([directory])
+##
+## Define the location of the documentation utilities shared by the
+## GNOME C++ binding modules.  If the <directory> argument is given,
+## it should name a directory relative to the toplevel directory of
+## the source tree.
+##
+## The directory name is used by mm-common-prepare as the destination
+## for copying the required files into the source tree.  If you make
+## use of this feature in order to avoid a dependency on glibmm, make
+## sure to include the installed files in the distribution tarball of
+## your package.
+##
+AC_DEFUN([MM_CONFIG_DOCTOOL_DIR],
+[dnl
+m4_ifval([$1], [MMDOCTOOLDIR='${top_srcdir}/$1'], [AC_REQUIRE([_MM_CONFIG_DOCTOOL_DIR])])
+AC_SUBST([MMDOCTOOLDIR])[]dnl
+])
 
 ## _MM_ARG_ENABLE_DOCUMENTATION
 ##
diff --git a/util/mm-common-prepare.in b/util/mm-common-prepare.in
index 1d86071..51882a9 100644
--- a/util/mm-common-prepare.in
+++ b/util/mm-common-prepare.in
@@ -76,11 +76,19 @@ test -f "$acfile" || {
   echo "$progname: error: $acfile not found" >&2
   exit 1
 }
-# Extract the AC_CONFIG_AUX_DIR argument from configure.ac
-auxdir=`${AUTOCONF:-autoconf} --trace='AC_CONFIG_AUX_DIR:$1' "$acfile"`
-auxdir="$srcdir${auxdir:+/}$auxdir"
+# Extract the macro arguments from configure.ac
+auxdir=
+doctooldir=
+trace=`${AUTOCONF:-autoconf} --trace='MM_CONFIG_DOCTOOL_DIR:doctooldir="$1"' \
+                             --trace='AC_CONFIG_AUX_DIR:auxdir="$1"' "$acfile"`
+case $trace in
+  auxdir=*|doctooldir=*)
+    eval "$trace"
+    ;;
+esac
 
-echo "$progname: putting auxiliary files into '$auxdir'"
+auxdir="$srcdir${auxdir:+/}$auxdir"
+echo "$progname: putting auxiliary files in '$auxdir'."
 
 for file in compile-binding.am dist-changelog.am doc-reference.am generate-binding.am
 do
@@ -90,4 +98,21 @@ do
   fi
 done
 
+if test -n "$doctooldir"
+then
+  doctooldir="$srcdir/$doctooldir"
+  echo "$progname: putting documentation utilities in '$doctooldir'."
+
+  # Create the destination directory automatically if necessary
+  test -d "$doctooldir" || mkdir "$doctooldir"
+
+  for file in doc-install.pl doc-postprocess.pl tagfile-to-devhelp2.xsl
+  do
+    if test -n "$forceflag" || test ! -f "$doctooldir/$file"; then
+      echo "$progname: $instaction file '$file'"
+      $installcmd$forceflag "$pkgdatadir/doctool/$file" "$doctooldir/$file"
+    fi
+  done
+fi
+
 exit 0



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