| 1 |
# gnulib-i18n.m4 |
| 2 |
# serial 1 |
| 3 |
dnl Copyright (C) 2005-2026 Free Software Foundation, Inc. |
| 4 |
dnl This file is free software; the Free Software Foundation |
| 5 |
dnl gives unlimited permission to copy and/or distribute it, |
| 6 |
dnl with or without modifications, as long as this notice is preserved. |
| 7 |
dnl This file is offered as-is, without any warranty. |
| 8 |
|
| 9 |
dnl From Bruno Haible. |
| 10 |
|
| 11 |
dnl Support for internationalization of Gnulib code. |
| 12 |
|
| 13 |
dnl GNULIB_I18N |
| 14 |
dnl Sets GNULIB_LOCALEDIR to indicate where to find the gnulib.mo files. |
| 15 |
dnl Also it defines GNULIB_LOCALEDIR as macro in config.h, that expands to |
| 16 |
dnl the corresponding C string. |
| 17 |
AC_DEFUN([GNULIB_I18N], |
| 18 |
[ |
| 19 |
dnl It is best to not test "$USE_NLS" here, because: It would be empty |
| 20 |
dnl in case the package is internationalized but this macro is used before |
| 21 |
dnl AM_GNU_GETTEXT. We would need to warn about this situation. But since |
| 22 |
dnl this module is used as a dependency of many packages, such a warning is |
| 23 |
dnl not welcome. |
| 24 |
|
| 25 |
dnl Determine gnulib's localedir. |
| 26 |
dnl Generally, accept an option --with-gnulib-prefix=PREFIX to indicate |
| 27 |
dnl where to find gnulib's runtime data. |
| 28 |
dnl Usually ${prefix}/share/locale, but can be influenced by the configure |
| 29 |
dnl options --datarootdir and --localedir. |
| 30 |
GNULIB_LOCALEDIR="${localedir}" |
| 31 |
AC_ARG_WITH([gnulib-prefix], |
| 32 |
[[ --with-gnulib-prefix=DIR search for gnulib's runtime data in DIR/share]], |
| 33 |
[if test "X$withval" != "X" && test "X$withval" != "Xno"; then |
| 34 |
GNULIB_LOCALEDIR="$withval/share/locale" |
| 35 |
fi |
| 36 |
]) |
| 37 |
AC_SUBST([GNULIB_LOCALEDIR]) |
| 38 |
|
| 39 |
dnl Define GNULIB_LOCALEDIR_c and GNULIB_LOCALEDIR_c_make. |
| 40 |
dnl Find the final value of GNULIB_LOCALEDIR. |
| 41 |
gl_saved_prefix="${prefix}" |
| 42 |
gl_saved_datarootdir="${datarootdir}" |
| 43 |
gl_saved_localedir="${localedir}" |
| 44 |
gl_saved_gnuliblocaledir="${GNULIB_LOCALEDIR}" |
| 45 |
dnl Unfortunately, prefix gets only finally determined at the end of |
| 46 |
dnl configure. |
| 47 |
if test "X$prefix" = "XNONE"; then |
| 48 |
prefix="$ac_default_prefix" |
| 49 |
fi |
| 50 |
eval datarootdir="$datarootdir" |
| 51 |
eval localedir="$localedir" |
| 52 |
eval GNULIB_LOCALEDIR="$GNULIB_LOCALEDIR" |
| 53 |
gl_BUILD_TO_HOST([GNULIB_LOCALEDIR]) |
| 54 |
GNULIB_LOCALEDIR="${gl_saved_gnuliblocaledir}" |
| 55 |
localedir="${gl_saved_localedir}" |
| 56 |
datarootdir="${gl_saved_datarootdir}" |
| 57 |
prefix="${gl_saved_prefix}" |
| 58 |
|
| 59 |
AC_DEFINE_UNQUOTED([GNULIB_LOCALEDIR], [${GNULIB_LOCALEDIR_c}], |
| 60 |
[Define to the directory where to find the localizations of the translation domain 'gnulib', as a C string.]) |
| 61 |
]) |