Home | History | Annotate | Line # | Download | only in config
      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 
     12 AC_DEFUN([ZW_GNU_GETTEXT_SISTER_DIR],
     13 [
     14 m4_pushdef([gettext_builddir],
     15            m4_default([$1], [../gettext]))
     16 m4_pushdef([gettext_cfg],
     17            gettext_builddir[/uninstalled-config.sh])
     18 if test -f gettext_cfg; then
     19   relative_builddir='[$(top_builddir)/]gettext_builddir'
     20   .  gettext_cfg
     21 else
     22   # The sister gettext directory doesn't exist and won't collect information on
     23   # using gettext for us.  Call a bundled AM_GNU_GETTEXT.
     24   AM_GNU_GETTEXT([external])
     25 fi
     26 m4_popdef([gettext_cfg])
     27 m4_popdef([gettext_builddir])
     28 
     29 AC_SUBST([USE_NLS])
     30 AC_SUBST([LIBINTL])
     31 AC_SUBST([LIBINTL_DEP])
     32 AC_SUBST([INCINTL])
     33 AC_SUBST([XGETTEXT])
     34 AC_SUBST([GMSGFMT])
     35 AC_SUBST([POSUB])
     36 
     37 AC_MSG_CHECKING([whether NLS is requested])
     38 if test x"$USE_NLS" != xyes; then
     39   AC_MSG_RESULT(no)
     40 else
     41   AC_MSG_RESULT(yes)
     42   AC_DEFINE(ENABLE_NLS, 1, 
     43  [Define to 1 if translation of program messages to the 
     44   user's native language is requested.])
     45 
     46   AC_MSG_CHECKING(for catalogs to be installed)
     47   # Look for .po and .gmo files in the source directory.
     48   CATALOGS=  AC_SUBST(CATALOGS)
     49   XLINGUAS=
     50   for cat in $srcdir/po/*.gmo $srcdir/po/*.po; do
     51     # If there aren't any .gmo files the shell will give us the
     52     # literal string "../path/to/srcdir/po/*.gmo" which has to be
     53     # weeded out.
     54     case "$cat" in *\**)
     55       continue;;
     56     esac
     57     # The quadruple backslash is collapsed to a double backslash
     58     # by the backticks, then collapsed again by the double quotes,
     59     # leaving us with one backslash in the sed expression (right
     60     # before the dot that mustn't act as a wildcard).
     61     cat=`echo $cat | sed -e "s!$srcdir/po/!!" -e "s!\\\\.po!.gmo!"`
     62     lang=`echo $cat | sed -e "s!\\\\.gmo!!"`
     63     # The user is allowed to set LINGUAS to a list of languages to
     64     # install catalogs for.  If it's empty that means "all of them."
     65     if test "x$LINGUAS" = x; then
     66       CATALOGS="$CATALOGS $cat"
     67       XLINGUAS="$XLINGUAS $lang"
     68     else
     69       case "$LINGUAS" in *$lang*)
     70         CATALOGS="$CATALOGS $cat"
     71         XLINGUAS="$XLINGUAS $lang"
     72         ;;
     73       esac
     74     fi
     75   done
     76   LINGUAS="$XLINGUAS"
     77   AC_MSG_RESULT($LINGUAS)
     78 
     79   dnl Set up some additional variables which our po/Make-in files
     80   dnl may need.
     81 
     82   dnl For backward compatibility. Some Makefiles may be using these.
     83   DATADIRNAME=share
     84   AC_SUBST(DATADIRNAME)
     85   INSTOBJEXT=.mo
     86   AC_SUBST(INSTOBJEXT)
     87   GENCAT=gencat
     88   AC_SUBST(GENCAT)
     89   CATOBJEXT=.gmo
     90   AC_SUBST(CATOBJEXT)
     91 fi])
     92