Bug 1036645 part 1 - Use AC_OUTPUT_SUBDIRS to call ICU configure. r=gps

As ICU needs an objdir different from its source directory, add support for
that in AC_OUTPUT_SUBDIRS.
This commit is contained in:
Mike Hommey 2014-07-11 19:05:59 +09:00
parent 28d2bd170c
commit c180fcf730
2 changed files with 58 additions and 81 deletions

View File

@ -18,33 +18,42 @@ MOZ_CONFIG_LOG_TRAP
]) ])
dnl Disable the trap when running sub-configures. dnl Disable the trap when running sub-configures.
define([_MOZ_AC_OUTPUT_SUBDIRS], defn([AC_OUTPUT_SUBDIRS])) define(GEN_MOZ_AC_OUTPUT_SUBDIRS, [
define([MOZ_SUBCONFIGURE_WRAP], define([_MOZ_AC_OUTPUT_SUBDIRS], [
[ _CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} patsubst($@, [$srcdir/$ac_config_dir], [$srcdir/$moz_config_srcdir])
case "$host" in ])
*-mingw*) ])
GEN_MOZ_AC_OUTPUT_SUBDIRS(defn([AC_OUTPUT_SUBDIRS]))
define([AC_OUTPUT_SUBDIRS],
[trap '' EXIT
for moz_config_dir in $1; do
case "$moz_config_dir" in
*:*)
moz_config_srcdir=$(echo $moz_config_dir | awk -F: '{print [$]1}')
moz_config_dir=$(echo $moz_config_dir | awk -F: '{print [$]2}')
;;
*)
moz_config_srcdir=$moz_config_dir
;;
esac
_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
case "$host" in
*-mingw*)
_CONFIG_SHELL=$(cd $(dirname $_CONFIG_SHELL); pwd -W)/$(basename $_CONFIG_SHELL) _CONFIG_SHELL=$(cd $(dirname $_CONFIG_SHELL); pwd -W)/$(basename $_CONFIG_SHELL)
if test ! -e "$_CONFIG_SHELL" -a -e "${_CONFIG_SHELL}.exe"; then if test ! -e "$_CONFIG_SHELL" -a -e "${_CONFIG_SHELL}.exe"; then
_CONFIG_SHELL="${_CONFIG_SHELL}.exe" _CONFIG_SHELL="${_CONFIG_SHELL}.exe"
fi fi
;; ;;
esac esac
if test -d "$1"; then if test -d "$moz_config_dir"; then
(cd "$1"; $PYTHON $_topsrcdir/build/subconfigure.py dump "$_CONFIG_SHELL") (cd "$moz_config_dir"; $PYTHON $_topsrcdir/build/subconfigure.py dump "$_CONFIG_SHELL")
else else
mkdir -p "$1" mkdir -p "$moz_config_dir"
fi fi
$2 _MOZ_AC_OUTPUT_SUBDIRS($moz_config_dir)
(cd "$1"; $PYTHON $_topsrcdir/build/subconfigure.py adjust $ac_sub_configure) (cd "$moz_config_dir"; $PYTHON $_topsrcdir/build/subconfigure.py adjust $ac_sub_configure)
])
define([AC_OUTPUT_SUBDIRS],
[trap '' EXIT
for moz_config_dir in $1; do
MOZ_SUBCONFIGURE_WRAP([$moz_config_dir],[
_MOZ_AC_OUTPUT_SUBDIRS($moz_config_dir)
])
done done
MOZ_CONFIG_LOG_TRAP MOZ_CONFIG_LOG_TRAP

View File

@ -154,27 +154,8 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
ICU_CPPFLAGS="$ICU_CPPFLAGS -I$icudir/common -I$icudir/i18n" ICU_CPPFLAGS="$ICU_CPPFLAGS -I$icudir/common -I$icudir/i18n"
ICU_CROSS_BUILD_OPT="" 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 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
;;
DragonFly|FreeBSD|NetBSD|OpenBSD|GNU_kFreeBSD)
ICU_TARGET=BSD
;;
esac
# Remove _DEPEND_CFLAGS from HOST_FLAGS to avoid configure error # Remove _DEPEND_CFLAGS from HOST_FLAGS to avoid configure error
HOST_ICU_CFLAGS="$HOST_CFLAGS" HOST_ICU_CFLAGS="$HOST_CFLAGS"
HOST_ICU_CXXFLAGS="$HOST_CXXFLAGS" HOST_ICU_CXXFLAGS="$HOST_CXXFLAGS"
@ -196,24 +177,21 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
abs_srcdir=`(cd $srcdir; pwd)` abs_srcdir=`(cd $srcdir; pwd)`
mkdir -p $_objdir/intl/icu/host mkdir -p $_objdir/intl/icu/host
(cd $_objdir/intl/icu/host (export AR="$HOST_AR"
MOZ_SUBCONFIGURE_WRAP([.],[ export RANLIB="$HOST_RANLIB"
AR="$HOST_AR" RANLIB="$HOST_RANLIB" \ export CC="$HOST_CC"
CC="$HOST_CC" CXX="$HOST_CXX" LD="$HOST_LD" \ export CXX="$HOST_CXX"
CFLAGS="$HOST_ICU_CFLAGS $HOST_OPTIMIZE_FLAGS" \ export CPP="$HOST_CPP"
CPPFLAGS="$ICU_CPPFLAGS" \ export LD="$HOST_LD"
CXXFLAGS="$HOST_ICU_CXXFLAGS $HOST_OPTIMIZE_FLAGS" \ export CFLAGS="$HOST_ICU_CFLAGS $HOST_OPTIMIZE_FLAGS"
LDFLAGS="$HOST_LDFLAGS" \ export CPPFLAGS="$ICU_CPPFLAGS"
$SHELL $abs_srcdir/intl/icu/source/runConfigureICU \ export CXXFLAGS="$HOST_ICU_CXXFLAGS $HOST_OPTIMIZE_FLAGS"
$HOST_ICU_BUILD_OPTS \ export LDFLAGS="$HOST_LDFLAGS"
$ICU_TARGET \ ac_configure_args="$HOST_ICU_BUILD_OPTS"
dnl Shell quoting is fun. ac_configure_args="$ac_configure_args --enable-static --disable-shared --enable-extras=no --enable-icuio=no --enable-layout=no --enable-tests=no --enable-samples=no"
${ICU_SRCDIR+"$ICU_SRCDIR"} \ cache_file=$_objdir/intl/icu/host/config.cache
--enable-static --disable-shared \ AC_OUTPUT_SUBDIRS(intl/icu/source:intl/icu/host)
--enable-extras=no --enable-icuio=no --enable-layout=no \ ) || exit 1
--enable-tests=no --enable-samples=no || exit 1
])
) || exit 1
# generate config/icucross.mk # generate config/icucross.mk
$GMAKE -C $_objdir/intl/icu/host/ config/icucross.mk $GMAKE -C $_objdir/intl/icu/host/ config/icucross.mk
@ -308,29 +286,19 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
fi fi
fi fi
# We cannot use AC_OUTPUT_SUBDIRS since ICU tree is out of spidermonkey. (export AR="$AR"
# When using AC_OUTPUT_SUBDIRS, objdir of ICU is out of objdir export CC="$CC"
# due to relative path. export CXX="$CXX"
# If building ICU moves into root of mozilla tree, we can use export LD="$LD"
# AC_OUTPUT_SUBDIR instead. export ARFLAGS="$ARFLAGS"
mkdir -p $_objdir/intl/icu/target export CPPFLAGS="$ICU_CPPFLAGS $CPPFLAGS"
(cd $_objdir/intl/icu/target export CFLAGS="$ICU_CFLAGS"
MOZ_SUBCONFIGURE_WRAP([.],[ export CXXFLAGS="$ICU_CXXFLAGS"
AR="$AR" CC="$CC" CXX="$CXX" LD="$LD" \ export LDFLAGS="$ICU_LDFLAGS $LDFLAGS"
ARFLAGS="$ARFLAGS" \ ac_configure_args="$ICU_BUILD_OPTS $ICU_CROSS_BUILD_OPT $ICU_LINK_OPTS $ICU_TARGET_OPT"
CPPFLAGS="$ICU_CPPFLAGS $CPPFLAGS" \ ac_configure_args="$ac_configure_args --disable-extras --disable-icuio --disable-layout --disable-tests --disable-samples"
CFLAGS="$ICU_CFLAGS" \ cache_file=$_objdir/intl/icu/target/config.cache
CXXFLAGS="$ICU_CXXFLAGS" \ AC_OUTPUT_SUBDIRS(intl/icu/source:intl/icu/target)
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 ) || exit 1
fi fi