Bug 1500160 [wpt PR 13600] - Add tests for simple dialog newline normalization, a...
[gecko.git] / build / autoconf / icu.m4
blob6afa262b073e29939f2709095bd6e8e05945bbd0
1 dnl This Source Code Form is subject to the terms of the Mozilla Public
2 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
3 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 dnl Set the MOZ_ICU_VERSION variable to denote the current version of the
6 dnl ICU library, as well as a few other things.
8 AC_DEFUN([MOZ_CONFIG_ICU], [
10 MOZ_SYSTEM_ICU=
11 MOZ_ARG_WITH_BOOL(system-icu,
12 [  --with-system-icu
13                           Use system ICU (located with pkgconfig)],
14     MOZ_SYSTEM_ICU=1)
16 if test -n "$MOZ_SYSTEM_ICU"; then
17     PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 63.1)
18     CFLAGS="$CFLAGS $MOZ_ICU_CFLAGS"
19     CXXFLAGS="$CXXFLAGS $MOZ_ICU_CFLAGS"
20     AC_DEFINE(MOZ_SYSTEM_ICU)
23 AC_SUBST(MOZ_SYSTEM_ICU)
25 MOZ_ARG_WITH_STRING(intl-api,
26 [  --with-intl-api, --with-intl-api=build, --without-intl-api
27     Determine the status of the ECMAScript Internationalization API.  The first
28     (or lack of any of these) builds and exposes the API.  The second builds it
29     but doesn't use ICU or expose the API to script.  The third doesn't build
30     ICU at all.],
31     _INTL_API=$withval)
33 ENABLE_INTL_API=
34 EXPOSE_INTL_API=
35 case "$_INTL_API" in
36 no)
37     ;;
38 build)
39     ENABLE_INTL_API=1
40     ;;
41 yes)
42     ENABLE_INTL_API=1
43     EXPOSE_INTL_API=1
44     ;;
46     AC_MSG_ERROR([Invalid value passed to --with-intl-api: $_INTL_API])
47     ;;
48 esac
50 if test -n "$ENABLE_INTL_API"; then
51     USE_ICU=1
54 if test -n "$EXPOSE_INTL_API"; then
55     AC_DEFINE(EXPOSE_INTL_API)
58 if test -n "$ENABLE_INTL_API"; then
59     AC_DEFINE(ENABLE_INTL_API)
62 dnl Settings for the implementation of the ECMAScript Internationalization API
63 if test -n "$USE_ICU"; then
64     icudir="$_topsrcdir/intl/icu/source"
65     if test ! -d "$icudir"; then
66         icudir="$_topsrcdir/../../intl/icu/source"
67         if test ! -d "$icudir"; then
68             AC_MSG_ERROR([Cannot find the ICU directory])
69         fi
70     fi
72     version=`sed -n 's/^[[[:space:]]]*#[[:space:]]*define[[:space:]][[:space:]]*U_ICU_VERSION_MAJOR_NUM[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]]*$/\1/p' "$icudir/common/unicode/uvernum.h"`
73     if test x"$version" = x; then
74        AC_MSG_ERROR([cannot determine icu version number from uvernum.h header file $lineno])
75     fi
76     MOZ_ICU_VERSION="$version"
78     # TODO: the l is actually endian-dependent
79     # We could make this set as 'l' or 'b' for little or big, respectively,
80     # but we'd need to check in a big-endian version of the file.
81     ICU_DATA_FILE="icudt${version}l.dat"
84 AC_SUBST(MOZ_ICU_VERSION)
85 AC_SUBST(ENABLE_INTL_API)
86 AC_SUBST(USE_ICU)
87 AC_SUBST(ICU_DATA_FILE)
89 if test -n "$USE_ICU"; then
90     dnl Source files that use ICU should have control over which parts of the ICU
91     dnl namespace they want to use.
92     AC_DEFINE(U_USING_ICU_NAMESPACE,0)
94     if test -z "$MOZ_SYSTEM_ICU"; then
95         case "$OS_TARGET:$CPU_ARCH" in
96         WINNT:aarch64)
97             dnl we use non-yasm, non-GNU as solutions here.
98             ;;
99         *)
100             if test -z "$YASM" -a -z "$GNU_AS" -a "$COMPILE_ENVIRONMENT"; then
101                 AC_MSG_ERROR([Building ICU requires either yasm or a GNU assembler. If you do not have either of those available for this platform you must use --without-intl-api])
102             fi
103             ;;
104         esac
105         dnl We build ICU as a static library.
106         AC_DEFINE(U_STATIC_IMPLEMENTATION)
107     fi