Commit 4f54391e authored by Houtan Bastani's avatar Houtan Bastani
Browse files

add --with-matio option to configure

parent fd66086c
......@@ -87,10 +87,8 @@ AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
AC_SUBST([LIBADD_DLOPEN])
# Check for libmatio, needed by Dynare++
AC_CHECK_HEADER([matio.h])
AC_CHECK_LIB([matio], [Mat_Open], [LIBADD_MATIO="-lmatio"])
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"])
AX_MATIO
AM_CONDITIONAL([HAVE_MATIO], [test "x$has_matio" = "xyes"])
AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo])
......@@ -238,7 +236,7 @@ AM_CONDITIONAL([ENABLE_ORG_EXPORT], [test "x$enable_org_export" != "x"])
BUILD_PREPROCESSOR="yes"
if test "x$ax_blas_ok" = "xyes" -a "x$ax_lapack_ok" = "xyes" -a "x$ac_cv_header_matio_h" = "xyes" -a "x$ac_cv_lib_matio_Mat_Open" = "xyes"; then
if test "x$ax_blas_ok" = "xyes" -a "x$ax_lapack_ok" = "xyes" -a "x$has_matio" = "xyes"; then
if test x"$ax_pthread_ok" = "xyes"; then
BUILD_DYNAREPLUSPLUS="yes"
else
......
......@@ -21,9 +21,9 @@ dynare___SOURCES = \
nlsolve.h \
$(GENERATED_FILES)
dynare___CPPFLAGS = -I../sylv/cc -I../tl/cc -I../kord -I../integ/cc -I.. -I$(top_srcdir)/mex/sources -DDYNVERSION=\"$(PACKAGE_VERSION)\" $(BOOST_CPPFLAGS)
dynare___LDFLAGS = $(BOOST_LDFLAGS)
dynare___LDADD = ../kord/libkord.a ../integ/cc/libinteg.a ../tl/cc/libtl.a ../parser/cc/libparser.a ../utils/cc/libutils.a ../sylv/cc/libsylv.a $(noinst_LIBRARIES) $(LAPACK_LIBS) $(BLAS_LIBS) $(LIBS) $(FLIBS) $(PTHREAD_LIBS) $(LIBADD_MATIO)
dynare___CPPFLAGS = -I../sylv/cc -I../tl/cc -I../kord -I../integ/cc -I.. -I$(top_srcdir)/mex/sources -DDYNVERSION=\"$(PACKAGE_VERSION)\" $(BOOST_CPPFLAGS) $(MATIO_CFLAGS)
dynare___LDFLAGS = $(LDFLAGS_MATIO) $(BOOST_LDFLAGS)
dynare___LDADD = ../kord/libkord.a ../integ/cc/libinteg.a ../tl/cc/libtl.a ../parser/cc/libparser.a ../utils/cc/libutils.a ../sylv/cc/libsylv.a $(LIBADD_MATIO) $(noinst_LIBRARIES) $(LAPACK_LIBS) $(BLAS_LIBS) $(LIBS) $(FLIBS) $(PTHREAD_LIBS)
dynare___CXXFLAGS = $(PTHREAD_CFLAGS)
BUILT_SOURCES = $(GENERATED_FILES)
......
dnl Detect the MATIO Library.
dnl We don't use the official M4 macro since it relies on the script gsl-config,
dnl which does not work when cross-compiling.
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_MATIO],
[
AC_ARG_WITH(matio, AC_HELP_STRING([--with-matio=DIR], [prefix to MATIO installation]),
matio_prefix="$withval", matio_prefix="")
has_matio=yes
if test "x$matio_prefix" != "x"; then
CFLAGS_MATIO="-I$withval/include"
LDFLAGS_MATIO="-L$withval/lib"
else
CFLAGS_MATIO=""
LDFLAGS_MATIO=""
fi
ac_save_CFLAGS="$CFLAGS"
ac_save_LDFLAGS="$LDFLAGS"
LIBADD_MATIO=""
CFLAGS="$CFLAGS_MATIO $CFLAGS"
LDFLAGS="$LDFLAGS_MATIO $LDFLAGS"
AC_CHECK_HEADER([matio.h], [], [has_matio=no])
AC_CHECK_LIB([matio], [Mat_Open], [LIBADD_MATIO="-lmatio"], [has_matio=no])
CFLAGS="$ac_save_CFLAGS"
LDFLAGS="$ac_save_LDFLAGS"
LIBS="$ac_save_LIBS"
AC_SUBST(CFLAGS_MATIO)
AC_SUBST(LIBADD_MATIO)
AC_SUBST(LDFLAGS_MATIO)
])
noinst_PROGRAMS = dynare_simul_
dynare_simul__CPPFLAGS = -I$(top_srcdir)/../../../dynare++/sylv/cc -I$(top_srcdir)/../../../dynare++/tl/cc -I$(top_srcdir)/../../../dynare++/kord -I$(top_srcdir)/../../sources
dynare_simul__CPPFLAGS = -I$(top_srcdir)/../../../dynare++/sylv/cc -I$(top_srcdir)/../../../dynare++/tl/cc -I$(top_srcdir)/../../../dynare++/kord -I$(top_srcdir)/../../sources $(CFLAGS_MATIO)
dynare_simul__CXXFLAGS = $(PTHREAD_CFLAGS)
# libdynare++ must come before pthread
dynare_simul__LDFLAGS = $(LDFLAGS_MATIO)
dynare_simul__LDADD = ../libdynare++/libdynare++.a $(PTHREAD_LIBS) $(LIBADD_MATIO)
nodist_dynare_simul__SOURCES = $(top_srcdir)/../../../dynare++/extern/matlab/dynare_simul.cpp
noinst_PROGRAMS = logposterior logMHMCMCposterior
# We use shared flags so that automake does not compile things two times
CPPFLAGS += -I$(top_srcdir)/../../sources/estimation/libmat -I$(top_srcdir)/../../sources/estimation/utils $(BOOST_CPPFLAGS)
LDFLAGS += $(BOOST_LDFLAGS)
LDADD = $(LIBADD_DLOPEN)
CPPFLAGS += -I$(top_srcdir)/../../sources/estimation/libmat -I$(top_srcdir)/../../sources/estimation/utils $(CFLAGS_MATIO) $(BOOST_CPPFLAGS)
LDFLAGS += $(LDFLAGS_MATIO) $(BOOST_LDFLAGS)
LDADD = $(LIBADD_DLOPEN) $(LIBADD_MATIO)
TOPDIR = $(top_srcdir)/../../sources/estimation
......
......@@ -2,9 +2,10 @@ noinst_PROGRAMS = k_order_perturbation
k_order_perturbation_CPPFLAGS = -I$(top_srcdir)/../../../dynare++/src -I$(top_srcdir)/../../../dynare++/kord -I$(top_srcdir)/../../../dynare++/tl/cc -I$(top_srcdir)/../../../dynare++/utils/cc -I$(top_srcdir)/../../../dynare++/sylv/cc -I$(top_srcdir)/../../../dynare++/integ/cc -I$(top_srcdir)/../../sources
k_order_perturbation_CXXFLAGS = $(PTHREAD_CFLAGS)
k_order_perturbation_CXXFLAGS = $(CFLAGS_MATIO) $(PTHREAD_CFLAGS)
# libdynare++ must come before pthread
k_order_perturbation_LDFLAGS = $(LDFLAGS_MATIO)
k_order_perturbation_LDADD = ../libdynare++/libdynare++.a $(PTHREAD_LIBS) $(LIBADD_DLOPEN) $(LIBADD_MATIO)
TOPDIR = $(top_srcdir)/../../sources/k_order_perturbation
......
......@@ -77,10 +77,8 @@ AX_GSL
AM_CONDITIONAL([HAVE_GSL], [test "x$has_gsl" = "xyes"])
# Check for libmatio, needed by MEX files using Dynare++ code
AC_CHECK_HEADER([matio.h])
AC_CHECK_LIB([matio], [Mat_Open], [LIBADD_MATIO="-lmatio"])
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"])
AX_MATIO
AM_CONDITIONAL([HAVE_MATIO], [test "x$has_matio" = "xyes"])
# Check for libslicot, needed by kalman_steady_state
AX_SLICOT([matlab])
......@@ -98,7 +96,7 @@ else
BUILD_MEX_MATLAB="no (missing MATLAB, or unknown version, or unknown architecture)"
fi
if test "x$ax_enable_matlab" = "xyes" -a "x$ac_cv_header_matio_h" = "xyes" -a "x$ac_cv_lib_matio_Mat_Open" = "xyes"; then
if test "x$ax_enable_matlab" = "xyes" -a "x$has_matio" = "xyes"; then
BUILD_KORDER_DYNSIMUL_MEX_MATLAB="yes"
else
BUILD_KORDER_DYNSIMUL_MEX_MATLAB="no (missing MatIO library)"
......
......@@ -60,10 +60,8 @@ AX_GSL
AM_CONDITIONAL([HAVE_GSL], [test "x$has_gsl" = "xyes"])
# Check for libmatio, needed by estimation DLL (only under Octave, as an alternative to MATLAB's libmat)
AC_CHECK_HEADER([matio.h])
AC_CHECK_LIB([matio], [Mat_Open], [LIBADD_MATIO="-lmatio"])
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"])
AX_MATIO
AM_CONDITIONAL([HAVE_MATIO], [test "x$has_matio" = "xyes"])
# Check for libslicot, needed by kalman_steady_state
AX_SLICOT([octave])
......@@ -81,7 +79,7 @@ else
BUILD_MEX_OCTAVE="no (missing mkoctfile)"
fi
if test "x$MKOCTFILE" != "x" -a "x$ac_cv_header_matio_h" = "xyes" -a "x$ac_cv_lib_matio_Mat_Open" = "xyes"; then
if test "x$MKOCTFILE" != "x" -a "x$has_matio" = "xyes"; then
BUILD_ESTIMATION_KORDER_DYNSIMUL_MEX_OCTAVE="yes"
else
BUILD_ESTIMATION_KORDER_DYNSIMUL_MEX_OCTAVE="no (missing MatIO library)"
......@@ -93,7 +91,7 @@ else
BUILD_KALMAN_STEADY_STATE_OCTAVE="no (missing SLICOT)"
fi
if test "x$MKOCTFILE" != "x" -a "x$has_gsl" = "xyes" -a "x$ac_cv_header_matio_h" = "xyes" -a "x$ac_cv_lib_matio_Mat_Open" = "xyes"; then
if test "x$MKOCTFILE" != "x" -a "x$has_gsl" = "xyes" -a "x$has_matio" = "xyes"; then
BUILD_MS_SBVAR_MEX_OCTAVE="yes"
else
BUILD_MS_SBVAR_MEX_OCTAVE="no (missing GSL or MatIO library)"
......
......@@ -2,5 +2,11 @@ EXEEXT = .mex
include ../mex.am
include ../../ms_sbvar.am
ms_sbvar_command_line_CPPLAGS = $(MATIO_CFLAGS)
ms_sbvar_create_init_file_CPPLAGS = $(MATIO_CFLAGS)
ms_sbvar_command_line_LDFLAGS = $(LDFLAGS_MATIO)
ms_sbvar_create_init_file_LDFLAGS = $(LDFLAGS_MATIO)
ms_sbvar_command_line_LDADD = $(LIBADD_MATIO)
ms_sbvar_create_init_file_LDADD = $(LIBADD_MATIO)
\ No newline at end of file
ms_sbvar_create_init_file_LDADD = $(LIBADD_MATIO)
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