FYI, the recent move in diffutils of $(LIBICONV) from cmp_LDADD to LDADD, a syntax-check rule began to fail. This extends the rule to recognize the new situation.
It could be slightly more efficient in some cases by determining that the only programs are in say src/, and when it finds LDADD has the requisite string, stop right away (success) rather than continuing to do the same search for each additional program. However, making it ultimately efficient would hurt readability for negligible gain. No thanks. >From bc3991768078b437cbbbe93bc1cd2eab0ca98000 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Sat, 9 Jan 2010 11:41:00 +0100 Subject: [PATCH] maint.mk: extend proper_name_utf8-vs-LIBICONV-checking rule * top/maint.mk (sc_proper_name_utf8_requires_ICONV): Adapt to work also when $(LIBICONV) is part of LDADD, rather than ${prog}_LDADD. --- ChangeLog | 6 ++++++ top/maint.mk | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4d4137e..9bacb89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-01-09 Jim Meyering <meyer...@redhat.com> + + maint.mk: extend proper_name_utf8-vs-LIBICONV-checking rule + * top/maint.mk (sc_proper_name_utf8_requires_ICONV): Adapt to work + also when $(LIBICONV) is part of LDADD, rather than ${prog}_LDADD. + 2010-01-08 Simon Josefsson <si...@josefsson.org> * lib/dup2.c (rpl_dup2): Improve comment. diff --git a/top/maint.mk b/top/maint.mk index 3cd1a93..3651543 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -524,14 +524,20 @@ sc_prohibit_S_IS_definition: msg='do not define S_IS* macros; include <sys/stat.h>' \ $(_prohibit_regexp) -# Each program that uses proper_name_utf8 must link with -# one of the ICONV libraries. +# Each program that uses proper_name_utf8 must link with one of the +# ICONV libraries. Otherwise, some ICONV library must appear in LDADD. +# The perl -0777 invocation below extracts the possibly-multi-line +# definition of LDADD from the appropriate Makefile.am and exits 0 +# when it contains "ICONV". sc_proper_name_utf8_requires_ICONV: @progs=$$(grep -l 'proper_name_utf8 ''("' $$($(VC_LIST_EXCEPT)));\ if test "x$$progs" != x; then \ fail=0; \ for p in $$progs; do \ dir=$$(dirname "$$p"); \ + perl -0777 \ + -ne 'exit !(/^LDADD =(.+?[^\\]\n)/ms && $$1 =~ /ICONV/)' \ + $$dir/Makefile.am && continue; \ base=$$(basename "$$p" .c); \ grep "$${base}_LDADD.*ICONV)" $$dir/Makefile.am > /dev/null \ || { fail=1; echo 1>&2 "$(ME): $$p uses proper_name_utf8"; }; \ -- 1.6.6.439.gaf68f