1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/build/autoconf/ffi.m4 Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,92 @@ 1.4 +dnl This Source Code Form is subject to the terms of the Mozilla Public 1.5 +dnl License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +AC_DEFUN([MOZ_CONFIG_FFI], [ 1.9 + 1.10 +MOZ_ARG_ENABLE_BOOL(system-ffi, 1.11 +[ --enable-system-ffi Use system libffi (located with pkgconfig)], 1.12 + MOZ_NATIVE_FFI=1 ) 1.13 + 1.14 +if test -n "$MOZ_NATIVE_FFI"; then 1.15 + # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10 1.16 + # for non-GCC compilers. 1.17 + if test -z "$GNU_CC"; then 1.18 + PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9) 1.19 + else 1.20 + PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9) 1.21 + fi 1.22 +fi 1.23 + 1.24 +AC_SUBST(MOZ_NATIVE_FFI) 1.25 + 1.26 +]) 1.27 + 1.28 +AC_DEFUN([MOZ_SUBCONFIGURE_FFI], [ 1.29 +if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then 1.30 + 1.31 + if test "$BUILD_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then 1.32 + # Run the libffi 'configure' script. 1.33 + ac_configure_args="--disable-shared --enable-static --disable-raw-api" 1.34 + if test "$MOZ_DEBUG"; then 1.35 + ac_configure_args="$ac_configure_args --enable-debug" 1.36 + fi 1.37 + if test "$DSO_PIC_CFLAGS"; then 1.38 + ac_configure_args="$ac_configure_args --with-pic" 1.39 + fi 1.40 + for var in AS CC CXX CPP LD AR RANLIB STRIP; do 1.41 + ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'" 1.42 + done 1.43 + if test "$CROSS_COMPILE"; then 1.44 + export CPPFLAGS CFLAGS LDFLAGS 1.45 + fi 1.46 + ac_configure_args="$ac_configure_args --build=$build --host=$target" 1.47 + if test "$_MSC_VER"; then 1.48 + # Use a wrapper script for cl and ml that looks more like gcc. 1.49 + # autotools can't quite handle an MSVC build environment yet. 1.50 + LDFLAGS= 1.51 + CFLAGS= 1.52 + ac_configure_args="$ac_configure_args LD=link CPP=\"cl -nologo -EP\" SHELL=sh.exe" 1.53 + case "${target_cpu}" in 1.54 + x86_64) 1.55 + # Need target since MSYS tools into mozilla-build may be 32bit 1.56 + ac_configure_args="$ac_configure_args CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64\"" 1.57 + ;; 1.58 + *) 1.59 + ac_configure_args="$ac_configure_args CC=$_topsrcdir/js/src/ctypes/libffi/msvcc.sh" 1.60 + ;; 1.61 + esac 1.62 + fi 1.63 + if test "$SOLARIS_SUNPRO_CC"; then 1.64 + # Always use gcc for libffi on Solaris 1.65 + if test ! "$HAVE_64BIT_OS"; then 1.66 + ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m32 LD= LDFLAGS=" 1.67 + else 1.68 + ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m64 LD= LDFLAGS=" 1.69 + fi 1.70 + fi 1.71 + if test "$AIX_IBM_XLC"; then 1.72 + # Always use gcc for libffi on IBM AIX5/AIX6 1.73 + if test ! "$HAVE_64BIT_OS"; then 1.74 + ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix32" 1.75 + else 1.76 + ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix64" 1.77 + fi 1.78 + fi 1.79 + 1.80 + # Use a separate cache file for libffi, since it does things differently 1.81 + # from our configure. 1.82 + mkdir -p $_objdir/js/src/ctypes/libffi 1.83 + old_cache_file=$cache_file 1.84 + cache_file=$_objdir/js/src/ctypes/libffi/config.cache 1.85 + old_config_files=$CONFIG_FILES 1.86 + unset CONFIG_FILES 1.87 + AC_OUTPUT_SUBDIRS(js/src/ctypes/libffi) 1.88 + cache_file=$old_cache_file 1.89 + ac_configure_args="$_SUBDIR_CONFIG_ARGS" 1.90 + CONFIG_FILES=$old_config_files 1.91 + fi 1.92 + 1.93 +fi 1.94 +]) 1.95 +