r9310: update headers
[clsql.git] / db-oracle / oracle-loader.lisp
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          oracle-loader.lisp
6 ;;;; Purpose:       Foreign library loader for CLSQL Oracle interface
7 ;;;;
8 ;;;; $Id$
9 ;;;;
10 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
11 ;;;;
12 ;;;; CLSQL users are granted the rights to distribute and use this software
13 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
14 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
15 ;;;; *************************************************************************
16
17 (in-package #:clsql-oracle)
18
19 ;; Load the foreign library
20
21 (eval-when (:load-toplevel :compile-toplevel)
22   (defvar *oracle-home*
23     nil
24     "The root of the Oracle installation, usually $ORACLE_HOME is set to this.")
25   (unless *oracle-home*
26     (setf *oracle-home*
27           (cdr (assoc ':ORACLE_HOME ext:*environment-list* :test #'eq)))))
28
29 (defparameter *oracle-libs*
30   '(#-oracle-9i "rdbms/lib/ssdbaed.o"
31     "rdbms/lib/defopt.o"
32     #-oracle-9i "rdbms/lib/homts.o"
33     "lib/nautab.o"
34     "lib/naeet.o"
35     "lib/naect.o"
36     "lib/naedhs.o"
37     #-oracle-9i"lib/libnsslb8.a"
38     #+oracle-9i "lib/homts.o"
39     )
40   "Oracle client libraries, relative to ORACLE_HOME.")
41
42 (defun make-oracle-load-path ()
43   (mapcar (lambda (x)
44             (concatenate 'string *oracle-home* "/" x))
45           *oracle-libs*))
46
47
48 ; ;(defparameter *oracle-so-libraries*
49 ; ;;  `(,(concatenate 'string "-L" *oracle-home* "/lib/")
50 ;     '(
51 ;       "-lclntsh"
52 ;       "-lnetv2"
53 ;       "-lnttcp"
54 ;       "-lnetwork"
55 ;       "-lncr"
56 ;       "-lclient"
57 ;       "-lvsn"
58 ;       "-lcommon"
59 ;       "-lgeneric"
60 ;       "-lmm"
61 ;       "-lnlsrtl3"
62 ;       "-lcore4"
63 ;       "-lnlsrtl3"
64 ;       "-lepc"
65 ;       "-ldl"
66 ;       "-lm")
67 ;   "List of library flags needed to be passed to ld to load the
68 ; Oracle client library succesfully.  If this differs at your site,
69 ; set *oracle-so-libraries* to the right path before compiling or
70 ; loading the system.")
71
72
73 #-oracle-9i
74 (defun oracle-libraries ()
75   `(,(concatenate 'string
76                  "-L" *oracle-home* "/lib")
77     "-lagtsh"
78 ;;    "-locijdbc8"
79     "-lclntsh"
80     "-lclient8"
81     "-lvsn8"
82     "-lcommon8"
83     "-lskgxp8"
84     "-lmm"
85     "-lnls8"
86     "-lcore8"
87     "-lgeneric8"
88     "-ltrace8"
89     "-ldl"
90     "-lm"))
91
92 ;;  "List of library flags needed to be passed to ld to load the
93 ;;Oracle client library succesfully.  If this differs at your site,
94 ;;set *oracle-so-libraries* to the right path before compiling or
95 ;;loading the system.")
96
97 #+oracle-9i
98 (defun oracle-libraries ()
99   `(,(concatenate 'string
100                  "-L" *oracle-home* "/lib")
101     "-lagent9"
102     "-lagtsh"
103 ;;    "-locijdbc8"
104     "-lclntsh"
105     "-lclntst9"
106     "-lclient9"
107     "-lvsn9"
108     "-lcommon9"
109     "-lskgxp9"
110     "-lmm"
111     "-lnls9"
112     "-lcore9"
113     "-lgeneric9"
114     "-ltrace9"
115     "-ldl"
116     #+redhat-linux "-L/usr/lib/gcc-lib/i386-redhat-linux/2.96"
117     "-lgcc"
118     "-lm"))
119
120 (defmethod database-type-load-foreign ((database-type (eql :oracle)))
121   (progv '(sys::*dso-linker*)
122       '("/usr/bin/ld")
123     (ext:load-foreign (make-oracle-load-path)
124                     :libraries (oracle-libraries))))
125
126
127 (database-type-load-foreign :oracle)