. "$topsrcdir/b2g/config/mozconfigs/common"

if [ "$TARGET_BUILD_VARIANT" != "user" ] ; then
ENABLE_MARIONETTE=1
ENABLE_TESTS=1
fi

mk_add_options MOZ_OBJDIR="$GECKO_OBJDIR"

if [ "$TARGET_ARCH" = "x86" ]; then
ac_add_options --target=i686-android-linux
else
ac_add_options --target=arm-linux-androideabi
fi
ac_add_options --with-gonk="$GONK_PATH"
ac_add_options --with-gonk-toolchain-prefix="$TARGET_TOOLS_PREFIX"

ac_add_options --enable-application=b2g

ac_add_options --enable-debug-symbols
if [ "${B2G_DEBUG:-0}" != "0" ]; then
ac_add_options --enable-debug
fi

if [ "${B2G_NOOPT:-0}" != "0" ]; then
ac_add_options --disable-optimize
fi

if [ "${B2G_DUMP_PAINTING:-0}" != "0" ]; then
ac_add_options --enable-dump-painting
fi

ac_add_options --with-ccache

if [ "${DISABLE_JEMALLOC:-0}" != "0" ]; then
ac_add_options --disable-jemalloc
fi

if [ "${B2G_VALGRIND:-0}" != "0" ]; then
ac_add_options --enable-valgrind
ac_add_options --enable-profiling
ac_add_options --disable-jemalloc
fi

if [ "${MOZ_NON_UNIFIED:-0}" != "0" ] ; then
ac_add_options --disable-unified-compilation
fi

if [ "${B2G_PROFILING:-0}" != "0" ]; then
ac_add_options --enable-profiling
fi

if [ "$HOST_OS" != "linux" ]; then
ac_add_options --disable-crashreporter
fi

if [ "${B2G_UPDATER:-0}" != "0" ]; then
  # Note: if B2G_UPDATE_CHANNEL isn't set, then configure will use its own
  # default, which is "default".
  ac_add_options --enable-updater
  ac_add_options --enable-update-channel="${B2G_UPDATE_CHANNEL}"
fi

ac_add_options --enable-update-packaging

# Enable dump() from JS.
export CXXFLAGS="-DMOZ_ENABLE_JS_DUMP $EXTRA_INCLUDE ${CXXFLAGS}"

ac_add_options --with-fpu="$ARCH_ARM_VFP"

if [ "${MOZ_DMD:-0}" != 0 ]; then
  ac_add_options --enable-dmd
fi

if [ "${ENABLE_GLOBAL_PRELINK:-0}" != 0 ]; then
# Disable ELF_HACK on B2G for prelink.
ac_add_options --disable-elf-hack
fi

if [ "$TARGET_BUILD_VARIANT" = eng ]; then
  ac_add_options --enable-content-sandbox-reporter
  # bug 979947 - Engineering builds should have
  # the profiler enabled by default
  ac_add_options --enable-profiling
fi
