| 1 | | # Macro to add for using GNU gettext. |
|---|
| 2 | | # Ulrich Drepper <drepper@cygnus.com>, 1995. |
|---|
| 3 | | # |
|---|
| 4 | | # This file can be copied and used freely without restrictions. It can |
|---|
| 5 | | # be used in projects which are not available under the GNU General Public |
|---|
| 6 | | # License or the GNU Library General Public License but which still want |
|---|
| 7 | | # to provide support for the GNU gettext functionality. |
|---|
| 8 | | # Please note that the actual code of the GNU gettext library is covered |
|---|
| 9 | | # by the GNU Library General Public License, and the rest of the GNU |
|---|
| 10 | | # gettext package package is covered by the GNU General Public License. |
|---|
| 11 | | # They are *not* in the public domain. |
|---|
| 12 | | |
|---|
| 13 | | # serial 10 |
|---|
| 14 | | |
|---|
| 15 | | dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]). |
|---|
| 16 | | dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library |
|---|
| | 1 | # gettext.m4 serial 17 (gettext-0.11.5) |
|---|
| | 2 | dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. |
|---|
| | 3 | dnl This file is free software, distributed under the terms of the GNU |
|---|
| | 4 | dnl General Public License. As a special exception to the GNU General |
|---|
| | 5 | dnl Public License, this file may be distributed as part of a program |
|---|
| | 6 | dnl that contains a configuration script generated by Autoconf, under |
|---|
| | 7 | dnl the same distribution terms as the rest of that program. |
|---|
| | 8 | dnl |
|---|
| | 9 | dnl This file can can be used in projects which are not available under |
|---|
| | 10 | dnl the GNU General Public License or the GNU Library General Public |
|---|
| | 11 | dnl License but which still want to provide support for the GNU gettext |
|---|
| | 12 | dnl functionality. |
|---|
| | 13 | dnl Please note that the actual code of the GNU gettext library is covered |
|---|
| | 14 | dnl by the GNU Library General Public License, and the rest of the GNU |
|---|
| | 15 | dnl gettext package package is covered by the GNU General Public License. |
|---|
| | 16 | dnl They are *not* in the public domain. |
|---|
| | 17 | |
|---|
| | 18 | dnl Authors: |
|---|
| | 19 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. |
|---|
| | 20 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2002. |
|---|
| | 21 | |
|---|
| | 22 | dnl Macro to add for using GNU gettext. |
|---|
| | 23 | |
|---|
| | 24 | dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). |
|---|
| | 25 | dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The |
|---|
| | 26 | dnl default (if it is not specified or empty) is 'no-libtool'. |
|---|
| | 27 | dnl INTLSYMBOL should be 'external' for packages with no intl directory, |
|---|
| | 28 | dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. |
|---|
| | 29 | dnl If INTLSYMBOL is 'use-libtool', then a libtool library |
|---|
| 43 | | AC_DEFUN([AM_WITH_NLS], |
|---|
| 44 | | [AC_MSG_CHECKING([whether NLS is requested]) |
|---|
| 45 | | dnl Default is enabled NLS |
|---|
| 46 | | AC_ARG_ENABLE(nls, |
|---|
| 47 | | [ --disable-nls do not use Native Language Support], |
|---|
| 48 | | USE_NLS=$enableval, USE_NLS=yes) |
|---|
| 49 | | AC_MSG_RESULT($USE_NLS) |
|---|
| 50 | | AC_SUBST(USE_NLS) |
|---|
| 51 | | |
|---|
| | 59 | AC_DEFUN([AM_GNU_GETTEXT], |
|---|
| | 60 | [ |
|---|
| | 61 | dnl Argument checking. |
|---|
| | 62 | ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , |
|---|
| | 63 | [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT |
|---|
| | 64 | ])])])])]) |
|---|
| | 65 | ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , |
|---|
| | 66 | [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT |
|---|
| | 67 | ])])])]) |
|---|
| | 68 | define(gt_included_intl, ifelse([$1], [external], [no], [yes])) |
|---|
| | 69 | define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) |
|---|
| | 70 | |
|---|
| | 71 | AC_REQUIRE([AM_PO_SUBDIRS])dnl |
|---|
| | 72 | ifelse(gt_included_intl, yes, [ |
|---|
| | 73 | AC_REQUIRE([AM_INTL_SUBDIR])dnl |
|---|
| | 74 | ]) |
|---|
| | 75 | |
|---|
| | 76 | dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. |
|---|
| | 77 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
|---|
| | 78 | AC_REQUIRE([AC_LIB_RPATH]) |
|---|
| | 79 | |
|---|
| | 80 | dnl Sometimes libintl requires libiconv, so first search for libiconv. |
|---|
| | 81 | dnl Ideally we would do this search only after the |
|---|
| | 82 | dnl if test "$USE_NLS" = "yes"; then |
|---|
| | 83 | dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then |
|---|
| | 84 | dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT |
|---|
| | 85 | dnl the configure script would need to contain the same shell code |
|---|
| | 86 | dnl again, outside any 'if'. There are two solutions: |
|---|
| | 87 | dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. |
|---|
| | 88 | dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. |
|---|
| | 89 | dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not |
|---|
| | 90 | dnl documented, we avoid it. |
|---|
| | 91 | ifelse(gt_included_intl, yes, , [ |
|---|
| | 92 | AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) |
|---|
| | 93 | ]) |
|---|
| | 94 | |
|---|
| | 95 | AC_MSG_CHECKING([whether NLS is requested]) |
|---|
| | 96 | dnl Default is enabled NLS |
|---|
| | 97 | AC_ARG_ENABLE(nls, |
|---|
| | 98 | [ --disable-nls do not use Native Language Support], |
|---|
| | 99 | USE_NLS=$enableval, USE_NLS=yes) |
|---|
| | 100 | AC_MSG_RESULT($USE_NLS) |
|---|
| | 101 | AC_SUBST(USE_NLS) |
|---|
| | 102 | |
|---|
| | 103 | ifelse(gt_included_intl, yes, [ |
|---|
| 76 | | define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc]) |
|---|
| 77 | | define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl]) |
|---|
| 78 | | |
|---|
| 79 | | AC_CHECK_HEADER(libintl.h, |
|---|
| 80 | | [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, |
|---|
| 81 | | [AC_TRY_LINK([#include <libintl.h> |
|---|
| 82 | | extern int _nl_msg_cat_cntr;], |
|---|
| 83 | | [bindtextdomain ("", ""); |
|---|
| 84 | | return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], |
|---|
| 85 | | gt_cv_func_gnugettext_libc=yes, |
|---|
| 86 | | gt_cv_func_gnugettext_libc=no)]) |
|---|
| 87 | | |
|---|
| 88 | | if test "$gt_cv_func_gnugettext_libc" != "yes"; then |
|---|
| 89 | | AC_CACHE_CHECK([for GNU gettext in libintl], |
|---|
| 90 | | gt_cv_func_gnugettext_libintl, |
|---|
| 91 | | [gt_save_LIBS="$LIBS" |
|---|
| 92 | | LIBS="$LIBS -lintl $LIBICONV" |
|---|
| 93 | | AC_TRY_LINK([#include <libintl.h> |
|---|
| 94 | | extern int _nl_msg_cat_cntr;], |
|---|
| 95 | | [bindtextdomain ("", ""); |
|---|
| 96 | | return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], |
|---|
| 97 | | gt_cv_func_gnugettext_libintl=yes, |
|---|
| 98 | | gt_cv_func_gnugettext_libintl=no) |
|---|
| 99 | | LIBS="$gt_save_LIBS"]) |
|---|
| 100 | | fi |
|---|
| 101 | | |
|---|
| 102 | | dnl If an already present or preinstalled GNU gettext() is found, |
|---|
| 103 | | dnl use it. But if this macro is used in GNU gettext, and GNU |
|---|
| 104 | | dnl gettext is already preinstalled in libintl, we update this |
|---|
| 105 | | dnl libintl. (Cf. the install rule in intl/Makefile.in.) |
|---|
| 106 | | if test "$gt_cv_func_gnugettext_libc" = "yes" \ |
|---|
| 107 | | || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ |
|---|
| 108 | | && test "$PACKAGE" != gettext; }; then |
|---|
| 109 | | AC_DEFINE(HAVE_GETTEXT, 1, |
|---|
| 110 | | [Define if the GNU gettext() function is already present or preinstalled.]) |
|---|
| 111 | | |
|---|
| 112 | | if test "$gt_cv_func_gnugettext_libintl" = "yes"; then |
|---|
| 113 | | dnl If iconv() is in a separate libiconv library, then anyone |
|---|
| 114 | | dnl linking with libintl{.a,.so} also needs to link with |
|---|
| 115 | | dnl libiconv. |
|---|
| 116 | | INTLLIBS="-lintl $LIBICONV" |
|---|
| 117 | | fi |
|---|
| 118 | | |
|---|
| 119 | | gt_save_LIBS="$LIBS" |
|---|
| 120 | | LIBS="$LIBS $INTLLIBS" |
|---|
| 121 | | AC_CHECK_FUNCS(dcgettext) |
|---|
| 122 | | LIBS="$gt_save_LIBS" |
|---|
| 123 | | |
|---|
| 124 | | dnl Search for GNU msgfmt in the PATH. |
|---|
| 125 | | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, |
|---|
| 126 | | [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) |
|---|
| 127 | | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) |
|---|
| 128 | | |
|---|
| 129 | | dnl Search for GNU xgettext in the PATH. |
|---|
| 130 | | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, |
|---|
| 131 | | [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) |
|---|
| 132 | | |
|---|
| 133 | | CATOBJEXT=.gmo |
|---|
| 134 | | fi |
|---|
| 135 | | ]) |
|---|
| 136 | | |
|---|
| 137 | | if test "$CATOBJEXT" = "NONE"; then |
|---|
| 138 | | dnl GNU gettext is not found in the C library. |
|---|
| 139 | | dnl Fall back on GNU gettext library. |
|---|
| 140 | | nls_cv_use_gnu_gettext=yes |
|---|
| | 130 | define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) |
|---|
| | 131 | define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) |
|---|
| | 132 | define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) |
|---|
| | 133 | |
|---|
| | 134 | AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, |
|---|
| | 135 | [AC_TRY_LINK([#include <libintl.h> |
|---|
| | 136 | ]ifelse([$2], [need-formatstring-macros], |
|---|
| | 137 | [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION |
|---|
| | 138 | #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) |
|---|
| | 139 | #endif |
|---|
| | 140 | changequote(,)dnl |
|---|
| | 141 | typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; |
|---|
| | 142 | changequote([,])dnl |
|---|
| | 143 | ], [])[extern int _nl_msg_cat_cntr; |
|---|
| | 144 | extern int *_nl_domain_bindings;], |
|---|
| | 145 | [bindtextdomain ("", ""); |
|---|
| | 146 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], |
|---|
| | 147 | gt_cv_func_gnugettext_libc=yes, |
|---|
| | 148 | gt_cv_func_gnugettext_libc=no)]) |
|---|
| | 149 | |
|---|
| | 150 | if test "$gt_cv_func_gnugettext_libc" != "yes"; then |
|---|
| | 151 | dnl Sometimes libintl requires libiconv, so first search for libiconv. |
|---|
| | 152 | ifelse(gt_included_intl, yes, , [ |
|---|
| | 153 | AM_ICONV_LINK |
|---|
| | 154 | ]) |
|---|
| | 155 | dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL |
|---|
| | 156 | dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) |
|---|
| | 157 | dnl because that would add "-liconv" to LIBINTL and LTLIBINTL |
|---|
| | 158 | dnl even if libiconv doesn't exist. |
|---|
| | 159 | AC_LIB_LINKFLAGS_BODY([intl]) |
|---|
| | 160 | AC_CACHE_CHECK([for GNU gettext in libintl], |
|---|
| | 161 | gt_cv_func_gnugettext_libintl, |
|---|
| | 162 | [gt_save_CPPFLAGS="$CPPFLAGS" |
|---|
| | 163 | CPPFLAGS="$CPPFLAGS $INCINTL" |
|---|
| | 164 | gt_save_LIBS="$LIBS" |
|---|
| | 165 | LIBS="$LIBS $LIBINTL" |
|---|
| | 166 | dnl Now see whether libintl exists and does not depend on libiconv. |
|---|
| | 167 | AC_TRY_LINK([#include <libintl.h> |
|---|
| | 168 | ]ifelse([$2], [need-formatstring-macros], |
|---|
| | 169 | [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION |
|---|
| | 170 | #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) |
|---|
| | 171 | #endif |
|---|
| | 172 | changequote(,)dnl |
|---|
| | 173 | typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; |
|---|
| | 174 | changequote([,])dnl |
|---|
| | 175 | ], [])[extern int _nl_msg_cat_cntr; |
|---|
| | 176 | extern |
|---|
| | 177 | #ifdef __cplusplus |
|---|
| | 178 | "C" |
|---|
| | 179 | #endif |
|---|
| | 180 | const char *_nl_expand_alias ();], |
|---|
| | 181 | [bindtextdomain ("", ""); |
|---|
| | 182 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], |
|---|
| | 183 | gt_cv_func_gnugettext_libintl=yes, |
|---|
| | 184 | gt_cv_func_gnugettext_libintl=no) |
|---|
| | 185 | dnl Now see whether libintl exists and depends on libiconv. |
|---|
| | 186 | if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then |
|---|
| | 187 | LIBS="$LIBS $LIBICONV" |
|---|
| | 188 | AC_TRY_LINK([#include <libintl.h> |
|---|
| | 189 | ]ifelse([$2], [need-formatstring-macros], |
|---|
| | 190 | [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION |
|---|
| | 191 | #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) |
|---|
| | 192 | #endif |
|---|
| | 193 | changequote(,)dnl |
|---|
| | 194 | typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; |
|---|
| | 195 | changequote([,])dnl |
|---|
| | 196 | ], [])[extern int _nl_msg_cat_cntr; |
|---|
| | 197 | extern |
|---|
| | 198 | #ifdef __cplusplus |
|---|
| | 199 | "C" |
|---|
| | 200 | #endif |
|---|
| | 201 | const char *_nl_expand_alias ();], |
|---|
| | 202 | [bindtextdomain ("", ""); |
|---|
| | 203 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], |
|---|
| | 204 | [LIBINTL="$LIBINTL $LIBICONV" |
|---|
| | 205 | LTLIBINTL="$LTLIBINTL $LTLIBICONV" |
|---|
| | 206 | gt_cv_func_gnugettext_libintl=yes |
|---|
| | 207 | ]) |
|---|
| | 208 | fi |
|---|
| | 209 | CPPFLAGS="$gt_save_CPPFLAGS" |
|---|
| | 210 | LIBS="$gt_save_LIBS"]) |
|---|
| | 211 | fi |
|---|
| | 212 | |
|---|
| | 213 | dnl If an already present or preinstalled GNU gettext() is found, |
|---|
| | 214 | dnl use it. But if this macro is used in GNU gettext, and GNU |
|---|
| | 215 | dnl gettext is already preinstalled in libintl, we update this |
|---|
| | 216 | dnl libintl. (Cf. the install rule in intl/Makefile.in.) |
|---|
| | 217 | if test "$gt_cv_func_gnugettext_libc" = "yes" \ |
|---|
| | 218 | || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ |
|---|
| | 219 | && test "$PACKAGE" != gettext; }; then |
|---|
| | 220 | gt_use_preinstalled_gnugettext=yes |
|---|
| | 221 | else |
|---|
| | 222 | dnl Reset the values set by searching for libintl. |
|---|
| | 223 | LIBINTL= |
|---|
| | 224 | LTLIBINTL= |
|---|
| | 225 | INCINTL= |
|---|
| | 226 | fi |
|---|
| | 227 | |
|---|
| | 228 | ifelse(gt_included_intl, yes, [ |
|---|
| | 229 | if test "$gt_use_preinstalled_gnugettext" != "yes"; then |
|---|
| | 230 | dnl GNU gettext is not found in the C library. |
|---|
| | 231 | dnl Fall back on included GNU gettext library. |
|---|
| | 232 | nls_cv_use_gnu_gettext=yes |
|---|
| 296 | | dnl Usage: Just like AM_WITH_NLS, which see. |
|---|
| 297 | | AC_DEFUN([AM_GNU_GETTEXT], |
|---|
| 298 | | [AC_REQUIRE([AC_PROG_MAKE_SET])dnl |
|---|
| 299 | | AC_REQUIRE([AC_PROG_CC])dnl |
|---|
| 300 | | AC_REQUIRE([AC_CANONICAL_HOST])dnl |
|---|
| 301 | | AC_REQUIRE([AC_PROG_RANLIB])dnl |
|---|
| 302 | | AC_REQUIRE([AC_ISC_POSIX])dnl |
|---|
| 303 | | AC_REQUIRE([AC_HEADER_STDC])dnl |
|---|
| 304 | | AC_REQUIRE([AC_C_CONST])dnl |
|---|
| 305 | | AC_REQUIRE([AC_C_INLINE])dnl |
|---|
| 306 | | AC_REQUIRE([AC_TYPE_OFF_T])dnl |
|---|
| 307 | | AC_REQUIRE([AC_TYPE_SIZE_T])dnl |
|---|
| 308 | | AC_REQUIRE([AC_FUNC_ALLOCA])dnl |
|---|
| 309 | | AC_REQUIRE([AC_FUNC_MMAP])dnl |
|---|
| 310 | | AC_REQUIRE([jm_GLIBC21])dnl |
|---|
| 311 | | |
|---|
| 312 | | AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ |
|---|
| | 317 | dnl For backward compatibility. Some Makefiles may be using this. |
|---|
| | 318 | INTLLIBS="$LIBINTL" |
|---|
| | 319 | AC_SUBST(INTLLIBS) |
|---|
| | 320 | |
|---|
| | 321 | dnl Make all documented variables known to autoconf. |
|---|
| | 322 | AC_SUBST(LIBINTL) |
|---|
| | 323 | AC_SUBST(LTLIBINTL) |
|---|
| | 324 | AC_SUBST(POSUB) |
|---|
| | 325 | ]) |
|---|
| | 326 | |
|---|
| | 327 | |
|---|
| | 328 | dnl Checks for all prerequisites of the po subdirectory, |
|---|
| | 329 | dnl except for USE_NLS. |
|---|
| | 330 | AC_DEFUN([AM_PO_SUBDIRS], |
|---|
| | 331 | [ |
|---|
| | 332 | AC_REQUIRE([AC_PROG_MAKE_SET])dnl |
|---|
| | 333 | AC_REQUIRE([AC_PROG_INSTALL])dnl |
|---|
| | 334 | AC_REQUIRE([AM_MKINSTALLDIRS])dnl |
|---|
| | 335 | |
|---|
| | 336 | dnl Perform the following tests also if --disable-nls has been given, |
|---|
| | 337 | dnl because they are needed for "make dist" to work. |
|---|
| | 338 | |
|---|
| | 339 | dnl Search for GNU msgfmt in the PATH. |
|---|
| | 340 | dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. |
|---|
| | 341 | dnl The second test excludes FreeBSD msgfmt. |
|---|
| | 342 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, |
|---|
| | 343 | [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && |
|---|
| | 344 | (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], |
|---|
| | 345 | :) |
|---|
| | 346 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) |
|---|
| | 347 | |
|---|
| | 348 | dnl Search for GNU xgettext 0.11 or newer in the PATH. |
|---|
| | 349 | dnl The first test excludes Solaris xgettext and early GNU xgettext versions. |
|---|
| | 350 | dnl The second test excludes FreeBSD xgettext. |
|---|
| | 351 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, |
|---|
| | 352 | [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && |
|---|
| | 353 | (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], |
|---|
| | 354 | :) |
|---|
| | 355 | dnl Remove leftover from FreeBSD xgettext call. |
|---|
| | 356 | rm -f messages.po |
|---|
| | 357 | |
|---|
| | 358 | dnl Search for GNU msgmerge 0.11 or newer in the PATH. |
|---|
| | 359 | AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, |
|---|
| | 360 | [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) |
|---|
| | 361 | |
|---|
| | 362 | dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. |
|---|
| | 363 | dnl Test whether we really found GNU msgfmt. |
|---|
| | 364 | if test "$GMSGFMT" != ":"; then |
|---|
| | 365 | dnl If it is no GNU msgfmt we define it as : so that the |
|---|
| | 366 | dnl Makefiles still can work. |
|---|
| | 367 | if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && |
|---|
| | 368 | (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then |
|---|
| | 369 | : ; |
|---|
| | 370 | else |
|---|
| | 371 | GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` |
|---|
| | 372 | AC_MSG_RESULT( |
|---|
| | 373 | [found $GMSGFMT program is not GNU msgfmt; ignore it]) |
|---|
| | 374 | GMSGFMT=":" |
|---|
| | 375 | fi |
|---|
| | 376 | fi |
|---|
| | 377 | |
|---|
| | 378 | dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. |
|---|
| | 379 | dnl Test whether we really found GNU xgettext. |
|---|
| | 380 | if test "$XGETTEXT" != ":"; then |
|---|
| | 381 | dnl If it is no GNU xgettext we define it as : so that the |
|---|
| | 382 | dnl Makefiles still can work. |
|---|
| | 383 | if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && |
|---|
| | 384 | (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then |
|---|
| | 385 | : ; |
|---|
| | 386 | else |
|---|
| | 387 | AC_MSG_RESULT( |
|---|
| | 388 | [found xgettext program is not GNU xgettext; ignore it]) |
|---|
| | 389 | XGETTEXT=":" |
|---|
| | 390 | fi |
|---|
| | 391 | dnl Remove leftover from FreeBSD xgettext call. |
|---|
| | 392 | rm -f messages.po |
|---|
| | 393 | fi |
|---|
| | 394 | |
|---|
| | 395 | AC_OUTPUT_COMMANDS([ |
|---|
| | 396 | for ac_file in $CONFIG_FILES; do |
|---|
| | 397 | # Support "outfile[:infile[:infile...]]" |
|---|
| | 398 | case "$ac_file" in |
|---|
| | 399 | *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; |
|---|
| | 400 | esac |
|---|
| | 401 | # PO directories have a Makefile.in generated from Makefile.in.in. |
|---|
| | 402 | case "$ac_file" in */Makefile.in) |
|---|
| | 403 | # Adjust a relative srcdir. |
|---|
| | 404 | ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` |
|---|
| | 405 | ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" |
|---|
| | 406 | ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` |
|---|
| | 407 | # In autoconf-2.13 it is called $ac_given_srcdir. |
|---|
| | 408 | # In autoconf-2.50 it is called $srcdir. |
|---|
| | 409 | test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" |
|---|
| | 410 | case "$ac_given_srcdir" in |
|---|
| | 411 | .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; |
|---|
| | 412 | /*) top_srcdir="$ac_given_srcdir" ;; |
|---|
| | 413 | *) top_srcdir="$ac_dots$ac_given_srcdir" ;; |
|---|
| | 414 | esac |
|---|
| | 415 | if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then |
|---|
| | 416 | rm -f "$ac_dir/POTFILES" |
|---|
| | 417 | test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" |
|---|
| | 418 | cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" |
|---|
| | 419 | # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend |
|---|
| | 420 | # on $ac_dir but don't depend on user-specified configuration |
|---|
| | 421 | # parameters. |
|---|
| | 422 | if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then |
|---|
| | 423 | # The LINGUAS file contains the set of available languages. |
|---|
| | 424 | if test -n "$ALL_LINGUAS"; then |
|---|
| | 425 | test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" |
|---|
| | 426 | fi |
|---|
| | 427 | ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` |
|---|
| | 428 | # Hide the ALL_LINGUAS assigment from automake. |
|---|
| | 429 | eval 'ALL_LINGUAS''=$ALL_LINGUAS_' |
|---|
| | 430 | fi |
|---|
| | 431 | case "$ac_given_srcdir" in |
|---|
| | 432 | .) srcdirpre= ;; |
|---|
| | 433 | *) srcdirpre='$(srcdir)/' ;; |
|---|
| | 434 | esac |
|---|
| | 435 | POFILES= |
|---|
| | 436 | GMOFILES= |
|---|
| | 437 | UPDATEPOFILES= |
|---|
| | 438 | DUMMYPOFILES= |
|---|
| | 439 | for lang in $ALL_LINGUAS; do |
|---|
| | 440 | POFILES="$POFILES $srcdirpre$lang.po" |
|---|
| | 441 | GMOFILES="$GMOFILES $srcdirpre$lang.gmo" |
|---|
| | 442 | UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" |
|---|
| | 443 | DUMMYPOFILES="$DUMMYPOFILES $lang.nop" |
|---|
| | 444 | done |
|---|
| | 445 | # CATALOGS depends on both $ac_dir and the user's LINGUAS |
|---|
| | 446 | # environment variable. |
|---|
| | 447 | INST_LINGUAS= |
|---|
| | 448 | if test -n "$ALL_LINGUAS"; then |
|---|
| | 449 | for presentlang in $ALL_LINGUAS; do |
|---|
| | 450 | useit=no |
|---|
| | 451 | if test "%UNSET%" != "$LINGUAS"; then |
|---|
| | 452 | desiredlanguages="$LINGUAS" |
|---|
| | 453 | else |
|---|
| | 454 | desiredlanguages="$ALL_LINGUAS" |
|---|
| | 455 | fi |
|---|
| | 456 | for desiredlang in $desiredlanguages; do |
|---|
| | 457 | # Use the presentlang catalog if desiredlang is |
|---|
| | 458 | # a. equal to presentlang, or |
|---|
| | 459 | # b. a variant of presentlang (because in this case, |
|---|
| | 460 | # presentlang can be used as a fallback for messages |
|---|
| | 461 | # which are not translated in the desiredlang catalog). |
|---|
| | 462 | case "$desiredlang" in |
|---|
| | 463 | "$presentlang"*) useit=yes;; |
|---|
| | 464 | esac |
|---|
| | 465 | done |
|---|
| | 466 | if test $useit = yes; then |
|---|
| | 467 | INST_LINGUAS="$INST_LINGUAS $presentlang" |
|---|
| | 468 | fi |
|---|
| | 469 | done |
|---|
| | 470 | fi |
|---|
| | 471 | CATALOGS= |
|---|
| | 472 | if test -n "$INST_LINGUAS"; then |
|---|
| | 473 | for lang in $INST_LINGUAS; do |
|---|
| | 474 | CATALOGS="$CATALOGS $lang.gmo" |
|---|
| | 475 | done |
|---|
| | 476 | fi |
|---|
| | 477 | test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" |
|---|
| | 478 | sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" |
|---|
| | 479 | for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do |
|---|
| | 480 | if test -f "$f"; then |
|---|
| | 481 | case "$f" in |
|---|
| | 482 | *.orig | *.bak | *~) ;; |
|---|
| | 483 | *) cat "$f" >> "$ac_dir/Makefile" ;; |
|---|
| | 484 | esac |
|---|
| | 485 | fi |
|---|
| | 486 | done |
|---|
| | 487 | fi |
|---|
| | 488 | ;; |
|---|
| | 489 | esac |
|---|
| | 490 | done], |
|---|
| | 491 | [# Capture the value of obsolete ALL_LINGUAS because we need it to compute |
|---|
| | 492 | # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it |
|---|
| | 493 | # from automake. |
|---|
| | 494 | eval 'ALL_LINGUAS''="$ALL_LINGUAS"' |
|---|
| | 495 | # Capture the value of LINGUAS because we need it to compute CATALOGS. |
|---|
| | 496 | LINGUAS="${LINGUAS-%UNSET%}" |
|---|
| | 497 | ]) |
|---|
| | 498 | ]) |
|---|
| | 499 | |
|---|
| | 500 | |
|---|
| | 501 | dnl Checks for all prerequisites of the intl subdirectory, |
|---|
| | 502 | dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, |
|---|
| | 503 | dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. |
|---|
| | 504 | AC_DEFUN([AM_INTL_SUBDIR], |
|---|
| | 505 | [ |
|---|
| | 506 | AC_REQUIRE([AC_PROG_INSTALL])dnl |
|---|
| | 507 | AC_REQUIRE([AM_MKINSTALLDIRS])dnl |
|---|
| | 508 | AC_REQUIRE([AC_PROG_CC])dnl |
|---|
| | 509 | AC_REQUIRE([AC_CANONICAL_HOST])dnl |
|---|
| | 510 | AC_REQUIRE([AC_PROG_RANLIB])dnl |
|---|
| | 511 | AC_REQUIRE([AC_ISC_POSIX])dnl |
|---|
| | 512 | AC_REQUIRE([AC_HEADER_STDC])dnl |
|---|
| | 513 | AC_REQUIRE([AC_C_CONST])dnl |
|---|
| | 514 | AC_REQUIRE([AC_C_INLINE])dnl |
|---|
| | 515 | AC_REQUIRE([AC_TYPE_OFF_T])dnl |
|---|
| | 516 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl |
|---|
| | 517 | AC_REQUIRE([AC_FUNC_ALLOCA])dnl |
|---|
| | 518 | AC_REQUIRE([AC_FUNC_MMAP])dnl |
|---|
| | 519 | AC_REQUIRE([jm_GLIBC21])dnl |
|---|
| | 520 | AC_REQUIRE([gt_INTDIV0])dnl |
|---|
| | 521 | AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl |
|---|
| | 522 | AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl |
|---|
| | 523 | AC_REQUIRE([gt_INTTYPES_PRI])dnl |
|---|
| | 524 | |
|---|
| | 525 | AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ |
|---|
| 314 | | AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ |
|---|
| 315 | | getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ |
|---|
| 316 | | strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) |
|---|
| 317 | | |
|---|
| 318 | | AM_ICONV |
|---|
| 319 | | AM_LANGINFO_CODESET |
|---|
| 320 | | AM_LC_MESSAGES |
|---|
| 321 | | AM_WITH_NLS([$1],[$2],[$3]) |
|---|
| 322 | | |
|---|
| 323 | | if test "x$CATOBJEXT" != "x"; then |
|---|
| 324 | | if test "x$ALL_LINGUAS" = "x"; then |
|---|
| 325 | | LINGUAS= |
|---|
| 326 | | else |
|---|
| 327 | | AC_MSG_CHECKING(for catalogs to be installed) |
|---|
| 328 | | NEW_LINGUAS= |
|---|
| 329 | | for presentlang in $ALL_LINGUAS; do |
|---|
| 330 | | useit=no |
|---|
| 331 | | for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do |
|---|
| 332 | | # Use the presentlang catalog if desiredlang is |
|---|
| 333 | | # a. equal to presentlang, or |
|---|
| 334 | | # b. a variant of presentlang (because in this case, |
|---|
| 335 | | # presentlang can be used as a fallback for messages |
|---|
| 336 | | # which are not translated in the desiredlang catalog). |
|---|
| 337 | | case "$desiredlang" in |
|---|
| 338 | | "$presentlang"*) useit=yes;; |
|---|
| 339 | | esac |
|---|
| 340 | | done |
|---|
| 341 | | if test $useit = yes; then |
|---|
| 342 | | NEW_LINGUAS="$NEW_LINGUAS $presentlang" |
|---|
| 343 | | fi |
|---|
| 344 | | done |
|---|
| 345 | | LINGUAS=$NEW_LINGUAS |
|---|
| 346 | | AC_MSG_RESULT($LINGUAS) |
|---|
| 347 | | fi |
|---|
| 348 | | |
|---|
| 349 | | dnl Construct list of names of catalog files to be constructed. |
|---|
| 350 | | if test -n "$LINGUAS"; then |
|---|
| 351 | | for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done |
|---|
| 352 | | fi |
|---|
| 353 | | fi |
|---|
| 354 | | |
|---|
| 355 | | dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly |
|---|
| 356 | | dnl find the mkinstalldirs script in another subdir but $(top_srcdir). |
|---|
| 357 | | dnl Try to locate is. |
|---|
| 358 | | MKINSTALLDIRS= |
|---|
| 359 | | if test -n "$ac_aux_dir"; then |
|---|
| 360 | | MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" |
|---|
| 361 | | fi |
|---|
| 362 | | if test -z "$MKINSTALLDIRS"; then |
|---|
| 363 | | MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" |
|---|
| 364 | | fi |
|---|
| 365 | | AC_SUBST(MKINSTALLDIRS) |
|---|
| 366 | | |
|---|
| 367 | | dnl Enable libtool support if the surrounding package wishes it. |
|---|
| 368 | | INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) |
|---|
| 369 | | AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) |
|---|
| 370 | | ]) |
|---|
| | 527 | AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ |
|---|
| | 528 | geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ |
|---|
| | 529 | strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) |
|---|
| | 530 | |
|---|
| | 531 | AM_ICONV |
|---|
| | 532 | AM_LANGINFO_CODESET |
|---|
| | 533 | if test $ac_cv_header_locale_h = yes; then |
|---|
| | 534 | AM_LC_MESSAGES |
|---|
| | 535 | fi |
|---|
| | 536 | |
|---|
| | 537 | dnl intl/plural.c is generated from intl/plural.y. It requires bison, |
|---|
| | 538 | dnl because plural.y uses bison specific features. It requires at least |
|---|
| | 539 | dnl bison-1.26 because earlier versions generate a plural.c that doesn't |
|---|
| | 540 | dnl compile. |
|---|
| | 541 | dnl bison is only needed for the maintainer (who touches plural.y). But in |
|---|
| | 542 | dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put |
|---|
| | 543 | dnl the rule in general Makefile. Now, some people carelessly touch the |
|---|
| | 544 | dnl files or have a broken "make" program, hence the plural.c rule will |
|---|
| | 545 | dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not |
|---|
| | 546 | dnl present or too old. |
|---|
| | 547 | AC_CHECK_PROGS([INTLBISON], [bison]) |
|---|
| | 548 | if test -z "$INTLBISON"; then |
|---|
| | 549 | ac_verc_fail=yes |
|---|
| | 550 | else |
|---|
| | 551 | dnl Found it, now check the version. |
|---|
| | 552 | AC_MSG_CHECKING([version of bison]) |
|---|
| | 553 | changequote(<<,>>)dnl |
|---|
| | 554 | ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` |
|---|
| | 555 | case $ac_prog_version in |
|---|
| | 556 | '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; |
|---|
| | 557 | 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) |
|---|
| | 558 | changequote([,])dnl |
|---|
| | 559 | ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; |
|---|
| | 560 | *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; |
|---|
| | 561 | esac |
|---|
| | 562 | AC_MSG_RESULT([$ac_prog_version]) |
|---|
| | 563 | fi |
|---|
| | 564 | if test $ac_verc_fail = yes; then |
|---|
| | 565 | INTLBISON=: |
|---|
| | 566 | fi |
|---|
| | 567 | ]) |
|---|
| | 568 | |
|---|
| | 569 | |
|---|
| | 570 | AC_DEFUN([AM_MKINSTALLDIRS], |
|---|
| | 571 | [ |
|---|
| | 572 | dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly |
|---|
| | 573 | dnl find the mkinstalldirs script in another subdir but $(top_srcdir). |
|---|
| | 574 | dnl Try to locate is. |
|---|
| | 575 | MKINSTALLDIRS= |
|---|
| | 576 | if test -n "$ac_aux_dir"; then |
|---|
| | 577 | MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" |
|---|
| | 578 | fi |
|---|
| | 579 | if test -z "$MKINSTALLDIRS"; then |
|---|
| | 580 | MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" |
|---|
| | 581 | fi |
|---|
| | 582 | AC_SUBST(MKINSTALLDIRS) |
|---|
| | 583 | ]) |
|---|
| | 584 | |
|---|
| | 585 | |
|---|
| | 586 | dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) |
|---|
| | 587 | AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) |
|---|