{ echo -e "$(ME): $$msg" 1>&2; exit 1; };
endef
+# _sc_search_regexp used to be named _prohibit_regexp. However,
+# upgrading to the new definition and leaving the old name undefined
+# would usually convert each custom rule using $(_prohibit_regexp)
+# (usually defined in cfg.mk) into a no-op. This definition ensures
+# that people know right away if they're still using the old name.
+# FIXME: remove in 2012.
+_prohibit_regexp = \
+ $(error '*** you need to s/_prohibit_regexp/_sc_search_regexp/, and adapt')
+
define _sc_search_regexp
dummy=; : so we do not need a semicolon before each use; \
\
sc_prohibit_HAVE_MBRTOWC:
@prohibit='\bHAVE_MBRTOWC\b' \
- halt="do not use $$re; it is always defined" \
+ halt="do not use $$prohibit; it is always defined" \
$(_sc_search_regexp)
# To use this "command" macro, you must first define two shell variables:
# Using test's -a and -o operators is not portable.
# We prefer test over [, since the latter is spelled [[ in configure.ac.
sc_prohibit_test_minus_ao:
- @re='(\<test| \[+) .+ -[ao] ' \
- msg='$(_ptm1); $(_ptm2)' \
- $(_prohibit_regexp)
+ @prohibit='(\<test| \[+) .+ -[ao] ' \
+ halt='$(_ptm1); $(_ptm2)' \
+ $(_sc_search_regexp)
# Each program that uses proper_name_utf8 must link with one of the
# ICONV libraries. Otherwise, some ICONV library must appear in LDADD.
halt='out of date copyright in $(texi); update it' \
$(_sc_search_regexp)
+# If tests/help-version exists and seems to be new enough, assume that its
+# use of init.sh and path_prepend_ is correct, and ensure that every other
+# use of init.sh is identical.
+# This is useful because help-version cross-checks prog --version
+# with $(VERSION), which verifies that its path_prepend_ invocation
+# sets PATH correctly. This is an inexpensive way to ensure that
+# the other init.sh-using tests also get it right.
+_hv_file ?= $(srcdir)/tests/help-version
+_hv_regex ?= ^ *\. [^ ]*/init\.sh
+sc_cross_check_PATH_usage_in_tests:
+ @if grep -l 'VERSION mismatch' $(_hv_file) >/dev/null \
+ && grep -lE '$(_hv_regex)' $(_hv_file) >/dev/null; then \
+ good=$$(grep -E '$(_hv_regex)' < $(_hv_file)); \
+ grep -LFx "$$good" \
+ $$(grep -lE '$(_hv_regex)' $$($(VC_LIST_EXCEPT))) \
+ | grep . && \
+ { echo "$(ME): the above files use path_prepend_ inconsistently" \
+ 1>&2; exit 1; } || :; \
+ fi
+
# #if HAVE_... will evaluate to false for any non numeric string.
# That would be flagged by using -Wundef, however gnulib currently
# tests many undefined macros, and so we can't enable that option.