jpayne@68: # po.m4 serial 32 (gettext-0.21.1) jpayne@68: dnl Copyright (C) 1995-2014, 2016, 2018-2022, 2024 Free Software Foundation, jpayne@68: dnl Inc. jpayne@68: dnl This file is free software; the Free Software Foundation jpayne@68: dnl gives unlimited permission to copy and/or distribute it, jpayne@68: dnl with or without modifications, as long as this notice is preserved. jpayne@68: dnl jpayne@68: dnl This file can be used in projects which are not available under jpayne@68: dnl the GNU General Public License or the GNU Lesser General Public jpayne@68: dnl License but which still want to provide support for the GNU gettext jpayne@68: dnl functionality. jpayne@68: dnl Please note that the actual code of the GNU gettext library is covered jpayne@68: dnl by the GNU Lesser General Public License, and the rest of the GNU jpayne@68: dnl gettext package is covered by the GNU General Public License. jpayne@68: dnl They are *not* in the public domain. jpayne@68: jpayne@68: dnl Authors: jpayne@68: dnl Ulrich Drepper , 1995-2000. jpayne@68: dnl Bruno Haible , 2000-2003. jpayne@68: jpayne@68: AC_PREREQ([2.60]) jpayne@68: jpayne@68: dnl Checks for all prerequisites of the po subdirectory. jpayne@68: AC_DEFUN([AM_PO_SUBDIRS], jpayne@68: [ jpayne@68: AC_REQUIRE([AC_PROG_MAKE_SET])dnl jpayne@68: AC_REQUIRE([AC_PROG_INSTALL])dnl jpayne@68: AC_REQUIRE([AC_PROG_MKDIR_P])dnl jpayne@68: AC_REQUIRE([AC_PROG_SED])dnl jpayne@68: AC_REQUIRE([AM_NLS])dnl jpayne@68: jpayne@68: dnl Release version of the gettext macros. This is used to ensure that jpayne@68: dnl the gettext macros and po/Makefile.in.in are in sync. jpayne@68: AC_SUBST([GETTEXT_MACRO_VERSION], [0.20]) jpayne@68: jpayne@68: dnl Perform the following tests also if --disable-nls has been given, jpayne@68: dnl because they are needed for "make dist" to work. jpayne@68: jpayne@68: dnl Search for GNU msgfmt in the PATH. jpayne@68: dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. jpayne@68: dnl The second test excludes FreeBSD msgfmt. jpayne@68: AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, jpayne@68: [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && jpayne@68: (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], jpayne@68: :) jpayne@68: AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT]) jpayne@68: jpayne@68: dnl Test whether it is GNU msgfmt >= 0.15. jpayne@68: changequote(,)dnl jpayne@68: case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in jpayne@68: '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; jpayne@68: *) GMSGFMT_015=$GMSGFMT ;; jpayne@68: esac jpayne@68: changequote([,])dnl jpayne@68: AC_SUBST([GMSGFMT_015]) jpayne@68: jpayne@68: dnl Search for GNU xgettext 0.12 or newer in the PATH. jpayne@68: dnl The first test excludes Solaris xgettext and early GNU xgettext versions. jpayne@68: dnl The second test excludes FreeBSD xgettext. jpayne@68: AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, jpayne@68: [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && jpayne@68: (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)], jpayne@68: :) jpayne@68: dnl Remove leftover from FreeBSD xgettext call. jpayne@68: rm -f messages.po jpayne@68: jpayne@68: dnl Test whether it is GNU xgettext >= 0.15. jpayne@68: changequote(,)dnl jpayne@68: case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in jpayne@68: '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; jpayne@68: *) XGETTEXT_015=$XGETTEXT ;; jpayne@68: esac jpayne@68: changequote([,])dnl jpayne@68: AC_SUBST([XGETTEXT_015]) jpayne@68: jpayne@68: dnl Search for GNU msgmerge 0.11 or newer in the PATH. jpayne@68: AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, jpayne@68: [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) jpayne@68: jpayne@68: dnl Test whether it is GNU msgmerge >= 0.20. jpayne@68: if LC_ALL=C $MSGMERGE --help | grep ' --for-msgfmt ' >/dev/null; then jpayne@68: MSGMERGE_FOR_MSGFMT_OPTION='--for-msgfmt' jpayne@68: else jpayne@68: dnl Test whether it is GNU msgmerge >= 0.12. jpayne@68: if LC_ALL=C $MSGMERGE --help | grep ' --no-fuzzy-matching ' >/dev/null; then jpayne@68: MSGMERGE_FOR_MSGFMT_OPTION='--no-fuzzy-matching --no-location --quiet' jpayne@68: else jpayne@68: dnl With these old versions, $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) is jpayne@68: dnl slow. But this is not a big problem, as such old gettext versions are jpayne@68: dnl hardly in use any more. jpayne@68: MSGMERGE_FOR_MSGFMT_OPTION='--no-location --quiet' jpayne@68: fi jpayne@68: fi jpayne@68: AC_SUBST([MSGMERGE_FOR_MSGFMT_OPTION]) jpayne@68: jpayne@68: dnl Support for AM_XGETTEXT_OPTION. jpayne@68: test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= jpayne@68: AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) jpayne@68: jpayne@68: AC_CONFIG_COMMANDS([po-directories], [[ jpayne@68: for ac_file in $CONFIG_FILES; do jpayne@68: # Support "outfile[:infile[:infile...]]" jpayne@68: case "$ac_file" in jpayne@68: *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; jpayne@68: esac jpayne@68: # PO directories have a Makefile.in generated from Makefile.in.in. jpayne@68: case "$ac_file" in */Makefile.in) jpayne@68: # Adjust a relative srcdir. jpayne@68: ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` jpayne@68: ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` jpayne@68: ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` jpayne@68: # In autoconf-2.13 it is called $ac_given_srcdir. jpayne@68: # In autoconf-2.50 it is called $srcdir. jpayne@68: test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" jpayne@68: case "$ac_given_srcdir" in jpayne@68: .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; jpayne@68: /*) top_srcdir="$ac_given_srcdir" ;; jpayne@68: *) top_srcdir="$ac_dots$ac_given_srcdir" ;; jpayne@68: esac jpayne@68: # Treat a directory as a PO directory if and only if it has a jpayne@68: # POTFILES.in file. This allows packages to have multiple PO jpayne@68: # directories under different names or in different locations. jpayne@68: if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then jpayne@68: rm -f "$ac_dir/POTFILES" jpayne@68: test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" jpayne@68: gt_tab=`printf '\t'` jpayne@68: 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" jpayne@68: POMAKEFILEDEPS="POTFILES.in" jpayne@68: # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend jpayne@68: # on $ac_dir but don't depend on user-specified configuration jpayne@68: # parameters. jpayne@68: if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then jpayne@68: # The LINGUAS file contains the set of available languages. jpayne@68: if test -n "$OBSOLETE_ALL_LINGUAS"; then jpayne@68: test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" jpayne@68: fi jpayne@68: ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` jpayne@68: POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" jpayne@68: else jpayne@68: # The set of available languages was given in configure.in. jpayne@68: ALL_LINGUAS=$OBSOLETE_ALL_LINGUAS jpayne@68: fi jpayne@68: # Compute POFILES jpayne@68: # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) jpayne@68: # Compute UPDATEPOFILES jpayne@68: # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) jpayne@68: # Compute DUMMYPOFILES jpayne@68: # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) jpayne@68: # Compute GMOFILES jpayne@68: # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) jpayne@68: case "$ac_given_srcdir" in jpayne@68: .) srcdirpre= ;; jpayne@68: *) srcdirpre='$(srcdir)/' ;; jpayne@68: esac jpayne@68: POFILES= jpayne@68: UPDATEPOFILES= jpayne@68: DUMMYPOFILES= jpayne@68: GMOFILES= jpayne@68: for lang in $ALL_LINGUAS; do jpayne@68: POFILES="$POFILES $srcdirpre$lang.po" jpayne@68: UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" jpayne@68: DUMMYPOFILES="$DUMMYPOFILES $lang.nop" jpayne@68: GMOFILES="$GMOFILES $srcdirpre$lang.gmo" jpayne@68: done jpayne@68: # CATALOGS depends on both $ac_dir and the user's LINGUAS jpayne@68: # environment variable. jpayne@68: INST_LINGUAS= jpayne@68: if test -n "$ALL_LINGUAS"; then jpayne@68: for presentlang in $ALL_LINGUAS; do jpayne@68: useit=no jpayne@68: if test "%UNSET%" != "$LINGUAS"; then jpayne@68: desiredlanguages="$LINGUAS" jpayne@68: else jpayne@68: desiredlanguages="$ALL_LINGUAS" jpayne@68: fi jpayne@68: for desiredlang in $desiredlanguages; do jpayne@68: # Use the presentlang catalog if desiredlang is jpayne@68: # a. equal to presentlang, or jpayne@68: # b. a variant of presentlang (because in this case, jpayne@68: # presentlang can be used as a fallback for messages jpayne@68: # which are not translated in the desiredlang catalog). jpayne@68: case "$desiredlang" in jpayne@68: "$presentlang" | "$presentlang"_* | "$presentlang".* | "$presentlang"@*) jpayne@68: useit=yes jpayne@68: ;; jpayne@68: esac jpayne@68: done jpayne@68: if test $useit = yes; then jpayne@68: INST_LINGUAS="$INST_LINGUAS $presentlang" jpayne@68: fi jpayne@68: done jpayne@68: fi jpayne@68: CATALOGS= jpayne@68: if test -n "$INST_LINGUAS"; then jpayne@68: for lang in $INST_LINGUAS; do jpayne@68: CATALOGS="$CATALOGS $lang.gmo" jpayne@68: done jpayne@68: fi jpayne@68: test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" jpayne@68: 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" jpayne@68: for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do jpayne@68: if test -f "$f"; then jpayne@68: case "$f" in jpayne@68: *.orig | *.bak | *~) ;; jpayne@68: *) cat "$f" >> "$ac_dir/Makefile" ;; jpayne@68: esac jpayne@68: fi jpayne@68: done jpayne@68: fi jpayne@68: ;; jpayne@68: esac jpayne@68: done]], jpayne@68: [# Capture the value of obsolete ALL_LINGUAS because we need it to compute jpayne@68: # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. jpayne@68: OBSOLETE_ALL_LINGUAS="$ALL_LINGUAS" jpayne@68: # Capture the value of LINGUAS because we need it to compute CATALOGS. jpayne@68: LINGUAS="${LINGUAS-%UNSET%}" jpayne@68: ]) jpayne@68: ]) jpayne@68: jpayne@68: dnl Postprocesses a Makefile in a directory containing PO files. jpayne@68: AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], jpayne@68: [ jpayne@68: # When this code is run, in config.status, two variables have already been jpayne@68: # set: jpayne@68: # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, jpayne@68: # - LINGUAS is the value of the environment variable LINGUAS at configure jpayne@68: # time. jpayne@68: jpayne@68: changequote(,)dnl jpayne@68: # Adjust a relative srcdir. jpayne@68: ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` jpayne@68: ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` jpayne@68: ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` jpayne@68: # In autoconf-2.13 it is called $ac_given_srcdir. jpayne@68: # In autoconf-2.50 it is called $srcdir. jpayne@68: test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" jpayne@68: case "$ac_given_srcdir" in jpayne@68: .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; jpayne@68: /*) top_srcdir="$ac_given_srcdir" ;; jpayne@68: *) top_srcdir="$ac_dots$ac_given_srcdir" ;; jpayne@68: esac jpayne@68: jpayne@68: # Find a way to echo strings without interpreting backslash. jpayne@68: if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then jpayne@68: gt_echo='echo' jpayne@68: else jpayne@68: if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then jpayne@68: gt_echo='printf %s\n' jpayne@68: else jpayne@68: echo_func () { jpayne@68: cat < "$ac_file.tmp" jpayne@68: tab=`printf '\t'` jpayne@68: if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then jpayne@68: # Add dependencies that cannot be formulated as a simple suffix rule. jpayne@68: for lang in $ALL_LINGUAS; do jpayne@68: frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` jpayne@68: cat >> "$ac_file.tmp" < /dev/null; then jpayne@68: # Add dependencies that cannot be formulated as a simple suffix rule. jpayne@68: for lang in $ALL_LINGUAS; do jpayne@68: 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/'` jpayne@68: cat >> "$ac_file.tmp" <> "$ac_file.tmp" <