Take advantage of a libffi.pc if one exists, as it does on Fedora 8. Make
authorHavoc Pennington <hp@redhat.com>
Wed, 5 Mar 2008 17:10:28 +0000 (17:10 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Wed, 5 Mar 2008 17:10:28 +0000 (17:10 +0000)
2008-03-05  Havoc Pennington  <hp@redhat.com>

* configure.ac: Take advantage of a libffi.pc if one exists, as it
does on Fedora 8. Make libffi a hard requirement, since it was in
practice anyway (was not really conditional in the code or
makefile, only in configure).

svn path=/trunk/; revision=121

ChangeLog
configure.ac
girepository/Makefile.am

index 496c595a0f0564f352dcc530fddb281731bb64e7..47dc9d0049c9ca719d56a249952968464e4df178 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-03-05  Havoc Pennington  <hp@redhat.com>
+
+       * configure.ac: Take advantage of a libffi.pc if one exists, as it
+       does on Fedora 8. Make libffi a hard requirement, since it was in
+       practice anyway (was not really conditional in the code or
+       makefile, only in configure).
+
 2008-02-21  Mark Doffman  <mark.doffman@codethink.co.uk>
     
        reviewed by: Rob Taylor  <rob.taylor@codethink.co.uk>
index 90b50f007fb4f676753af53d6d0f27e724197aa7..8eef47124c6dc216cf1ccd45d0252fe165a4ba80 100644 (file)
@@ -35,47 +35,47 @@ PKG_CHECK_MODULES(GOBJECT, [gobject-2.0])
 PKG_CHECK_MODULES(SCANNER, [gobject-2.0 gthread-2.0])
 
 dnl libffi
-AC_MSG_CHECKING(for ffi.h)
-AC_ARG_WITH(libffi,
-  AC_HELP_STRING([--without-ffi], [Disable libffi support]),
-  with_ffi=$withval,
-  with_ffi=auto)
-if test x"$with_ffi" = xno ; then
-  have_ffi_h=disabled
-else
+PKG_CHECK_MODULES(FFI, libffi, have_ffi_pkgconfig=yes, have_ffi_pkgconfig=no)
+
+if x$have_ffi_pkgconfig = xno ; then
+  AC_MSG_CHECKING(for ffi.h)
+
   AC_TRY_CPP([#include <ffi.h>], have_ffi_h=yes, have_ffi_h=no)
   if test $have_ffi_h = yes; then
-    AC_DEFINE(HAVE_FFI_H,1,[Have ffi.h include file])
+
     save_LIBS=$LIBS
     if test x"$with_ffi" = xyes || test x"$with_ffi" = xauto; then
       other_LIBS=
     else
       other_LIBS=$with_ffi
     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_ffi" != xauto && test x"$have_ffi_h" != xyes ; then
-  AC_MSG_ERROR([libffi requested, but ffi.h not found])
-fi
-AC_MSG_RESULT([$have_ffi_h])
-AM_CONDITIONAL(HAVE_LIBFFI, test "$have_ffi_h" = "yes")
-AC_SUBST(FFI_LIBS)
+  if test x"$have_ffi_h" != xyes ; then
+    AC_MSG_ERROR([ffi.h not found])
+  fi
 
-dnl if libffi is not found, g_function_info_invoke is not available,
-dnl but everything else still works
+  FFI_CFLAGS=
+
+  AC_MSG_RESULT([$have_ffi_h])
+  AC_SUBST(FFI_LIBS)
+  AC_SUBST(FFI_CFLAGS)
+fi
 
 PKG_CHECK_MODULES(GIREPO, [glib-2.0 gobject-2.0 gmodule-2.0])
 
-if test "$have_ffi_h" = "yes"; then
-   GIREPO_LIBS="$GIREPO_LIBS $FFI_LIBS"
-fi
+# if we ever remove manual check for ffi and require .pc file, then 
+# just put libffi in the PKG_CHECK_MODULES(GIREPO) deps
+GIREPO_LIBS="$GIREPO_LIBS $FFI_LIBS"
+GIREPO_CFLAGS="$GIREPO_CFLAGS $FFI_CFLAGS"
 
 GIREPO_CFLAGS="$GIREPO_CFLAGS $GCOV_CFLAGS"
 
index 2bb0e1bcd0bad897372743d63e2971c8b603114d..74e5ada594b34a2b5592d009851d24c623c14de9 100644 (file)
@@ -12,7 +12,8 @@ libgirepository_la_SOURCES =                  \
        gmetadata.c                             \
        ginfo.c                                 \
        ginvoke.c
-libgirepository_la_CFLAGS = $(GIREPO_CFLAGS)
+libgirepository_la_CPPFLAGS = $(GIREPO_CFLAGS)
+libgirepository_la_LIBADD = $(GIREPO_LIBS)
 
 girepodir = $(includedir)/glib-2.0/gobject-introspection
 girepo_HEADERS = girepository.h