• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ===========================================================================
2#       http://www.gnu.org/software/autoconf-archive/ax_check_icu.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7#   AX_CHECK_ICU(version, action-if, action-if-not)
8#
9# DESCRIPTION
10#
11#   Defines ICU_LIBS, ICU_CFLAGS, ICU_CXXFLAGS. See icu-config(1) man page.
12#
13# LICENSE
14#
15#   Copyright (c) 2008 Akos Maroy <darkeye@tyrell.hu>
16#
17#   Copying and distribution of this file, with or without modification, are
18#   permitted in any medium without royalty provided the copyright notice
19#   and this notice are preserved. This file is offered as-is, without any
20#   warranty.
21
22#serial 6
23
24AU_ALIAS([AC_CHECK_ICU], [AX_CHECK_ICU])
25AC_DEFUN([AX_CHECK_ICU], [
26  succeeded=no
27
28  if test -z "$ICU_CONFIG"; then
29    AC_PATH_PROG(ICU_CONFIG, icu-config, no)
30  fi
31
32  if test "$ICU_CONFIG" = "no" ; then
33    echo "*** The icu-config script could not be found. Make sure it is"
34    echo "*** in your path, and that taglib is properly installed."
35    echo "*** Or see http://ibm.com/software/globalization/icu/"
36  else
37    ICU_VERSION=`$ICU_CONFIG --version`
38    AC_MSG_CHECKING(for ICU >= $1)
39        VERSION_CHECK=`expr $ICU_VERSION \>\= $1`
40        if test "$VERSION_CHECK" = "1" ; then
41            AC_MSG_RESULT(yes)
42            succeeded=yes
43
44            AC_MSG_CHECKING(ICU_CPPFLAGS)
45            ICU_CPPFLAGS=`$ICU_CONFIG --cppflags`
46            AC_MSG_RESULT($ICU_CPPFLAGS)
47
48            AC_MSG_CHECKING(ICU_CFLAGS)
49            ICU_CFLAGS=`$ICU_CONFIG --cflags`
50            AC_MSG_RESULT($ICU_CFLAGS)
51
52            AC_MSG_CHECKING(ICU_CXXFLAGS)
53            ICU_CXXFLAGS=`$ICU_CONFIG --cxxflags`
54            AC_MSG_RESULT($ICU_CXXFLAGS)
55
56            AC_MSG_CHECKING(ICU_LIBS)
57            ICU_LIBS=`$ICU_CONFIG --ldflags`
58            AC_MSG_RESULT($ICU_LIBS)
59        else
60            ICU_CPPFLAGS=""
61            ICU_CFLAGS=""
62            ICU_CXXFLAGS=""
63            ICU_LIBS=""
64            ## If we have a custom action on failure, don't print errors, but
65            ## do set a variable so people can do so.
66            ifelse([$3], ,echo "can't find ICU >= $1",)
67        fi
68
69        AC_SUBST(ICU_CPPFLAGS)
70        AC_SUBST(ICU_CFLAGS)
71        AC_SUBST(ICU_CXXFLAGS)
72        AC_SUBST(ICU_LIBS)
73  fi
74
75  if test $succeeded = yes; then
76     ifelse([$2], , :, [$2])
77  else
78     ifelse([$3], , AC_MSG_ERROR([Library requirements (ICU) not met.]), [$3])
79  fi
80])
81