| # po.m4 |
| # serial 35 (gettext-1.0) |
| dnl Copyright (C) 1995-2026 Free Software Foundation, Inc. |
| dnl This file is free software; the Free Software Foundation |
| dnl gives unlimited permission to copy and/or distribute it, |
| dnl with or without modifications, as long as this notice is preserved. |
| dnl This file is offered as-is, without any warranty. |
| dnl |
| dnl This file can be used in projects which are not available under |
| dnl the GNU General Public License or the GNU Lesser General Public |
| dnl License but which still want to provide support for the GNU gettext |
| dnl functionality. |
| dnl Please note that the actual code of the GNU gettext library is covered |
| dnl by the GNU Lesser General Public License, and the rest of the GNU |
| dnl gettext package is covered by the GNU General Public License. |
| dnl They are *not* in the public domain. |
| |
| dnl From Ulrich Drepper, Bruno Haible. |
| |
| AC_PREREQ([2.60]) |
| |
| dnl Checks for all prerequisites of the po subdirectory. |
| AC_DEFUN([AM_PO_SUBDIRS], |
| [ |
| AC_REQUIRE([AC_PROG_MAKE_SET])dnl |
| AC_REQUIRE([AC_PROG_INSTALL])dnl |
| AC_REQUIRE([AC_PROG_MKDIR_P])dnl |
| AC_REQUIRE([AC_PROG_SED])dnl |
| AC_REQUIRE([AM_NLS])dnl |
| |
| dnl Release version of the gettext macros. This is used to ensure that |
| dnl the gettext macros and po/Makefile.in.in are in sync. |
| AC_SUBST([GETTEXT_MACRO_VERSION], [0.24]) |
| |
| dnl Perform the following tests also if --disable-nls has been given, |
| dnl because they are needed for "make dist" to work. |
| |
| dnl Search for GNU msgfmt in the PATH. |
| dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. |
| dnl The second test excludes FreeBSD msgfmt. |
| AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, |
| [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && |
| (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], |
| :) |
| AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT]) |
| |
| dnl Test whether it is GNU msgfmt >= 0.15. |
| changequote(,)dnl |
| case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in |
| '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; |
| *) GMSGFMT_015=$GMSGFMT ;; |
| esac |
| changequote([,])dnl |
| AC_SUBST([GMSGFMT_015]) |
| |
| dnl Search for GNU xgettext 0.12 or newer in the PATH. |
| dnl The first test excludes Solaris xgettext and early GNU xgettext versions. |
| dnl The second test excludes FreeBSD xgettext. |
| AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, |
| [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && |
| (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)], |
| :) |
| dnl Remove leftover from FreeBSD xgettext call. |
| rm -f messages.po |
| |
| dnl Test whether it is GNU xgettext >= 0.15. |
| changequote(,)dnl |
| case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in |
| '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; |
| *) XGETTEXT_015=$XGETTEXT ;; |
| esac |
| changequote([,])dnl |
| AC_SUBST([XGETTEXT_015]) |
| |
| dnl Search for GNU msgmerge 0.11 or newer in the PATH. |
| AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, |
| [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) |
| |
| dnl Test whether it is GNU msgmerge >= 0.20. |
| if LC_ALL=C $MSGMERGE --help | grep ' --for-msgfmt ' >/dev/null; then |
| MSGMERGE_FOR_MSGFMT_OPTION='--for-msgfmt' |
| else |
| dnl Test whether it is GNU msgmerge >= 0.12. |
| if LC_ALL=C $MSGMERGE --help | grep ' --no-fuzzy-matching ' >/dev/null; then |
| MSGMERGE_FOR_MSGFMT_OPTION='--no-fuzzy-matching --no-location --quiet' |
| else |
| dnl With these old versions, $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) is |
| dnl slow. But this is not a big problem, as such old gettext versions are |
| dnl hardly in use any more. |
| MSGMERGE_FOR_MSGFMT_OPTION='--no-location --quiet' |
| fi |
| fi |
| AC_SUBST([MSGMERGE_FOR_MSGFMT_OPTION]) |
| |
| dnl Support for AM_XGETTEXT_OPTION. |
| test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= |
| AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) |
| |
| if test -n "$ALL_LINGUAS"; then |
| test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" |
| fi |
| |
| dnl Capture the value of LINGUAS because we need it to compute CATALOGS. |
| dnl In the Makefile, call it DESIRED_LINGUAS (because there, LINGUAS denotes |
| dnl the set of available translations, given by the developer). |
| DESIRED_LINGUAS="${LINGUAS-\$(ALL_LINGUAS)}" |
| AC_SUBST([DESIRED_LINGUAS]) |
| |
| AC_CONFIG_COMMANDS([po-directories], [[ |
| for ac_file in $CONFIG_FILES; do |
| # Support "outfile[:infile[:infile...]]" |
| case "$ac_file" in |
| *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; |
| esac |
| # PO directories have a Makefile.in generated from Makefile.in.in. |
| case "$ac_file" in */Makefile.in) |
| # Adjust a relative srcdir. |
| ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` |
| ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` |
| ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` |
| # In autoconf-2.13 it is called $ac_given_srcdir. |
| # In autoconf-2.50 it is called $srcdir. |
| test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" |
| # Treat a directory as a PO directory if and only if it has a |
| # POTFILES.in file. This allows packages to have multiple PO |
| # directories under different names or in different locations. |
| if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then |
| test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" |
| cat "$ac_dir/Makefile.in" > "$ac_dir/Makefile" |
| fi |
| ;; |
| esac |
| done]], |
| []) |
| ]) |
| |
| dnl Postprocesses a Makefile in a directory containing PO files. |
| AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], |
| [ |
| sed -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp" |
| mv "$ac_file.tmp" "$ac_file" |
| ]) |
| |
| dnl Initializes the accumulator used by AM_XGETTEXT_OPTION. |
| AC_DEFUN([AM_XGETTEXT_OPTION_INIT], |
| [ |
| XGETTEXT_EXTRA_OPTIONS= |
| ]) |
| |
| dnl Registers an option to be passed to xgettext in the po subdirectory. |
| AC_DEFUN([AM_XGETTEXT_OPTION], |
| [ |
| AC_REQUIRE([AM_XGETTEXT_OPTION_INIT]) |
| XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1" |
| ]) |