GNU Gnulib provides an autoconf macro that tests for the availability
libunistring. It is contained in the Gnulib module
The macro is called
gl_LIBUNISTRING. It searches for an installed
libunistring. If found, it sets and AC_SUBSTs
LTLIBUNISTRING variables and augments
CPPFLAGS variable, and defines the C macro
HAVE_LIBUNISTRING to 1. Otherwise, it sets and AC_SUBSTs
The complexities that
gl_LIBUNISTRING deals with are the following:
libiconv, and the options for linking with libiconv must be mentioned explicitly on the link command line.
libunistring, if installed, is not necessarily already in the search path (
CPPFLAGSfor the include file search path,
LDFLAGSfor the library search path).
libunistring, 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
LIBUNISTRINGvariable. This works on most systems.