From: Akim Demaille Date: Wed, 1 Aug 2001 15:02:36 +0000 (+0000) Subject: * lib/Autom4te/General.pm (&unique): New. X-Git-Tag: AUTOCONF-2.52a~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0cd6d6a75b60c5e84a1c36476fdaba99b6c3394;p=thirdparty%2Fautoconf.git * lib/Autom4te/General.pm (&unique): New. * bin/autoscan.in (&output): Use it to issue trace requests once. --- diff --git a/ChangeLog b/ChangeLog index 743a1b753..5f468c68c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-08-01 Akim Demaille + + * lib/Autom4te/General.pm (&unique): New. + * bin/autoscan.in (&output): Use it to issue trace requests once. + 2001-08-01 Akim Demaille * lib/Autom4te/General.pm: New. diff --git a/bin/autom4te.in b/bin/autom4te.in index 660465e5e..64329e75a 100644 --- a/bin/autom4te.in +++ b/bin/autom4te.in @@ -379,7 +379,7 @@ Tracing: Report bugs to . EOF - # Help font-lock-mode find an closing back quote: ` + # Help font-lock-mode find a closing back quote: ` exit 0; } diff --git a/bin/autoscan.in b/bin/autoscan.in index 212908899..50d015533 100644 --- a/bin/autoscan.in +++ b/bin/autoscan.in @@ -544,15 +544,15 @@ sub output ($) 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"; diff --git a/lib/Autom4te/General.pm b/lib/Autom4te/General.pm index 23c1ef85e..4194aab49 100644 --- a/lib/Autom4te/General.pm +++ b/lib/Autom4te/General.pm @@ -26,7 +26,7 @@ use strict; 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 @@ -131,6 +131,26 @@ sub mktmpdir ($) } +# @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 (@)