2009-10-02 19:22:19 +02:00
dnl Process this file with autoconf to produce a configure script.
2023-01-05 17:52:02 +01:00
dnl Copyright © 2009-2023 Dynare Team
2009-10-02 19:22:19 +02:00
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
2021-06-09 17:33:48 +02:00
dnl along with Dynare. If not, see <https://www.gnu.org/licenses/>.
2009-10-02 19:22:19 +02:00
2012-08-02 16:10:34 +02:00
AC_PREREQ([2.62])
2021-12-08 14:23:26 +01:00
AC_INIT([dynare], [6-unstable])
2009-10-02 19:22:19 +02:00
AC_CONFIG_SRCDIR([configure.ac])
2013-09-09 14:50:32 +02:00
AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign])
2009-10-02 19:22:19 +02:00
2010-01-10 11:59:02 +01:00
dnl The following must occur before we modify CFLAGS/CXXFLAGS
AC_CANONICAL_HOST
2009-10-02 19:22:19 +02:00
AX_MATLAB
2019-11-26 12:58:48 +01:00
AX_MATLAB_VERSION
AX_DOT_MEXEXT
AX_MATLAB_ARCH
AX_MEXOPTS
2009-10-02 19:22:19 +02:00
2019-11-26 12:58:48 +01:00
if test "$ax_enable_matlab" != yes -o "$ax_matlab_version_ok" != yes -o "$ax_mexopts_ok" != yes; then
AC_MSG_ERROR([MATLAB cannot be found])
2009-10-02 19:22:19 +02:00
fi
2020-04-07 12:24:16 +02:00
AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [8.3], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to version 8.3 (R2014a) at least (or disable MATLAB support with --disable-matlab).])])
2019-11-26 12:58:48 +01:00
2010-01-08 13:15:16 +01:00
case ${host_os} in
*cygwin*)
2010-08-18 16:21:23 +02:00
AC_MSG_WARN([You are compiling for the Cygwin target. This means that the MEX files will])
AC_MSG_WARN([not run from MATLAB, because it cannot load the Cygwin DLL.])
AC_MSG_WARN([This is probably not what you want. Consider using a MinGW cross-compiler.])
2010-01-08 13:15:16 +01:00
;;
esac
2019-12-03 16:17:00 +01:00
AC_PROG_FC
2009-10-02 19:22:19 +02:00
AC_PROG_CC
AC_PROG_CXX
2009-11-02 13:04:07 +01:00
AC_PROG_RANLIB
2009-10-02 19:22:19 +02:00
AX_PROG_LN_S
2010-01-29 15:13:34 +01:00
AC_PROG_MKDIR_P
2012-09-28 17:21:25 +02:00
AM_PROG_AR
2014-03-10 17:25:39 +01:00
2022-01-04 11:31:02 +01:00
# Get the size of a pthread_t instance, needed by pthread.F08
AC_CHECK_SIZEOF([pthread_t], [], [#include <pthread.h>])
2009-10-23 11:07:47 +02:00
# Check for dlopen(), needed by k_order_perturbation DLL
2009-10-02 19:22:19 +02:00
AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
AC_SUBST([LIBADD_DLOPEN])
2019-11-26 12:58:48 +01:00
# Define optional components and their corresponding flags and Automake conditionals
AC_ARG_ENABLE([mex-ms-sbvar], AS_HELP_STRING([--disable-mex-ms-sbvar], [disable compilation of the MS-SBVAR MEX]), [], [enable_mex_ms_sbvar=yes])
AM_CONDITIONAL([ENABLE_MEX_MS_SBVAR], [test "$enable_mex_ms_sbvar" = yes])
AC_ARG_ENABLE([mex-dynare++], AS_HELP_STRING([--disable-mex-dynare++], [disable compilation of MEX based on Dynare++]), [], [enable_mex_dynareplusplus=yes])
AM_CONDITIONAL([ENABLE_MEX_DYNAREPLUSPLUS], [test "$enable_mex_dynareplusplus" = yes])
AC_ARG_ENABLE([mex-kalman-steady-state], AS_HELP_STRING([--disable-mex-kalman-steady-state], [disable compilation of the kalman_steady_state MEX]), [], [enable_mex_kalman_steady_state=yes])
AM_CONDITIONAL([ENABLE_MEX_KALMAN_STEADY_STATE], [test "$enable_mex_kalman_steady_state" = yes])
# Check for GSL, needed by MS-SBVAR MEX
if test "$enable_mex_ms_sbvar" = yes; then
AX_GSL
2019-11-28 14:43:44 +01:00
test "$has_gsl" != yes && AC_MSG_ERROR([GSL cannot be found. If you want to skip the compilation of the MS-SBVAR MEX, pass the --disable-mex-ms-sbvar flag.])
2019-11-26 12:58:48 +01:00
fi
2009-10-02 19:22:19 +02:00
2012-08-23 18:30:27 +02:00
# Check for libmatio, needed by MEX files using Dynare++ code
2019-11-26 12:58:48 +01:00
if test "$enable_mex_dynareplusplus" = yes; then
AX_MATIO
2019-11-28 14:43:44 +01:00
test "$has_matio" != yes && AC_MSG_ERROR([libmatio cannot be found. If you want to skip the compilation of MEX files based Dynare++, pass the --disable-mex-dynare++ flag.])
2019-11-26 12:58:48 +01:00
fi
2012-08-23 18:30:27 +02:00
2012-08-30 14:49:21 +02:00
# Check for libslicot, needed by kalman_steady_state
2019-11-26 12:58:48 +01:00
if test "$enable_mex_kalman_steady_state" = yes; then
2021-05-09 18:00:42 +02:00
# FCFLAGS must be temporarily modified, because otherwise -fno-underscoring is not
# taken into account by AC_FC_FUNC in the AX_SLICOT macro.
# For some obscure reason, it is necessary to do it at this level and not within the macro.
2021-08-31 17:57:16 +02:00
my_save_FCFLAGS=$FCFLAGS
2021-05-09 18:00:42 +02:00
FCFLAGS="$FCFLAGS $MATLAB_FCFLAGS"
2019-11-26 12:58:48 +01:00
AX_SLICOT([matlab])
2021-08-31 17:57:16 +02:00
FCFLAGS=$my_save_FCFLAGS
2019-11-28 14:43:44 +01:00
test "$has_slicot" != yes && AC_MSG_ERROR([slicot cannot be found. If you want to skip the compilation of the kalman_steady_state MEX, pass the --disable-mex-kalman-steady-state flag.])
2019-11-26 12:58:48 +01:00
fi
2012-08-30 14:49:21 +02:00
2018-11-06 12:17:56 +01:00
# On Windows, we want static linking of the external libraries
case ${host_os} in
*mingw32*)
GSL_LIBS="-Wl,-Bstatic $GSL_LIBS -Wl,-Bdynamic"
LIBADD_MATIO="-Wl,-Bstatic $LIBADD_MATIO -Wl,-Bdynamic"
LIBADD_SLICOT="-Wl,-Bstatic $LIBADD_SLICOT -Wl,-Bdynamic"
;;
esac
2019-11-26 12:58:48 +01:00
# Support for M2HTML
AC_ARG_WITH([m2html], AS_HELP_STRING([--with-m2html=DIR], [specify installation directory of M2HTML]), [
M2HTML=$withval
BUILD_M2HTML=yes
], [
M2HTML=
BUILD_M2HTML=no
])
AC_SUBST([M2HTML])
AM_CONDITIONAL([HAVE_M2HTML], [test "x$M2HTML" != "x"])
2009-10-02 19:22:19 +02:00
2019-11-26 12:58:48 +01:00
# Construct final output message
if test "$enable_mex_dynareplusplus" = yes; then
2018-11-12 12:55:18 +01:00
BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_MATLAB="yes"
2012-08-23 18:30:27 +02:00
else
2019-11-26 12:58:48 +01:00
BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_MATLAB="no"
2012-08-23 18:30:27 +02:00
fi
2019-11-26 12:58:48 +01:00
if test "$enable_mex_kalman_steady_state" = yes; then
2010-12-14 10:27:39 +01:00
BUILD_KALMAN_STEADY_STATE_MATLAB="yes"
2010-12-13 18:15:00 +01:00
else
2019-11-26 12:58:48 +01:00
BUILD_KALMAN_STEADY_STATE_MATLAB="no"
2010-12-13 18:15:00 +01:00
fi
2019-11-26 12:58:48 +01:00
if test "$enable_mex_ms_sbvar" = yes; then
2011-02-17 11:42:54 +01:00
BUILD_MS_SBVAR_MEX_MATLAB="yes"
else
2019-11-26 12:58:48 +01:00
BUILD_MS_SBVAR_MEX_MATLAB="no"
2011-02-17 11:42:54 +01:00
fi
2009-10-02 19:22:19 +02:00
AC_MSG_NOTICE([
Dynare is now configured for building the following components...
Binaries (with "make"):
2019-11-26 12:58:48 +01:00
MEX files for MATLAB (except those listed below): yes
2018-11-12 12:55:18 +01:00
Gensylv, k-order and dynare_simul MEX files for MATLAB: $BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_MATLAB
2011-02-17 11:42:54 +01:00
MS-SBVAR MEX files for MATLAB: $BUILD_MS_SBVAR_MEX_MATLAB
Kalman Steady State MEX file for MATLAB: $BUILD_KALMAN_STEADY_STATE_MATLAB
M2HTML documentation: $BUILD_M2HTML
2009-10-02 19:22:19 +02:00
])
2010-06-01 15:33:45 +02:00
AC_CONFIG_FILES([Makefile
mjdgges/Makefile
kronecker/Makefile
bytecode/Makefile
2011-01-25 23:13:00 +01:00
libdynare++/Makefile
gensylv/Makefile
2021-06-15 14:30:32 +02:00
libkorder/Makefile
2010-06-01 15:33:45 +02:00
k_order_perturbation/Makefile
2021-06-15 14:30:32 +02:00
k_order_welfare/Makefile
2011-02-17 11:42:54 +01:00
kalman_steady_state/Makefile
2011-09-23 18:22:15 +02:00
ms_sbvar/Makefile
2011-12-21 18:23:15 +01:00
block_kalman_filter/Makefile
2020-09-17 14:53:32 +02:00
sobol/Makefile
local_state_space_iterations/Makefile
2021-08-27 13:55:51 +02:00
libkordersim/Makefile
folded_to_unfolded_dr/Makefile
2021-09-23 17:07:14 +02:00
k_order_simul/Makefile
2021-11-24 14:27:25 +01:00
k_order_mean/Makefile
2019-06-26 17:06:52 +02:00
perfect_foresight_problem/Makefile
2019-12-03 16:17:16 +01:00
num_procs/Makefile
2020-09-17 14:53:32 +02:00
block_trust_region/Makefile
2022-09-28 11:53:22 +02:00
disclyap_fast/Makefile
2022-10-04 22:34:07 +02:00
cycle_reduction/Makefile
2022-11-08 18:09:47 +01:00
logarithmic_reduction/Makefile
riccati_update/Makefile])
2010-06-01 15:33:45 +02:00
2009-10-02 19:22:19 +02:00
AC_OUTPUT