slib.scm 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  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. ;;; Look for slib.init in the $datadir, in /usr/share, and finally in
  20. ;;; the load path. It's not usually in the load path on common distros,
  21. ;;; but it could be if the user put it there. The init file takes care
  22. ;;; of defining the module.
  23. (let ((try-load (lambda (dir)
  24. (let ((init (string-append dir "/slib/guile.init")))
  25. (and (file-exists? init)
  26. (begin
  27. (load init)
  28. #t))))))
  29. (or (try-load (assq-ref %guile-build-info 'datadir))
  30. (try-load "/usr/share")
  31. (load-from-path "slib/guile.init")))