(gettext.info)lib/gettext.h


Prev: src/Makefile Up: Adjusting Files
Enter node , (file) or (file)node

13.4.13 ‘gettext.h’ in ‘lib/’
-----------------------------

   Internationalization of packages, as provided by GNU ‘gettext’, is
optional.  It can be turned off in two situations:

   • When the installer has specified ‘./configure --disable-nls’.  This
     can be useful when small binaries are more important than features,
     for example when building utilities for boot diskettes.  It can
     also be useful in order to get some specific C compiler warnings
     about code quality with some older versions of GCC (older than
     3.0).

   • When the package does not include the ‘intl/’ subdirectory, and the
     libintl.h header (with its associated libintl library, if any) is
     not already installed on the system, it is preferable that the
     package builds without internationalization support, rather than to
     give a compilation error.

   A C preprocessor macro can be used to detect these two cases.
Usually, when ‘libintl.h’ was found and not explicitly disabled, the
‘ENABLE_NLS’ macro will be defined to 1 in the autoconf generated
configuration file (usually called ‘config.h’).  In the two negative
situations, however, this macro will not be defined, thus it will
evaluate to 0 in C preprocessor expressions.

   ‘gettext.h’ is a convenience header file for conditional use of
‘<libintl.h>’, depending on the ‘ENABLE_NLS’ macro.  If ‘ENABLE_NLS’ is
set, it includes ‘<libintl.h>’; otherwise it defines no-op substitutes
for the libintl.h functions.  We recommend the use of ‘"gettext.h"’ over
direct use of ‘<libintl.h>’, so that portability to older systems is
guaranteed and installers can turn off internationalization if they want
to.  In the C code, you will then write

     #include "gettext.h"

instead of

     #include <libintl.h>

   The location of ‘gettext.h’ is usually in a directory containing
auxiliary include files.  In many GNU packages, there is a directory
‘lib/’ containing helper functions; ‘gettext.h’ fits there.  In other
packages, it can go into the ‘src’ directory.

   Do not install the ‘gettext.h’ file in public locations.  Every
package that needs it should contain a copy of it on its own.


automatically generated by info2www version 1.2.2.9