2013-12-06 17:08:52 +04:00
dnl This Source Code Form is subject to the terms of the Mozilla Public
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
dnl Set the MOZ_ICU_VERSION variable to denote the current version of the
2016-02-11 16:21:16 +03:00
dnl ICU library, as well as a few other things.
2013-12-06 17:08:52 +04:00
AC_DEFUN([MOZ_CONFIG_ICU], [
2014-02-11 05:37:47 +04:00
2016-02-01 18:49:34 +03:00
MOZ_SYSTEM_ICU=
2014-02-11 05:37:47 +04:00
MOZ_ARG_WITH_BOOL(system-icu,
[ --with-system-icu
Use system ICU (located with pkgconfig)],
2016-02-01 18:49:34 +03:00
MOZ_SYSTEM_ICU=1)
2014-02-11 05:37:47 +04:00
2016-02-01 18:49:34 +03:00
if test -n "$MOZ_SYSTEM_ICU"; then
2018-11-01 19:39:38 +03:00
PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 63.1)
2016-07-20 08:00:13 +03:00
CFLAGS="$CFLAGS $MOZ_ICU_CFLAGS"
CXXFLAGS="$CXXFLAGS $MOZ_ICU_CFLAGS"
2018-08-21 16:02:00 +03:00
AC_DEFINE(MOZ_SYSTEM_ICU)
2014-02-11 05:37:47 +04:00
fi
2016-02-01 18:49:34 +03:00
AC_SUBST(MOZ_SYSTEM_ICU)
2014-02-11 05:37:47 +04:00
MOZ_ARG_WITH_STRING(intl-api,
[ --with-intl-api, --with-intl-api=build, --without-intl-api
Determine the status of the ECMAScript Internationalization API. The first
(or lack of any of these) builds and exposes the API. The second builds it
but doesn't use ICU or expose the API to script. The third doesn't build
ICU at all.],
_INTL_API=$withval)
ENABLE_INTL_API=
EXPOSE_INTL_API=
case "$_INTL_API" in
no)
;;
build)
ENABLE_INTL_API=1
;;
yes)
ENABLE_INTL_API=1
EXPOSE_INTL_API=1
;;
*)
AC_MSG_ERROR([Invalid value passed to --with-intl-api: $_INTL_API])
;;
esac
2014-10-10 10:55:00 +04:00
if test -n "$ENABLE_INTL_API"; then
USE_ICU=1
fi
2014-02-11 05:37:47 +04:00
if test -n "$EXPOSE_INTL_API"; then
AC_DEFINE(EXPOSE_INTL_API)
fi
if test -n "$ENABLE_INTL_API"; then
AC_DEFINE(ENABLE_INTL_API)
2014-10-10 10:55:00 +04:00
fi
2014-02-11 05:37:47 +04:00
2014-10-10 10:55:00 +04:00
dnl Settings for the implementation of the ECMAScript Internationalization API
if test -n "$USE_ICU"; then
2013-12-06 17:08:52 +04:00
icudir="$_topsrcdir/intl/icu/source"
if test ! -d "$icudir"; then
icudir="$_topsrcdir/../../intl/icu/source"
if test ! -d "$icudir"; then
AC_MSG_ERROR([Cannot find the ICU directory])
fi
fi
2017-01-10 01:25:00 +03:00
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"`
2013-12-06 17:08:52 +04:00
if test x"$version" = x; then
AC_MSG_ERROR([cannot determine icu version number from uvernum.h header file $lineno])
fi
MOZ_ICU_VERSION="$version"
2016-04-05 17:09:12 +03:00
# TODO: the l is actually endian-dependent
# We could make this set as 'l' or 'b' for little or big, respectively,
# but we'd need to check in a big-endian version of the file.
ICU_DATA_FILE="icudt${version}l.dat"
2014-02-11 05:37:47 +04:00
fi
2016-04-05 17:09:12 +03:00
AC_SUBST(MOZ_ICU_VERSION)
2014-02-11 05:37:47 +04:00
AC_SUBST(ENABLE_INTL_API)
2014-10-10 10:55:00 +04:00
AC_SUBST(USE_ICU)
2016-04-05 17:09:12 +03:00
AC_SUBST(ICU_DATA_FILE)
2014-02-11 05:37:47 +04:00
2016-12-22 04:42:19 +03:00
if test -n "$USE_ICU"; then
2014-02-11 05:37:47 +04:00
dnl Source files that use ICU should have control over which parts of the ICU
dnl namespace they want to use.
AC_DEFINE(U_USING_ICU_NAMESPACE,0)
2016-12-22 04:42:19 +03:00
if test -z "$MOZ_SYSTEM_ICU"; then
2018-08-21 18:00:34 +03:00
case "$OS_TARGET:$CPU_ARCH" in
WINNT:aarch64)
dnl we use non-yasm, non-GNU as solutions here.
;;
*)
if test -z "$YASM" -a -z "$GNU_AS" -a "$COMPILE_ENVIRONMENT"; then
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])
fi
;;
esac
2016-12-22 04:42:19 +03:00
dnl We build ICU as a static library.
AC_DEFINE(U_STATIC_IMPLEMENTATION)
fi
2014-02-11 05:37:47 +04:00
fi
2013-12-06 17:08:52 +04:00
])