Hello,
this is basically a followup of
http://lists.gnu.org/archive/html/automake/2007-03/msg00036.html
Short reminder: it is a common mistake to expect that maintainer-clean
will revert a working copy to the state it was after a fresh checkout
(before a bootstrap which usually does autoreconf -fvi). Some people
even change this target by adding Makefile.in and the like in
MAINTAINERCLEANFILES (and thus often wonder why this is not done by
default). The idea was to implement a rule, say bootstrap-clean, that
would do this. Unfortunately the autotools don't provide any way to
undo the work of autoreconf -fvi so I implemented this. Later on, it
will be easy for automake to generate a bootstrap-clean rule that would
Do The Right Thing.
I've reviewed the patches I proposed back in March, completed them with
tests, ChangeLog and NEWS entries. If they are accepted, I'll write the
documentation.
Comments welcome.
Cheers,
PS: autopoint (formerly gettextize) is not yet supported by this change
(although autoreconf tries to use autopoint --clean) but I'll patch it
sooner or later.
PPS: Although this would belong to
{autoconf,automake,[EMAIL PROTECTED], I only sent it to the
Autoconf ML because Autoconf has the biggest patch and I expect Automake
and Libtool maintainers to see this message. I hope my assumption
wasn't wrong :)
--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Index: ChangeLog
===================================================================
RCS file: /sources/autoconf/autoconf/ChangeLog,v
retrieving revision 1.3212
diff -u -r1.3212 ChangeLog
--- ChangeLog 12 Jun 2007 11:36:56 -0000 1.3212
+++ ChangeLog 16 Jun 2007 22:46:59 -0000
@@ -1,3 +1,13 @@
+2007-06-17 Benoit Sigoure <[EMAIL PROTECTED]>
+
+ * bin/autoconf.as, bin/autoheader.in, bin/autoreconf.in: New option
+ `--clean'.
+ * NEWS: Mention it.
+ * bin/autoreconf.in (&run_make): New.
+ * lib/Autom4te/General.pm ($clean): New boolean value.
+ (getopt): Handle `--clean'.
+ * tests/torture.at: Test the new feature.
+
2007-06-12 Noah Misch <[EMAIL PROTECTED]>
* lib/autoconf/general.m4 (AC_SUBST): Raise a fatal error if VARIABLE is
Index: NEWS
===================================================================
RCS file: /sources/autoconf/autoconf/NEWS,v
retrieving revision 1.430
diff -u -r1.430 NEWS
--- NEWS 21 May 2007 17:50:57 -0000 1.430
+++ NEWS 16 Jun 2007 22:47:00 -0000
@@ -1,5 +1,8 @@
* Major changes in Autoconf 2.61b (????-??-??)
+** It is now possible to undo the work of autoconf, autoheader and
+ autoreconf with the --clean option.
+
** New macro AC_OPENMP.
** AC_C_BIGENDIAN now supports universal binaries a la Mac OS X.
Index: bin/autoconf.as
===================================================================
RCS file: /sources/autoconf/autoconf/bin/autoconf.as,v
retrieving revision 1.25
diff -u -r1.25 autoconf.as
--- bin/autoconf.as 17 May 2007 02:43:12 -0000 1.25
+++ bin/autoconf.as 16 Jun 2007 22:47:02 -0000
@@ -33,6 +33,7 @@
-v, --verbose verbosely report processing
-d, --debug don't remove temporary files
-f, --force consider all files obsolete
+ --clean remove files installed by autoconf
-o, --output=FILE save output in FILE (stdout is the default)
-W, --warnings=CATEGORY report the warnings falling in CATEGORY [syntax]
@@ -82,6 +83,7 @@
autom4te_options=
outfile=
verbose=false
+clean=false
# Parse command line.
while test $# -gt 0 ; do
@@ -99,6 +101,9 @@
verbose=:
autom4te_options="$autom4te_options $1"; shift ;;
+ --clean )
+ clean=:; shift ;;
+
# Arguments passed as is to autom4te.
--debug | -d | \
--force | -f | \
@@ -175,6 +180,11 @@
# Unless specified, the output is stdout.
test -z "$outfile" && outfile=-
+if $clean && test x"$outfile" != x-; then
+ rm -rf autom4te.cache
+ exec rm -f "$outfile"
+fi
+
# Run autom4te with expansion.
eval set x $autom4te_options \
--language=autoconf --output=\$outfile "$traces" \$infile
Index: bin/autoheader.in
===================================================================
RCS file: /sources/autoconf/autoconf/bin/autoheader.in,v
retrieving revision 1.147
diff -u -r1.147 autoheader.in
--- bin/autoheader.in 4 Jan 2007 16:43:06 -0000 1.147
+++ bin/autoheader.in 16 Jun 2007 22:47:02 -0000
@@ -70,6 +70,7 @@
-h, --help print this help, then exit
-V, --version print version number, then exit
-v, --verbose verbosely report processing
+ --clean remove files installed by autoheader
-d, --debug don\'t remove temporary files
-f, --force consider all files obsolete
-W, --warnings=CATEGORY report the warnings falling in CATEGORY
@@ -195,6 +196,17 @@
($config_h, $config_h_in) = split (':', $config_h, 2);
$config_h_in ||= "$config_h.in";
+if ($clean)
+ {
+ my $SIMPLE_BACKUP_SUFFIX = $ENV{'SIMPLE_BACKUP_SUFFIX'} || '~';
+ foreach my $f ($config_h, $config_h_in . $SIMPLE_BACKUP_SUFFIX)
+ {
+ unlink $f or error "error: Cannot remove `$f': $!"
+ unless not -f $f;
+ }
+ exit 0;
+ }
+
# %SYMBOL might contain things like `F77_FUNC(name,NAME)', but we keep
# only the name of the macro.
%symbol = map { s/\(.*//; $_ => 1 } keys %symbol;
Index: bin/autoreconf.in
===================================================================
RCS file: /sources/autoconf/autoconf/bin/autoreconf.in,v
retrieving revision 1.137
diff -u -r1.137 autoreconf.in
--- bin/autoreconf.in 4 Jan 2007 16:43:06 -0000 1.137
+++ bin/autoreconf.in 16 Jun 2007 22:47:02 -0000
@@ -74,6 +74,7 @@
-d, --debug don't remove temporary files
-f, --force consider all files obsolete
-i, --install copy missing auxiliary files
+ -c, --clean remove auxiliary files
--no-recursive don't rebuild sub-packages
-s, --symlink with -i, install symbolic links instead of copies
-m, --make when applicable, re-run ./configure && make
@@ -150,10 +151,15 @@
'I|include=s' => [EMAIL PROTECTED],
'B|prepend-include=s' => [EMAIL PROTECTED],
'i|install' => \$install,
+ # --clean is already handled by getopt, accept a short version:
+ 'c' => \$clean,
's|symlink' => \$symlink,
'm|make' => \$make,
'recursive!' => \$recursive);
+ error "Cannot install and clean at the same time."
+ if ($install && $clean);
+
# Split the warnings as a list of elements instead of a list of
# lists.
@warning = map { split /,/ } @warning;
@@ -196,6 +202,15 @@
$automake .= ' --copy' unless $symlink;
$libtoolize .= ' --copy' unless $symlink;
}
+ elsif ($clean)
+ {
+ # Don't tell autoconf and aclocal to --clean: we need them to do their
+ # work before we can actually remove their files.
+ $autoheader .= ' --clean';
+ $automake .= ' --clean';
+ $autopoint .= ' --clean';
+ $libtoolize .= ' --clean';
+ }
# --force;
if ($force)
{
@@ -304,12 +319,50 @@
}
}
+# &run_make ([TARGET])
+# --------------------
+# Run make in the current directory. config.status is run first
+# in order to recreate the Makefile unless we're in --clean mode.
+# Return true on success, false if something went wrong.
+sub run_make (;$)
+{
+ my ($target) = @_;
+ $target = '' if not defined $target;
+
+ # Regenerate the Makefile first (unless we're in --clean mode).
+ if (!$clean)
+ {
+ if (!-f 'config.status')
+ {
+ verb 'no config.status: cannot re-make';
+ return 0;
+ }
+ else
+ {
+ xsystem ('./config.status --recheck');
+ xsystem ('./config.status');
+ }
+ }
+ if (!-f 'Makefile')
+ {
+ verb 'no Makefile: cannot re-make' unless $clean;
+ return 0;
+ }
+ else
+ {
+ xsystem ("make $target");
+ }
+ return 1;
+}
+
# &autoreconf_current_directory
# -----------------------------
sub autoreconf_current_directory ()
{
my $configure_ac = find_configure_ac;
+ run_make ('maintainer-clean') if ($make && $clean);
+
# ---------------------- #
# Is it using Autoconf? #
# ---------------------- #
@@ -345,7 +398,7 @@
# will fail: the Gettext macros are missing.
#
# Therefore, we can't use the traces to decide if we use Gettext or
- # not. I guess that once Gettext move to 2.5x we will be able to,
+ # not. I guess that once Gettext moves to 2.5x we will be able to,
# but in the meanwhile forget it.
#
# We can only grep for AM_GNU_GETTEXT_VERSION in configure.ac. You
@@ -359,7 +412,7 @@
{
verb "$configure_ac: not using Gettext";
}
- elsif (!$install)
+ elsif (!$install && !$clean)
{
verb "$configure_ac: not running autopoint: --install not given";
}
@@ -519,20 +572,21 @@
# Running libtoolize. #
# -------------------- #
+ if ($uses_libltdl)
+ {
+ $libtoolize .= " --ltdl";
+ }
+
if (!$uses_libtool)
{
verb "$configure_ac: not using Libtool";
}
elsif ($install)
{
- if ($uses_libltdl)
- {
- $libtoolize .= " --ltdl";
- }
xsystem ($libtoolize);
$rerun_aclocal = 1;
}
- else
+ elsif (!$clean)
{
verb "$configure_ac: not running libtoolize: --install not given";
}
@@ -569,6 +623,7 @@
# latter runs the former, and (ii) autoconf is stricter than
# autoheader. So all in all, autoconf should give better error
# messages.
+ $autoconf .= ' --clean' if $clean;
xsystem ($autoconf);
@@ -588,7 +643,7 @@
{
verb "$configure_ac: not using Autoheader";
}
- else
+ elsif (!$clean)
{
xsystem ($autoheader);
}
@@ -610,31 +665,24 @@
xsystem ($automake);
}
+ # ---------------------- #
+ # Finalize the cleanup. #
+ # ---------------------- #
+
+ if ($clean)
+ {
+ run_aclocal ($aclocal, '--clean ' . $aclocal_flags);
+ xsystem ($libtoolize) if ($uses_libtool);
+ xsystem ($autoheader) if ($uses_autoheader);
+ system ('rm -rf autom4te.cache');
+ }
+
# -------------- #
# Running make. #
# -------------- #
- if ($make)
- {
- if (!-f "config.status")
- {
- verb "no config.status: cannot re-make";
- }
- else
- {
- xsystem ("./config.status --recheck");
- xsystem ("./config.status");
- if (!-f "Makefile")
- {
- verb "no Makefile: cannot re-make";
- }
- else
- {
- xsystem ("make");
- }
- }
- }
+ run_make () if ($make);
}
Index: lib/Autom4te/General.pm
===================================================================
RCS file: /sources/autoconf/autoconf/lib/Autom4te/General.pm,v
retrieving revision 1.37
diff -u -r1.37 General.pm
--- lib/Autom4te/General.pm 25 Aug 2006 21:21:19 -0000 1.37
+++ lib/Autom4te/General.pm 16 Jun 2007 22:47:05 -0000
@@ -1,5 +1,6 @@
# autoconf -- create `configure' using m4 macros
-# Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007 Free Software
+# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -50,7 +51,7 @@
# Variables we define and export.
my @export_vars =
- qw ($debug $force $help $me $tmp $verbose $version);
+ qw ($debug $force $clean $help $me $tmp $verbose $version);
# Functions we define and export.
my @export_subs =
@@ -94,6 +95,16 @@
use vars qw ($force);
$force = undef;
+=item C<$clean>
+
+Set this variable to 1 to remove all files that would otherwise be
+created.
+
+=cut
+
+use vars qw ($clean);
+$clean = undef;
+
=item C<$help>
Set to the help message associated to the option C<--help>.
@@ -261,6 +272,7 @@
"v|verbose" => sub { ++$verbose },
"d|debug" => sub { ++$debug },
'f|force' => \$force,
+ 'clean' => \$clean,
# User options last, so that they have precedence.
%option);
Index: tests/torture.at
===================================================================
RCS file: /sources/autoconf/autoconf/tests/torture.at,v
retrieving revision 1.82
diff -u -r1.82 torture.at
--- tests/torture.at 12 Jun 2007 11:36:57 -0000 1.82
+++ tests/torture.at 16 Jun 2007 22:47:07 -0000
@@ -1179,3 +1179,39 @@
AT_CHECK([test -f HeeHee.in])
AT_CLEANUP
+
+## --------------------- ##
+## Unbootstrap (--clean) ##
+## --------------------- ##
+
+AT_SETUP([Unbootstrap with --clean])
+AT_KEYWORDS([autoreconf])
+
+# We use aclocal (via autoreconf).
+AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
+# We need a version of aclocal that is recent enough to support --clean
+AT_CHECK([aclocal --help | grep -e --clean || exit 77], [], [ignore], [ignore])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_CONFIG_HEADERS(config.h:config.hin)
+AC_OUTPUT
+]])
+
+
+AT_DATA([config.hin], [])
+
+# Save the result of `find' to see whether we properly cleaned everything.
+AT_DATA([list.after], [])
+AT_DATA([list.before], [])
+
+# Save the list of files in the current directory.
+find . >list.before
+
+AT_CHECK([autoreconf], [0], [ignore], [ignore])
+
+AT_CHECK([autoreconf --clean], [0], [ignore], [ignore])
+find . >list.after
+AT_CHECK([diff -u list.before list.after])
+
+AT_CLEANUP
Index: ChangeLog
===================================================================
RCS file: /sources/automake/automake/ChangeLog,v
retrieving revision 1.2989
diff -u -r1.2989 ChangeLog
--- ChangeLog 3 May 2007 17:57:41 -0000 1.2989
+++ ChangeLog 16 Jun 2007 22:47:09 -0000
@@ -1,3 +1,11 @@
+2007-06-17 Benoit Sigoure <[EMAIL PROTECTED]>
+
+ * automake.in, aclocal.in: New option `--clean'.
+ ($clean, @files_installed): New.
+ * NEWS: Mention the new option.
+ * tests/Makefile.am, tests/Makefile.in: Add the new test.
+ * tests/bootclean.test: New.
+
2007-05-03 Stepan Kasal <[EMAIL PROTECTED]>
* doc/automake.texi, lib/Automake/Rule.pm: Fix typos.
Index: NEWS
===================================================================
RCS file: /sources/automake/automake/NEWS,v
retrieving revision 1.326
diff -u -r1.326 NEWS
--- NEWS 29 Mar 2007 23:01:59 -0000 1.326
+++ NEWS 16 Jun 2007 22:47:10 -0000
@@ -15,6 +15,9 @@
- install-sh supports -C, which does not update the installed file
(and its time stamps) if the contents did not change.
+ - automake and aclocal support a new `--clean' option that undoes the job
+ done by `--add-missing'.
+
Bugs fixed in 1.10a:
* Long standing bugs:
Index: aclocal.in
===================================================================
RCS file: /sources/automake/automake/aclocal.in,v
retrieving revision 1.140
diff -u -r1.140 aclocal.in
--- aclocal.in 14 Oct 2006 17:40:25 -0000 1.140
+++ aclocal.in 16 Jun 2007 22:47:10 -0000
@@ -8,7 +8,7 @@
# aclocal - create aclocal.m4 by scanning configure.ac
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006 Free Software Foundation, Inc.
+# 2005, 2006, 2007 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -77,6 +77,12 @@
# Option --force.
my $force_output = 0;
+# Option --clean.
+my $clean = 0;
+
+# Files to remove with --clean.
+my @files_installed;
+
# Modification time of the youngest dependency.
my $greatest_mtime = 0;
@@ -248,6 +254,11 @@
if $res;
unlink_tmp;
}
+ elsif ($clean)
+ {
+ # Remember that we must remove this file once we're finished.
+ push (@files_installed, $dest);
+ }
elsif (!$dry_run)
{
xsystem ('cp', $src, $dest);
@@ -773,6 +784,14 @@
return 0;
}
+ # We are now about to output `$output_file'. If we're in clean mode, we
+ # shall just stop here.
+ if ($clean)
+ {
+ push (@files_installed, $output_file);
+ return 1;
+ }
+
# Nothing to output?!
# FIXME: Shouldn't we diagnose this?
return 1 if ! length ($output);
@@ -861,6 +880,7 @@
changed (implies --install and --dry-run)
--dry-run pretend to, but do not actually update any file
--force always update output file
+ --clean remove files installed by aclocal
--help print this help, then exit
-I DIR add directory to search list for .m4 files
--install copy third-party files to the first -I directory
@@ -915,6 +935,7 @@
'diff:s' => \$diff_command,
'dry-run' => \$dry_run,
'force' => \$force_output,
+ 'clean' => \$clean,
'I=s' => [EMAIL PROTECTED],
'install' => \$install,
'output=s' => \$output_file,
@@ -986,6 +1007,11 @@
$dry_run = 1;
}
+ if ($clean && $install)
+ {
+ fatal "Cannot install and clean at the same time.";
+ }
+
if ($install && [EMAIL PROTECTED])
{
fatal ("--install should copy macros in the directory indicated by the"
@@ -1050,7 +1076,17 @@
last if write_aclocal ($output_file, keys %macro_traced);
last if $dry_run;
}
-check_acinclude;
+check_acinclude unless $clean;
+
+if ($clean)
+ {
+ foreach my $cleanfile (@files_installed)
+ {
+ unlink $cleanfile or fatal "Failed to remove `$cleanfile': $!"
+ unless not -e $cleanfile;
+ }
+ system ('rm -rf autom4te.cache');
+ }
exit $exit_code;
Index: automake.in
===================================================================
RCS file: /sources/automake/automake/automake.in,v
retrieving revision 1.1645
diff -u -r1.1645 automake.in
--- automake.in 3 May 2007 17:57:41 -0000 1.1645
+++ automake.in 16 Jun 2007 22:47:13 -0000
@@ -291,6 +291,12 @@
# TRUE if we should copy missing files; otherwise symlink if possible.
my $copy_missing = 0;
+# TRUE if we shoud remove files that would otherwise be installed (--clean).
+my $clean = 0;
+
+# List of files to be removed when we're finished (--clean).
+my @files_installed;
+
# TRUE if we should always update files that we know about.
my $force_missing = 0;
@@ -7068,7 +7074,7 @@
# The default auxiliary directory is the first
# of ., .., or ../.. that contains install-sh.
# Assume . if install-sh doesn't exist yet.
- for my $dir (qw (. .. ../..))
+ for my $dir (qw(. .. ../..))
{
if (-f "$dir/install-sh")
{
@@ -7296,6 +7302,7 @@
$macro = rvar ($macro) unless ref $macro;
if ($config_libobj_dir)
{
+ # FIXME: Do we need to put @files in @files_installed when --clean?
require_file_internal ($macro->rdef ($cond)->location, $mystrict,
$config_libobj_dir, @files);
}
@@ -7312,6 +7319,7 @@
{
my ($where, $mystrict, @files) = @_;
require_file_internal ($where, $mystrict, $config_aux_dir, @files);
+ push (@files_installed, map { $_ = $config_aux_dir . '/' . $_ } @files);
}
@@ -7532,10 +7540,17 @@
# defined or overridden variables.
$output_vars .= output_variables;
- check_typos;
-
my ($out_file) = $output_directory . '/' . $makefile_in;
+ if ($clean && -e $out_file)
+ {
+ unlink ($out_file)
+ or fatal "cannot remove $out_file: $!\n";
+ return;
+ }
+
+ check_typos;
+
if ($exit_code != 0)
{
verb "not writing $out_file because of earlier errors";
@@ -7605,6 +7620,7 @@
--version print version number, then exit
-v, --verbose verbosely list files processed
--no-force only update Makefile.in's that are out of date
+ --clean remove files installed by automake
-W, --warnings=CATEGORY report the warnings falling in CATEGORY
Dependency tracking:
@@ -7721,6 +7737,7 @@
'o|output-dir=s' => \$output_directory,
'a|add-missing' => \$add_missing,
'c|copy' => \$copy_missing,
+ 'clean' => \$clean,
'v|verbose' => sub { setup_channel 'verb', silent => 0; },
'W|warnings=s' => \&parse_warnings,
# These long options (--Werror and --Wno-error) for backward
@@ -7860,6 +7877,15 @@
}
}
+if ($clean)
+ {
+ foreach my $cleanfile (@files_installed)
+ {
+ unlink $cleanfile or fatal "Failed to remove `$cleanfile': $!"
+ unless not -e $cleanfile;
+ }
+ }
+
exit $exit_code;
Index: tests/Makefile.am
===================================================================
RCS file: /sources/automake/automake/tests/Makefile.am,v
retrieving revision 1.621
diff -u -r1.621 Makefile.am
--- tests/Makefile.am 29 Mar 2007 23:26:48 -0000 1.621
+++ tests/Makefile.am 16 Jun 2007 22:47:15 -0000
@@ -72,6 +72,7 @@
badline.test \
badprog.test \
block.test \
+bootclean.test \
bsource.test \
canon.test \
canon2.test \
Index: tests/Makefile.in
===================================================================
RCS file: /sources/automake/automake/tests/Makefile.in,v
retrieving revision 1.809
diff -u -r1.809 Makefile.in
--- tests/Makefile.in 29 Mar 2007 23:26:48 -0000 1.809
+++ tests/Makefile.in 16 Jun 2007 22:47:15 -0000
@@ -205,6 +205,7 @@
badline.test \
badprog.test \
block.test \
+bootclean.test \
bsource.test \
canon.test \
canon2.test \
Index: tests/bootclean.test
===================================================================
diff -u /dev/null tests/bootclean.test
--- /dev/null 2007-06-17 00:23:24.000000000 +0200
+++ tests/bootclean.test 2007-06-16 23:56:05.000000000 +0200
@@ -0,0 +1,56 @@
+#! /bin/sh
+# Copyright (C) 2007 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test that automake and aclocal --clean remove all the files installed
+# by --add-missing.
+
+. ./defs || exit 1
+
+set -e
+
+# Run the test in a subdir.
+mkdir frob
+cd frob
+
+# The "./." is here so we don't have to mess with subdirs.
+cat > configure.ac << 'END'
+AC_INIT([auxdir], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+END
+: > Makefile.am
+
+touch list.after
+find . >list.before
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOMAKE --clean
+$ACLOCAL --clean
+
+find . >list.after
+
+res=false
+
+diff -u list.before list.after && res=:
+
+cd ..
+rm -rf frob
+$res
Index: ChangeLog
===================================================================
RCS file: /sources/libtool/libtool/ChangeLog,v
retrieving revision 1.2468
diff -u -r1.2468 ChangeLog
--- ChangeLog 9 Jun 2007 17:46:40 -0000 1.2468
+++ ChangeLog 16 Jun 2007 22:47:18 -0000
@@ -1,3 +1,11 @@
+2007-06-17 Benoit Sigoure <[EMAIL PROTECTED]>
+
+ * libtoolize.m4sh: New option `--clean'.
+ (func_serial_update, func_keyword_update): Remove the files
+ installed by `--install' when `--clean' is passed.
+ * NEWS: Mention the new option.
+ * tests/libtoolize.at: Test the new feature.
+
2007-06-09 Charles Wilson <[EMAIL PROTECTED]>
* ltmain.m4sh (func_emit_libtool_wrapper_script):
Index: NEWS
===================================================================
RCS file: /sources/libtool/libtool/NEWS,v
retrieving revision 1.204
diff -u -r1.204 NEWS
--- NEWS 8 May 2007 14:38:50 -0000 1.204
+++ NEWS 16 Jun 2007 22:47:18 -0000
@@ -46,6 +46,8 @@
libtoolize. The new recursive and non-recursive build modes for
libltdl don't require a subconfigure any more.
The Libtool package itself builds libltdl nonrecursively.
+ - New libtoolize option: --clean. Provides a way to undo the work of
+ libtoolize in order to "un-bootstrap" a project.
- New multi-module-loader safe libltdl handle iteration APIs:
lt_dlhandle_iterate, lt_dlhandle_fetch, lt_dlhandle_map.
- New lt_dlinterface_register to maintain separation of concerns
Index: libtoolize.m4sh
===================================================================
RCS file: /sources/libtool/libtool/libtoolize.m4sh,v
retrieving revision 1.62
diff -u -r1.62 libtoolize.m4sh
--- libtoolize.m4sh 25 Mar 2007 12:12:42 -0000 1.62
+++ libtoolize.m4sh 16 Jun 2007 22:47:19 -0000
@@ -5,7 +5,7 @@
# libtoolize (GNU @PACKAGE@@TIMESTAMP@) @VERSION@
# Written by Gary V. Vaughan <[EMAIL PROTECTED]>, 2003
-# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -34,6 +34,7 @@
# -n, --dry-run print commands rather than running them
# -f, --force replace existing files
# -i, --install copy missing auxiliary files
+# --clean remove auxiliary files
# --ltdl[=DIR] install libltdl sources [default: libltdl]
# --nonrecursive prepare ltdl for non-recursive make
# -q, --quiet work silently
@@ -84,6 +85,7 @@
opt_debug=:
opt_force=false
opt_install=false
+opt_clean=false
opt_link=:
opt_ltdl=false
@@ -142,6 +144,10 @@
--install|-i) opt_install=: ;;
+ --clean) opt_clean=:
+ opt_quiet=:
+ ;;
+
--ltdl) opt_ltdl=:
if test "$#" -gt 0; then
case $1 in
@@ -724,6 +730,17 @@
my_srcfile="$my_srcdir/$my_filename"
my_destfile="$my_destdir/$my_filename"
+ if $opt_clean; then
+ if $opt_dry_run; then
+ echo rm -f "$my_destfile"
+ my_return_status=0
+ else
+ rm -f "$my_destfile"
+ my_return_status=$?
+ fi
+ return $my_return_status
+ fi
+
test -f "$my_srcfile" || func_fatal_error "\`$my_srcfile' does not exist."
if test -f "$my_destfile"; then
@@ -745,7 +762,6 @@
if $my_serial_update_p || $opt_force; then
func_copy "$my_srcfile" "$my_destfile"
- my_return_status=$?
elif test "X$my_dest_serial" = "X$my_src_serial"; then
$opt_quiet \
|| func_echo "\`$my_destfile' is already up to date."
@@ -793,6 +809,17 @@
my_srcfile="$my_srcdir/$my_filename"
my_destfile="$my_destdir/$my_filename"
+ if $opt_clean; then
+ if $opt_dry_run; then
+ echo rm -f "$my_destfile"
+ my_return_status=0
+ else
+ rm -f "$my_destfile"
+ my_return_status=$?
+ fi
+ return $my_return_status
+ fi
+
my_keyword_update_p=:
test -f "$my_srcfile" || func_fatal_error "\`$my_srcfile' does not exist."
Index: tests/libtoolize.at
===================================================================
RCS file: /sources/libtool/libtool/tests/libtoolize.at,v
retrieving revision 1.12
diff -u -r1.12 libtoolize.at
--- tests/libtoolize.at 25 Mar 2007 12:12:43 -0000 1.12
+++ tests/libtoolize.at 16 Jun 2007 22:47:19 -0000
@@ -96,6 +96,34 @@
AT_CLEANUP
+## ---------------------- ##
+## Macro un-installation. ##
+## ---------------------- ##
+
+AT_SETUP([libtoolize macro un-installation])
+
+_LT_CONFIGURE_AC
+
+# Save the result of `find' to see whether we properly cleaned everything.
+AT_DATA([list.after], [])
+AT_DATA([list.before], [])
+
+# Create the directories so that they are in list.before
+mkdir m4
+mkdir config
+
+# Save the list of files in the current directory.
+find . >list.before
+
+LT_AT_CHECK_LIBTOOLIZE([--copy], 0, [ignore])
+
+LT_AT_CHECK_LIBTOOLIZE([--clean], 0, [ignore])
+find . >list.after
+AT_CHECK([diff -u list.before list.after])
+
+AT_CLEANUP
+
+
## -------------- ##
## Serial update. ##
## -------------- ##