From 00bc5e7904f63ad30100517ba80b4f24503ecf23 Mon Sep 17 00:00:00 2001 From: David MacKenzie Date: Fri, 4 Nov 1994 14:44:38 +0000 Subject: [PATCH] add autoreconf --force --- NEWS | 3 +++ autoconf.texi | 37 +++++++++++++++++++++++-------- autoreconf.in | 56 +++++++++++++++++++++++++++++++++-------------- autoreconf.sh | 56 +++++++++++++++++++++++++++++++++-------------- bin/autoreconf.in | 56 +++++++++++++++++++++++++++++++++-------------- doc/autoconf.texi | 37 +++++++++++++++++++++++-------- 6 files changed, 176 insertions(+), 69 deletions(-) diff --git a/NEWS b/NEWS index af1bbe2e..cb226556 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,9 @@ Major changes in release 2.1: * More explanations in the manual. * Fix a spurious failure in the testsuite. * Clarify some warning messages. +* autoreconf by default only rebuilds configure and config.h.in files + that are older than any of their particular input files; there is a + --force option to use after installing a new version of Autoconf. Thanks to everybody who's submitted changes and additions to Autoconf! I've incorporated many of them, and am still considering others for diff --git a/autoconf.texi b/autoconf.texi index f4de6347..3ec9655c 100644 --- a/autoconf.texi +++ b/autoconf.texi @@ -661,16 +661,29 @@ Print the version number of Autoconf and exit. @node Invoking autoreconf, , Invoking autoconf, Making configure Scripts @section Using @code{autoreconf} to Update @code{configure} Scripts -If you have a lot of Autoconf-generated @code{configure} scripts and you -get a new version of Autoconf, the @code{autoreconf} program can be -handy. It runs @code{autoconf} (and @code{autoheader}, where -appropriate) repeatedly to remake all of the Autoconf @code{configure} -scripts in the directory tree rooted at the current directory. If you -give the @samp{--macrodir=@var{dir}} or @samp{--localdir=@var{dir}} -options, it passes them down (with relative paths adjusted properly). +If you have a lot of Autoconf-generated @code{configure} scripts, the +@code{autoreconf} program can save you some work. It runs +@code{autoconf} (and @code{autoheader}, where appropriate) repeatedly to +remake the Autoconf @code{configure} scripts and configuration header +templates in the directory tree rooted at the current directory. By +default, it only remakes those files that are older than their +@file{configure.in} or (if present) @file{aclocal.m4}. Since +@code{autoheader} does not change the timestamp of its output file if +the file wouldn't be changing, this is not necessarily the minimum +amount of work. If you install a new version of Autoconf, you can make +@code{autoreconf} remake @emph{all} of the files by giving it the +@samp{--force} option. -@xref{Automatic Remaking}, for information about automatic remaking of -@code{configure} scripts when their source files change. +If you give @code{autoreconf} the @samp{--macrodir=@var{dir}} or +@samp{--localdir=@var{dir}} options, it passes them down to +@code{autoconf} and @code{autoheader} (with relative paths adjusted +properly). + +@xref{Automatic Remaking}, for @file{Makefile} rules to automatically +remake @code{configure} scripts when their source files change. That +method handles the timestamps of configuration header templates +properly, but does not pass @samp{--macrodir=@var{dir}} or +@samp{--localdir=@var{dir}}. @noindent @code{autoreconf} accepts the following options: @@ -680,6 +693,12 @@ options, it passes them down (with relative paths adjusted properly). @itemx -h Print a summary of the command line options and exit. +@item --force +@itemx -f +Remake even @file{configure} scripts and configuration headers that are +newer than their input files (@file{configure.in} and, if present, +@file{aclocal.m4}). + @item --localdir=@var{dir} @itemx -l @var{dir} Look for the package files @file{aclocal.m4} and @file{acconfig.h} (but diff --git a/autoreconf.in b/autoreconf.in index d6fd5cae..4b83f804 100644 --- a/autoreconf.in +++ b/autoreconf.in @@ -17,12 +17,13 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. usage="\ -Usage: autoreconf [-h] [--help] [-m dir] [--macrodir=dir] - [-l dir] [--localdir=dir] [--verbose] [--version]" +Usage: autoreconf [-f] [-h] [--help] [-m dir] [--macrodir=dir] + [-l dir] [--localdir=dir] [--force] [--verbose] [--version]" localdir= verbose=no show_version=no +force=no test -z "$AC_MACRODIR" && AC_MACRODIR=@datadir@ @@ -30,14 +31,14 @@ while test $# -gt 0; do case "$1" in -h | --help | --h*) echo "$usage"; exit 0 ;; - --localdir=* | --l*=* ) - localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" - shift ;; - -l | --localdir | --l*) - shift - test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } - localdir="${1}" - shift ;; + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"$1\" | sed -e 's/^[^=]*=//'`" shift ;; @@ -48,6 +49,8 @@ while test $# -gt 0; do shift ;; --verbose | --verb*) verbose=yes; shift ;; + -f | --force) + force=yes; shift ;; --version | --vers*) show_version=yes; shift ;; --) # Stop option processing. @@ -97,13 +100,25 @@ while read dir; do esac case "$localdir" in - "") localdir_opt= ;; - /*) localdir_opt="--localdir=$localdir" ;; - *) localdir_opt="--localdir=$dots$localdir" ;; + "") localdir_opt= + aclocal=aclocal.m4 ;; + /*) localdir_opt="--localdir=$localdir" + aclocal=$localdir/aclocal.m4 ;; + *) localdir_opt="--localdir=$dots$localdir" + aclocal=$dots$localdir/aclocal.m4 ;; esac - test $verbose = yes && echo running autoconf in $dir - $autoconf $macrodir_opt $localdir_opt + test ! -f $aclocal && aclocal= + + if test $force = no && test -f configure && + ls -lt configure configure.in $aclocal | sed 1q | + grep 'configure$' > /dev/null + then + : + else + test $verbose = yes && echo running autoconf in $dir + $autoconf $macrodir_opt $localdir_opt + fi if grep AC_CONFIG_HEADER configure.in >/dev/null; then template=`sed -n '/AC_CONFIG_HEADER/{ @@ -118,8 +133,15 @@ p q }' configure.in` if test ! -f $template || grep autoheader $template >/dev/null; then - test $verbose = yes && echo running autoheader in $dir - $autoheader $macrodir_opt $localdir_opt + if test $force = no && test -f $template && + ls -lt $template configure.in $aclocal | sed 1q | + grep "$template$" > /dev/null + then + : + else + test $verbose = yes && echo running autoheader in $dir + $autoheader $macrodir_opt $localdir_opt + fi fi fi ) diff --git a/autoreconf.sh b/autoreconf.sh index d6fd5cae..4b83f804 100644 --- a/autoreconf.sh +++ b/autoreconf.sh @@ -17,12 +17,13 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. usage="\ -Usage: autoreconf [-h] [--help] [-m dir] [--macrodir=dir] - [-l dir] [--localdir=dir] [--verbose] [--version]" +Usage: autoreconf [-f] [-h] [--help] [-m dir] [--macrodir=dir] + [-l dir] [--localdir=dir] [--force] [--verbose] [--version]" localdir= verbose=no show_version=no +force=no test -z "$AC_MACRODIR" && AC_MACRODIR=@datadir@ @@ -30,14 +31,14 @@ while test $# -gt 0; do case "$1" in -h | --help | --h*) echo "$usage"; exit 0 ;; - --localdir=* | --l*=* ) - localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" - shift ;; - -l | --localdir | --l*) - shift - test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } - localdir="${1}" - shift ;; + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"$1\" | sed -e 's/^[^=]*=//'`" shift ;; @@ -48,6 +49,8 @@ while test $# -gt 0; do shift ;; --verbose | --verb*) verbose=yes; shift ;; + -f | --force) + force=yes; shift ;; --version | --vers*) show_version=yes; shift ;; --) # Stop option processing. @@ -97,13 +100,25 @@ while read dir; do esac case "$localdir" in - "") localdir_opt= ;; - /*) localdir_opt="--localdir=$localdir" ;; - *) localdir_opt="--localdir=$dots$localdir" ;; + "") localdir_opt= + aclocal=aclocal.m4 ;; + /*) localdir_opt="--localdir=$localdir" + aclocal=$localdir/aclocal.m4 ;; + *) localdir_opt="--localdir=$dots$localdir" + aclocal=$dots$localdir/aclocal.m4 ;; esac - test $verbose = yes && echo running autoconf in $dir - $autoconf $macrodir_opt $localdir_opt + test ! -f $aclocal && aclocal= + + if test $force = no && test -f configure && + ls -lt configure configure.in $aclocal | sed 1q | + grep 'configure$' > /dev/null + then + : + else + test $verbose = yes && echo running autoconf in $dir + $autoconf $macrodir_opt $localdir_opt + fi if grep AC_CONFIG_HEADER configure.in >/dev/null; then template=`sed -n '/AC_CONFIG_HEADER/{ @@ -118,8 +133,15 @@ p q }' configure.in` if test ! -f $template || grep autoheader $template >/dev/null; then - test $verbose = yes && echo running autoheader in $dir - $autoheader $macrodir_opt $localdir_opt + if test $force = no && test -f $template && + ls -lt $template configure.in $aclocal | sed 1q | + grep "$template$" > /dev/null + then + : + else + test $verbose = yes && echo running autoheader in $dir + $autoheader $macrodir_opt $localdir_opt + fi fi fi ) diff --git a/bin/autoreconf.in b/bin/autoreconf.in index d6fd5cae..4b83f804 100644 --- a/bin/autoreconf.in +++ b/bin/autoreconf.in @@ -17,12 +17,13 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. usage="\ -Usage: autoreconf [-h] [--help] [-m dir] [--macrodir=dir] - [-l dir] [--localdir=dir] [--verbose] [--version]" +Usage: autoreconf [-f] [-h] [--help] [-m dir] [--macrodir=dir] + [-l dir] [--localdir=dir] [--force] [--verbose] [--version]" localdir= verbose=no show_version=no +force=no test -z "$AC_MACRODIR" && AC_MACRODIR=@datadir@ @@ -30,14 +31,14 @@ while test $# -gt 0; do case "$1" in -h | --help | --h*) echo "$usage"; exit 0 ;; - --localdir=* | --l*=* ) - localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" - shift ;; - -l | --localdir | --l*) - shift - test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } - localdir="${1}" - shift ;; + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"$1\" | sed -e 's/^[^=]*=//'`" shift ;; @@ -48,6 +49,8 @@ while test $# -gt 0; do shift ;; --verbose | --verb*) verbose=yes; shift ;; + -f | --force) + force=yes; shift ;; --version | --vers*) show_version=yes; shift ;; --) # Stop option processing. @@ -97,13 +100,25 @@ while read dir; do esac case "$localdir" in - "") localdir_opt= ;; - /*) localdir_opt="--localdir=$localdir" ;; - *) localdir_opt="--localdir=$dots$localdir" ;; + "") localdir_opt= + aclocal=aclocal.m4 ;; + /*) localdir_opt="--localdir=$localdir" + aclocal=$localdir/aclocal.m4 ;; + *) localdir_opt="--localdir=$dots$localdir" + aclocal=$dots$localdir/aclocal.m4 ;; esac - test $verbose = yes && echo running autoconf in $dir - $autoconf $macrodir_opt $localdir_opt + test ! -f $aclocal && aclocal= + + if test $force = no && test -f configure && + ls -lt configure configure.in $aclocal | sed 1q | + grep 'configure$' > /dev/null + then + : + else + test $verbose = yes && echo running autoconf in $dir + $autoconf $macrodir_opt $localdir_opt + fi if grep AC_CONFIG_HEADER configure.in >/dev/null; then template=`sed -n '/AC_CONFIG_HEADER/{ @@ -118,8 +133,15 @@ p q }' configure.in` if test ! -f $template || grep autoheader $template >/dev/null; then - test $verbose = yes && echo running autoheader in $dir - $autoheader $macrodir_opt $localdir_opt + if test $force = no && test -f $template && + ls -lt $template configure.in $aclocal | sed 1q | + grep "$template$" > /dev/null + then + : + else + test $verbose = yes && echo running autoheader in $dir + $autoheader $macrodir_opt $localdir_opt + fi fi fi ) diff --git a/doc/autoconf.texi b/doc/autoconf.texi index f4de6347..3ec9655c 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -661,16 +661,29 @@ Print the version number of Autoconf and exit. @node Invoking autoreconf, , Invoking autoconf, Making configure Scripts @section Using @code{autoreconf} to Update @code{configure} Scripts -If you have a lot of Autoconf-generated @code{configure} scripts and you -get a new version of Autoconf, the @code{autoreconf} program can be -handy. It runs @code{autoconf} (and @code{autoheader}, where -appropriate) repeatedly to remake all of the Autoconf @code{configure} -scripts in the directory tree rooted at the current directory. If you -give the @samp{--macrodir=@var{dir}} or @samp{--localdir=@var{dir}} -options, it passes them down (with relative paths adjusted properly). +If you have a lot of Autoconf-generated @code{configure} scripts, the +@code{autoreconf} program can save you some work. It runs +@code{autoconf} (and @code{autoheader}, where appropriate) repeatedly to +remake the Autoconf @code{configure} scripts and configuration header +templates in the directory tree rooted at the current directory. By +default, it only remakes those files that are older than their +@file{configure.in} or (if present) @file{aclocal.m4}. Since +@code{autoheader} does not change the timestamp of its output file if +the file wouldn't be changing, this is not necessarily the minimum +amount of work. If you install a new version of Autoconf, you can make +@code{autoreconf} remake @emph{all} of the files by giving it the +@samp{--force} option. -@xref{Automatic Remaking}, for information about automatic remaking of -@code{configure} scripts when their source files change. +If you give @code{autoreconf} the @samp{--macrodir=@var{dir}} or +@samp{--localdir=@var{dir}} options, it passes them down to +@code{autoconf} and @code{autoheader} (with relative paths adjusted +properly). + +@xref{Automatic Remaking}, for @file{Makefile} rules to automatically +remake @code{configure} scripts when their source files change. That +method handles the timestamps of configuration header templates +properly, but does not pass @samp{--macrodir=@var{dir}} or +@samp{--localdir=@var{dir}}. @noindent @code{autoreconf} accepts the following options: @@ -680,6 +693,12 @@ options, it passes them down (with relative paths adjusted properly). @itemx -h Print a summary of the command line options and exit. +@item --force +@itemx -f +Remake even @file{configure} scripts and configuration headers that are +newer than their input files (@file{configure.in} and, if present, +@file{aclocal.m4}). + @item --localdir=@var{dir} @itemx -l @var{dir} Look for the package files @file{aclocal.m4} and @file{acconfig.h} (but