[PATCH 1/2] autoreconf: integrate gtkdocize into the standard reconfiguration tools

Eli Schwartz <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Message-ID <[email protected]>
When the GTK_DOC_CHECK macro is in use, this flags a given configure.ac
as belonging the the common class of gtk-related software that requires
the gtkdocize tool to be run before autoreconf, in order to install the
gtk-doc macro and Makefile fragment. Make this easier to accomplish via
teaching autoreconf how to detect and run this tool automatically; this
gets us one step closer to a world in which `autoreconf -fi` on its own
is enough to bootstrap any autotools project into a configurable state.

Signed-off-by: Eli Schwartz <[email protected]>
---
 bin/autoreconf.in | 26 +++++++++++++++++++++++++-
 doc/autoconf.texi | 10 +++++-----
 lib/autom4te.in   |  1 +
 3 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/bin/autoreconf.in b/bin/autoreconf.in
index 79ffb9f5..fe7df300 100644
--- a/bin/autoreconf.in
+++ b/bin/autoreconf.in
@@ -112,6 +112,7 @@ my $autom4te   = $ENV{'AUTOM4TE'}   || '@bindir@/@autom4te-name@';
 my $automake   = $ENV{'AUTOMAKE'}   || 'automake';
 my $aclocal    = $ENV{'ACLOCAL'}    || 'aclocal';
 my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize';
+my $gtkdocize  = $ENV{'GTKDOCIZE'}  || 'gtkdocize';
 my $autopoint  = $ENV{'AUTOPOINT'}  || 'autopoint';
 my $make       = $ENV{'MAKE'}       || 'make';
 
@@ -174,7 +175,8 @@ sub parse_args ()
       for my $prog ($autoconf, $autoheader,
 		    $automake, $aclocal,
 		    $autopoint,
-		    $libtoolize)
+		    $libtoolize,
+		    $gtkdocize)
 	{
 	  xsystem ("$prog --version | sed 1q >&2");
 	  print STDERR "\n";
@@ -200,6 +202,7 @@ sub parse_args ()
       $automake   .= ' --add-missing';
       $automake   .= ' --copy' unless $symlink;
       $libtoolize .= ' --copy' unless $symlink;
+      $gtkdocize  .= ' --copy' unless $symlink;
     }
   # --force;
   if ($force)
@@ -382,6 +385,7 @@ sub autoreconf_current_directory ()
   my $aux_dir;
   my $uses_gettext_via_traces;
   my $uses_libtool;
+  my $uses_gtkdoc;
   my $uses_libltdl;
   my $uses_autoheader;
   my $uses_automake;
@@ -402,6 +406,7 @@ sub autoreconf_current_directory ()
 	     'LT_CONFIG_LTDL_DIR',
 	     'AM_GNU_GETTEXT',
 	     'AM_INIT_AUTOMAKE',
+	     'GTK_DOC_CHECK',
 	    )
      . ' |');
   while ($_ = $traces->getline)
@@ -416,6 +421,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;
     }
@@ -482,6 +488,24 @@ sub autoreconf_current_directory ()
     }
 
 
+  # ------------------- #
+  # Running gtkdocize.  #
+  # ------------------- #
+
+  if (!$uses_gtkdoc)
+    {
+      verb "$configure_ac: not using Gtkdoc";
+    }
+  elsif ($install)
+    {
+      xsystem_hint ("gtkdocize is needed because this package uses Gtkdoc", $gtkdocize);
+      xsystem ($gtkdocize)
+    }
+  else
+    {
+      verb "$configure_ac: not running gtkdocize: --install not given";
+    }
+
 
   # ------------------- #
   # Rerunning aclocal.  #
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 2ac66969..a1442520 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -1687,14 +1687,14 @@ 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
-GNU Build System in the specified directories and their
+@command{aclocal}, @command{automake}, @command{libtoolize},
+@command{gtkdocize}, and @command{autopoint} (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
 @env{AUTOM4TE}, @env{AUTOCONF}, @env{AUTOHEADER}, @env{AUTOMAKE},
-@env{ACLOCAL}, @env{AUTOPOINT}, @env{LIBTOOLIZE}, @env{M4}, and @env{MAKE}
-may be used to override the invocation of the respective tools.
+@env{ACLOCAL}, @env{AUTOPOINT}, @env{LIBTOOLIZE}, @env{GTKDOCIZE}, @env{M4},
+and @env{MAKE} may be used to override the invocation of the respective tools.
 
 If you install a new version of some tool, you can make
 @command{autoreconf} remake @emph{all} of the files by giving it the
diff --git a/lib/autom4te.in b/lib/autom4te.in
index 13350ab4..2acd39cd 100644
--- a/lib/autom4te.in
+++ b/lib/autom4te.in
@@ -98,6 +98,7 @@ args: --preselect AC_CONFIG_MACRO_DIR_TRACE
 args: --preselect AC_CONFIG_SUBDIRS
 args: --preselect AC_INIT
 args: --preselect AC_PROG_LIBTOOL
+args: --preselect GTK_DOC_CHECK
 args: --preselect LT_INIT
 args: --preselect LT_CONFIG_LTDL_DIR
 args: --preselect AM_GNU_GETTEXT
-- 
2.21.0
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.