]> git.draconx.ca Git - cdecl99.git/blob - m4/linguas.m4
Add copyright header to bootstrap.
[cdecl99.git] / m4 / linguas.m4
1 dnl Copyright © 2011 Nick Bowler
2 dnl
3 dnl Computes the set of .po and .mo files based on the LINGUAS environment
4 dnl variable.  The variable POFILES is set to the complete list of .po files,
5 dnl according to the LINGUAS file in the po directory.  The variable MOFILES
6 dnl is set to the list of .mo files that the user has requested be installed.
7 dnl Both POFILES and MOFILES are AC_SUBSTed.
8 dnl
9 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
10 dnl This is free software: you are free to do what the fuck you want to.
11 dnl There is NO WARRANTY, to the extent permitted by law.
12
13 AC_DEFUN([DX_LINGUAS], [dnl
14 AC_REQUIRE([AM_GNU_GETTEXT])
15
16 POFILES=
17 MOFILES=
18
19 if test -f "$srcdir/po/LINGUAS"; then
20         ALL_LINGUAS=`sed 's/#.*$//' "$srcdir/po/LINGUAS"`
21
22         : ${LINGUAS=all}
23         if test x"$LINGUAS" != x"all"; then
24                 # Replicate la_CC-style codes as la.
25                 LINGUAS=`printf '%s\n' "$LINGUAS" \
26                         | [sed 's/\([^_[:space:]]*\)_[^[:space:]]*/& \1/g']`
27
28                 printf '%s\n' $ALL_LINGUAS | sort > conftest.LINGUAS
29                 LINGUAS=`printf '%s\n' $LINGUAS | sort \
30                         | join - conftest.LINGUAS`
31         else
32                 LINGUAS=$ALL_LINGUAS
33         fi
34
35         # Note: $srcdir is not used here because these variables are for make.
36         set x $ALL_LINGUAS; shift
37         case ${#} in
38         0) ;;
39         *) POFILES=`printf "po/%s.po\n" "${@}"` ;;
40         esac
41
42         if test x"$USE_NLS" = x"yes"; then
43                 set x $LINGUAS; shift
44                 case ${#} in
45                 0) ;;
46                 *) MOFILES=`printf "po/%s.mo\n" "${@}"` ;;
47                 esac
48         fi
49 fi
50
51 AC_SUBST([POFILES])
52 AC_SUBST([MOFILES])
53 ])