From c3b48241ff333f453fd3dd1c9db50396d76376cc Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 11 Nov 2015 21:43:07 -0500 Subject: configure: Add FreeImage and GSL prefix/libdir options. --- configure.ac | 46 ++++++++++++++++++++++++++++++++++++++++++++++ sly/config.scm.in | 10 +++++++++- sly/wrappers/freeimage.scm | 7 ++++--- sly/wrappers/gsl.scm | 3 ++- 4 files changed, 61 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 1dfa107..0b2ba97 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,52 @@ dnl test instead. AC_CHECK_LIB([freeimage], [FreeImage_GetVersion],, [AC_MSG_ERROR([freeimage not found.])]) +LIBFREEIMAGE="libfreeimage" +LIBFREEIMAGE_LIBDIR="no" +LIBFREEIMAGE_PREFIX="no" + +AC_ARG_WITH([libfreeimage-prefix], + [AS_HELP_STRING([--with-libfreeimage-prefix=DIR], [search for FreeImage in DIR])], + [case "$withval" in + yes|no) + ;; + *) + LIBFREEIMAGE="$withval/lib/libfreeimage" + LIBFREEIMAGE_PREFIX="$withval" + LIBFREEIMAGE_LIBDIR="$withval/lib" + ;; + esac]) + +dnl Library name suitable for `dynamic-link'. +AC_MSG_CHECKING([for libfreeimage shared library name]) +AC_MSG_RESULT([$LIBFREEIMAGE]) +AC_SUBST([LIBFREEIMAGE]) +AC_SUBST([LIBFREEIMAGE_PREFIX]) +AC_SUBST([LIBFREEIMAGE_LIBDIR]) + +LIBGSLCBLAS="libgslcblas" +LIBGSLCBLAS_LIBDIR="no" +LIBGSLCBLAS_PREFIX="no" + +AC_ARG_WITH([libgslcblas-prefix], + [AS_HELP_STRING([--with-libgslcblas-prefix=DIR], [search for GSL CBLAS in DIR])], + [case "$withval" in + yes|no) + ;; + *) + LIBGSLCBLAS="$withval/lib/libgslcblas" + LIBGSLCBLAS_PREFIX="$withval" + LIBGSLCBLAS_LIBDIR="$withval/lib" + ;; + esac]) + +dnl Library name suitable for `dynamic-link'. +AC_MSG_CHECKING([for libgslcblas shared library name]) +AC_MSG_RESULT([$LIBGSLCBLAS]) +AC_SUBST([LIBGSLCBLAS]) +AC_SUBST([LIBGSLCBLAS_PREFIX]) +AC_SUBST([LIBGSLCBLAS_LIBDIR]) + PKG_CHECK_MODULES([GSL], [gsl]) AC_OUTPUT diff --git a/sly/config.scm.in b/sly/config.scm.in index b296492..012483e 100644 --- a/sly/config.scm.in +++ b/sly/config.scm.in @@ -22,7 +22,15 @@ ;;; Code: (define-module (sly config) - #:export (%pkgdatadir)) + #:export (%pkgdatadir + %libfreeimage + %libgslcblas)) (define %pkgdatadir (or (getenv "GUILE_2D_PKGDATADIR") "@pkgdatadir@")) + +(define %libfreeimage + "@LIBFREEIMAGE@") + +(define %libgslcblas + "@LIBGSLCBLAS@") diff --git a/sly/wrappers/freeimage.scm b/sly/wrappers/freeimage.scm index 9680460..eb1ceeb 100644 --- a/sly/wrappers/freeimage.scm +++ b/sly/wrappers/freeimage.scm @@ -23,10 +23,11 @@ (define-module (sly wrappers freeimage) #:use-module (system foreign) - #:use-module (sly wrappers util) - #:use-module (ice-9 format)) + #:use-module (ice-9 format) + #:use-module (sly config) + #:use-module (sly wrappers util)) -(define libfreeimage (dynamic-link "libfreeimage")) +(define libfreeimage (dynamic-link %libfreeimage)) (define-syntax-rule (define-foreign name ret string-name args) (define name diff --git a/sly/wrappers/gsl.scm b/sly/wrappers/gsl.scm index f05f4ae..3146757 100644 --- a/sly/wrappers/gsl.scm +++ b/sly/wrappers/gsl.scm @@ -23,6 +23,7 @@ (define-module (sly wrappers gsl) #:use-module (system foreign) + #:use-module (sly config) #:export (cblas-row-major cblas-no-trans cblas-sgemm @@ -39,7 +40,7 @@ ;;; GSL CBLAS Functions ;;; -(define libgslcblas (dynamic-link "libgslcblas")) +(define libgslcblas (dynamic-link %libgslcblas)) (define-syntax-rule (define-foreign name ret string-name args) (define name -- cgit v1.2.3