* bin/autoscan.in (&output): Use it to issue trace requests once.
+2001-08-01 Akim Demaille <akim@epita.fr>
+
+ * lib/Autom4te/General.pm (&unique): New.
+ * bin/autoscan.in (&output): Use it to issue trace requests once.
+
2001-08-01 Akim Demaille <akim@epita.fr>
* lib/Autom4te/General.pm: New.
Report bugs to <bug-autoconf\@gnu.org>.
EOF
- # Help font-lock-mode find an closing back quote: `
+ # Help font-lock-mode find a closing back quote: `
exit 0;
}
sub check_configure_ac ($)
{
my ($configure_ac) = @_;
- my ($trace_option) = '';
# Find what needed macros are invoked in CONFIGURE_AC.
- foreach my $macro (sort keys %needed_macros)
- {
- $macro =~ s/\(.*//;
- $trace_option .= " -t $macro";
- }
+ # I'd be very happy if someone could explain to me why sort (uniq ...)
+ # doesn't work properly: I need `uniq (sort ...)'. --akim
+ my $trace_option =
+ join (' -t ', '',
+ uniq (sort (map { s/\(.*//; $_ } keys %needed_macros)));
+ verbose "running: $autoconf -A $datadir $trace_option $configure_ac";
my $traces =
new IO::File "$autoconf -A $datadir $trace_option $configure_ac|"
or die "$me: cannot create read traces: $!\n";
use vars qw (@ISA @EXPORT $me);
@ISA = qw (Exporter);
-@EXPORT = qw (&find_configure_ac &find_peer &mktmpdir &verbose &xsystem
+@EXPORT = qw (&find_configure_ac &find_peer &mktmpdir &uniq &verbose &xsystem
$me $verbose $debug $tmp);
# Variable we share with the main package. Be sure to have a single
}
+# @RES
+# uniq (@LIST)
+# ------------
+# Return LIST with no duplicates.
+sub uniq (@)
+{
+ my @res = ();
+ my %seen = ();
+ foreach my $item (@_)
+ {
+ if (! exists $seen{$item})
+ {
+ $seen{$item} = 1;
+ push (@res, $item);
+ }
+ }
+ return wantarray ? @res : "@res";
+}
+
+
# verbose
# -------
sub verbose (@)