* top/maint.mk (sc_bindtextdomain): Check for evidence that _() will likely work.
Signed-off-by: Eric Blake <ebl...@redhat.com> --- I recently debugged a situation in libvirt where a program had not set up the i18n framework, therefore calls to _() were doing nothing. If this rule had been in place, I would have quickly detected that main() was not properly initializing gettext during 'make syntax-check'. I noticed that this gives several false positives for coreutils, for example on #ifdef'd test code in lib/euidaccess-stat.c, but such files can easily be avoided by listing them in .x-sc_bindtextdomain. Also, for a package that does not yet use gettext, it's easy enough to entirely skip this test via a cfg.mk entry. Any comments before I commit this? ChangeLog | 6 ++++++ top/maint.mk | 9 +++++++++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index c319549..78caa49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-11-11 Eric Blake <ebl...@redhat.com> + + maintainer-makefile: check for i18n setup + * top/maint.mk (sc_bindtextdomain): Check for evidence that _() + will likely work. + 2010-11-11 Christian Weisgerber <na...@mips.inka.de> (tiny change) mknod: avoid false failure with dash diff --git a/top/maint.mk b/top/maint.mk index 55aeb7b..39df47d 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -594,6 +594,15 @@ sc_program_name: halt='the above files do not call set_program_name' \ $(_sc_search_regexp) +# Ensure that each .c file containing a "main" function also +# calls bindtextdomain. +sc_bindtextdomain: + @require='bindtextdomain *\(' \ + in_vc_files='\.c$$' \ + containing='\<main *(' \ + halt='the above files do not call bindtextdomain' \ + $(_sc_search_regexp) + # Require that the final line of each test-lib.sh-using test be this one: # Exit $fail # Note: this test requires GNU grep's --label= option. -- 1.7.3.2