#lang scheme
(require (lib "foreign.ss")
(lib "etc.ss"))
(unsafe!)
(provide libgsl libgslcblas)
(define try-paths
(case (system-type)
((macosx)
(list "/usr/local/lib"
"/opt/local/lib"
"/sw/local/lib"))
(else '())))
(define cblaslibname
(path-replace-suffix "libgslcblas.xxx" (system-type 'so-suffix)))
(define cblaslibpath
(or (ormap (lambda (path)
(let ((full-path (build-path path cblaslibname)))
(and (file-exists? full-path)
full-path)))
try-paths)
cblaslibname))
(define gsllibname
(path-replace-suffix "libgsl.xxx" (system-type 'so-suffix)))
(define gsllibpath
(or (ormap (lambda (path)
(let ((full-path (build-path path gsllibname)))
(and (file-exists? full-path)
full-path)))
try-paths)
gsllibname))
(define libgslcblas (ffi-lib cblaslibpath))
(define libgsl (ffi-lib gsllibpath))