GNU Gnulib provides an autoconf macro that tests for the availability
of libunistring. It is contained in the Gnulib module
‘libunistring’, see
http://www.gnu.org/software/gnulib/MODULES.html#module=libunistring.
The macro is called gl_LIBUNISTRING. It searches for an installed
libunistring. If found, it sets and AC_SUBSTs HAVE_LIBUNISTRING=yes
and the LIBUNISTRING and LTLIBUNISTRING variables and augments
the CPPFLAGS variable, and defines the C macro
HAVE_LIBUNISTRING to 1. Otherwise, it sets and AC_SUBSTs
HAVE_LIBUNISTRING=no and LIBUNISTRING and LTLIBUNISTRING
to empty.
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 (CPPFLAGS for the include file search path,
LDFLAGS for 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 LIBUNISTRING variable. This works
on most systems.