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
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
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
necessary. If not found, it sets
empty and doesn't change
The complexities that
AM_ICONV deals with are the following:
iconvin 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
libiconvmight have been installed. In that case, it should be used instead of the operating system's native
libiconv, if installed, is not necessarily already in the search path (
CPPFLAGSfor the include file search path,
LDFLAGSfor the library search path).
libiconvis 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
LIBICONVvariable. 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.