maint: update all copyright year number ranges
[platform/upstream/coreutils.git] / cfg.mk
diff --git a/cfg.mk b/cfg.mk
index 780e6a8..fbc64b4 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -1,5 +1,5 @@
 # Customize maint.mk                           -*- makefile -*-
-# Copyright (C) 2003-2012 Free Software Foundation, Inc.
+# Copyright (C) 2003-2013 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
@@ -22,7 +22,8 @@ manual_title = Core GNU utilities
 url_dir_list = http://ftp.gnu.org/gnu/$(PACKAGE)
 
 # Tests not to run as part of "make distcheck".
-local-checks-to-skip =
+local-checks-to-skip = \
+  sc_proper_name_utf8_requires_ICONV
 
 # Tools used to bootstrap this package, used for "announcement".
 bootstrap-tools = autoconf,automake,gnulib,bison
@@ -44,7 +45,7 @@ export VERBOSE = yes
 # 4914152 9e
 export XZ_OPT = -8e
 
-old_NEWS_hash = a99128b9985b2e76bdcabf3e5d95ca1a
+old_NEWS_hash = b93e7e43dd35f32961c354e41211b86e
 
 # Add an exemption for sc_makefile_at_at_check.
 _makefile_at_at_check_exceptions = ' && !/^cu_install_program =/'
@@ -94,21 +95,25 @@ sc_prohibit_jm_in_m4:
 
 # Ensure that each root-requiring test is run via the "check-root" rule.
 sc_root_tests:
-       @if test -d tests \
-             && grep check-root tests/Makefile.am>/dev/null 2>&1; then \
-       t1=sc-root.expected; t2=sc-root.actual;                         \
-       grep -nl '^ *require_root_$$'                                   \
-         $$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1;            \
-       sed -n '/^root_tests =[  ]*\\$$/,/[^\]$$/p'                     \
-         $(srcdir)/tests/Makefile.am                                   \
-           | sed 's/^  *//;/^root_tests =/d'                           \
-           | tr -s '\012\\' '  ' | fmt -1 | sort > $$t2;               \
-       diff -u $$t1 $$t2 || diff=1 || diff=;                           \
+       @t1=sc-root.expected; t2=sc-root.actual;                        \
+       grep -nl '^ *require_root_$$' `$(VC_LIST) tests` | sort > $$t1; \
+       for t in $(all_root_tests); do echo $$t; done | sort > $$t2;    \
+       st=0; diff -u $$t1 $$t2 || st=1;                                \
        rm -f $$t1 $$t2;                                                \
-       test "$$diff"                                                   \
-         && { echo 'tests/Makefile.am: missing check-root action'>&2;  \
-              exit 1; } || :;                                          \
-       fi
+       exit $$st
+
+# Ensure that all version-controlled test cases are listed in $(all_tests).
+sc_tests_list_consistency:
+       @bs="\\";                                                       \
+       test_extensions_rx=`echo $(TEST_EXTENSIONS)                     \
+         | sed -e "s/ /|/g" -e "s/$$bs./$$bs$$bs./g"`;                 \
+       {                                                               \
+         for t in $(all_tests); do echo $$t; done;                     \
+         cd $(top_srcdir);                                             \
+         $(SHELL) build-aux/vc-list-files tests                        \
+           | grep -Ev '^tests/(factor/(run|create-test)|init)\.sh$$'   \
+           | $(EGREP) "$$test_extensions_rx\$$";                       \
+       } | sort | uniq -u | grep . && exit 1; :
 
 # Create a list of regular expressions matching the names
 # of files included from system.h.  Exclude a couple.
@@ -145,7 +150,6 @@ sc_sun_os_names:
          { echo '$(ME): found misuse of Sun OS version numbers' 1>&2;  \
            exit 1; } || :
 
-sc_check-AUTHORS:
 # Ensure that the list of programs and author names is accurate.
 # We need a UTF8 locale.  If a lack of locale support or a missing
 # translation inhibits printing of UTF-8 names, just skip this test.
@@ -177,6 +181,26 @@ sc_check-AUTHORS: $(all_programs)
          && diff $(au_actual) $(au_dotdot) \
          && rm -f $(au_actual) $(au_dotdot)
 
+# Each program with a non-ASCII author name must link with LIBICONV.
+sc_check-I18N-AUTHORS:
+       @cd $(srcdir)/src &&                                            \
+         for i in $$(git grep -l -w proper_name_utf8 *.c|sed 's/\.c//'); do \
+           grep -E "^src_$${i}_LDADD"' .?= .*\$$\(LIBICONV\)' local.mk \
+               > /dev/null                                             \
+             || { echo "$(ME): link rules for $$i do not include"      \
+                   '$$(LIBICONV)' 1>&2; exit 1; };                     \
+         done
+
+# Ensure %j is not used for intmax_t as it's not universally supported.
+# There are issues on HPUX for example.  But note that %ju was used between
+# coreutils 8.13 (2011-10) and 8.20 (2012-10) without any reported issue,
+# and the particular issue this check is associated with was for %*jx.
+# So we may be able to relax this restriction soon.
+sc_prohibit-j-printf-format:
+       @cd $(srcdir)/src && GIT_PAGER= git grep -n '%[0*]*j[udx]' *.c  \
+         && { echo '$(ME): Use PRI*MAX instead of %j' 1>&2; exit 1; }  \
+         || :
+
 # Look for lines longer than 80 characters, except omit:
 # - program-generated long lines in diff headers,
 # - tests involving long checksum lines, and
@@ -198,17 +222,15 @@ sc_long_lines:
 # One could grep source directly as follows:
 # grep -E " {2,6}-.*[^.]  [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$')
 # but that would miss descriptions not on the same line as the -option.
-sc_option_desc_uppercase:
+sc_option_desc_uppercase: $(ALL_MANS)
        @grep '^\\fB\\-' -A1 man/*.1 | LC_ALL=C grep '\.1.[A-Z][a-z]'   \
          && { echo 1>&2 '$@: found initial capitals in --help'; exit 1; } || :
-sc_option_desc_uppercase: $(dist_man1_MANS) \
-                          $(patsubst %,man/%.1,$(NO_INSTALL_PROGS_DEFAULT))
 
 # Ensure all man/*.[1x] files are present.
 sc_man_file_correlation: check-x-vs-1 check-programs-vs-x
 
 # Ensure that for each .x file in the 'man/' subdirectory, there is a
-# corresponding .1 file in the definition of $(dist_man1_MANS).
+# corresponding .1 file in the definition of $(EXTRA_MANS).
 # But since that expansion usually lacks programs like arch and hostname,
 # add them here manually.
 .PHONY: check-x-vs-1
@@ -217,8 +239,7 @@ check-x-vs-1:
        t=$@-t;                                                         \
        (cd $(srcdir)/man && ls -1 *.x)                                 \
          | sed 's/\.x$$//' | $(ASSORT) > $$t;                          \
-       (echo $(patsubst man/%,%,$(dist_man1_MANS))                     \
-             $(NO_INSTALL_PROGS_DEFAULT)                               \
+       (echo $(patsubst man/%,%,$(ALL_MANS))                           \
          | tr -s ' ' '\n' | sed 's/\.1$$//')                           \
          | $(ASSORT) -u | diff - $$t || { rm $$t; exit 1; };           \
        rm $$t
@@ -233,6 +254,7 @@ all-progs-but-lbracket = $(filter-out [,$(patsubst src/%,%,$(all_programs)))
 check-programs-vs-x:
        @status=0;                                      \
        for p in dummy $(all-progs-but-lbracket); do    \
+         case $$p in *.so) continue;; esac;            \
          test $$p = dummy && continue;                 \
          test $$p = ginstall && p=install || : ;       \
          test -f $(srcdir)/man/$$p.x                   \
@@ -247,17 +269,6 @@ sc_NEWS_two_empty_lines:
          || { echo '$(ME): use two empty lines to separate NEWS sections' \
                 1>&2; exit 1; } || :
 
-# Perl-based tests used to exec perl from a #!/bin/sh script.
-# Now they all start with #!/usr/bin/perl and the portability
-# infrastructure is in tests/Makefile.am.  Make sure no old-style
-# script sneaks back in.
-sc_no_exec_perl_coreutils:
-       @if test -f $(srcdir)/tests/Coreutils.pm; then                  \
-         grep '^exec  *\$$PERL.*MCoreutils' $$($(VC_LIST) tests) &&    \
-           { echo 1>&2 '$(ME): found anachronistic Perl-based tests';  \
-             exit 1; } || :;                                           \
-       fi
-
 # With split lines, don't leave an operator at end of line.
 # Instead, put it on the following line, where it is more apparent.
 # Don't bother checking for "*" at end of line, since it provokes
@@ -524,10 +535,11 @@ update-copyright-env = \
 # List syntax-check exemptions.
 exclude_file_name_regexp--sc_space_tab = \
   ^(tests/pr/|tests/misc/nl\.sh$$|gl/.*\.diff$$)
-exclude_file_name_regexp--sc_bindtextdomain = ^(gl/.*|lib/euidaccess-stat)\.c$$
+exclude_file_name_regexp--sc_bindtextdomain = \
+  ^(gl/.*|lib/euidaccess-stat|src/make-prime-list)\.c$$
 exclude_file_name_regexp--sc_trailing_blank = ^tests/pr/
 exclude_file_name_regexp--sc_system_h_headers = \
-  ^src/((system|copy)\.h|libstdbuf\.c)$$
+  ^src/((system|copy)\.h|libstdbuf\.c|make-prime-list\.c)$$
 
 _src = (false|lbracket|ls-(dir|ls|vdir)|tac-pipe|uname-(arch|uname))
 exclude_file_name_regexp--sc_require_config_h_first = \
@@ -539,22 +551,30 @@ exclude_file_name_regexp--sc_po_check = ^gl/
 exclude_file_name_regexp--sc_prohibit_always-defined_macros = \
   ^src/(seq|remove)\.c$$
 exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^tests/pr/
-exclude_file_name_regexp--sc_program_name = ^(gl/.*|lib/euidaccess-stat)\.c$$
+exclude_file_name_regexp--sc_program_name = \
+  ^(gl/.*|lib/euidaccess-stat|src/make-prime-list)\.c$$
 exclude_file_name_regexp--sc_file_system = \
-  NEWS|^(tests/init\.cfg|src/df\.c|tests/df/df-P\.sh)$$
+  NEWS|^(init\.cfg|src/df\.c|tests/df/df-P\.sh|tests/df/df-output\.sh)$$
 exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
   ^m4/stat-prog\.m4$$
 exclude_file_name_regexp--sc_prohibit_fail_0 = \
   (^.*/git-hooks/commit-msg|^tests/init\.sh|Makefile\.am|\.mk|.*\.texi)$$
 exclude_file_name_regexp--sc_prohibit_atoi_atof = ^lib/euidaccess-stat\.c$$
 
-tbi_1 = ^tests/pr/|(^gl/lib/reg.*\.c\.diff|Makefile(\.am)?|\.mk|^man/help2man)$$
+# longlong.h is maintained elsewhere.
+_ll = ^src/longlong\.h$$
+exclude_file_name_regexp--sc_useless_cpp_parens = $(_ll)
+exclude_file_name_regexp--sc_long_lines = $(_ll)
+exclude_file_name_regexp--sc_space_before_open_paren = $(_ll)
+
+tbi_1 = ^tests/pr/|(^gl/lib/reg.*\.c\.diff|\.mk|^man/help2man)$$
 tbi_2 = ^scripts/git-hooks/(pre-commit|pre-applypatch|applypatch-msg)$$
+tbi_3 = (GNU)?[Mm]akefile(\.am)?$$|$(_ll)
 exclude_file_name_regexp--sc_prohibit_tab_based_indentation = \
-  $(tbi_1)|$(tbi_2)
+  $(tbi_1)|$(tbi_2)|$(tbi_3)
 
 exclude_file_name_regexp--sc_preprocessor_indentation = \
-  ^(gl/lib/rand-isaac\.[ch]|gl/tests/test-rand-isaac\.c)$$
+  ^(gl/lib/rand-isaac\.[ch]|gl/tests/test-rand-isaac\.c)$$|$(_ll)
 exclude_file_name_regexp--sc_prohibit_stat_st_blocks = \
   ^(src/system\.h|tests/du/2g\.sh)$$
 
@@ -562,8 +582,30 @@ exclude_file_name_regexp--sc_prohibit_continued_string_alpha_in_column_1 = \
   ^src/(system\.h|od\.c|printf\.c)$$
 
 exclude_file_name_regexp--sc_prohibit_test_backticks = \
-  ^tests/(init\.sh|Makefile\.am|misc/stdbuf\.sh)$$
+  ^tests/(local\.mk|(init|misc/stdbuf|factor/create-test)\.sh)$$
 
 # Exempt test.c, since it's nominally shared, and relatively static.
 exclude_file_name_regexp--sc_prohibit_operator_at_end_of_line = \
   ^src/(ptx|test|head)\.c$$
+
+exclude_file_name_regexp--sc_error_message_uppercase = ^src/factor\.c$$
+exclude_file_name_regexp--sc_prohibit_atoi_atof = ^src/make-prime-list\.c$$
+
+# Augment AM_CFLAGS to include our per-directory options:
+AM_CFLAGS += $($(@D)_CFLAGS)
+
+src_CFLAGS = $(WARN_CFLAGS)
+lib_CFLAGS = $(GNULIB_WARN_CFLAGS)
+gnulib-tests_CFLAGS = $(GNULIB_TEST_WARN_CFLAGS)
+
+# Configuration to make the tight-scope syntax-check rule work with
+# non-recursive make.
+export _gl_TS_headers = $(srcdir)/cfg.mk
+_gl_TS_dir = .
+_gl_TS_obj_files = src/*.$(OBJEXT)
+_gl_TS_other_headers = src/*.h
+
+# Tell the tight_scope rule about an exceptional "extern" variable.
+# Normally, the rule would detect its declaration, but that uses a
+# different name, __clz_tab.
+_gl_TS_unmarked_extern_vars = factor_clz_tab