[librep] correctly check for libffi



commit 0a9de012ba694d01e68c6ade25ef35be13174e5a
Author: chrisb <zanghar freenet de>
Date:   Wed Jul 15 20:22:43 2009 +0200

    correctly check for libffi

 ChangeLog       |    5 +++++
 Makedefs.in     |    2 +-
 config.h.in     |    6 ------
 configure.in    |   33 +++++++--------------------------
 man/news.texi   |    2 ++
 src/Makefile.in |    2 +-
 6 files changed, 16 insertions(+), 34 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c7faea3..0775a03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-15  Christopher Bratusek <zanghar freenet de>
+	* configure.in
+	* Makedefs.in
+	* src/Makefile.in: update checks for libffi
+
 2009-07-11  Christopher Bratusek <zanghar freenet de>
 	* src/unix_processes.c: fix a definition
 
diff --git a/Makedefs.in b/Makedefs.in
index 4f0c29b..cc03270 100644
--- a/Makedefs.in
+++ b/Makedefs.in
@@ -59,7 +59,7 @@ EXTRA_LIBOBJS= EXTRA_LIBOBJS@
 READLINE_LIBS= READLINE_LIBS@
 GMP_LIBS= GMP_LIBS@
 GDBM_LIBS= GDBM_LIBS@
-FFI_LIBS= FFI_LIBS@
+LIBFFI_LIBS= LIBFFI_LIBS@
 ALLOCA= ALLOCA@
 
 DESTDIR=
diff --git a/config.h.in b/config.h.in
index d32e0e4..b5bab1e 100644
--- a/config.h.in
+++ b/config.h.in
@@ -79,9 +79,6 @@
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
-/* Have ffi header */
-#undef HAVE_FFI_H
-
 /* Define to 1 if you have the `getcwd' function. */
 #undef HAVE_GETCWD
 
@@ -109,9 +106,6 @@
 /* Define to 1 if you have the `dl' library (-ldl). */
 #undef HAVE_LIBDL
 
-/* Have libffi */
-#undef HAVE_LIBFFI
-
 /* Define to 1 if you have the <libintl.h> header file. */
 #undef HAVE_LIBINTL_H
 
diff --git a/configure.in b/configure.in
index 5881672..54e432a 100644
--- a/configure.in
+++ b/configure.in
@@ -219,37 +219,17 @@ fi
 AC_SUBST(READLINE_LIBS)
 
 dnl Check for ffi
+FFI_MIN_VER=3.0
+
 AC_ARG_WITH(ffi,
  [  --with-ffi              Support for ffi
-  --without-ffi           Don't use ffi], [], [with_ffi=maybe])
+  --without-ffi           Don't use ffi], [], [with_ffi=yes])
 
 if test "$with_ffi" != "no"; then
-  dnl Save in case test with directory specified fails
-  _cppflags=${CPPFLAGS}
-  _ldflags=${LDFLAGS}
-  AC_ARG_WITH(ffi-prefix,
-  [  --with-ffi-prefix=DIR   path to ffi],
-  [ if test "$withval" != "no" -a "$withval" != "yes"; then
-    CPPFLAGS="${CPPFLAGS} -I$withval/include"
-    LDFLAGS="${LDFLAGS} -L$withval/lib"
-  fi ])
-
-  AC_CHECK_HEADER(ffi.h,
-    AC_DEFINE(HAVE_FFI_H, 1, [Have ffi header])
-    AC_CHECK_LIB(ffi, ffi_call,[
-      FFI_LIBS="-lffi"
-      AC_DEFINE(HAVE_LIBFFI, 1, [Have libffi])] found_ffi=yes))
-
-  if test -z "$FFI_LIBS"; then
-    if test "$with_ffi_prefix" = "yes"; then
-      AC_MSG_ERROR([Can't find libffi])
-    else
-      CPPFLAGS=${_cppflags}
-      LDFLAGS=${_ldflags}
-    fi
-  fi
+  PKG_CHECK_MODULES(LIBFFI, libffi >= $FFI_MIN_VER
+  ,found_ffi=yes
+  ,AC_MSG_ERROR([can't locate libffi]))
 fi
-AC_SUBST(FFI_LIBS)
 
 dnl Check for dynamic loading
 AC_CHECK_HEADER(dlfcn.h, [AC_DEFINE(HAVE_DLFCN_H, 1, [Have dlfcn header])])
@@ -621,6 +601,7 @@ AC_SUBST(INTLOBJS)
 AC_SUBST(GT_YES)
 AC_SUBST(GT_NO)
 AC_SUBST(l)
+AC_SUBST(LIBFFI_LIBS)
 
 dnl If it looks like GNU gettext is in libc, don't compile a local copy
 USE_INCLUDED_LIBINTL=yes
diff --git a/man/news.texi b/man/news.texi
index 7d77a21..0a74b2e 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -12,6 +12,8 @@
 @item Remove scheme and unscheme modules
 
 @item Going on with code-cleanup
+
+ item We do now correctly check for libffi
 @end itemize
 
 @heading 0.17.4
diff --git a/src/Makefile.in b/src/Makefile.in
index 8359ef4..f28229a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -160,7 +160,7 @@ utf8.la : utf8.lo
 	$(rep_DL_LD) $(LDFLAGS) -o $@ $^
 
 ffi.la : ffi.lo
-	$(rep_DL_LD) $(LDFLAGS) -o $@ $^ $(FFI_LIBS)
+	$(rep_DL_LD) $(LDFLAGS) -o $@ $^ $(LIBFFI_LIBS)
 
 .libexec : $(DL_OBJS)
 	$(SHELL) $(srcdir)/fake-libexec



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]