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
2020-12-02 18:26:09 +01:00
AX_OCTAVE
test "$ax_enable_octave" != yes && AC_MSG_ERROR([Octave cannot be found])
2019-11-26 12:58:48 +01:00
2021-05-09 18:00:42 +02:00
# Let mkoctfile set the default compilers and flags (except for FC and FCFLAGS which are not supported)
# NB: mkoctfile honors overrides via environment variables
2019-11-26 12:58:48 +01:00
CC=$($MKOCTFILE -p CC)
CXX=$($MKOCTFILE -p CXX)
2020-11-13 10:05:40 +01:00
AR=$($MKOCTFILE -p AR)
RANLIB=$($MKOCTFILE -p RANLIB)
2021-05-09 18:00:42 +02:00
CFLAGS=$($MKOCTFILE -p CFLAGS)
CXXFLAGS=$($MKOCTFILE -p CXXFLAGS)
2022-04-15 14:32:54 +02:00
# The --link-stand-alone is needed since Octave 7 to avoid inserting -shared, which
# is undesirable for generic LDFLAGS.
LDFLAGS=$($MKOCTFILE --link-stand-alone -p LDFLAGS)
2009-10-02 19:22:19 +02:00
2019-12-09 17:07:25 +01:00
AC_CANONICAL_HOST
2019-11-26 12:58:48 +01:00
OCTAVE_VERSION=$($MKOCTFILE -v 2>&1 | sed 's/mkoctfile, version //')
2021-03-12 14:50:35 +01:00
AX_COMPARE_VERSION([$OCTAVE_VERSION], [lt], [6.2.0], [AC_MSG_ERROR([Your Octave is too old, please upgrade to version 6.2.0 at least (or disable Octave support with --disable-octave).])])
2010-06-11 18:40:58 +02:00
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
2019-01-28 18:39:42 +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])
2011-02-17 11:42:54 +01:00
# Check for GSL, needed by MS-SBVAR
2019-11-26 12:58:48 +01:00
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
2018-11-12 12:55:18 +01:00
# Check for libmatio, needed by MEX files using Dynare++ code, and by ms-sbvar (the latter only under Octave, as an alternative to MATLAB's libmat)
2019-11-26 12:58:48 +01:00
if test "$enable_mex_dynareplusplus" = yes -o "$enable_mex_ms_sbvar" = 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 MS-SBVAR MEX and MEX files based Dynare++, pass the --disable-mex-dynare++ and --disable-mex-ms-sbvar flags.])
2019-11-26 12:58:48 +01:00
fi
2010-12-08 10:22:44 +01: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
AX_SLICOT([octave])
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
2013-03-23 17:09:00 +01:00
# Check for UMFPACK, needed by bytecode
2013-03-29 15:30:31 +01:00
AC_CHECK_LIB([umfpack], [umfpack_dl_defaults], [LIBADD_UMFPACK="-lumfpack"], [AC_MSG_ERROR([Can't find UMFPACK])])
AC_SUBST([LIBADD_UMFPACK])
2013-03-23 17:09:00 +01:00
2020-11-18 15:31:06 +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
2021-10-25 18:02:46 +02:00
# Determine whether to link MEX files against the Octave libraries.
# mkoctfile no longer does this by default but in practice it is needed
# for Windows and macOS.
2021-09-21 17:58:05 +02:00
case ${host_os} in
*mingw32*)
2021-10-25 18:02:46 +02:00
# This is hardcoded in src/mkoctfile.cc.in.
link_octave_libs=yes
;;
*darwin*)
# Under macOS, the Homebrew formula passes --enable-link-all-dependencies
# to the configure script.
link_octave_libs=yes
2021-09-21 17:58:05 +02:00
;;
*)
2021-10-25 18:02:46 +02:00
link_octave_libs=no
2021-09-21 17:58:05 +02:00
;;
esac
2021-10-25 18:02:46 +02:00
AM_CONDITIONAL([LINK_OCTAVE_LIBS], [test ${link_octave_libs} = yes])
2021-09-21 17:58:05 +02:00
2019-11-26 12:58:48 +01:00
# Construct final output message
if test "$enable_mex_dynareplusplus" = yes; then
BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE="yes"
2010-12-08 10:22:44 +01:00
else
2019-11-26 12:58:48 +01:00
BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE="no"
2010-12-08 10:22:44 +01: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_OCTAVE="yes"
2010-12-13 18:15:00 +01:00
else
2019-11-26 12:58:48 +01:00
BUILD_KALMAN_STEADY_STATE_OCTAVE="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_OCTAVE="yes"
else
2019-11-26 12:58:48 +01:00
BUILD_MS_SBVAR_MEX_OCTAVE="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 Octave (except those listed below): yes
2018-11-12 12:55:18 +01:00
Gensylv, k-order and dynare_simul MEX for Octave: $BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE
2011-02-17 11:42:54 +01:00
MS-SBVAR MEX files for Octave: $BUILD_MS_SBVAR_MEX_OCTAVE
Kalman Steady State MEX file for Octave: $BUILD_KALMAN_STEADY_STATE_OCTAVE
2009-10-02 19:22:19 +02:00
])
AC_CONFIG_FILES([Makefile
mjdgges/Makefile
kronecker/Makefile
bytecode/Makefile
2009-11-02 13:04:07 +01:00
libdynare++/Makefile
gensylv/Makefile
2021-06-15 14:30:32 +02:00
libkorder/Makefile
2009-11-02 13:04:07 +01: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-12-16 10:42:24 +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])
2009-10-02 19:22:19 +02:00
AC_OUTPUT