Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | dnl This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | dnl License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 4 | |
michael@0 | 5 | AC_DEFUN([MOZ_CONFIG_FFI], [ |
michael@0 | 6 | |
michael@0 | 7 | MOZ_ARG_ENABLE_BOOL(system-ffi, |
michael@0 | 8 | [ --enable-system-ffi Use system libffi (located with pkgconfig)], |
michael@0 | 9 | MOZ_NATIVE_FFI=1 ) |
michael@0 | 10 | |
michael@0 | 11 | if test -n "$MOZ_NATIVE_FFI"; then |
michael@0 | 12 | # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10 |
michael@0 | 13 | # for non-GCC compilers. |
michael@0 | 14 | if test -z "$GNU_CC"; then |
michael@0 | 15 | PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9) |
michael@0 | 16 | else |
michael@0 | 17 | PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9) |
michael@0 | 18 | fi |
michael@0 | 19 | fi |
michael@0 | 20 | |
michael@0 | 21 | AC_SUBST(MOZ_NATIVE_FFI) |
michael@0 | 22 | |
michael@0 | 23 | ]) |
michael@0 | 24 | |
michael@0 | 25 | AC_DEFUN([MOZ_SUBCONFIGURE_FFI], [ |
michael@0 | 26 | if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then |
michael@0 | 27 | |
michael@0 | 28 | if test "$BUILD_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then |
michael@0 | 29 | # Run the libffi 'configure' script. |
michael@0 | 30 | ac_configure_args="--disable-shared --enable-static --disable-raw-api" |
michael@0 | 31 | if test "$MOZ_DEBUG"; then |
michael@0 | 32 | ac_configure_args="$ac_configure_args --enable-debug" |
michael@0 | 33 | fi |
michael@0 | 34 | if test "$DSO_PIC_CFLAGS"; then |
michael@0 | 35 | ac_configure_args="$ac_configure_args --with-pic" |
michael@0 | 36 | fi |
michael@0 | 37 | for var in AS CC CXX CPP LD AR RANLIB STRIP; do |
michael@0 | 38 | ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'" |
michael@0 | 39 | done |
michael@0 | 40 | if test "$CROSS_COMPILE"; then |
michael@0 | 41 | export CPPFLAGS CFLAGS LDFLAGS |
michael@0 | 42 | fi |
michael@0 | 43 | ac_configure_args="$ac_configure_args --build=$build --host=$target" |
michael@0 | 44 | if test "$_MSC_VER"; then |
michael@0 | 45 | # Use a wrapper script for cl and ml that looks more like gcc. |
michael@0 | 46 | # autotools can't quite handle an MSVC build environment yet. |
michael@0 | 47 | LDFLAGS= |
michael@0 | 48 | CFLAGS= |
michael@0 | 49 | ac_configure_args="$ac_configure_args LD=link CPP=\"cl -nologo -EP\" SHELL=sh.exe" |
michael@0 | 50 | case "${target_cpu}" in |
michael@0 | 51 | x86_64) |
michael@0 | 52 | # Need target since MSYS tools into mozilla-build may be 32bit |
michael@0 | 53 | ac_configure_args="$ac_configure_args CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64\"" |
michael@0 | 54 | ;; |
michael@0 | 55 | *) |
michael@0 | 56 | ac_configure_args="$ac_configure_args CC=$_topsrcdir/js/src/ctypes/libffi/msvcc.sh" |
michael@0 | 57 | ;; |
michael@0 | 58 | esac |
michael@0 | 59 | fi |
michael@0 | 60 | if test "$SOLARIS_SUNPRO_CC"; then |
michael@0 | 61 | # Always use gcc for libffi on Solaris |
michael@0 | 62 | if test ! "$HAVE_64BIT_OS"; then |
michael@0 | 63 | ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m32 LD= LDFLAGS=" |
michael@0 | 64 | else |
michael@0 | 65 | ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m64 LD= LDFLAGS=" |
michael@0 | 66 | fi |
michael@0 | 67 | fi |
michael@0 | 68 | if test "$AIX_IBM_XLC"; then |
michael@0 | 69 | # Always use gcc for libffi on IBM AIX5/AIX6 |
michael@0 | 70 | if test ! "$HAVE_64BIT_OS"; then |
michael@0 | 71 | ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix32" |
michael@0 | 72 | else |
michael@0 | 73 | ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix64" |
michael@0 | 74 | fi |
michael@0 | 75 | fi |
michael@0 | 76 | |
michael@0 | 77 | # Use a separate cache file for libffi, since it does things differently |
michael@0 | 78 | # from our configure. |
michael@0 | 79 | mkdir -p $_objdir/js/src/ctypes/libffi |
michael@0 | 80 | old_cache_file=$cache_file |
michael@0 | 81 | cache_file=$_objdir/js/src/ctypes/libffi/config.cache |
michael@0 | 82 | old_config_files=$CONFIG_FILES |
michael@0 | 83 | unset CONFIG_FILES |
michael@0 | 84 | AC_OUTPUT_SUBDIRS(js/src/ctypes/libffi) |
michael@0 | 85 | cache_file=$old_cache_file |
michael@0 | 86 | ac_configure_args="$_SUBDIR_CONFIG_ARGS" |
michael@0 | 87 | CONFIG_FILES=$old_config_files |
michael@0 | 88 | fi |
michael@0 | 89 | |
michael@0 | 90 | fi |
michael@0 | 91 | ]) |
michael@0 | 92 |