Commit | Line | Data |
---|---|---|
24d56127 | 1 | # libunistring.m4 serial 1 |
61cd9dc9 | 2 | dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. |
24d56127 LC |
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. | |
6 | ||
7 | dnl gl_LIBUNISTRING | |
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 LIBUNINSTRING and LTLIBUNISTRING to empty. | |
13 | ||
14 | AC_DEFUN([gl_LIBUNISTRING], | |
15 | [ | |
16 | dnl First, try to link without -liconv. libunistring often depends on | |
17 | dnl libiconv, but we don't know (and often don't need to know) where | |
18 | dnl libiconv is installed. | |
19 | AC_LIB_HAVE_LINKFLAGS([unistring], [], | |
20 | [#include <uniconv.h>], [u8_strconv_from_locale((char*)0);], | |
21 | [no, consider installing GNU libunistring]) | |
22 | if test "$ac_cv_libunistring" != yes; then | |
23 | dnl Second try, with -liconv. | |
24 | AC_REQUIRE([AM_ICONV]) | |
25 | if test -n "$LIBICONV"; then | |
26 | glus_save_LIBS="$LIBS" | |
27 | LIBS="$LIBS $LIBICONV" | |
28 | AC_LIB_HAVE_LINKFLAGS([unistring], [], | |
29 | [#include <uniconv.h>], [u8_strconv_from_locale((char*)0);], | |
30 | [no, consider installing GNU libunistring]) | |
31 | if test -n "$LIBUNISTRING"; then | |
32 | LIBUNISTRING="$LIBUNISTRING $LIBICONV" | |
33 | fi | |
34 | LIBS="$glus_save_LIBS" | |
35 | fi | |
36 | fi | |
37 | ]) |