[PATCH v2] autoreconf: Add checks for Gtk-Doc usage

Javier Jardón <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Message-ID <[email protected]>
Signed-off-by: Javier Jardón <[email protected]>
---
 NEWS              |  6 ++++++
 bin/autoreconf.in | 22 ++++++++++++++++++++++
 doc/autoconf.texi |  6 +++---
 lib/autom4te.in   |  1 +
 4 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 5f05ad6..a41d682 100644
--- a/NEWS
+++ b/NEWS
@@ -113,6 +113,12 @@ GNU Autoconf NEWS - User visible changes.
 ** Man pages for config.guess and config.sub are no longer provided.
 They were moved to the master source tree for config.guess and config.sub.
 
+** Executables
+
+- autoreconf
+  Runs gtkdocize when appropriate.
+
+
 * Noteworthy changes in release 2.69 (2012-04-24) [stable]
 
 ** Autoconf now requires perl 5.6 or better (but generated configure
diff --git a/bin/autoreconf.in b/bin/autoreconf.in
index da5b3ea..4db8691 100644
--- a/bin/autoreconf.in
+++ b/bin/autoreconf.in
@@ -114,6 +114,7 @@ my $aclocal    = $ENV{'ACLOCAL'}    || 'aclocal';
 my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize';
 my $autopoint  = $ENV{'AUTOPOINT'}  || 'autopoint';
 my $make       = $ENV{'MAKE'}       || 'make';
+my $gtkdocize  = $ENV{'GTKDOCIZE'}  || 'gtkdocize';
 
 # --install -- as --add-missing in other tools.
 my $install = 0;
@@ -200,6 +201,7 @@ sub parse_args ()
       $automake   .= ' --add-missing';
       $automake   .= ' --copy' unless $symlink;
       $libtoolize .= ' --copy' unless $symlink;
+      $gtkdocize  .= ' --copy' unless $symlink;
     }
   # --force;
   if ($force)
@@ -385,6 +387,7 @@ sub autoreconf_current_directory ()
   my $uses_libltdl;
   my $uses_autoheader;
   my $uses_automake;
+  my $uses_gtkdoc;
   my @subdir;
   verb "$configure_ac: tracing";
   my $traces = new Autom4te::XFile
@@ -402,6 +405,7 @@ sub autoreconf_current_directory ()
 	     'LT_CONFIG_LTDL_DIR',
 	     'AM_GNU_GETTEXT',
 	     'AM_INIT_AUTOMAKE',
+	     'GTK_DOC_CHECK',
 	    )
      . ' |');
   while ($_ = $traces->getline)
@@ -416,6 +420,7 @@ sub autoreconf_current_directory ()
       $uses_libltdl = 1             if $macro eq "LT_CONFIG_LTDL_DIR";
       $uses_autoheader = 1          if $macro eq "AC_CONFIG_HEADERS";
       $uses_automake = 1            if $macro eq "AM_INIT_AUTOMAKE";
+      $uses_gtkdoc = 1              if $macro eq "GTK_DOC_CHECK";
       push @subdir, split (' ', $args[0])
                                     if $macro eq "AC_CONFIG_SUBDIRS" && $recursive;
     }
@@ -458,6 +463,23 @@ sub autoreconf_current_directory ()
 	or error "cannot create $aux_dir: $!";
     }
 
+  # ------------------- #
+  # Running gtkdocize   #
+  # ------------------- #
+
+  if (!$uses_gtkdoc)
+    {
+      verb "$configure_ac: not using Gtk-Doc";
+    }
+  elsif (!$install)
+    {
+      verb "$configure_ac: not running gtkdocize: --install not given";
+    }
+  else
+    {
+      xsystem_hint ("gtkdocize is needed because this package uses Gtk-Doc", "$gtkdocize");
+    }
+
 
   # -------------------- #
   # Running libtoolize.  #
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 9ea67cc..8ba787f 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -1681,8 +1681,8 @@ been updated, or finally, simply in order to install the GNU Build
 System in a fresh tree.
 
 @command{autoreconf} runs @command{autoconf}, @command{autoheader},
-@command{aclocal}, @command{automake}, @command{libtoolize}, and
-@command{autopoint} (when appropriate) repeatedly to update the
+@command{aclocal}, @command{automake}, @command{libtoolize}, @command{autopoint}
+and @command{gtkdocize} (when appropriate) repeatedly to update the
 GNU Build System in the specified directories and their
 subdirectories (@pxref{Subdirectories}).  By default, it only remakes
 those files that are older than their sources.  The environment variables
@@ -1744,7 +1744,7 @@ are copied; this can be changed with @option{--symlink}.
 
 If deemed appropriate, this option triggers calls to
 @samp{automake --add-missing},
-@samp{libtoolize}, @samp{autopoint}, etc.
+@samp{libtoolize}, @samp{autopoint}, @samp{gtkdocize} etc.
 
 @item --no-recursive
 Do not rebuild files in subdirectories to configure (see @ref{Subdirectories},
diff --git a/lib/autom4te.in b/lib/autom4te.in
index e7d5557..e667c8f 100644
--- a/lib/autom4te.in
+++ b/lib/autom4te.in
@@ -101,6 +101,7 @@ args: --preselect AC_PROG_LIBTOOL
 args: --preselect LT_INIT
 args: --preselect LT_CONFIG_LTDL_DIR
 args: --preselect AM_GNU_GETTEXT
+args: --preselect GTK_DOC_CHECK
 end-language: "Autoreconf-preselections"
 
 
-- 
2.7.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.