From 292597a9e10a1b178b9cff5ed27a4cca6bec50f6 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 3 Jun 2010 12:32:54 +0100 Subject: [PATCH] build: Use AS_ALL_LINGUAS The AS_ALL_LINGUAS m4 macro allows configure-time generation of the ALL_LINGUAS variable from the translations inside po/ instead of using the LINGUAS file. --- build/autotools/Makefile.am | 1 + build/autotools/as-linguas.m4 | 24 ++++++++++++++++++++++++ configure.ac | 3 +-- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 build/autotools/as-linguas.m4 diff --git a/build/autotools/Makefile.am b/build/autotools/Makefile.am index 5200d63f2..5d73468ab 100644 --- a/build/autotools/Makefile.am +++ b/build/autotools/Makefile.am @@ -10,4 +10,5 @@ EXTRA_DIST = \ introspection.m4 \ gtk-doc.m4 \ as-compiler-flag.m4 \ + as-linguas.m4 \ $(NULL) diff --git a/build/autotools/as-linguas.m4 b/build/autotools/as-linguas.m4 new file mode 100644 index 000000000..92b28f717 --- /dev/null +++ b/build/autotools/as-linguas.m4 @@ -0,0 +1,24 @@ +# Set ALL_ALL_LINGUAS based on the .po files present. Optional argument is the +# name of the po directory. $podir/LINGUAS.ignore can be used to ignore a +# subset of the po files. + +AC_DEFUN([AS_ALL_LINGUAS], +[ + AC_MSG_CHECKING([for linguas]) + podir="m4_default([$1],[$srcdir/po])" + linguas=`cd $podir && ls *.po 2>/dev/null | awk 'BEGIN { FS="."; ORS=" " } { print $[]1 }'` + if test -f "$podir/LINGUAS.ignore"; then + ALL_LINGUAS=""; + ignore_linguas=`sed -n -e 's/^\s\+\|\s\+$//g' -e '/^#/b' -e '/\S/!b' \ + -e 's/\s\+/\n/g' -e p "$podir/LINGUAS.ignore"`; + for lang in $linguas; do + if ! echo "$ignore_linguas" | grep -q "^${lang}$"; then + ALL_LINGUAS="$ALL_LINGUAS $lang"; + fi; + done; + else + ALL_LINGUAS="$linguas"; + fi; + AC_SUBST([ALL_LINGUAS]) + AC_MSG_RESULT($ALL_LINGUAS) +]) diff --git a/configure.ac b/configure.ac index 86d146f0f..426c95b43 100644 --- a/configure.ac +++ b/configure.ac @@ -1027,8 +1027,7 @@ AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The prefix for our gettext translation domains.]) - -ALL_LINGUAS="`grep -v '^#' "$srcdir/po/LINGUAS" | tr '\n' ' '`" +AS_ALL_LINGUAS AM_GLIB_GNU_GETTEXT GLIB_DEFINE_LOCALEDIR(LOCALEDIR)