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], [
12 MOZ_ARG_WITH_BOOL(system-icu,
14 Use system ICU (located with pkgconfig)],
17 if test -n "$MOZ_SYSTEM_ICU"; then
18 PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1)
19 CFLAGS="$CFLAGS $MOZ_ICU_CFLAGS"
20 CXXFLAGS="$CXXFLAGS $MOZ_ICU_CFLAGS"
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
46 AC_MSG_ERROR([Invalid value passed to --with-intl-api: $_INTL_API])
50 if test -n "$ENABLE_INTL_API"; then
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])
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])
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"
83 dnl We won't build ICU data as a separate file when building
84 dnl JS standalone so that embedders don't have to deal with it.
85 dnl We also don't do it on Windows because sometimes the file goes
86 dnl missing -- possibly due to overzealous antivirus software? --
87 dnl which prevents the browser from starting up :(
88 if test -z "$JS_STANDALONE" -a -z "$MOZ_SYSTEM_ICU" -a "$OS_TARGET" != WINNT -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
89 MOZ_ICU_DATA_ARCHIVE=1
95 AC_SUBST(MOZ_ICU_VERSION)
96 AC_SUBST(ENABLE_INTL_API)
98 AC_SUBST(ICU_DATA_FILE)
99 AC_SUBST(MOZ_ICU_DATA_ARCHIVE)
101 if test -n "$USE_ICU" -a -z "$MOZ_SYSTEM_ICU"; then
102 if test -z "$YASM" -a -z "$GNU_AS" -a "$COMPILE_ENVIRONMENT"; then
103 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])
105 dnl We build ICU as a static library.
106 AC_DEFINE(U_STATIC_IMPLEMENTATION)
107 dnl Source files that use ICU should have control over which parts of the ICU
108 dnl namespace they want to use.
109 AC_DEFINE(U_USING_ICU_NAMESPACE,0)