Commit ed6c7e56 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

bug fix: slicot configuration (allow path specification using --with-slicot flag)

(cherry picked from commit a54af094)

Conflicts:

	mex/build/matlab/configure.ac
parent 9f0f2e45
dnl Detect the SLICOT Library.
dnl Called with an argument of either 'matlab' or 'octave', depending
dnl on the configure script from which we're calling it
dnl
dnl AX_SLICOT([matlab])
dnl AX_SLICOT([octave])
dnl
dnl Copyright (C) 2012 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
dnl Dynare is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl Dynare is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>.
AC_DEFUN([AX_SLICOT],
[
if test "x$1" != "xmatlab" && test "x$1" != "xoctave"; then
AC_MSG_ERROR([Argument to autoconf slicot macro must be either 'matlab' or 'octave'])
fi
AC_ARG_WITH(slicot, AC_HELP_STRING([--with-slicot=DIR], [prefix to SLICOT installation]),
slicot_prefix="$withval", slicot_prefix="")
has_slicot=yes
if test "x$slicot_prefix" != "x"; then
LDFLAGS_SLICOT="-L$withval/lib"
else
LDFLAGS_SLICOT=""
fi
ac_save_LDFLAGS="$LDFLAGS"
LDFLAGS_SAVED="$LDFLAGS"
AC_F77_FUNC(sb02od)
if test "x$1" = "xmatlab"; then
case ${MATLAB_ARCH} in
maci | maci64)
# Work around for exported_symbols_list flag present in Mac MATLAB_LDFLAGS
LDFLAGS="$MATLAB_LDFLAGS_NOMAP $LDFLAGS_SLICOT"
;;
*)
LDFLAGS="$LDFLAGS $MATLAB_LDFLAGS $LDFLAGS_SLICOT"
;;
esac
case ${MATLAB_ARCH} in
glnxa64 | win64 | maci64)
AX_COMPARE_VERSION([$MATLAB_VERSION], [ge], [7.8], [use_64_bit_indexing=yes], [use_64_bit_indexing=no])
;;
*)
use_64_bit_indexing=no
;;
esac
if test "$use_64_bit_indexing" = "yes"; then
AC_CHECK_LIB([slicot64_pic], [$sb02od], [LIBADD_SLICOT="-lslicot64_pic"], [has_slicot=no], [$MATLAB_LIBS])
else
AC_CHECK_LIB([slicot_pic], [$sb02od], [LIBADD_SLICOT="-lslicot_pic"], [has_slicot=no], [$MATLAB_LIBS])
fi
else
LDFLAGS="$LDFLAGS $LDFLAGS_SLICOT"
AC_CHECK_LIB([slicot], [$sb02od], [LIBADD_SLICOT="-lslicot"],
[
AC_CHECK_LIB([slicot_pic], [$sb02od], [LIBADD_SLICOT="-lslicot_pic"], [has_slicot=no], [`$MKOCTFILE -p BLAS_LIBS` `$MKOCTFILE -p LAPACK_LIBS`])
], # Fallback on libslicot_pic if dynamic libslicot not found
[`$MKOCTFILE -p BLAS_LIBS` `$MKOCTFILE -p LAPACK_LIBS`])
fi
LDFLAGS="$ac_save_LDFLAGS"
AC_SUBST(LDFLAGS_SLICOT)
AC_SUBST(LIBADD_SLICOT)
])
noinst_PROGRAMS = kalman_steady_state
kalman_steady_state_LDADD = $(LIBADD_SLICOT)
kalman_steady_state_LDFLAGS = $(LDFLAGS_SLICOT)
nodist_kalman_steady_state_SOURCES = $(top_srcdir)/../../sources/kalman_steady_state/kalman_steady_state.cc
......@@ -77,33 +77,8 @@ AX_GSL
AM_CONDITIONAL([HAVE_GSL], [test "x$has_gsl" = "xyes"])
# Check for libslicot, needed by kalman_steady_state
AC_F77_FUNC(sb02od)
LDFLAGS_SAVED=$LDFLAGS
case ${MATLAB_ARCH} in
maci | maci64)
# Work around for exported_symbols_list flag present in Mac MATLAB_LDFLAGS
LDFLAGS=$MATLAB_LDFLAGS_NOMAP
;;
*)
LDFLAGS=$MATLAB_LDFLAGS
;;
esac
case ${MATLAB_ARCH} in
glnxa64 | win64 | maci64)
AX_COMPARE_VERSION([$MATLAB_VERSION], [ge], [7.8], [use_64_bit_indexing=yes], [use_64_bit_indexing=no])
;;
*)
use_64_bit_indexing=no
;;
esac
if test "$use_64_bit_indexing" = "yes"; then
AC_CHECK_LIB([slicot64_pic], [$sb02od], [LIBADD_SLICOT="-lslicot64_pic"], [], [$MATLAB_LIBS])
else
AC_CHECK_LIB([slicot_pic], [$sb02od], [LIBADD_SLICOT="-lslicot_pic"], [], [$MATLAB_LIBS])
fi
LDFLAGS=$LDFLAGS_SAVED
AC_SUBST([LIBADD_SLICOT])
AM_CONDITIONAL([HAVE_SLICOT], [test "x$LIBADD_SLICOT" != "x"])
AX_SLICOT([matlab])
AM_CONDITIONAL([HAVE_SLICOT], [test "x$has_slicot" = "xyes"])
AM_CONDITIONAL([DO_SOMETHING], [test "x$ax_enable_matlab" = "xyes" -a "x$ax_matlab_version_ok" = "xyes" -a "x$ax_mexopts_ok" = "xyes"])
......@@ -117,7 +92,7 @@ else
BUILD_MEX_MATLAB="no (missing MATLAB, or unknown version, or unknown architecture)"
fi
if test "x$ax_enable_matlab" = "xyes" -a "x$ax_matlab_version_ok" = "xyes" -a "x$ax_mexopts_ok" = "xyes" -a "x$LIBADD_SLICOT" != "x"; then
if test "x$ax_enable_matlab" = "xyes" -a "x$ax_matlab_version_ok" = "xyes" -a "x$ax_mexopts_ok" = "xyes" -a "x$has_slicot" = "xyes"; then
BUILD_KALMAN_STEADY_STATE_MATLAB="yes"
else
BUILD_KALMAN_STEADY_STATE_MATLAB="no (missing SLICOT)"
......
......@@ -66,12 +66,8 @@ AC_SUBST([LIBADD_MATIO])
AM_CONDITIONAL([HAVE_MATIO], [test "x$ac_cv_header_matio_h" = "xyes" -a "x$ac_cv_lib_matio_Mat_Open" = "xyes"])
# Check for libslicot, needed by kalman_steady_state
AC_F77_FUNC(sb02od)
AC_CHECK_LIB([slicot], [$sb02od], [LIBADD_SLICOT="-lslicot"],
[AC_CHECK_LIB([slicot_pic], [$sb02od], [LIBADD_SLICOT="-lslicot_pic"], [], [`$MKOCTFILE -p BLAS_LIBS` `$MKOCTFILE -p LAPACK_LIBS`])], # Fallback on libslicot_pic if dynamic libslicot not found
[`$MKOCTFILE -p BLAS_LIBS` `$MKOCTFILE -p LAPACK_LIBS`])
AC_SUBST([LIBADD_SLICOT])
AM_CONDITIONAL([HAVE_SLICOT], [test "x$LIBADD_SLICOT" != "x"])
AX_SLICOT([octave])
AM_CONDITIONAL([HAVE_SLICOT], [test "x$has_slicot" = "xyes"])
AM_CONDITIONAL([DO_SOMETHING], [test "x$MKOCTFILE" != "x"])
......@@ -91,7 +87,7 @@ else
BUILD_ESTIMATION_MEX_OCTAVE="no (missing MatIO library)"
fi
if test "x$MKOCTFILE" != "x" -a "x$LIBADD_SLICOT" != "x"; then
if test "x$MKOCTFILE" != "x" -a "x$has_slicot" = "xyes"; then
BUILD_KALMAN_STEADY_STATE_OCTAVE="yes"
else
BUILD_KALMAN_STEADY_STATE_OCTAVE="no (missing SLICOT)"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment