Reusing the maint.mk code allows for a more efficient syntax check
(fewer grep processes), and a more compact representation of what
we are really checking for in commit
1919e35.
* cfg.mk (sc_require_locale_h): Use maint.mk loop instead of
rolling our own.
Signed-off-by: Eric Blake <eblake@redhat.com>
# Require #include <locale.h> in all files that call setlocale()
sc_require_locale_h:
- @for i in $$($(VC_LIST_EXCEPT) | grep '\.[chx]$$'); do \
- if ! grep -q setlocale\( $$i ; then continue; fi ; \
- if ! grep -q '# *include <locale.h>' $$i ; then \
- echo '$(ME): missing locale.h include in' $$i 1>&2; exit 1; \
- fi; \
- done;
+ @require='include.*locale\.h' \
+ containing='setlocale *(' \
+ halt='setlocale() requires <locale.h>' \
+ $(_sc_search_regexp)
# We don't use this feature of maint.mk.
prev_version_file = /dev/null