2014-02-11 05:37:47 +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/.
|
|
|
|
|
2014-02-11 05:37:47 +04:00
|
|
|
AC_DEFUN([MOZ_SUBCONFIGURE_FFI], [
|
2016-03-18 12:33:18 +03:00
|
|
|
if test "$MOZ_BUILD_APP" != js -o -n "$JS_STANDALONE"; then
|
2014-02-11 05:37:47 +04:00
|
|
|
|
2016-02-01 18:49:34 +03:00
|
|
|
if test "$BUILD_CTYPES" -a -z "$MOZ_SYSTEM_FFI"; then
|
2014-02-11 05:37:47 +04:00
|
|
|
# Run the libffi 'configure' script.
|
|
|
|
ac_configure_args="--disable-shared --enable-static --disable-raw-api"
|
|
|
|
if test "$MOZ_DEBUG"; then
|
|
|
|
ac_configure_args="$ac_configure_args --enable-debug"
|
2014-02-11 05:37:47 +04:00
|
|
|
fi
|
2014-02-11 05:37:47 +04:00
|
|
|
if test "$DSO_PIC_CFLAGS"; then
|
|
|
|
ac_configure_args="$ac_configure_args --with-pic"
|
|
|
|
fi
|
|
|
|
for var in AS CC CXX CPP LD AR RANLIB STRIP; do
|
|
|
|
ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
|
|
|
|
done
|
2016-06-29 06:48:49 +03:00
|
|
|
old_cflags="$CFLAGS"
|
|
|
|
# The libffi sources (especially the ARM ones) are written expecting gas
|
|
|
|
# syntax, and clang's integrated assembler doesn't handle all of gas syntax.
|
|
|
|
if test -n "$CLANG_CC" -a "$CPU_ARCH" = arm; then
|
|
|
|
CFLAGS="-no-integrated-as $CFLAGS"
|
|
|
|
fi
|
2016-07-05 02:24:40 +03:00
|
|
|
ac_configure_args="$ac_configure_args --build=$build --host=$target"
|
2014-02-11 05:37:47 +04:00
|
|
|
if test "$CROSS_COMPILE"; then
|
2016-07-05 02:24:40 +03:00
|
|
|
ac_configure_args="$ac_configure_args \
|
|
|
|
CFLAGS=\"$CFLAGS\" \
|
|
|
|
CPPFLAGS=\"$CPPFLAGS\" \
|
|
|
|
LDFLAGS=\"$LDFLAGS\""
|
2014-02-11 05:37:47 +04:00
|
|
|
fi
|
2016-07-05 02:24:40 +03:00
|
|
|
CFLAGS="$old_cflags"
|
2014-02-11 05:37:47 +04:00
|
|
|
if test "$_MSC_VER"; then
|
|
|
|
# Use a wrapper script for cl and ml that looks more like gcc.
|
|
|
|
# autotools can't quite handle an MSVC build environment yet.
|
|
|
|
LDFLAGS=
|
|
|
|
CFLAGS=
|
2014-06-13 16:28:29 +04:00
|
|
|
ac_configure_args="$ac_configure_args LD=link CPP=\"$CC -nologo -EP\" \
|
|
|
|
CXXCPP=\"$CXX -nologo -EP\" SHELL=sh.exe"
|
|
|
|
flags=
|
2014-06-13 19:08:04 +04:00
|
|
|
if test -z "$MOZ_NO_DEBUG_RTL" -a -n "$MOZ_DEBUG"; then
|
2014-06-13 16:28:29 +04:00
|
|
|
flags=" -DUSE_DEBUG_RTL"
|
|
|
|
fi
|
|
|
|
if test -n "$CLANG_CL"; then
|
|
|
|
flags="$flags -clang-cl"
|
2014-05-30 04:39:19 +04:00
|
|
|
fi
|
2014-02-11 05:37:47 +04:00
|
|
|
case "${target_cpu}" in
|
|
|
|
x86_64)
|
|
|
|
# Need target since MSYS tools into mozilla-build may be 32bit
|
2014-05-13 22:51:01 +04:00
|
|
|
ac_configure_args="$ac_configure_args \
|
2014-06-13 16:28:29 +04:00
|
|
|
CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64$flags\" \
|
|
|
|
CXX=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64$flags\""
|
2014-02-11 05:37:47 +04:00
|
|
|
;;
|
|
|
|
*)
|
2014-05-13 22:51:01 +04:00
|
|
|
ac_configure_args="$ac_configure_args \
|
2014-06-13 16:28:29 +04:00
|
|
|
CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh$flags\" \
|
|
|
|
CXX=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh$flags\""
|
2014-02-11 05:37:47 +04:00
|
|
|
;;
|
|
|
|
esac
|
2014-02-11 05:37:47 +04:00
|
|
|
fi
|
2014-02-11 05:37:47 +04:00
|
|
|
|
|
|
|
# Use a separate cache file for libffi, since it does things differently
|
|
|
|
# from our configure.
|
|
|
|
old_config_files=$CONFIG_FILES
|
|
|
|
unset CONFIG_FILES
|
|
|
|
AC_OUTPUT_SUBDIRS(js/src/ctypes/libffi)
|
|
|
|
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
|
|
|
|
CONFIG_FILES=$old_config_files
|
2014-02-11 05:37:47 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|