2 # serial 32 (gettext-0.21.1)
3 dnl Copyright (C) 1995-2014, 2016, 2018-2022, 2024 Free Software Foundation,
5 dnl This file is free software; the Free Software Foundation
6 dnl gives unlimited permission to copy and/or distribute it,
7 dnl with or without modifications, as long as this notice is preserved.
9 dnl This file can be used in projects which are not available under
10 dnl the GNU General Public License or the GNU Lesser General Public
11 dnl License but which still want to provide support for the GNU gettext
13 dnl Please note that the actual code of the GNU gettext library is covered
14 dnl by the GNU Lesser General Public License, and the rest of the GNU
15 dnl gettext package is covered by the GNU General Public License.
16 dnl They are *not* in the public domain.
19 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
20 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
24 dnl Checks for all prerequisites of the po subdirectory.
25 AC_DEFUN([AM_PO_SUBDIRS],
27 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
28 AC_REQUIRE([AC_PROG_INSTALL])dnl
29 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
30 AC_REQUIRE([AC_PROG_SED])dnl
31 AC_REQUIRE([AM_NLS])dnl
33 dnl Release version of the gettext macros. This is used to ensure that
34 dnl the gettext macros and po/Makefile.in.in are in sync.
35 AC_SUBST([GETTEXT_MACRO_VERSION], [0.20])
37 dnl Perform the following tests also if --disable-nls has been given,
38 dnl because they are needed for "make dist" to work.
40 dnl Search for GNU msgfmt in the PATH.
41 dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
42 dnl The second test excludes FreeBSD msgfmt.
43 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
44 [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
45 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
47 AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT])
49 dnl Test whether it is GNU msgfmt >= 0.15.
51 case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
52 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
53 *) GMSGFMT_015=$GMSGFMT ;;
56 AC_SUBST([GMSGFMT_015])
58 dnl Search for GNU xgettext 0.12 or newer in the PATH.
59 dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
60 dnl The second test excludes FreeBSD xgettext.
61 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
62 [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
63 (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)],
65 dnl Remove leftover from FreeBSD xgettext call.
68 dnl Test whether it is GNU xgettext >= 0.15.
70 case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
71 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
72 *) XGETTEXT_015=$XGETTEXT ;;
75 AC_SUBST([XGETTEXT_015])
77 dnl Search for GNU msgmerge 0.11 or newer in the PATH.
78 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
79 [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
81 dnl Test whether it is GNU msgmerge >= 0.20.
82 if LC_ALL=C $MSGMERGE --help | grep ' --for-msgfmt ' >/dev/null; then
83 MSGMERGE_FOR_MSGFMT_OPTION='--for-msgfmt'
85 dnl Test whether it is GNU msgmerge >= 0.12.
86 if LC_ALL=C $MSGMERGE --help | grep ' --no-fuzzy-matching ' >/dev/null; then
87 MSGMERGE_FOR_MSGFMT_OPTION='--no-fuzzy-matching --no-location --quiet'
89 dnl With these old versions, $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) is
90 dnl slow. But this is not a big problem, as such old gettext versions are
91 dnl hardly in use any more.
92 MSGMERGE_FOR_MSGFMT_OPTION='--no-location --quiet'
95 AC_SUBST([MSGMERGE_FOR_MSGFMT_OPTION])
97 dnl Support for AM_XGETTEXT_OPTION.
98 test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
99 AC_SUBST([XGETTEXT_EXTRA_OPTIONS])
101 AC_CONFIG_COMMANDS([po-directories], [[
102 for ac_file in $CONFIG_FILES; do
103 # Support "outfile[:infile[:infile...]]"
105 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
107 # PO directories have a Makefile.in generated from Makefile.in.in.
108 case "$ac_file" in */Makefile.in)
109 # Adjust a relative srcdir.
110 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
111 ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
112 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
113 # In autoconf-2.13 it is called $ac_given_srcdir.
114 # In autoconf-2.50 it is called $srcdir.
115 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
116 case "$ac_given_srcdir" in
117 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
118 /*) top_srcdir="$ac_given_srcdir" ;;
119 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
121 # Treat a directory as a PO directory if and only if it has a
122 # POTFILES.in file. This allows packages to have multiple PO
123 # directories under different names or in different locations.
124 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
125 rm -f "$ac_dir/POTFILES"
126 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
128 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"
129 POMAKEFILEDEPS="POTFILES.in"
130 # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
131 # on $ac_dir but don't depend on user-specified configuration
133 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
134 # The LINGUAS file contains the set of available languages.
135 if test -n "$OBSOLETE_ALL_LINGUAS"; then
136 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
138 ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
139 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
141 # The set of available languages was given in configure.in.
142 ALL_LINGUAS=$OBSOLETE_ALL_LINGUAS
145 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
146 # Compute UPDATEPOFILES
147 # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
148 # Compute DUMMYPOFILES
149 # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
151 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
152 case "$ac_given_srcdir" in
154 *) srcdirpre='$(srcdir)/' ;;
160 for lang in $ALL_LINGUAS; do
161 POFILES="$POFILES $srcdirpre$lang.po"
162 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
163 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
164 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
166 # CATALOGS depends on both $ac_dir and the user's LINGUAS
167 # environment variable.
169 if test -n "$ALL_LINGUAS"; then
170 for presentlang in $ALL_LINGUAS; do
172 if test "%UNSET%" != "$LINGUAS"; then
173 desiredlanguages="$LINGUAS"
175 desiredlanguages="$ALL_LINGUAS"
177 for desiredlang in $desiredlanguages; do
178 # Use the presentlang catalog if desiredlang is
179 # a. equal to presentlang, or
180 # b. a variant of presentlang (because in this case,
181 # presentlang can be used as a fallback for messages
182 # which are not translated in the desiredlang catalog).
183 case "$desiredlang" in
184 "$presentlang" | "$presentlang"_* | "$presentlang".* | "$presentlang"@*)
189 if test $useit = yes; then
190 INST_LINGUAS="$INST_LINGUAS $presentlang"
195 if test -n "$INST_LINGUAS"; then
196 for lang in $INST_LINGUAS; do
197 CATALOGS="$CATALOGS $lang.gmo"
200 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
201 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"
202 for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
203 if test -f "$f"; then
205 *.orig | *.bak | *~) ;;
206 *) cat "$f" >> "$ac_dir/Makefile" ;;
214 [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
215 # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS.
216 OBSOLETE_ALL_LINGUAS="$ALL_LINGUAS"
217 # Capture the value of LINGUAS because we need it to compute CATALOGS.
218 LINGUAS="${LINGUAS-%UNSET%}"
222 dnl Postprocesses a Makefile in a directory containing PO files.
223 AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
225 # When this code is run, in config.status, two variables have already been
227 # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
228 # - LINGUAS is the value of the environment variable LINGUAS at configure
232 # Adjust a relative srcdir.
233 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
234 ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
235 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
236 # In autoconf-2.13 it is called $ac_given_srcdir.
237 # In autoconf-2.50 it is called $srcdir.
238 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
239 case "$ac_given_srcdir" in
240 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
241 /*) top_srcdir="$ac_given_srcdir" ;;
242 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
245 # Find a way to echo strings without interpreting backslash.
246 if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
249 if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
250 gt_echo='printf %s\n'
261 # A sed script that extracts the value of VARIABLE from a Makefile.
264 # Test if the hold space is empty.
269 # Yes it was empty. Look if we have the expected variable definition.
270 /^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=/{
271 # Seen the first line of the variable definition.
272 s/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=//
277 # Here we are processing a line from the variable definition.
278 # Remove comment, more precisely replace it with a space.
280 # See if the line ends in a backslash.
284 # Print the line, without the trailing backslash.
287 # There was no trailing backslash. The end of the variable definition is
288 # reached. Clear the hold space.
293 # A trailing backslash means that the variable definition continues in the
294 # next line. Put a nonempty string into the hold space to indicate this.
301 # Set POTFILES to the value of the Makefile variable POTFILES.
302 sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`
303 POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
304 # Compute POTFILES_DEPS as
305 # $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
307 for file in $POTFILES; do
308 POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
312 if test -n "$OBSOLETE_ALL_LINGUAS"; then
313 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
315 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
316 # The LINGUAS file contains the set of available languages.
317 ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
318 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
320 # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
321 sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
322 ALL_LINGUAS=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
325 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
326 # Compute UPDATEPOFILES
327 # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
328 # Compute DUMMYPOFILES
329 # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
331 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
332 # Compute PROPERTIESFILES
333 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(DOMAIN)_$(lang).properties)
335 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(DOMAIN)_$(lang).class)
337 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
339 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
340 # Compute RESOURCESDLLFILES
341 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
342 case "$ac_given_srcdir" in
344 *) srcdirpre='$(srcdir)/' ;;
355 for lang in $ALL_LINGUAS; do
356 POFILES="$POFILES $srcdirpre$lang.po"
357 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
358 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
359 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
360 PROPERTIESFILES="$PROPERTIESFILES \$(srcdir)/\$(DOMAIN)_$lang.properties"
361 CLASSFILES="$CLASSFILES \$(srcdir)/\$(DOMAIN)_$lang.class"
362 QMFILES="$QMFILES $srcdirpre$lang.qm"
363 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
364 MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
365 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/'`
366 RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
368 # CATALOGS depends on both $ac_dir and the user's LINGUAS
369 # environment variable.
371 if test -n "$ALL_LINGUAS"; then
372 for presentlang in $ALL_LINGUAS; do
374 if test "%UNSET%" != "$LINGUAS"; then
375 desiredlanguages="$LINGUAS"
377 desiredlanguages="$ALL_LINGUAS"
379 for desiredlang in $desiredlanguages; do
380 # Use the presentlang catalog if desiredlang is
381 # a. equal to presentlang, or
382 # b. a variant of presentlang (because in this case,
383 # presentlang can be used as a fallback for messages
384 # which are not translated in the desiredlang catalog).
385 case "$desiredlang" in
386 "$presentlang" | "$presentlang"_* | "$presentlang".* | "$presentlang"@*)
391 if test $useit = yes; then
392 INST_LINGUAS="$INST_LINGUAS $presentlang"
401 if test -n "$INST_LINGUAS"; then
402 for lang in $INST_LINGUAS; do
403 CATALOGS="$CATALOGS $lang.gmo"
404 JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
405 QTCATALOGS="$QTCATALOGS $lang.qm"
406 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
407 TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
408 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/'`
409 CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
413 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"
415 if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
416 # Add dependencies that cannot be formulated as a simple suffix rule.
417 for lang in $ALL_LINGUAS; do
418 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
419 cat >> "$ac_file.tmp" <<EOF
420 $frobbedlang.msg: $lang.po
421 ${tab}@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
422 ${tab}\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
426 if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
427 # Add dependencies that cannot be formulated as a simple suffix rule.
428 for lang in $ALL_LINGUAS; do
429 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/'`
430 cat >> "$ac_file.tmp" <<EOF
431 $frobbedlang/\$(DOMAIN).resources.dll: $lang.po
432 ${tab}@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
433 ${tab}\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
437 if test -n "$POMAKEFILEDEPS"; then
438 cat >> "$ac_file.tmp" <<EOF
439 Makefile: $POMAKEFILEDEPS
442 mv "$ac_file.tmp" "$ac_file"
445 dnl Initializes the accumulator used by AM_XGETTEXT_OPTION.
446 AC_DEFUN([AM_XGETTEXT_OPTION_INIT],
448 XGETTEXT_EXTRA_OPTIONS=
451 dnl Registers an option to be passed to xgettext in the po subdirectory.
452 AC_DEFUN([AM_XGETTEXT_OPTION],
454 AC_REQUIRE([AM_XGETTEXT_OPTION_INIT])
455 XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"