[commit] r2087 - check for libffi via pkg-config before explicit search

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[commit] r2087 - check for libffi via pkg-config before explicit search

commits-3
 
Author: piumarta
Date: 2009-08-25 19:51:28 -0700 (Tue, 25 Aug 2009)
New Revision: 2087

Modified:
   trunk/platforms/unix/ChangeLog
   trunk/platforms/unix/plugins/SqueakFFIPrims/config.cmake
Log:
check for libffi via pkg-config before explicit search

Modified: trunk/platforms/unix/ChangeLog
===================================================================
--- trunk/platforms/unix/ChangeLog 2009-08-26 02:49:49 UTC (rev 2086)
+++ trunk/platforms/unix/ChangeLog 2009-08-26 02:51:28 UTC (rev 2087)
@@ -1,5 +1,8 @@
 2009-08-25    <[hidden email]>
 
+ * plugins/SqueakFFIPrims/config.cmake: Check for libffi via
+ pkf-config before eplicit search.
+
  * vm/config.cmake: Add includes and libraries from /usr/pkg if present.
 
  * cmake/PluginInternal.cmake, cmake/PluginExternal.cmake: Add

Modified: trunk/platforms/unix/plugins/SqueakFFIPrims/config.cmake
===================================================================
--- trunk/platforms/unix/plugins/SqueakFFIPrims/config.cmake 2009-08-26 02:49:49 UTC (rev 2086)
+++ trunk/platforms/unix/plugins/SqueakFFIPrims/config.cmake 2009-08-26 02:51:28 UTC (rev 2087)
@@ -25,15 +25,25 @@
     SET (cpu any)
     SET (abi libffi)
     PLUGIN_MESSAGE ("${cpu}-${abi}")
-    CHECK_INCLUDE_FILE (ffi.h HAVE_FFI_H)
-    CHECK_INCLUDE_FILE (ffi/ffi.h HAVE_FFI_FFI_H)
-    IF (NOT HAVE_FFI_H AND NOT HAVE_FFI_FFI_H)
+    IF (PKG_CONFIG_FOUND)
+      PKG_CHECK_MODULES (LIBFFI libffi)
+      IF (LIBFFI_FOUND)
+       PLUGIN_INCLUDE_DIRECTORIES (${LIBFFI_INCLUDE_DIRS})
+       PLUGIN_LINK_DIRECTORIES    (${LIBFFI_LIBRARY_DIRS})
+       PLUGIN_LINK_LIBRARIES      (${LIBFFI_LIBRARIES})
+ SET (HAVE_FFI_H 1)
+      ENDIF ()
+    ENDIF ()
+      IF (NOT LIBFFI_FOUND)
+      CHECK_INCLUDE_FILE (ffi.h HAVE_FFI_H)
+      CHECK_INCLUDE_FILE (ffi/ffi.h HAVE_FFI_FFI_H)
+      IF (NOT HAVE_FFI_H AND NOT HAVE_FFI_FFI_H)
         PLUGIN_DISABLE ()
-    ELSE ()
+     ELSE ()
         PLUGIN_LINK_LIBRARIES (ffi)
+      ENDIF ()
     ENDIF ()
   ENDIF ()
-
   PLUGIN_SOURCES ("${unix}/plugins/${plugin}/${cpu}-${abi}.c ${unix}/plugins/${plugin}/${cpu}-${abi}-asm.S")
 ENDIF ()