[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
use portable awk scripts
From: |
Ralf Wildenhues |
Subject: |
use portable awk scripts |
Date: |
Thu, 22 Nov 2007 22:34:54 +0100 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Hello,
Well, `for (key in array)' is not portable awk if array is empty. This
fixes it. The question is whether we should now go back to using plain
awk instead of $(AWK) now and drop the dependency upon AC_PROG_AWK.
I fear it may uncover bugs in user code that just assumed AC_PROG_AWK,
so I haven't done it for now.
Anyway, I've applied this to master.
Cheers,
Ralf
* lib/am/tags.am (ID, TAGS, CTAGS): Make awk scripts portable again.
(CTAGS): Drop unneeded variable `here'.
diff --git a/lib/am/tags.am b/lib/am/tags.am
index 92eafd5..b3cfe6f 100644
--- a/lib/am/tags.am
+++ b/lib/am/tags.am
@@ -1,6 +1,6 @@
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
-## Free Software Foundation, Inc.
+## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003,
+## 2004, 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
@@ -28,8 +28,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
## Handle VPATH correctly.
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
@@ -73,8 +73,8 @@ TAGS: %TAGSDIRS% $(HEADERS) $(SOURCES) %CONFIG%
$(TAGS_DEPENDENCIES) \
## Handle VPATH correctly.
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
## Make sure we have something to run etags on.
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -97,15 +97,14 @@ ctags: CTAGS
CTAGS: %CTAGSDIRS% $(HEADERS) $(SOURCES) %CONFIG% $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
- here=`pwd`; \
## Make sure the list of sources is unique.
list='$(SOURCES) $(HEADERS) %CONFIG% $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
## Handle VPATH correctly.
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
## Make sure we have something to run ctags on.
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- use portable awk scripts,
Ralf Wildenhues <=