| 1 | ;;;; slib.scm --- definitions needed to get SLIB to work with Guile |
| 2 | ;;;; |
| 3 | ;;;; Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2013 Free Software Foundation, Inc. |
| 4 | ;;;; |
| 5 | ;;;; This library is free software; you can redistribute it and/or |
| 6 | ;;;; modify it under the terms of the GNU Lesser General Public |
| 7 | ;;;; License as published by the Free Software Foundation; either |
| 8 | ;;;; version 3 of the License, or (at your option) any later version. |
| 9 | ;;;; |
| 10 | ;;;; This library is distributed in the hope that it will be useful, |
| 11 | ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | ;;;; Lesser General Public License for more details. |
| 14 | ;;;; |
| 15 | ;;;; You should have received a copy of the GNU Lesser General Public |
| 16 | ;;;; License along with this library; if not, write to the Free Software |
| 17 | ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | ;;;; |
| 19 | |
| 20 | ;;; Look for slib.init in the $datadir, in /usr/share, and finally in |
| 21 | ;;; the load path. It's not usually in the load path on common distros, |
| 22 | ;;; but it could be if the user put it there. The init file takes care |
| 23 | ;;; of defining the module. |
| 24 | |
| 25 | (let ((try-load (lambda (dir) |
| 26 | (let ((init (string-append dir "/slib/guile.init"))) |
| 27 | (and (file-exists? init) |
| 28 | (begin |
| 29 | (load init) |
| 30 | #t)))))) |
| 31 | (or (try-load (assq-ref %guile-build-info 'datadir)) |
| 32 | (try-load "/usr/share") |
| 33 | (load-from-path "slib/guile.init"))) |