summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-04-24 23:06:35 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-04-24 23:06:35 -0700
commit0a4bbf74bdc55ed80e72aac2941dcd6aefc153b3 (patch)
treec248483f87cd4aea200636df37d4f69558f8bd69 /configure
parent1525ee4cfd3b8f9256c0e3f7deaefd0c6697c1e1 (diff)
downloadtxr-0a4bbf74bdc55ed80e72aac2941dcd6aefc153b3.tar.gz
txr-0a4bbf74bdc55ed80e72aac2941dcd6aefc153b3.tar.bz2
txr-0a4bbf74bdc55ed80e72aac2941dcd6aefc153b3.zip
Start of FFI implementation based on libffi.
* Makefile (OBJS): Add ffi.o. * configure (have_libffi): New variable. (gen_config_make): Generate have_libffi make variable. New check for availability of libffi. * ffi.c, ffi.h: New files. * lib.c (init): Call ffi_init.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure34
1 files changed, 34 insertions, 0 deletions
diff --git a/configure b/configure
index 6bdf99c6..0147bd9d 100755
--- a/configure
+++ b/configure
@@ -142,6 +142,7 @@ have_alloca=
have_termios=
have_winsize=
termios_define=
+have_libffi=
#
# Parse configuration variables
@@ -677,6 +678,8 @@ have_sockets := $have_sockets
have_termios := $have_termios
termios_define := $termios_define
+have_libffi := $have_libffi
+
# do we compile in debug support?
debug_support := $debug_support
@@ -2743,6 +2746,37 @@ else
printf "no\n"
fi
+printf "Checking for libffi ... "
+
+cat > conftest.c <<!
+#include <stdio.h>
+#include <ffi.h>
+
+int main(void)
+{
+ ffi_cif cif;
+ ffi_type *args[1];
+ void *values[1];
+ char *s;
+ args[0] = &ffi_type_pointer;
+ values[0] = &s;
+ return ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_sint, args) == FFI_OK;
+}
+!
+
+if conftest ; then
+ printf "yes\n"
+ printf "#define HAVE_LIBFFI 1\n" >> config.h
+ have_libffi=y
+elif conftest EXTRA_LDFLAGS=-lffi ; then
+ printf "yes\n"
+ printf "#define HAVE_LIBFFI 1\n" >> config.h
+ have_libffi=y
+ conf_ldflags="${conf_ldflags:+"$conf_ldflags "}-lffi"
+else
+ printf "no\n"
+fi
+
#
# Dependent variables
#