Previous: AM_XGETTEXT_OPTION in po.m4, Up: Autoconf macros for use in configure.ac [Contents][Index]
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:
iconv
in the C library, for example
glibc. Some have it in a separate library libiconv
, for example
OSF/1 or FreeBSD. Regardless of the operating system, GNU libiconv
might have been installed. In that case, it should be used instead of the
operating system’s native iconv
.
libiconv
, if installed, is not necessarily already in the search
path (CPPFLAGS
for the include file search path, LDFLAGS
for
the library search path).
libiconv
is binary incompatible with some operating system’s
native iconv
, for example on FreeBSD. Use of an iconv.h
and libiconv.so that don’t fit together would produce program
crashes.
libiconv
, 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 LIBICONV
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 in po.m4, Up: Autoconf macros for use in configure.ac [Contents][Index]