gettext: AM_GNU_GETTEXT

1 
1 13.5.1 AM_GNU_GETTEXT in ‘gettext.m4’
1 -------------------------------------
1 
1    The ‘AM_GNU_GETTEXT’ macro tests for the presence of the GNU gettext
1 function family in either the C library or a separate ‘libintl’ library
1 (shared or static libraries are both supported) or in the package’s
1 ‘intl/’ directory.  It also invokes ‘AM_PO_SUBDIRS’, thus preparing the
1 ‘po/’ directories of the package for building.
1 
1    ‘AM_GNU_GETTEXT’ accepts up to three optional arguments.  The general
1 syntax is
1 
1      AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR])
1 
1    INTLSYMBOL can be ‘external’ or ‘no-libtool’.  The default (if it is
1 not specified or empty) is ‘no-libtool’.  INTLSYMBOL should be
1 ‘external’ for packages with no ‘intl/’ directory.  For packages with an
1 ‘intl/’ directory, you can either use an INTLSYMBOL equal to
1 ‘no-libtool’, or you can use ‘external’ and override by using the macro
1 ‘AM_GNU_GETTEXT_INTL_SUBDIR’ elsewhere.  The two ways to specify the
1 existence of an ‘intl/’ directory are equivalent.  At build time, a
1 static library ‘$(top_builddir)/intl/libintl.a’ will then be created.
1 
1    If NEEDSYMBOL is specified and is ‘need-ngettext’, then GNU gettext
1 implementations (in libc or libintl) without the ‘ngettext()’ function
1 will be ignored.  If NEEDSYMBOL is specified and is
1 ‘need-formatstring-macros’, then GNU gettext implementations that don’t
1 support the ISO C 99 ‘<inttypes.h>’ formatstring macros will be ignored.
1 Only one NEEDSYMBOL can be specified.  These requirements can also be
1 specified by using the macro ‘AM_GNU_GETTEXT_NEED’ elsewhere.  To
1 specify more than one requirement, just specify the strongest one among
1 them, or invoke the ‘AM_GNU_GETTEXT_NEED’ macro several times.  The
1 hierarchy among the various alternatives is as follows:
1 ‘need-formatstring-macros’ implies ‘need-ngettext’.
1 
1    INTLDIR is used to find the intl libraries.  If empty, the value
1 ‘$(top_builddir)/intl/’ is used.
1 
1    The ‘AM_GNU_GETTEXT’ macro determines whether GNU gettext is
1 available and should be used.  If so, it sets the ‘USE_NLS’ variable to
1 ‘yes’; it defines ‘ENABLE_NLS’ to 1 in the autoconf generated
1 configuration file (usually called ‘config.h’); it sets the variables
1 ‘LIBINTL’ and ‘LTLIBINTL’ to the linker options for use in a Makefile
1 (‘LIBINTL’ for use without libtool, ‘LTLIBINTL’ for use with libtool);
1 it adds an ‘-I’ option to ‘CPPFLAGS’ if necessary.  In the negative
1 case, it sets ‘USE_NLS’ to ‘no’; it sets ‘LIBINTL’ and ‘LTLIBINTL’ to
1 empty and doesn’t change ‘CPPFLAGS’.
1 
1    The complexities that ‘AM_GNU_GETTEXT’ deals with are the following:
1 
1    • Some operating systems have ‘gettext’ in the C library, for example
1      glibc.  Some have it in a separate library ‘libintl’.  GNU
1      ‘libintl’ might have been installed as part of the GNU ‘gettext’
1      package.
1 
1    • GNU ‘libintl’, if installed, is not necessarily already in the
1      search path (‘CPPFLAGS’ for the include file search path, ‘LDFLAGS’
1      for the library search path).
1 
1    • Except for glibc, the operating system’s native ‘gettext’ cannot
1      exploit the GNU mo files, doesn’t have the necessary locale
1      dependency features, and cannot convert messages from the catalog’s
1      text encoding to the user’s locale encoding.
1 
1    • GNU ‘libintl’, if installed, is not necessarily already in the run
1      time library search path.  To avoid the need for setting an
1      environment variable like ‘LD_LIBRARY_PATH’, the macro adds the
1      appropriate run time search path options to the ‘LIBINTL’ and
1      ‘LTLIBINTL’ variables.  This works on most systems, but not on some
1      operating systems with limited shared library support, like SCO.
1 
1    • GNU ‘libintl’ relies on POSIX/XSI ‘iconv’.  The macro checks for
1      linker options needed to use iconv and appends them to the
1      ‘LIBINTL’ and ‘LTLIBINTL’ variables.
1