(gettext.info)AM_GNU_GETTEXT


Next: AM_GNU_GETTEXT_VERSION Prev: autoconf macros Up: autoconf macros
Enter node , (file) or (file)node

13.5.1 AM_GNU_GETTEXT in ‘gettext.m4’
-------------------------------------

   The ‘AM_GNU_GETTEXT’ macro tests for the presence of the GNU gettext
function family in either the C library or a separate ‘libintl’ library
(shared or static libraries are both supported) or in the package’s
‘intl/’ directory.  It also invokes ‘AM_PO_SUBDIRS’, thus preparing the
‘po/’ directories of the package for building.

   ‘AM_GNU_GETTEXT’ accepts up to three optional arguments.  The general
syntax is

     AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR])

   INTLSYMBOL can be ‘external’ or ‘no-libtool’.  The default (if it is
not specified or empty) is ‘no-libtool’.  INTLSYMBOL should be
‘external’ for packages with no ‘intl/’ directory.  For packages with an
‘intl/’ directory, you can either use an INTLSYMBOL equal to
‘no-libtool’, or you can use ‘external’ and override by using the macro
‘AM_GNU_GETTEXT_INTL_SUBDIR’ elsewhere.  The two ways to specify the
existence of an ‘intl/’ directory are equivalent.  At build time, a
static library ‘$(top_builddir)/intl/libintl.a’ will then be created.

   If NEEDSYMBOL is specified and is ‘need-ngettext’, then GNU gettext
implementations (in libc or libintl) without the ‘ngettext()’ function
will be ignored.  If NEEDSYMBOL is specified and is
‘need-formatstring-macros’, then GNU gettext implementations that don’t
support the ISO C 99 ‘<inttypes.h>’ formatstring macros will be ignored.
Only one NEEDSYMBOL can be specified.  These requirements can also be
specified by using the macro ‘AM_GNU_GETTEXT_NEED’ elsewhere.  To
specify more than one requirement, just specify the strongest one among
them, or invoke the ‘AM_GNU_GETTEXT_NEED’ macro several times.  The
hierarchy among the various alternatives is as follows:
‘need-formatstring-macros’ implies ‘need-ngettext’.

   INTLDIR is used to find the intl libraries.  If empty, the value
‘$(top_builddir)/intl/’ is used.

   The ‘AM_GNU_GETTEXT’ macro determines whether GNU gettext is
available and should be used.  If so, it sets the ‘USE_NLS’ variable to
‘yes’; it defines ‘ENABLE_NLS’ to 1 in the autoconf generated
configuration file (usually called ‘config.h’); it sets the variables
‘LIBINTL’ and ‘LTLIBINTL’ to the linker options for use in a Makefile
(‘LIBINTL’ for use without libtool, ‘LTLIBINTL’ for use with libtool);
it adds an ‘-I’ option to ‘CPPFLAGS’ if necessary.  In the negative
case, it sets ‘USE_NLS’ to ‘no’; it sets ‘LIBINTL’ and ‘LTLIBINTL’ to
empty and doesn’t change ‘CPPFLAGS’.

   The complexities that ‘AM_GNU_GETTEXT’ deals with are the following:

   • Some operating systems have ‘gettext’ in the C library, for example
     glibc.  Some have it in a separate library ‘libintl’.  GNU
     ‘libintl’ might have been installed as part of the GNU ‘gettext’
     package.

   • GNU ‘libintl’, if installed, is not necessarily already in the
     search path (‘CPPFLAGS’ for the include file search path, ‘LDFLAGS’
     for the library search path).

   • Except for glibc, the operating system’s native ‘gettext’ cannot
     exploit the GNU mo files, doesn’t have the necessary locale
     dependency features, and cannot convert messages from the catalog’s
     text encoding to the user’s locale encoding.

   • GNU ‘libintl’, if installed, is not necessarily already in the run
     time library search path.  To avoid the need for setting an
     environment variable like ‘LD_LIBRARY_PATH’, the macro adds the
     appropriate run time search path options to the ‘LIBINTL’ and
     ‘LTLIBINTL’ variables.  This works on most systems, but not on some
     operating systems with limited shared library support, like SCO.

   • GNU ‘libintl’ relies on POSIX/XSI ‘iconv’.  The macro checks for
     linker options needed to use iconv and appends them to the
     ‘LIBINTL’ and ‘LTLIBINTL’ variables.


automatically generated by info2www version 1.2.2.9