X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=interfaces%2Fmysql%2Fmysql-loader.cl;h=65e06a178922e642f781233ad875cacc3e5cbae2;hb=0ba06f88c7b2e70c3fe8007b9aa9d7bbfef9afcd;hp=caa8c55fa559ba80f6194e4dd62f2bb03f504f50;hpb=ba513c82016bfa0dfe3c3e5398fea1e78bada78b;p=clsql.git diff --git a/interfaces/mysql/mysql-loader.cl b/interfaces/mysql/mysql-loader.cl index caa8c55..65e06a1 100644 --- a/interfaces/mysql/mysql-loader.cl +++ b/interfaces/mysql/mysql-loader.cl @@ -7,7 +7,7 @@ ;;;; Programmers: Kevin M. Rosenberg ;;;; Date Started: Feb 2002 ;;;; -;;;; $Id: mysql-loader.cl,v 1.3 2002/03/24 04:37:09 kevin Exp $ +;;;; $Id: mysql-loader.cl,v 1.7 2002/05/13 21:50:52 kevin Exp $ ;;;; ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -27,11 +27,11 @@ (defvar *clsql-mysql-library-filename* (translate-logical-pathname - #+(or linux unix) "CLSQL:interfaces;mysql;clsql-mysql.so" - #+(or mswindows win32) "CLSQL:interfaces;mysql;clsql-mysql.dll" + #+(or linux unix) "CL-LIBRARY:clsql;interfaces;mysql;clsql-mysql.so" + #+(or mswindows win32) "CL-LIBRARY:clsql;interfaces;mysql;clsql-mysql.dll" )) -(defvar *mysql-library-filename* +(defvar *mysql-library-filename* (cond ((probe-file "/opt/mysql/lib/mysql/libmysqlclient.so") "/opt/mysql/lib/mysql/libmysqlclient.so") @@ -46,6 +46,14 @@ (warn "Can't find MySQL client library to load."))) "Location where the MySQL client library is to be found.") +(defvar *mysql-library-candidate-names* + '("libmysqlclient" "libmysql")) + +(defvar *mysql-library-candidate-directories* + '("/opt/mysql/lib/mysql/" "/usr/local/lib/" "/usr/lib/" "/mysql/lib/opt/")) + +(defvar *mysql-library-candidate-drive-letters* '("C" "D" "E")) + (defvar *mysql-supporting-libraries* '("c") "Used only by CMU. List of library flags needed to be passed to ld to load the MySQL client library succesfully. If this differs at your site, @@ -58,17 +66,26 @@ set to the right path before compiling or loading the system.") *mysql-library-loaded*) (defmethod clsql-sys:database-type-load-foreign ((database-type (eql :mysql))) - (when - (and - (uffi:load-foreign-library *mysql-library-filename* - :module "mysql" - :supporting-libraries - *mysql-supporting-libraries*) - (uffi:load-foreign-library *clsql-mysql-library-filename* - :module "clsql-mysql" - :supporting-libraries - (append *mysql-supporting-libraries*))) - (setq *mysql-library-loaded* t))) + (let ((mysql-path + (uffi:find-foreign-library *mysql-library-candidate-names* + *mysql-library-candidate-directories* + :drive-letters + *mysql-library-candidate-drive-letters*))) + ;; zlib required to load mysql on CMUCL Solaris + (uffi:load-foreign-library + (uffi:find-foreign-library '("libz" "zlib") + '("/usr/lib/" "/usr/local/" "/lib/"))) + (when + (and + (uffi:load-foreign-library mysql-path + :module "mysql" + :supporting-libraries + *mysql-supporting-libraries*) + (uffi:load-foreign-library *clsql-mysql-library-filename* + :module "clsql-mysql" + :supporting-libraries + (append *mysql-supporting-libraries*))) + (setq *mysql-library-loaded* t)))) (clsql-sys:database-type-load-foreign :mysql)