Previous: src/Makefile, Up: Adjusting Files   [Contents][Index]


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:

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.


Previous: src/Makefile, Up: Adjusting Files   [Contents][Index]