1
;; guile-gnome -*- scheme -*-
2
;; Copyright (C) 2003,2004 Andy Wingo <wingo at pobox dot com>
4
;; This program is free software; you can redistribute it and/or
5
;; modify it under the terms of the GNU General Public License as
6
;; published by the Free Software Foundation; either version 2 of
7
;; the License, or (at your option) any later version.
9
;; This program is distributed in the hope that it will be useful,
10
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
;; GNU General Public License for more details.
14
;; You should have received a copy of the GNU General Public License
15
;; along with this program; if not, contact:
17
;; Free Software Foundation Voice: +1-617-542-5942
18
;; 59 Temple Place - Suite 330 Fax: +1-617-542-2652
19
;; Boston, MA 02111-1307, USA gnu@gnu.org
23
;;API version @API_VERSION@ of guile-gnome. Use this module before using
24
;;any other guile-gnome modules.
28
;; Although resolve-module would create (gnome) if it's not found, guile
29
;; 1.6 will still search for a lib named libgnome.so before giving up.
30
;; Avoid this problem by making sure (gnome) is defined.
31
(define-module (gnome))
33
(define-module (gnome-@API_VERSION@))
35
(define (ld-library-path-prepend! path)
36
(let ((ld-library-path (getenv "LD_LIBRARY_PATH")))
38
(setenv "LD_LIBRARY_PATH" (format #f "~A:~A"
39
path ld-library-path))
40
(setenv "LD_LIBRARY_PATH" path))))
42
;; Add path to the load path, preserving any modification that the user
43
;; already made via environment variables. Necessary so that
44
;; GUILE_LOAD_PATH munging during build works even after (gnome-0)
45
;; munges the path itself.
46
(define (add-to-load-path! path)
47
(let ((first-std-path (in-vicinity
48
(assq-ref %guile-build-info 'pkgdatadir)
50
(let lp ((tail %load-path) (head '()))
53
(set! %load-path (cons path %load-path)))
54
((string=? (car tail) first-std-path)
55
(set! %load-path (append (reverse head) (cons path tail))))
57
(lp (cdr tail) (cons (car tail) head)))))))
59
(define version "@API_VERSION@")
62
((module-variable (resolve-module '(gnome)) 'gnome-version)
65
(if (not (string=? (variable-ref v) version))
66
(error "Loading guile-gnome version ~A, but ~A was already loaded"
67
(variable-ref v) version))))
69
(@running-uninstalled@ ;; #t if we are uninstalled
70
(module-define! (resolve-module '(gnome)) 'gnome-version version)
71
#t) ;; we're building guile-gnome, let the build scripts do their hacks
74
(module-define! (resolve-module '(gnome)) 'gnome-version version)
76
(let ((guile-gnome-dir "@guilegnomedir@")
77
(guile-gnome-lib-dir "@guilegnomelibdir@")
80
(add-to-load-path! guile-gnome-dir)
82
;; Resolve (gnome gw ...) wrapper links to libguile-gnome-gobject.
83
(if (not (member libdir '("/usr/lib" "/usr/local/lib")))
84
(ld-library-path-prepend! libdir))
86
;; Resolve (gnome gw ...) wrappers.
87
(ld-library-path-prepend! guile-gnome-lib-dir))))