1# intl sister-directory configuration rules.
2#
3
4# The idea behind this macro is that there's no need to repeat all the
5# autoconf probes done by the intl directory - it's already done them
6# for us.  In fact, there's no need even to look at the cache for the
7# answers.  All we need to do is nab a few pieces of information.
8# The intl directory is set up to make this easy, by generating a
9# small file which can be sourced as a shell script; then we produce
10# the necessary substitutions and definitions for this directory.
11
12AC_DEFUN([ZW_GNU_GETTEXT_SISTER_DIR],
13[# If we haven't got the data from the intl directory,
14# assume NLS is disabled.
15USE_NLS=no	AC_SUBST(USE_NLS)
16LIBINTL=	AC_SUBST(LIBINTL)
17LIBINTL_DEP=	AC_SUBST(LIBINTL_DEP)
18INCINTL=	AC_SUBST(INCINTL)
19XGETTEXT=	AC_SUBST(XGETTEXT)
20GMSGFMT=	AC_SUBST(GMSGFMT)
21POSUB=		AC_SUBST(POSUB)
22if test -f ../intl/config.intl; then
23  . ../intl/config.intl
24fi
25AC_MSG_CHECKING([whether NLS is requested])
26if test x"$USE_NLS" != xyes; then
27  AC_MSG_RESULT(no)
28else
29  AC_MSG_RESULT(yes)
30  AC_DEFINE(ENABLE_NLS, 1, 
31 [Define to 1 if translation of program messages to the 
32  user's native language is requested.])
33
34  AC_MSG_CHECKING(for catalogs to be installed)
35  # Look for .po and .gmo files in the source directory.
36  CATALOGS=  AC_SUBST(CATALOGS)
37  XLINGUAS=
38  for cat in $srcdir/po/*.gmo $srcdir/po/*.po; do
39    # If there aren't any .gmo files the shell will give us the
40    # literal string "../path/to/srcdir/po/*.gmo" which has to be
41    # weeded out.
42    case "$cat" in *\**)
43      continue;;
44    esac
45    # The quadruple backslash is collapsed to a double backslash
46    # by the backticks, then collapsed again by the double quotes,
47    # leaving us with one backslash in the sed expression (right
48    # before the dot that mustn't act as a wildcard).
49    cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!.gmo!"`
50    lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\.gmo!!"`
51    # The user is allowed to set LINGUAS to a list of languages to
52    # install catalogs for.  If it's empty that means "all of them."
53    if test "x$LINGUAS" = x; then
54      CATALOGS="$CATALOGS $cat"
55      XLINGUAS="$XLINGUAS $lang"
56    else
57      case "$LINGUAS" in *$lang*)
58        CATALOGS="$CATALOGS $cat"
59        XLINGUAS="$XLINGUAS $lang"
60        ;;
61      esac
62    fi
63  done
64  LINGUAS="$XLINGUAS"
65  AC_MSG_RESULT($LINGUAS)
66fi])
67