fixed autoconf so that ffi.h and libffi are checked iff ffi is

enabled.  Also made prep-callback return #f if libffi does not
support closures.
This commit is contained in:
Abdulaziz Ghuloum 2008-09-22 21:55:05 -04:00
parent e07d8f9760
commit 09657334c0
4 changed files with 30 additions and 19 deletions

24
configure vendored
View File

@ -6650,13 +6650,12 @@ ac_cv_lib_gmp=ac_cv_lib_gmp_main
# Check whether --enable-libffi was given.
if test "${enable_libffi+set}" = set; then
enableval=$enable_libffi;
cat >>confdefs.h <<\_ACEOF
#define ENABLE_LIBFFI 1
_ACEOF
fi
if test "$enable_libffi" = "yes"; then
for ac_header in ffi.h
do
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@ -6804,8 +6803,7 @@ as_val=`eval 'as_val=${'$as_ac_Header'}
_ACEOF
else
if test "$enable_libffi" = "yes"; then
{ { $as_echo "$as_me:$LINENO: error: ffi.h cannot be found.
{ { $as_echo "$as_me:$LINENO: error: ffi.h cannot be found.
Please specify the location of the header file using
./configure CFLAGS=-I<path/to/ffi.h> <other-options ...>
" >&5
@ -6814,12 +6812,12 @@ Please specify the location of the header file using
./configure CFLAGS=-I<path/to/ffi.h> <other-options ...>
" >&2;}
{ (exit 1); exit 1; }; }
fi
fi
done
{ $as_echo "$as_me:$LINENO: checking for ffi_call in -lffi" >&5
$as_echo_n "checking for ffi_call in -lffi... " >&6; }
if test "${ac_cv_lib_ffi_ffi_call+set}" = set; then
@ -6893,8 +6891,7 @@ _ACEOF
LIBS="-lffi $LIBS"
else
if test "$enable_libffi" = "yes"; then
{ { $as_echo "$as_me:$LINENO: error: libffi cannot be found.
{ { $as_echo "$as_me:$LINENO: error: libffi cannot be found.
Please specify the location of the library file using
./configure LDFLAGS=-L<path/to/libffi.ld|dylib|so|etc.> <other-options ...>
" >&5
@ -6903,10 +6900,17 @@ Please specify the location of the library file using
./configure LDFLAGS=-L<path/to/libffi.ld|dylib|so|etc.> <other-options ...>
" >&2;}
{ (exit 1); exit 1; }; }
fi
fi
cat >>confdefs.h <<\_ACEOF
#define ENABLE_LIBFFI 1
_ACEOF
fi
# Checks for typedefs, structures, and compiler characteristics.
{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
$as_echo_n "checking for an ANSI C-conforming const... " >&6; }

View File

@ -64,22 +64,25 @@ ERROR: libgmp.so) if libgmp is installed in a non-standard location.
ERROR: libgmp can be obtained from <http://gmplib.org>. ])])
AC_ARG_ENABLE(libffi,
[ --enable-libffi enable support for libffi.],
AC_DEFINE(ENABLE_LIBFFI, 1, [adds support for libffi]))
[ --enable-libffi enable support for libffi.])
if test "$enable_libffi" = "yes"; then
AC_CHECK_HEADERS([ffi.h],,
if test "$enable_libffi" = "yes"; then
AC_MSG_ERROR([ffi.h cannot be found.
Please specify the location of the header file using
./configure CFLAGS=-I<path/to/ffi.h> <other-options ...>
])
fi)
]))
AC_CHECK_LIB(ffi,ffi_call,,
if test "$enable_libffi" = "yes"; then
AC_MSG_ERROR([libffi cannot be found.
Please specify the location of the library file using
./configure LDFLAGS=-L<path/to/libffi.ld|dylib|so|etc.> <other-options ...>
])
fi)
]))
AC_DEFINE(ENABLE_LIBFFI, 1, [adds support for libffi])
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

View File

@ -1 +1 @@
1601
1602

View File

@ -319,6 +319,7 @@ generic_callback(ffi_cif *cif, void *ret, void **args, void *user_data){
ikptr
ikrt_prepare_callback(ikptr data, ikpcb* pcb){
#if FFI_CLOSURES
ikptr cifptr = ref(data, off_vector_data + 0 * wordsize);
void* codeloc;
ffi_closure* closure = ffi_closure_alloc(sizeof(ffi_closure), &codeloc);
@ -346,6 +347,9 @@ ikrt_prepare_callback(ikptr data, ikpcb* pcb){
ref(p, 0) = pointer_tag;
ref(p, wordsize) = (ikptr) codeloc;
return p+vector_tag;
#else
return false_object
#endif
}
int ho (int(*f)(int), int n) {