GNU gettext utilities: AM_ICONV
Previous: AM_XGETTEXT_OPTION, Up: autoconf macros [Contents][Index]
13.5.6 AM_ICONV in iconv.m4
The AM_ICONV
macro tests for the presence of the POSIX/XSI iconv
function family in either the C library or a separate libiconv
library. If found, it sets the am_cv_func_iconv
variable to ‘yes
’; it defines HAVE_ICONV
to 1 in the autoconf generated configuration file (usually called config.h
); it defines ICONV_CONST
to ‘const
’ or to empty, depending on whether the second argument of iconv()
is of type ‘const char **
’ or ‘char **
’; it sets the variables LIBICONV
and LTLIBICONV
to the linker options for use in a Makefile (LIBICONV
for use without libtool, LTLIBICONV
for use with libtool); it adds an ‘-I
’ option to CPPFLAGS
if necessary. If not found, it sets LIBICONV
and LTLIBICONV
to empty and doesn’t change CPPFLAGS
.
The complexities that AM_ICONV
deals with are the following:
- Some operating systems have
iconv
in the C library, for example glibc. Some have it in a separate librarylibiconv
, for example OSF/1 or FreeBSD. Regardless of the operating system, GNUlibiconv
might have been installed. In that case, it should be used instead of the operating system’s nativeiconv
. - GNU
libiconv
, if installed, is not necessarily already in the search path (CPPFLAGS
for the include file search path,LDFLAGS
for the library search path). - GNU
libiconv
is binary incompatible with some operating system’s nativeiconv
, for example on FreeBSD. Use of aniconv.h
andlibiconv.so
that don’t fit together would produce program crashes. - GNU
libiconv
, if installed, is not necessarily already in the run time library search path. To avoid the need for setting an environment variable likeLD_LIBRARY_PATH
, the macro adds the appropriate run time search path options to theLIBICONV
variable. This works on most systems, but not on some operating systems with limited shared library support, like SCO.
iconv.m4
is distributed with the GNU gettext package because gettext.m4
relies on it.
Previous: AM_XGETTEXT_OPTION, Up: autoconf macros [Contents][Index]