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