- Build using system ffi library on arm*-linux*.
diff --git a/configure.in b/configure.in
index 7480ee6..2c5a85f 100644
--- a/configure.in
+++ b/configure.in
@@ -1748,12 +1748,16 @@
 [AC_MSG_RESULT(no)])
 
 # Check for use of the system libffi library
+AC_CHECK_HEADER(ffi.h)
 AC_MSG_CHECKING(for --with-system-ffi)
 AC_ARG_WITH(system_ffi,
             AC_HELP_STRING(--with-system-ffi, build _ctypes module using an installed ffi library))
 
-if test -z "$with_system_ffi"
-then with_system_ffi="no"
+if test -z "$with_system_ffi" && test "$ac_cv_header_ffi_h" = yes; then
+	case "$ac_sys_system/`uname -m`" in
+	Linux/arm*)  with_system_ffi="yes";;
+	*) with_system_ffi="no"
+	esac
 fi
 AC_MSG_RESULT($with_system_ffi)