1 # libunistring.m4 serial 5
2 dnl Copyright (C) 2009-2010 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
8 dnl Searches for an installed libunistring.
9 dnl If found, it sets and AC_SUBSTs HAVE_LIBUNISTRING=yes and the LIBUNISTRING
10 dnl and LTLIBUNISTRING variables and augments the CPPFLAGS variable, and
11 dnl #defines HAVE_LIBUNISTRING to 1. Otherwise, it sets and AC_SUBSTs
12 dnl HAVE_LIBUNISTRING=no and LIBUNISTRING and LTLIBUNISTRING to empty.
14 AC_DEFUN([gl_LIBUNISTRING],
16 AC_REQUIRE([AM_ICONV])
17 if test -n "$LIBICONV"; then
18 dnl First, try to link without -liconv. libunistring often depends on
19 dnl libiconv, but we don't know (and often don't need to know) where
20 dnl libiconv is installed.
21 AC_LIB_HAVE_LINKFLAGS([unistring], [],
22 [#include <uniconv.h>], [u8_strconv_from_locale((char*)0);],
23 [no, trying again together with libiconv])
24 if test "$ac_cv_libunistring" != yes; then
25 dnl Second try, with -liconv.
26 dnl We have to erase the cached result of the first AC_LIB_HAVE_LINKFLAGS
27 dnl invocation, otherwise the second one will not be run.
28 unset ac_cv_libunistring
29 glus_save_LIBS="$LIBS"
30 LIBS="$LIBS $LIBICONV"
31 AC_LIB_HAVE_LINKFLAGS([unistring], [],
32 [#include <uniconv.h>], [u8_strconv_from_locale((char*)0);],
33 [no, consider installing GNU libunistring])
34 if test -n "$LIBUNISTRING"; then
35 LIBUNISTRING="$LIBUNISTRING $LIBICONV"
36 LTLIBUNISTRING="$LTLIBUNISTRING $LTLIBICONV"
38 LIBS="$glus_save_LIBS"
41 AC_LIB_HAVE_LINKFLAGS([unistring], [],
42 [#include <uniconv.h>], [u8_strconv_from_locale((char*)0);],
43 [no, consider installing GNU libunistring])