/[cl-gsl]/cl-gsl/load-libraries.lisp
ViewVC logotype

Contents of /cl-gsl/load-libraries.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Wed Mar 2 01:04:53 2005 UTC (9 years, 1 month ago) by edenny
Branch: cl-gsl
CVS Tags: start
Changes since 1.1: +0 -0 lines
Initial Import
1 ;;;; -*- Mode: Lisp; Synatx: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;;
3 ;;;; Copyright (C) 2005 Edgar Denny <edgardenny@comcast.net>
4 ;;;; This file is part of CL-GSL.
5 ;;;;
6 ;;;; This program is free software; you can redistribute it and/or modify
7 ;;;; it under the terms of the GNU General Public License as published by
8 ;;;; the Free Software Foundation; either version 2 of the License, or
9 ;;;; (at your option) any later version.
10 ;;;;
11 ;;;; This program is distributed in the hope that it will be useful,
12 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;;; GNU General Public License for more details.
15 ;;;;
16 ;;;; You should have received a copy of the GNU General Public License
17 ;;;; along with this program; if not, write to the Free Software
18 ;;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 (in-package #:cl-gsl)
21
22 (defun load-library (library-name)
23 (if (uffi:load-foreign-library
24 (uffi:find-foreign-library
25 library-name
26 '("/usr/local/lib/" "/usr/lib/" "/lib/" "/usr/local/lib/cl-gsl/")
27 :types '("so" "a"))
28 :module library-name
29 :supporting-libraries '("c"))
30 t
31 (progn
32 (warn (concatenate 'string "Unable to load: " library-name))
33 nil)))
34
35 (defun gsl-config-lib-string ()
36 (multiple-value-bind (output error-output error-status)
37 (kmrcl:command-output "gsl-config --libs")
38 (declare (ignore error-output))
39 (if (not (= error-status 0))
40 (error "Could not run 'gsl-config --libs'")
41 output)))
42
43 (defun get-libs-list ()
44 (cons
45 "cwrapperstub"
46 (remove-if #'(lambda (elm) (not (cl-ppcre:scan "^lib" elm)))
47 (mapcar #'(lambda (elm) (cl-ppcre:regex-replace "^-l" elm "lib"))
48 (butlast
49 (cl-ppcre:split "[ ]+" (gsl-config-lib-string)))))))
50
51 (defun load-the-libraries ()
52 (mapcar #'load-library (reverse (get-libs-list))))
53
54 (load-the-libraries)

  ViewVC Help
Powered by ViewVC 1.1.5