;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; LUSH Lisp Universal Shell
;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
;;; Includes parts of TL3:
;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
;;; Includes selected parts of SN3.2:
;;;   Copyright (C) 1991-2001 AT&T Corp.
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;  9/9/2002       adapted from gsl-config.lsh  by jhuangfu
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(when (not cv-libcv-loaded)

(setq cv-libname "libopencv")

;; the version should be found automatically
(setq cv-version 0.9.3)

;; find  library
(cond
 ;; cv-libcv was already defined, don't touch it
 (cv-libcv t)
 ;; look for dynamic libopencv.so installed
 ((progn
    (let* ((lib (find-shared-library  cv-libname )))
      (when (and lib (filep lib)) (defvar cv-libcv lib)))))
 ;; look for static libopencv.a installed
 ((progn
    (let* ((lib (find-static-library  cv-libname )))
      (when (and lib (filep lib)) (defvar cv-libcv lib)))))
 ;; couldn't find it, complain loudly.
 (t (printf "neither the libopencv.so nor libopencv.a could be found\n")
    (printf "You can download cv from\n")
    (printf "http://sourceforge.net/projects/opencvlibrary/\n")
    (printf "compile it, and install it\n")
    (printf "in standard paths (e.g. in /usr/local/lib) so that I can find it.\n")
    (printf "If you have installed OpenCV and still get this message, please do\n")
    (printf "(defvar cv-libcv \"yourcvlibrary\") before loading this file\n")      
    (printf "(see %s for more details)\n" file-being-loaded)
    (error "cannot configure cv")))



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defvar cv-cpheader-cmd
      '(progn
	 (cpheader "#include <cv.h>")
	 (cpheader "#include <cvcompat.h>")
	 (cpheader "#undef ptr")
	 ))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; load libraries

(mod-load cv-libcv)
(defvar cv-libcv-loaded t)

)
