From 8a3c777bdede174284406d38e96a66fc9d3b61eb Mon Sep 17 00:00:00 2001
From: Liam Healy <liam@thinkpad.local>
Date: Mon, 16 Aug 2010 23:11:18 -0400
Subject: [PATCH] Improved finding of libraries for OS X, by Leo

---
 init/init.lisp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/init/init.lisp b/init/init.lisp
index 773f56b2..dff9e2c6 100644
--- a/init/init.lisp
+++ b/init/init.lisp
@@ -1,6 +1,6 @@
 ;; Load GSL
 ;; Liam Healy Sat Mar  4 2006 - 18:53
-;; Time-stamp: <2010-08-13 13:54:07EDT init.lisp>
+;; Time-stamp: <2010-08-16 23:08:13EDT init.lisp>
 ;;
 ;; Copyright 2006, 2007, 2008, 2009, 2010 Liam M. Healy
 ;; Distributed under the terms of the GNU General Public License
@@ -31,6 +31,8 @@
    #:cl-array #:dimensions #:element-type #:dim0 #:dim1
    #:copy))
 
+(in-package :gsl)
+
 (eval-when (:compile-toplevel :load-toplevel :execute)
   (defun gsl-config (arg)
     "A wrapper for tool `gsl-config'."
@@ -38,10 +40,13 @@
         (s (with-output-to-string (asdf::*verbose-out*)
              (asdf:run-shell-command "gsl-config ~s" arg)))
       (read-line s)
-      (read-line s))))
+      (read-line s)))
+  #+unix
+  (defun gsl-config-pathname (pn)
+    (merge-pathnames pn (pathname (format nil "~a/" (gsl-config "--prefix"))))))
 
 (cffi:define-foreign-library libgslcblas
-  (:darwin "libgslcblas.dylib")
+  (:darwin #.(gsl-config-pathname "lib/libgslcblas.dylib"))
   (:cygwin "cyggslcblas-0.dll")
   (:unix (:or "libgslcblas.so.0" "libgslcblas.so"))
   (t (:default "libgslcblas")))
@@ -55,7 +60,7 @@
 (cffi:load-foreign-library "/lib/lapack/cygblas.dll")
 
 (cffi:define-foreign-library libgsl
-  (:darwin "libgsl.dylib")
+  (:darwin #. (gsl-config-pathname "lib/libgsl.dylib"))
   (:cygwin "cyggsl-0.dll")
   (:unix (:or "libgsl.so.0" "libgsl.so"))
   (t (:default "libgsl")))
-- 
GitLab