This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

36-uniq.patch


It is on purpose my uses of uniq have no &: it disables prototype
checking.

Index: ChangeLog
from  Akim Demaille  <akim@epita.fr>
	* distdir.am (GZIP_ENV): Define.
	* automake.in (&handle_dist): Don't.
	(&uniq): New.
	(&handle_dist_worker, &am_install_var): Use it.

Index: automake.in
--- automake.in Sat, 17 Feb 2001 19:04:10 +0100 akim (am/f/39_automake.i 1.43 755)
+++ automake.in Sat, 17 Feb 2001 19:23:48 +0100 akim (am/f/39_automake.i 1.43 755)
@@ -421,17 +421,36 @@

 ################################################################

-
 # prog_error (@PRINT-ME)
 # ----------------------
 # Signal a programming error, display PRINT-ME, and exit 1.
-sub prog_error
+sub prog_error (@)
 {
     print STDERR "automake: programming error: @_\n";
     exit 1;
 }


+# @RES
+# uniq (@LIST)
+# ------------
+# Return LIST with no duplicates.
+sub uniq (@)
+{
+   my @res = ();
+   my %seen = ();
+   foreach my $item (@_)
+     {
+       if (! defined $seen{$item})
+	 {
+	   $seen{$item} = 1;
+	   push (@res, $item);
+	 }
+     }
+   return @res;
+}
+
+
 ################################################################

 # Parse command line.
@@ -2629,18 +2648,9 @@ sub handle_dist_worker
 	    $dist_subdir_name = 'DIST_SUBDIRS';
 	    if (! &variable_defined ('DIST_SUBDIRS'))
 	    {
-		local (@full_list) = &variable_value_as_list ('SUBDIRS',
-							      'all');
-		local (@ds_list, %uniq, $iter);
-		foreach $iter (@full_list)
-		{
-		    if (! defined $uniq{$iter})
-		    {
-			$uniq{$iter} = 1;
-			push (@ds_list, $iter);
-		    }
-		}
-		&define_pretty_variable ('DIST_SUBDIRS', '', @ds_list);
+		&define_pretty_variable
+		  ('DIST_SUBDIRS', '',
+		   uniq (&variable_value_as_list ('SUBDIRS', 'all')));
 	    }
 	}
 	else
@@ -2754,7 +2764,6 @@ sub handle_dist

     # Some boilerplate.
     $output_vars .= &file_contents ('dist-vars') . "\n";
-    &define_variable ('GZIP_ENV', '--best');

     # Put these things in rules section so it is easier for whoever
     # reads Makefile.in.
@@ -7374,9 +7383,7 @@ sub am_install_var
     # Make the result unique.  This lets the user use conditionals in
     # a natural way, but still lets us program lazily -- we don't have
     # to worry about handling a particular object more than once.
-    local (%uniquify) = ();
-    grep ($uniquify{$_} = 1, @result);
-    return sort keys %uniquify;
+    return uniq (sort @result);
 }


Index: dist-vars.am
--- dist-vars.am Sat, 13 Jan 2001 18:11:09 +0100 akim (am/g/41_dist-vars. 1.1 644)
+++ dist-vars.am Sat, 17 Feb 2001 19:05:04 +0100 akim (am/g/41_dist-vars. 1.1 644)
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright 1994, 1995, 1996, 1999 Free Software Foundation, Inc.
+## Copyright 1994, 1995, 1996, 1999, 2001 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
Index: distdir.am
--- distdir.am Sat, 17 Feb 2001 19:04:10 +0100 akim (am/h/17_distdir.am 1.6 644)
+++ distdir.am Sat, 17 Feb 2001 19:05:28 +0100 akim (am/h/17_distdir.am 1.6 644)
@@ -123,6 +123,7 @@
 ## the only reason) is that some versions of tar (e.g., OSF1)
 ## interpret `-z' differently.

+?TOPDIR?GZIP_ENV = --best
 ?TOPDIR?.PHONY: dist-all dist
 ?TOPDIR?dist-all: dist
 ?TOPDIR?dist: distdir
Index: tests/Makefile.in
--- tests/Makefile.in Sat, 17 Feb 2001 17:56:59 +0100 akim (am/h/14_Makefile.i 1.12 644)
+++ tests/Makefile.in Sat, 17 Feb 2001 19:24:01 +0100 akim (am/h/14_Makefile.i 1.12 644)
@@ -355,7 +355,6 @@

 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)

-GZIP_ENV = --best
 all: all-am
 .SUFFIXES:
 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
Index: m4/Makefile.in
--- m4/Makefile.in Sat, 17 Feb 2001 17:56:59 +0100 akim (am/h/15_Makefile.i 1.11 644)
+++ m4/Makefile.in Sat, 17 Feb 2001 19:24:00 +0100 akim (am/h/15_Makefile.i 1.11 644)
@@ -93,7 +93,6 @@

 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)

-GZIP_ENV = --best
 all: all-am
 .SUFFIXES:
 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
Index: Makefile.in
--- Makefile.in Sat, 17 Feb 2001 19:04:10 +0100 akim (am/h/16_Makefile.i 1.14 644)
+++ Makefile.in Sat, 17 Feb 2001 19:24:00 +0100 akim (am/h/16_Makefile.i 1.14 644)
@@ -134,7 +134,6 @@

 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)

-GZIP_ENV = --best
 DIST_SUBDIRS =  $(SUBDIRS)
 all: all-recursive
 .SUFFIXES:
@@ -482,6 +481,8 @@
 	echo "$$banner"; \
 	echo "$$dashes"

+GZIP_ENV = --best
+
 distdir: $(DISTFILES)
 	@if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" >/dev/null; then :; else \
 	  echo "NEWS not updated; not releasing" 1>&2; \
@@ -519,7 +520,6 @@
 	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
 	|| chmod -R a+r $(distdir)
-
 dist: distdir
 	$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
 	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]