diff --git a/bin/autoreconf.in b/bin/autoreconf.in index 86e8826..7eb7757 100644 --- a/bin/autoreconf.in +++ b/bin/autoreconf.in @@ -58,7 +58,7 @@ use strict; $help = "Usage: $0 [OPTION]... [DIRECTORY]... Run `autoconf' (and `autoheader', `aclocal', `automake', `autopoint' -(formerly `gettextize'), and `libtoolize' where appropriate) +(formerly `gettextize'), `gnulib-tool', and `libtoolize' where appropriate) repeatedly to remake the GNU Build System files in specified DIRECTORIES and their subdirectories (defaulting to `.'). @@ -89,7 +89,7 @@ Library directories: -I, --include=DIR append directory DIR to search path The environment variables AUTOCONF, AUTOHEADER, AUTOMAKE, ACLOCAL, -AUTOPOINT, LIBTOOLIZE, M4, and MAKE are honored. +AUTOPOINT, LIBTOOLIZE, GNULIB_TOOL, M4, and MAKE are honored. Report bugs to . "; @@ -107,13 +107,14 @@ Written by David J. MacKenzie and Akim Demaille. "; # Lib files. -my $autoconf = $ENV{'AUTOCONF'} || '@bindir@/@autoconf-name@'; -my $autoheader = $ENV{'AUTOHEADER'} || '@bindir@/@autoheader-name@'; -my $automake = $ENV{'AUTOMAKE'} || 'automake'; -my $aclocal = $ENV{'ACLOCAL'} || 'aclocal'; -my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize'; -my $autopoint = $ENV{'AUTOPOINT'} || 'autopoint'; -my $make = $ENV{'MAKE'} || 'make'; +my $autoconf = $ENV{'AUTOCONF'} || '@bindir@/@autoconf-name@'; +my $autoheader = $ENV{'AUTOHEADER'} || '@bindir@/@autoheader-name@'; +my $automake = $ENV{'AUTOMAKE'} || 'automake'; +my $aclocal = $ENV{'ACLOCAL'} || 'aclocal'; +my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize'; +my $autopoint = $ENV{'AUTOPOINT'} || 'autopoint'; +my $gnulib_tool = $ENV{'GNULIB_TOOL'} || 'gnulib-tool'; +my $make = $ENV{'MAKE'} || 'make'; # --install -- as --add-missing in other tools. my $install = 0; @@ -174,7 +175,8 @@ sub parse_args () for my $prog ($autoconf, $autoheader, $automake, $aclocal, $autopoint, - $libtoolize) + $libtoolize, + $gnulib_tool) { xsystem ("$prog --version | sed 1q >&2"); print STDERR "\n"; @@ -223,10 +225,11 @@ sub parse_args () # --verbose --verbose or --debug; if ($verbose > 1 || $debug) { - $autoconf .= ' --verbose'; - $autoheader .= ' --verbose'; - $automake .= ' --verbose'; - $aclocal .= ' --verbose'; + $autoconf .= ' --verbose'; + $autoheader .= ' --verbose'; + $automake .= ' --verbose'; + $aclocal .= ' --verbose'; + $gnulib_tool .= ' --verbose'; } if ($debug) { @@ -372,6 +375,85 @@ sub autoreconf_current_directory () } + # --------------------- # + # Running gnulib-tool. # + # --------------------- # + + # Gnulib files need to be updated after Gettext, but before everything + # else. Our logic for determining whether Gnulib is in use mirrors that + # in gnulib-tool. + my $uses_gnulib; + if (-f 'Makefile.am') + { + my $makefile = new Autom4te::XFile 'Makefile.am'; + while ($_ = $makefile->getline) + { + if (/^ACLOCAL_AMFLAGS\s*=\s*(.*)/) + { + my $m4dir_is_next; + for my $arg (split ' ', $1) + { + if ($m4dir_is_next) + { + # Ignore absolute directory pathnames, like + # /usr/local/share/aclocal. + if ($arg !~ m{^/} && -f "$arg/gnulib-cache.m4") + { + $uses_gnulib = 1; + last; + } + undef $m4dir_is_next; + } + elsif ($arg eq '-I') + { + $m4dir_is_next = 1; + } + else + { + undef $m4dir_is_next; + } + } + } + last if $uses_gnulib; + } + } + elsif (-f 'aclocal.m4') + { + # If there is no Makefile.am, look at the last generated aclocal.m4. + my $aclocal_m4 = new Autom4te::XFile 'aclocal.m4'; + while ($_ = $aclocal_m4->getline) + { + if (/^m4_include\(\[(.*)\]\)$/) + { + my $m4dir = $1; + if ($m4dir !~ m{/}) + { + $uses_gnulib = 1 if -f 'gnulib-cache.m4'; + } + else + { + $m4dir =~ s{/.*?$}{}; + $uses_gnulib = 1 if -f "$m4dir/gnulib-cache.m4"; + } + } + last if $uses_gnulib; + } + } + + if (!$uses_gnulib) + { + verb "$configure_ac: not using Gnulib"; + } + elsif (!$install) + { + verb "$configure_ac: not running gnulib-tool: --install not given"; + } + else + { + xsystem_hint ("gnulib-tool is needed because this package uses Gnulib", "$gnulib_tool --update"); + } + + # ----------------- # # Running aclocal. # # ----------------- # diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 07db254..e1dfb3a 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -1580,14 +1580,14 @@ been updated, or finally, simply in order to install the @acronym{GNU} Build System in a fresh tree. @command{autoreconf} runs @command{autoconf}, @command{autoheader}, address@hidden, @command{automake}, @command{libtoolize}, and address@hidden (when appropriate) repeatedly to update the address@hidden Build System in the specified directories and their -subdirectories (@pxref{Subdirectories}). By default, it only remakes address@hidden, @command{automake}, @command{libtoolize}, address@hidden, and @command{gnulib-tool} (when appropriate) repeatedly +to update the @acronym{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{AUTOCONF}, @env{AUTOHEADER}, @env{AUTOMAKE}, @env{ACLOCAL}, address@hidden, @env{LIBTOOLIZE}, @env{M4}, and @env{MAKE} may be used -to override the invocation of the respective tools. address@hidden, @env{LIBTOOLIZE}, @env{GNULIB_TOOL}, @env{M4}, and address@hidden 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