xref: /freebsd/sys/contrib/openzfs/config/po.m4 (revision e25152834cdf3b353892835a4f3b157e066a8ed4)
1*eda14cbcSMatt Macy# po.m4 serial 30 (gettext-0.20)
2*eda14cbcSMatt Macydnl Copyright (C) 1995-2014, 2016, 2018-2019 Free Software Foundation, Inc.
3*eda14cbcSMatt Macydnl This file is free software; the Free Software Foundation
4*eda14cbcSMatt Macydnl gives unlimited permission to copy and/or distribute it,
5*eda14cbcSMatt Macydnl with or without modifications, as long as this notice is preserved.
6*eda14cbcSMatt Macydnl
7*eda14cbcSMatt Macydnl This file can be used in projects which are not available under
8*eda14cbcSMatt Macydnl the GNU General Public License or the GNU Library General Public
9*eda14cbcSMatt Macydnl License but which still want to provide support for the GNU gettext
10*eda14cbcSMatt Macydnl functionality.
11*eda14cbcSMatt Macydnl Please note that the actual code of the GNU gettext library is covered
12*eda14cbcSMatt Macydnl by the GNU Library General Public License, and the rest of the GNU
13*eda14cbcSMatt Macydnl gettext package is covered by the GNU General Public License.
14*eda14cbcSMatt Macydnl They are *not* in the public domain.
15*eda14cbcSMatt Macy
16*eda14cbcSMatt Macydnl Authors:
17*eda14cbcSMatt Macydnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18*eda14cbcSMatt Macydnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
19*eda14cbcSMatt Macy
20*eda14cbcSMatt MacyAC_PREREQ([2.60])
21*eda14cbcSMatt Macy
22*eda14cbcSMatt Macydnl Checks for all prerequisites of the po subdirectory.
23*eda14cbcSMatt MacyAC_DEFUN([AM_PO_SUBDIRS],
24*eda14cbcSMatt Macy[
25*eda14cbcSMatt Macy  AC_REQUIRE([AC_PROG_MAKE_SET])dnl
26*eda14cbcSMatt Macy  AC_REQUIRE([AC_PROG_INSTALL])dnl
27*eda14cbcSMatt Macy  AC_REQUIRE([AC_PROG_MKDIR_P])dnl
28*eda14cbcSMatt Macy  AC_REQUIRE([AC_PROG_SED])dnl
29*eda14cbcSMatt Macy  AC_REQUIRE([AM_NLS])dnl
30*eda14cbcSMatt Macy
31*eda14cbcSMatt Macy  dnl Release version of the gettext macros. This is used to ensure that
32*eda14cbcSMatt Macy  dnl the gettext macros and po/Makefile.in.in are in sync.
33*eda14cbcSMatt Macy  AC_SUBST([GETTEXT_MACRO_VERSION], [0.20])
34*eda14cbcSMatt Macy
35*eda14cbcSMatt Macy  dnl Perform the following tests also if --disable-nls has been given,
36*eda14cbcSMatt Macy  dnl because they are needed for "make dist" to work.
37*eda14cbcSMatt Macy
38*eda14cbcSMatt Macy  dnl Search for GNU msgfmt in the PATH.
39*eda14cbcSMatt Macy  dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
40*eda14cbcSMatt Macy  dnl The second test excludes FreeBSD msgfmt.
41*eda14cbcSMatt Macy  AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
42*eda14cbcSMatt Macy    [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
43*eda14cbcSMatt Macy     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
44*eda14cbcSMatt Macy    :)
45*eda14cbcSMatt Macy  AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT])
46*eda14cbcSMatt Macy
47*eda14cbcSMatt Macy  dnl Test whether it is GNU msgfmt >= 0.15.
48*eda14cbcSMatt Macychangequote(,)dnl
49*eda14cbcSMatt Macy  case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
50*eda14cbcSMatt Macy    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
51*eda14cbcSMatt Macy    *) GMSGFMT_015=$GMSGFMT ;;
52*eda14cbcSMatt Macy  esac
53*eda14cbcSMatt Macychangequote([,])dnl
54*eda14cbcSMatt Macy  AC_SUBST([GMSGFMT_015])
55*eda14cbcSMatt Macy
56*eda14cbcSMatt Macy  dnl Search for GNU xgettext 0.12 or newer in the PATH.
57*eda14cbcSMatt Macy  dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
58*eda14cbcSMatt Macy  dnl The second test excludes FreeBSD xgettext.
59*eda14cbcSMatt Macy  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
60*eda14cbcSMatt Macy    [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
61*eda14cbcSMatt Macy     (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
62*eda14cbcSMatt Macy    :)
63*eda14cbcSMatt Macy  dnl Remove leftover from FreeBSD xgettext call.
64*eda14cbcSMatt Macy  rm -f messages.po
65*eda14cbcSMatt Macy
66*eda14cbcSMatt Macy  dnl Test whether it is GNU xgettext >= 0.15.
67*eda14cbcSMatt Macychangequote(,)dnl
68*eda14cbcSMatt Macy  case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
69*eda14cbcSMatt Macy    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
70*eda14cbcSMatt Macy    *) XGETTEXT_015=$XGETTEXT ;;
71*eda14cbcSMatt Macy  esac
72*eda14cbcSMatt Macychangequote([,])dnl
73*eda14cbcSMatt Macy  AC_SUBST([XGETTEXT_015])
74*eda14cbcSMatt Macy
75*eda14cbcSMatt Macy  dnl Search for GNU msgmerge 0.11 or newer in the PATH.
76*eda14cbcSMatt Macy  AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
77*eda14cbcSMatt Macy    [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
78*eda14cbcSMatt Macy
79*eda14cbcSMatt Macy  dnl Test whether it is GNU msgmerge >= 0.20.
80*eda14cbcSMatt Macy  if LC_ALL=C $MSGMERGE --help | grep ' --for-msgfmt ' >/dev/null; then
81*eda14cbcSMatt Macy    MSGMERGE_FOR_MSGFMT_OPTION='--for-msgfmt'
82*eda14cbcSMatt Macy  else
83*eda14cbcSMatt Macy    dnl Test whether it is GNU msgmerge >= 0.12.
84*eda14cbcSMatt Macy    if LC_ALL=C $MSGMERGE --help | grep ' --no-fuzzy-matching ' >/dev/null; then
85*eda14cbcSMatt Macy      MSGMERGE_FOR_MSGFMT_OPTION='--no-fuzzy-matching --no-location --quiet'
86*eda14cbcSMatt Macy    else
87*eda14cbcSMatt Macy      dnl With these old versions, $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) is
88*eda14cbcSMatt Macy      dnl slow. But this is not a big problem, as such old gettext versions are
89*eda14cbcSMatt Macy      dnl hardly in use any more.
90*eda14cbcSMatt Macy      MSGMERGE_FOR_MSGFMT_OPTION='--no-location --quiet'
91*eda14cbcSMatt Macy    fi
92*eda14cbcSMatt Macy  fi
93*eda14cbcSMatt Macy  AC_SUBST([MSGMERGE_FOR_MSGFMT_OPTION])
94*eda14cbcSMatt Macy
95*eda14cbcSMatt Macy  dnl Support for AM_XGETTEXT_OPTION.
96*eda14cbcSMatt Macy  test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
97*eda14cbcSMatt Macy  AC_SUBST([XGETTEXT_EXTRA_OPTIONS])
98*eda14cbcSMatt Macy
99*eda14cbcSMatt Macy  AC_CONFIG_COMMANDS([po-directories], [[
100*eda14cbcSMatt Macy    for ac_file in $CONFIG_FILES; do
101*eda14cbcSMatt Macy      # Support "outfile[:infile[:infile...]]"
102*eda14cbcSMatt Macy      case "$ac_file" in
103*eda14cbcSMatt Macy        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
104*eda14cbcSMatt Macy      esac
105*eda14cbcSMatt Macy      # PO directories have a Makefile.in generated from Makefile.in.in.
106*eda14cbcSMatt Macy      case "$ac_file" in */Makefile.in)
107*eda14cbcSMatt Macy        # Adjust a relative srcdir.
108*eda14cbcSMatt Macy        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
109*eda14cbcSMatt Macy        ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
110*eda14cbcSMatt Macy        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
111*eda14cbcSMatt Macy        # In autoconf-2.13 it is called $ac_given_srcdir.
112*eda14cbcSMatt Macy        # In autoconf-2.50 it is called $srcdir.
113*eda14cbcSMatt Macy        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
114*eda14cbcSMatt Macy        case "$ac_given_srcdir" in
115*eda14cbcSMatt Macy          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
116*eda14cbcSMatt Macy          /*) top_srcdir="$ac_given_srcdir" ;;
117*eda14cbcSMatt Macy          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
118*eda14cbcSMatt Macy        esac
119*eda14cbcSMatt Macy        # Treat a directory as a PO directory if and only if it has a
120*eda14cbcSMatt Macy        # POTFILES.in file. This allows packages to have multiple PO
121*eda14cbcSMatt Macy        # directories under different names or in different locations.
122*eda14cbcSMatt Macy        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
123*eda14cbcSMatt Macy          rm -f "$ac_dir/POTFILES"
124*eda14cbcSMatt Macy          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
125*eda14cbcSMatt Macy          gt_tab=`printf '\t'`
126*eda14cbcSMatt Macy          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
127*eda14cbcSMatt Macy          POMAKEFILEDEPS="POTFILES.in"
128*eda14cbcSMatt Macy          # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
129*eda14cbcSMatt Macy          # on $ac_dir but don't depend on user-specified configuration
130*eda14cbcSMatt Macy          # parameters.
131*eda14cbcSMatt Macy          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
132*eda14cbcSMatt Macy            # The LINGUAS file contains the set of available languages.
133*eda14cbcSMatt Macy            if test -n "$OBSOLETE_ALL_LINGUAS"; then
134*eda14cbcSMatt Macy              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
135*eda14cbcSMatt Macy            fi
136*eda14cbcSMatt Macy            ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
137*eda14cbcSMatt Macy            POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
138*eda14cbcSMatt Macy          else
139*eda14cbcSMatt Macy            # The set of available languages was given in configure.in.
140*eda14cbcSMatt Macy            ALL_LINGUAS=$OBSOLETE_ALL_LINGUAS
141*eda14cbcSMatt Macy          fi
142*eda14cbcSMatt Macy          # Compute POFILES
143*eda14cbcSMatt Macy          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
144*eda14cbcSMatt Macy          # Compute UPDATEPOFILES
145*eda14cbcSMatt Macy          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
146*eda14cbcSMatt Macy          # Compute DUMMYPOFILES
147*eda14cbcSMatt Macy          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
148*eda14cbcSMatt Macy          # Compute GMOFILES
149*eda14cbcSMatt Macy          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
150*eda14cbcSMatt Macy          case "$ac_given_srcdir" in
151*eda14cbcSMatt Macy            .) srcdirpre= ;;
152*eda14cbcSMatt Macy            *) srcdirpre='$(srcdir)/' ;;
153*eda14cbcSMatt Macy          esac
154*eda14cbcSMatt Macy          POFILES=
155*eda14cbcSMatt Macy          UPDATEPOFILES=
156*eda14cbcSMatt Macy          DUMMYPOFILES=
157*eda14cbcSMatt Macy          GMOFILES=
158*eda14cbcSMatt Macy          for lang in $ALL_LINGUAS; do
159*eda14cbcSMatt Macy            POFILES="$POFILES $srcdirpre$lang.po"
160*eda14cbcSMatt Macy            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
161*eda14cbcSMatt Macy            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
162*eda14cbcSMatt Macy            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
163*eda14cbcSMatt Macy          done
164*eda14cbcSMatt Macy          # CATALOGS depends on both $ac_dir and the user's LINGUAS
165*eda14cbcSMatt Macy          # environment variable.
166*eda14cbcSMatt Macy          INST_LINGUAS=
167*eda14cbcSMatt Macy          if test -n "$ALL_LINGUAS"; then
168*eda14cbcSMatt Macy            for presentlang in $ALL_LINGUAS; do
169*eda14cbcSMatt Macy              useit=no
170*eda14cbcSMatt Macy              if test "%UNSET%" != "$LINGUAS"; then
171*eda14cbcSMatt Macy                desiredlanguages="$LINGUAS"
172*eda14cbcSMatt Macy              else
173*eda14cbcSMatt Macy                desiredlanguages="$ALL_LINGUAS"
174*eda14cbcSMatt Macy              fi
175*eda14cbcSMatt Macy              for desiredlang in $desiredlanguages; do
176*eda14cbcSMatt Macy                # Use the presentlang catalog if desiredlang is
177*eda14cbcSMatt Macy                #   a. equal to presentlang, or
178*eda14cbcSMatt Macy                #   b. a variant of presentlang (because in this case,
179*eda14cbcSMatt Macy                #      presentlang can be used as a fallback for messages
180*eda14cbcSMatt Macy                #      which are not translated in the desiredlang catalog).
181*eda14cbcSMatt Macy                case "$desiredlang" in
182*eda14cbcSMatt Macy                  "$presentlang"*) useit=yes;;
183*eda14cbcSMatt Macy                esac
184*eda14cbcSMatt Macy              done
185*eda14cbcSMatt Macy              if test $useit = yes; then
186*eda14cbcSMatt Macy                INST_LINGUAS="$INST_LINGUAS $presentlang"
187*eda14cbcSMatt Macy              fi
188*eda14cbcSMatt Macy            done
189*eda14cbcSMatt Macy          fi
190*eda14cbcSMatt Macy          CATALOGS=
191*eda14cbcSMatt Macy          if test -n "$INST_LINGUAS"; then
192*eda14cbcSMatt Macy            for lang in $INST_LINGUAS; do
193*eda14cbcSMatt Macy              CATALOGS="$CATALOGS $lang.gmo"
194*eda14cbcSMatt Macy            done
195*eda14cbcSMatt Macy          fi
196*eda14cbcSMatt Macy          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
197*eda14cbcSMatt Macy          sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
198*eda14cbcSMatt Macy          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
199*eda14cbcSMatt Macy            if test -f "$f"; then
200*eda14cbcSMatt Macy              case "$f" in
201*eda14cbcSMatt Macy                *.orig | *.bak | *~) ;;
202*eda14cbcSMatt Macy                *) cat "$f" >> "$ac_dir/Makefile" ;;
203*eda14cbcSMatt Macy              esac
204*eda14cbcSMatt Macy            fi
205*eda14cbcSMatt Macy          done
206*eda14cbcSMatt Macy        fi
207*eda14cbcSMatt Macy        ;;
208*eda14cbcSMatt Macy      esac
209*eda14cbcSMatt Macy    done]],
210*eda14cbcSMatt Macy   [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
211*eda14cbcSMatt Macy    # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS.
212*eda14cbcSMatt Macy    OBSOLETE_ALL_LINGUAS="$ALL_LINGUAS"
213*eda14cbcSMatt Macy    # Capture the value of LINGUAS because we need it to compute CATALOGS.
214*eda14cbcSMatt Macy    LINGUAS="${LINGUAS-%UNSET%}"
215*eda14cbcSMatt Macy   ])
216*eda14cbcSMatt Macy])
217*eda14cbcSMatt Macy
218*eda14cbcSMatt Macydnl Postprocesses a Makefile in a directory containing PO files.
219*eda14cbcSMatt MacyAC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
220*eda14cbcSMatt Macy[
221*eda14cbcSMatt Macy  # When this code is run, in config.status, two variables have already been
222*eda14cbcSMatt Macy  # set:
223*eda14cbcSMatt Macy  # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
224*eda14cbcSMatt Macy  # - LINGUAS is the value of the environment variable LINGUAS at configure
225*eda14cbcSMatt Macy  #   time.
226*eda14cbcSMatt Macy
227*eda14cbcSMatt Macychangequote(,)dnl
228*eda14cbcSMatt Macy  # Adjust a relative srcdir.
229*eda14cbcSMatt Macy  ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
230*eda14cbcSMatt Macy  ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
231*eda14cbcSMatt Macy  ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
232*eda14cbcSMatt Macy  # In autoconf-2.13 it is called $ac_given_srcdir.
233*eda14cbcSMatt Macy  # In autoconf-2.50 it is called $srcdir.
234*eda14cbcSMatt Macy  test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
235*eda14cbcSMatt Macy  case "$ac_given_srcdir" in
236*eda14cbcSMatt Macy    .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
237*eda14cbcSMatt Macy    /*) top_srcdir="$ac_given_srcdir" ;;
238*eda14cbcSMatt Macy    *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
239*eda14cbcSMatt Macy  esac
240*eda14cbcSMatt Macy
241*eda14cbcSMatt Macy  # Find a way to echo strings without interpreting backslash.
242*eda14cbcSMatt Macy  if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
243*eda14cbcSMatt Macy    gt_echo='echo'
244*eda14cbcSMatt Macy  else
245*eda14cbcSMatt Macy    if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
246*eda14cbcSMatt Macy      gt_echo='printf %s\n'
247*eda14cbcSMatt Macy    else
248*eda14cbcSMatt Macy      echo_func () {
249*eda14cbcSMatt Macy        cat <<EOT
250*eda14cbcSMatt Macy$*
251*eda14cbcSMatt MacyEOT
252*eda14cbcSMatt Macy      }
253*eda14cbcSMatt Macy      gt_echo='echo_func'
254*eda14cbcSMatt Macy    fi
255*eda14cbcSMatt Macy  fi
256*eda14cbcSMatt Macy
257*eda14cbcSMatt Macy  # A sed script that extracts the value of VARIABLE from a Makefile.
258*eda14cbcSMatt Macy  tab=`printf '\t'`
259*eda14cbcSMatt Macy  sed_x_variable='
260*eda14cbcSMatt Macy# Test if the hold space is empty.
261*eda14cbcSMatt Macyx
262*eda14cbcSMatt Macys/P/P/
263*eda14cbcSMatt Macyx
264*eda14cbcSMatt Macyta
265*eda14cbcSMatt Macy# Yes it was empty. Look if we have the expected variable definition.
266*eda14cbcSMatt Macy/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=/{
267*eda14cbcSMatt Macy  # Seen the first line of the variable definition.
268*eda14cbcSMatt Macy  s/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=//
269*eda14cbcSMatt Macy  ba
270*eda14cbcSMatt Macy}
271*eda14cbcSMatt Macybd
272*eda14cbcSMatt Macy:a
273*eda14cbcSMatt Macy# Here we are processing a line from the variable definition.
274*eda14cbcSMatt Macy# Remove comment, more precisely replace it with a space.
275*eda14cbcSMatt Macys/#.*$/ /
276*eda14cbcSMatt Macy# See if the line ends in a backslash.
277*eda14cbcSMatt Macytb
278*eda14cbcSMatt Macy:b
279*eda14cbcSMatt Macys/\\$//
280*eda14cbcSMatt Macy# Print the line, without the trailing backslash.
281*eda14cbcSMatt Macyp
282*eda14cbcSMatt Macytc
283*eda14cbcSMatt Macy# There was no trailing backslash. The end of the variable definition is
284*eda14cbcSMatt Macy# reached. Clear the hold space.
285*eda14cbcSMatt Macys/^.*$//
286*eda14cbcSMatt Macyx
287*eda14cbcSMatt Macybd
288*eda14cbcSMatt Macy:c
289*eda14cbcSMatt Macy# A trailing backslash means that the variable definition continues in the
290*eda14cbcSMatt Macy# next line. Put a nonempty string into the hold space to indicate this.
291*eda14cbcSMatt Macys/^.*$/P/
292*eda14cbcSMatt Macyx
293*eda14cbcSMatt Macy:d
294*eda14cbcSMatt Macy'
295*eda14cbcSMatt Macychangequote([,])dnl
296*eda14cbcSMatt Macy
297*eda14cbcSMatt Macy  # Set POTFILES to the value of the Makefile variable POTFILES.
298*eda14cbcSMatt Macy  sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`
299*eda14cbcSMatt Macy  POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
300*eda14cbcSMatt Macy  # Compute POTFILES_DEPS as
301*eda14cbcSMatt Macy  #   $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
302*eda14cbcSMatt Macy  POTFILES_DEPS=
303*eda14cbcSMatt Macy  for file in $POTFILES; do
304*eda14cbcSMatt Macy    POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
305*eda14cbcSMatt Macy  done
306*eda14cbcSMatt Macy  POMAKEFILEDEPS=""
307*eda14cbcSMatt Macy
308*eda14cbcSMatt Macy  if test -n "$OBSOLETE_ALL_LINGUAS"; then
309*eda14cbcSMatt Macy    test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
310*eda14cbcSMatt Macy  fi
311*eda14cbcSMatt Macy  if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
312*eda14cbcSMatt Macy    # The LINGUAS file contains the set of available languages.
313*eda14cbcSMatt Macy    ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
314*eda14cbcSMatt Macy    POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
315*eda14cbcSMatt Macy  else
316*eda14cbcSMatt Macy    # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
317*eda14cbcSMatt Macy    sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
318*eda14cbcSMatt Macy    ALL_LINGUAS=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
319*eda14cbcSMatt Macy  fi
320*eda14cbcSMatt Macy  # Compute POFILES
321*eda14cbcSMatt Macy  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
322*eda14cbcSMatt Macy  # Compute UPDATEPOFILES
323*eda14cbcSMatt Macy  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
324*eda14cbcSMatt Macy  # Compute DUMMYPOFILES
325*eda14cbcSMatt Macy  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
326*eda14cbcSMatt Macy  # Compute GMOFILES
327*eda14cbcSMatt Macy  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
328*eda14cbcSMatt Macy  # Compute PROPERTIESFILES
329*eda14cbcSMatt Macy  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(DOMAIN)_$(lang).properties)
330*eda14cbcSMatt Macy  # Compute CLASSFILES
331*eda14cbcSMatt Macy  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(DOMAIN)_$(lang).class)
332*eda14cbcSMatt Macy  # Compute QMFILES
333*eda14cbcSMatt Macy  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
334*eda14cbcSMatt Macy  # Compute MSGFILES
335*eda14cbcSMatt Macy  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
336*eda14cbcSMatt Macy  # Compute RESOURCESDLLFILES
337*eda14cbcSMatt Macy  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
338*eda14cbcSMatt Macy  case "$ac_given_srcdir" in
339*eda14cbcSMatt Macy    .) srcdirpre= ;;
340*eda14cbcSMatt Macy    *) srcdirpre='$(srcdir)/' ;;
341*eda14cbcSMatt Macy  esac
342*eda14cbcSMatt Macy  POFILES=
343*eda14cbcSMatt Macy  UPDATEPOFILES=
344*eda14cbcSMatt Macy  DUMMYPOFILES=
345*eda14cbcSMatt Macy  GMOFILES=
346*eda14cbcSMatt Macy  PROPERTIESFILES=
347*eda14cbcSMatt Macy  CLASSFILES=
348*eda14cbcSMatt Macy  QMFILES=
349*eda14cbcSMatt Macy  MSGFILES=
350*eda14cbcSMatt Macy  RESOURCESDLLFILES=
351*eda14cbcSMatt Macy  for lang in $ALL_LINGUAS; do
352*eda14cbcSMatt Macy    POFILES="$POFILES $srcdirpre$lang.po"
353*eda14cbcSMatt Macy    UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
354*eda14cbcSMatt Macy    DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
355*eda14cbcSMatt Macy    GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
356*eda14cbcSMatt Macy    PROPERTIESFILES="$PROPERTIESFILES \$(srcdir)/\$(DOMAIN)_$lang.properties"
357*eda14cbcSMatt Macy    CLASSFILES="$CLASSFILES \$(srcdir)/\$(DOMAIN)_$lang.class"
358*eda14cbcSMatt Macy    QMFILES="$QMFILES $srcdirpre$lang.qm"
359*eda14cbcSMatt Macy    frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
360*eda14cbcSMatt Macy    MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
361*eda14cbcSMatt Macy    frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
362*eda14cbcSMatt Macy    RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
363*eda14cbcSMatt Macy  done
364*eda14cbcSMatt Macy  # CATALOGS depends on both $ac_dir and the user's LINGUAS
365*eda14cbcSMatt Macy  # environment variable.
366*eda14cbcSMatt Macy  INST_LINGUAS=
367*eda14cbcSMatt Macy  if test -n "$ALL_LINGUAS"; then
368*eda14cbcSMatt Macy    for presentlang in $ALL_LINGUAS; do
369*eda14cbcSMatt Macy      useit=no
370*eda14cbcSMatt Macy      if test "%UNSET%" != "$LINGUAS"; then
371*eda14cbcSMatt Macy        desiredlanguages="$LINGUAS"
372*eda14cbcSMatt Macy      else
373*eda14cbcSMatt Macy        desiredlanguages="$ALL_LINGUAS"
374*eda14cbcSMatt Macy      fi
375*eda14cbcSMatt Macy      for desiredlang in $desiredlanguages; do
376*eda14cbcSMatt Macy        # Use the presentlang catalog if desiredlang is
377*eda14cbcSMatt Macy        #   a. equal to presentlang, or
378*eda14cbcSMatt Macy        #   b. a variant of presentlang (because in this case,
379*eda14cbcSMatt Macy        #      presentlang can be used as a fallback for messages
380*eda14cbcSMatt Macy        #      which are not translated in the desiredlang catalog).
381*eda14cbcSMatt Macy        case "$desiredlang" in
382*eda14cbcSMatt Macy          "$presentlang"*) useit=yes;;
383*eda14cbcSMatt Macy        esac
384*eda14cbcSMatt Macy      done
385*eda14cbcSMatt Macy      if test $useit = yes; then
386*eda14cbcSMatt Macy        INST_LINGUAS="$INST_LINGUAS $presentlang"
387*eda14cbcSMatt Macy      fi
388*eda14cbcSMatt Macy    done
389*eda14cbcSMatt Macy  fi
390*eda14cbcSMatt Macy  CATALOGS=
391*eda14cbcSMatt Macy  JAVACATALOGS=
392*eda14cbcSMatt Macy  QTCATALOGS=
393*eda14cbcSMatt Macy  TCLCATALOGS=
394*eda14cbcSMatt Macy  CSHARPCATALOGS=
395*eda14cbcSMatt Macy  if test -n "$INST_LINGUAS"; then
396*eda14cbcSMatt Macy    for lang in $INST_LINGUAS; do
397*eda14cbcSMatt Macy      CATALOGS="$CATALOGS $lang.gmo"
398*eda14cbcSMatt Macy      JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
399*eda14cbcSMatt Macy      QTCATALOGS="$QTCATALOGS $lang.qm"
400*eda14cbcSMatt Macy      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
401*eda14cbcSMatt Macy      TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
402*eda14cbcSMatt Macy      frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
403*eda14cbcSMatt Macy      CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
404*eda14cbcSMatt Macy    done
405*eda14cbcSMatt Macy  fi
406*eda14cbcSMatt Macy
407*eda14cbcSMatt Macy  sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
408*eda14cbcSMatt Macy  tab=`printf '\t'`
409*eda14cbcSMatt Macy  if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
410*eda14cbcSMatt Macy    # Add dependencies that cannot be formulated as a simple suffix rule.
411*eda14cbcSMatt Macy    for lang in $ALL_LINGUAS; do
412*eda14cbcSMatt Macy      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
413*eda14cbcSMatt Macy      cat >> "$ac_file.tmp" <<EOF
414*eda14cbcSMatt Macy$frobbedlang.msg: $lang.po
415*eda14cbcSMatt Macy${tab}@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
416*eda14cbcSMatt Macy${tab}\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
417*eda14cbcSMatt MacyEOF
418*eda14cbcSMatt Macy    done
419*eda14cbcSMatt Macy  fi
420*eda14cbcSMatt Macy  if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
421*eda14cbcSMatt Macy    # Add dependencies that cannot be formulated as a simple suffix rule.
422*eda14cbcSMatt Macy    for lang in $ALL_LINGUAS; do
423*eda14cbcSMatt Macy      frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
424*eda14cbcSMatt Macy      cat >> "$ac_file.tmp" <<EOF
425*eda14cbcSMatt Macy$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
426*eda14cbcSMatt Macy${tab}@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
427*eda14cbcSMatt Macy${tab}\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
428*eda14cbcSMatt MacyEOF
429*eda14cbcSMatt Macy    done
430*eda14cbcSMatt Macy  fi
431*eda14cbcSMatt Macy  if test -n "$POMAKEFILEDEPS"; then
432*eda14cbcSMatt Macy    cat >> "$ac_file.tmp" <<EOF
433*eda14cbcSMatt MacyMakefile: $POMAKEFILEDEPS
434*eda14cbcSMatt MacyEOF
435*eda14cbcSMatt Macy  fi
436*eda14cbcSMatt Macy  mv "$ac_file.tmp" "$ac_file"
437*eda14cbcSMatt Macy])
438*eda14cbcSMatt Macy
439*eda14cbcSMatt Macydnl Initializes the accumulator used by AM_XGETTEXT_OPTION.
440*eda14cbcSMatt MacyAC_DEFUN([AM_XGETTEXT_OPTION_INIT],
441*eda14cbcSMatt Macy[
442*eda14cbcSMatt Macy  XGETTEXT_EXTRA_OPTIONS=
443*eda14cbcSMatt Macy])
444*eda14cbcSMatt Macy
445*eda14cbcSMatt Macydnl Registers an option to be passed to xgettext in the po subdirectory.
446*eda14cbcSMatt MacyAC_DEFUN([AM_XGETTEXT_OPTION],
447*eda14cbcSMatt Macy[
448*eda14cbcSMatt Macy  AC_REQUIRE([AM_XGETTEXT_OPTION_INIT])
449*eda14cbcSMatt Macy  XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"
450*eda14cbcSMatt Macy])
451