Bug 969164 - Move icu subconfigure invocation in build/autoconf/icu.m4. r=gps

This commit is contained in:
Mike Hommey 2014-02-11 10:37:47 +09:00
parent 0e117da4fb
commit 0c632e4c0a
2 changed files with 189 additions and 188 deletions

View File

@ -131,4 +131,192 @@ if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then
fi
])
AC_DEFUN([MOZ_SUBCONFIGURE_ICU], [
if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then
# Set ICU compile options
ICU_CPPFLAGS=""
# don't use icu namespace automatically in client code
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_USING_ICU_NAMESPACE=0"
# don't include obsolete header files
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
# remove chunks of the library that we don't need (yet)
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_LEGACY_CONVERSION"
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_TRANSLITERATION"
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_REGULAR_EXPRESSIONS"
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_BREAK_ITERATION"
ICU_CROSS_BUILD_OPT=""
ICU_SRCDIR=""
if test "$HOST_OS_ARCH" = "WINNT"; then
ICU_SRCDIR="--srcdir=$(cd $srcdir/intl/icu/source; pwd -W)"
fi
if test "$CROSS_COMPILE"; then
# Building host tools. It is necessary to build target binary.
case "$HOST_OS_ARCH" in
Darwin)
ICU_TARGET=MacOSX
;;
Linux)
ICU_TARGET=Linux
;;
WINNT)
ICU_TARGET=MSYS/MSVC
;;
*bsd*|dragonfly*)
ICU_TARGET=BSD
;;
esac
# Remove _DEPEND_CFLAGS from HOST_FLAGS to avoid configure error
HOST_ICU_CFLAGS="$HOST_CFLAGS"
HOST_ICU_CXXFLAGS="$HOST_CXXFLAGS"
HOST_ICU_CFLAGS=`echo $HOST_ICU_CFLAGS | sed "s|$_DEPEND_CFLAGS||g"`
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CFXXLAGS | sed "s|$_DEPEND_CFLAGS||g"`
# ICU requires RTTI
if test "$GNU_CC"; then
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CXXFLAGS | sed 's|-fno-rtti|-frtti|g'`
elif test "$_MSC_VER"; then
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CXXFLAGS | sed 's|-GR-|-GR|g'`
fi
HOST_ICU_BUILD_OPTS=""
if test -n "$MOZ_DEBUG"; then
HOST_ICU_BUILD_OPTS="$HOST_ICU_BUILD_OPTS --enable-debug"
fi
abs_srcdir=`(cd $srcdir; pwd)`
mkdir -p $_objdir/intl/icu/host
(cd $_objdir/intl/icu/host
MOZ_SUBCONFIGURE_WRAP([.],[
AR="$HOST_AR" RANLIB="$HOST_RANLIB" \
CC="$HOST_CC" CXX="$HOST_CXX" LD="$HOST_LD" \
CFLAGS="$HOST_ICU_CFLAGS $HOST_OPTIMIZE_FLAGS" \
CPPFLAGS="$ICU_CPPFLAGS" \
CXXFLAGS="$HOST_ICU_CXXFLAGS $HOST_OPTIMIZE_FLAGS" \
LDFLAGS="$HOST_LDFLAGS" \
$SHELL $abs_srcdir/intl/icu/source/runConfigureICU \
$HOST_ICU_BUILD_OPTS \
$ICU_TARGET \
dnl Shell quoting is fun.
${ICU_SRCDIR+"$ICU_SRCDIR"} \
--enable-static --disable-shared \
--enable-extras=no --enable-icuio=no --enable-layout=no \
--enable-tests=no --enable-samples=no || exit 1
])
) || exit 1
# generate config/icucross.mk
$GMAKE -C $_objdir/intl/icu/host/ config/icucross.mk
# --with-cross-build requires absolute path
ICU_HOST_PATH=`cd $_objdir/intl/icu/host && pwd`
ICU_CROSS_BUILD_OPT="--with-cross-build=$ICU_HOST_PATH"
ICU_TARGET_OPT="--build=$build --host=$target"
else
# CROSS_COMPILE isn't set build and target are i386 and x86-64.
# So we must set target for --build and --host.
ICU_TARGET_OPT="--build=$target --host=$target"
fi
if test -z "$MOZ_SHARED_ICU"; then
# To reduce library size, use static linking
ICU_LINK_OPTS="--enable-static --disable-shared"
else
ICU_LINK_OPTS="--disable-static --enable-shared"
fi
# Force the ICU static libraries to be position independent code
ICU_CFLAGS="$DSO_PIC_CFLAGS $CFLAGS"
ICU_CXXFLAGS="$DSO_PIC_CFLAGS $CXXFLAGS"
ICU_BUILD_OPTS=""
if test -n "$MOZ_DEBUG" -o "MOZ_DEBUG_SYMBOLS"; then
ICU_CFLAGS="$ICU_CFLAGS $MOZ_DEBUG_FLAGS"
ICU_CXXFLAGS="$ICU_CXXFLAGS $MOZ_DEBUG_FLAGS"
if test -n "$CROSS_COMPILE" -a "$OS_TARGET" = "Darwin" \
-a "$HOST_OS_ARCH" != "Darwin"
then
# Bug 951758: Cross-OSX builds with non-Darwin hosts have issues
# with -g and friends (like -gdwarf and -gfull) because they try
# to run dsymutil
changequote(,)
ICU_CFLAGS=`echo $ICU_CFLAGS | sed 's|-g[^ \t]*||g'`
ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-g[^ \t]*||g'`
changequote([,])
fi
ICU_LDFLAGS="$MOZ_DEBUG_LDFLAGS"
if test -z "$MOZ_DEBUG"; then
# To generate debug symbols, it requires MOZ_DEBUG_FLAGS.
# But, not debug build.
ICU_CFLAGS="$ICU_CFLAGS -UDEBUG -DNDEBUG"
ICU_CXXFLAGS="$ICU_CXXFLAGS -UDEBUG -DNDEBUG"
else
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --enable-debug"
fi
fi
if test -z "$MOZ_OPTIMIZE"; then
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --disable-release"
else
ICU_CFLAGS="$ICU_CFLAGS $MOZ_OPTIMIZE_FLAGS"
ICU_CXXFLAGS="$ICU_CXXFLAGS $MOZ_OPTIMIZE_FLAGS"
fi
if test "$am_cv_langinfo_codeset" = "no"; then
# ex. Android
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_HAVE_NL_LANGINFO_CODESET=0"
fi
# ICU requires RTTI
if test "$GNU_CC"; then
ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-fno-rtti|-frtti|g'`
else
if test "$_MSC_VER"; then
ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-GR-|-GR|g'`
fi
# Add RTL flags for MSVCRT.DLL
if test -n "$MOZ_DEBUG"; then
ICU_CFLAGS="$ICU_CFLAGS -MDd"
ICU_CXXFLAGS="$ICU_CXXFLAGS -MDd"
else
ICU_CFLAGS="$ICU_CFLAGS -MD"
ICU_CXXFLAGS="$ICU_CXXFLAGS -MD"
fi
# add disable optimize flag for workaround for bug 899948
if test -z "$MOZ_OPTIMIZE"; then
ICU_CFLAGS="$ICU_CFLAGS -Od"
ICU_CXXFLAGS="$ICU_CXXFLAGS -Od"
fi
fi
# We cannot use AC_OUTPUT_SUBDIRS since ICU tree is out of spidermonkey.
# When using AC_OUTPUT_SUBDIRS, objdir of ICU is out of objdir
# due to relative path.
# If building ICU moves into root of mozilla tree, we can use
# AC_OUTPUT_SUBDIR instead.
mkdir -p $_objdir/intl/icu/target
(cd $_objdir/intl/icu/target
MOZ_SUBCONFIGURE_WRAP([.],[
AR="$AR" CC="$CC" CXX="$CXX" LD="$LD" \
ARFLAGS="$ARFLAGS" \
CPPFLAGS="$ICU_CPPFLAGS $CPPFLAGS" \
CFLAGS="$ICU_CFLAGS" \
CXXFLAGS="$ICU_CXXFLAGS" \
LDFLAGS="$ICU_LDFLAGS $LDFLAGS" \
$SHELL $_topsrcdir/intl/icu/source/configure \
$ICU_BUILD_OPTS \
$ICU_CROSS_BUILD_OPT \
$ICU_LINK_OPTS \
${ICU_SRCDIR+"$ICU_SRCDIR"} \
$ICU_TARGET_OPT \
--disable-extras --disable-icuio --disable-layout \
--disable-tests --disable-samples || exit 1
])
) || exit 1
fi
])

View File

@ -4086,194 +4086,7 @@ _INTL_API=yes
MOZ_CONFIG_ICU()
dnl Settings for ICU
if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then
# Set ICU compile options
ICU_CPPFLAGS=""
# don't use icu namespace automatically in client code
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_USING_ICU_NAMESPACE=0"
# don't include obsolete header files
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
# remove chunks of the library that we don't need (yet)
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_LEGACY_CONVERSION"
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_TRANSLITERATION"
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_REGULAR_EXPRESSIONS"
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_BREAK_ITERATION"
ICU_CROSS_BUILD_OPT=""
ICU_SRCDIR=""
if test "$HOST_OS_ARCH" = "WINNT"; then
ICU_SRCDIR="--srcdir=$(cd $srcdir/intl/icu/source; pwd -W)"
fi
if test "$CROSS_COMPILE"; then
# Building host tools. It is necessary to build target binary.
case "$HOST_OS_ARCH" in
Darwin)
ICU_TARGET=MacOSX
;;
Linux)
ICU_TARGET=Linux
;;
WINNT)
ICU_TARGET=MSYS/MSVC
;;
*bsd*|dragonfly*)
ICU_TARGET=BSD
;;
esac
# Remove _DEPEND_CFLAGS from HOST_FLAGS to avoid configure error
HOST_ICU_CFLAGS="$HOST_CFLAGS"
HOST_ICU_CXXFLAGS="$HOST_CXXFLAGS"
HOST_ICU_CFLAGS=`echo $HOST_ICU_CFLAGS | sed "s|$_DEPEND_CFLAGS||g"`
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CFXXLAGS | sed "s|$_DEPEND_CFLAGS||g"`
# ICU requires RTTI
if test "$GNU_CC"; then
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CXXFLAGS | sed 's|-fno-rtti|-frtti|g'`
elif test "$_MSC_VER"; then
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CXXFLAGS | sed 's|-GR-|-GR|g'`
fi
HOST_ICU_BUILD_OPTS=""
if test -n "$MOZ_DEBUG"; then
HOST_ICU_BUILD_OPTS="$HOST_ICU_BUILD_OPTS --enable-debug"
fi
abs_srcdir=`(cd $srcdir; pwd)`
mkdir -p $_objdir/intl/icu/host
(cd $_objdir/intl/icu/host
MOZ_SUBCONFIGURE_WRAP([.],[
AR="$HOST_AR" RANLIB="$HOST_RANLIB" \
CC="$HOST_CC" CXX="$HOST_CXX" LD="$HOST_LD" \
CFLAGS="$HOST_ICU_CFLAGS $HOST_OPTIMIZE_FLAGS" \
CPPFLAGS="$ICU_CPPFLAGS" \
CXXFLAGS="$HOST_ICU_CXXFLAGS $HOST_OPTIMIZE_FLAGS" \
LDFLAGS="$HOST_LDFLAGS" \
$SHELL $abs_srcdir/intl/icu/source/runConfigureICU \
$HOST_ICU_BUILD_OPTS \
$ICU_TARGET \
dnl Shell quoting is fun.
${ICU_SRCDIR+"$ICU_SRCDIR"} \
--enable-static --disable-shared \
--enable-extras=no --enable-icuio=no --enable-layout=no \
--enable-tests=no --enable-samples=no || exit 1
])
) || exit 1
# generate config/icucross.mk
$GMAKE -C $_objdir/intl/icu/host/ config/icucross.mk
# --with-cross-build requires absolute path
ICU_HOST_PATH=`cd $_objdir/intl/icu/host && pwd`
ICU_CROSS_BUILD_OPT="--with-cross-build=$ICU_HOST_PATH"
ICU_TARGET_OPT="--build=$build --host=$target"
else
# CROSS_COMPILE isn't set build and target are i386 and x86-64.
# So we must set target for --build and --host.
ICU_TARGET_OPT="--build=$target --host=$target"
fi
if test -z "$MOZ_SHARED_ICU"; then
# To reduce library size, use static linking
ICU_LINK_OPTS="--enable-static --disable-shared"
else
ICU_LINK_OPTS="--disable-static --enable-shared"
fi
# Force the ICU static libraries to be position independent code
ICU_CFLAGS="$DSO_PIC_CFLAGS $CFLAGS"
ICU_CXXFLAGS="$DSO_PIC_CFLAGS $CXXFLAGS"
ICU_BUILD_OPTS=""
if test -n "$MOZ_DEBUG" -o "MOZ_DEBUG_SYMBOLS"; then
ICU_CFLAGS="$ICU_CFLAGS $MOZ_DEBUG_FLAGS"
ICU_CXXFLAGS="$ICU_CXXFLAGS $MOZ_DEBUG_FLAGS"
if test -n "$CROSS_COMPILE" -a "$OS_TARGET" = "Darwin" \
-a "$HOST_OS_ARCH" != "Darwin"
then
# Bug 951758: Cross-OSX builds with non-Darwin hosts have issues
# with -g and friends (like -gdwarf and -gfull) because they try
# to run dsymutil
changequote(,)
ICU_CFLAGS=`echo $ICU_CFLAGS | sed 's|-g[^ \t]*||g'`
ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-g[^ \t]*||g'`
changequote([,])
fi
ICU_LDFLAGS="$MOZ_DEBUG_LDFLAGS"
if test -z "$MOZ_DEBUG"; then
# To generate debug symbols, it requires MOZ_DEBUG_FLAGS.
# But, not debug build.
ICU_CFLAGS="$ICU_CFLAGS -UDEBUG -DNDEBUG"
ICU_CXXFLAGS="$ICU_CXXFLAGS -UDEBUG -DNDEBUG"
else
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --enable-debug"
fi
fi
if test -z "$MOZ_OPTIMIZE"; then
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --disable-release"
else
ICU_CFLAGS="$ICU_CFLAGS $MOZ_OPTIMIZE_FLAGS"
ICU_CXXFLAGS="$ICU_CXXFLAGS $MOZ_OPTIMIZE_FLAGS"
fi
if test "$am_cv_langinfo_codeset" = "no"; then
# ex. Android
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_HAVE_NL_LANGINFO_CODESET=0"
fi
# ICU requires RTTI
if test "$GNU_CC"; then
ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-fno-rtti|-frtti|g'`
else
if test "$_MSC_VER"; then
ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-GR-|-GR|g'`
fi
# Add RTL flags for MSVCRT.DLL
if test -n "$MOZ_DEBUG"; then
ICU_CFLAGS="$ICU_CFLAGS -MDd"
ICU_CXXFLAGS="$ICU_CXXFLAGS -MDd"
else
ICU_CFLAGS="$ICU_CFLAGS -MD"
ICU_CXXFLAGS="$ICU_CXXFLAGS -MD"
fi
# add disable optimize flag for workaround for bug 899948
if test -z "$MOZ_OPTIMIZE"; then
ICU_CFLAGS="$ICU_CFLAGS -Od"
ICU_CXXFLAGS="$ICU_CXXFLAGS -Od"
fi
fi
# We cannot use AC_OUTPUT_SUBDIRS since ICU tree is out of spidermonkey.
# When using AC_OUTPUT_SUBDIRS, objdir of ICU is out of objdir
# due to relative path.
# If building ICU moves into root of mozilla tree, we can use
# AC_OUTPUT_SUBDIR instead.
mkdir -p $_objdir/intl/icu/target
(cd $_objdir/intl/icu/target
MOZ_SUBCONFIGURE_WRAP([.],[
AR="$AR" CC="$CC" CXX="$CXX" LD="$LD" \
ARFLAGS="$ARFLAGS" \
CPPFLAGS="$ICU_CPPFLAGS $CPPFLAGS" \
CFLAGS="$ICU_CFLAGS" \
CXXFLAGS="$ICU_CXXFLAGS" \
LDFLAGS="$ICU_LDFLAGS $LDFLAGS" \
$SHELL $_topsrcdir/intl/icu/source/configure \
$ICU_BUILD_OPTS \
$ICU_CROSS_BUILD_OPT \
$ICU_LINK_OPTS \
${ICU_SRCDIR+"$ICU_SRCDIR"} \
$ICU_TARGET_OPT \
--disable-extras --disable-icuio --disable-layout \
--disable-tests --disable-samples || exit 1
])
) || exit 1
fi
MOZ_SUBCONFIGURE_ICU()
dnl ========================================================
dnl JavaScript shell