gettext: AM_ICONV

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