summaryrefslogtreecommitdiff
blob: 9c5554739eac81251d27afaf7a5986e1ffec9682 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- pygobject-2.14.0/configure.ac	2007/11/12 00:09:09	1.1
+++ pygobject-2.14.0/configure.ac	2007/11/12 00:22:35
@@ -129,10 +129,33 @@ AC_SUBST([pygobject_CODEGEN_DEFINES])
 
 dnl libffi
 AC_MSG_CHECKING(for ffi.h)
-AC_TRY_CPP([#include <ffi.h>], pygobject_ffi_h=yes, pygobject_ffi_h=no)
-if test $pygobject_ffi_h = yes; then
-   AC_DEFINE(HAVE_FFI_H,1,[Have ffi.h include file])
-   FFI_LIBS="-lffi"
+AC_ARG_WITH(libffi,
+  AC_HELP_STRING([--without-libffi], [Disable libffi support]),
+  with_libffi=$withval,
+  with_libffi=auto)
+if test x"$with_libffi" = xno ; then
+  pygobject_ffi_h=disabled
+else
+  AC_TRY_CPP([#include <ffi.h>], pygobject_ffi_h=yes, pygobject_ffi_h=no)
+  if test $pygobject_ffi_h = yes; then
+    AC_DEFINE(HAVE_FFI_H,1,[Have ffi.h include file])
+    save_LIBS=$LIBS
+    if test x"$with_libffi" = xyes || test x"$with_libffi" = xauto; then
+      other_LIBS=
+    else
+      other_LIBS=$with_libffi
+    fi
+    AC_SEARCH_LIBS(ffi_call,ffi,,AC_MSG_ERROR([libffi not found]),$other_LIBS)
+    if test x$"ac_cv_search_ffi_call" = x"none required" ; then
+      FFI_LIBS=$other_LIBS
+    else
+      FFI_LIBS="$ac_cv_search_ffi_call $other_LIBS"
+    fi
+    LIBS=$save_LIBS
+  fi
+fi
+if test x"$with_libffi" = xyes && test x"$pygobject_ffi_h" != xyes ; then
+  AC_MSG_ERROR([libffi requested, but ffi.h not found])
 fi
 AC_MSG_RESULT([$pygobject_ffi_h])
 AM_CONDITIONAL(HAVE_LIBFFI, test "$pygobject_ffi_h" = "yes")