configure.ac 5.8 KB
Newer Older
1
2
dnl Process this file with autoconf to produce a configure script.

3
dnl Copyright © 2009-2021 Dynare Team
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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/>.

20
AC_PREREQ([2.62])
21
AC_INIT([dynare], [4.7-unstable])
22
AC_CONFIG_SRCDIR([configure.ac])
23
AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign])
24

25
26
27
AX_OCTAVE

test "$ax_enable_octave" != yes && AC_MSG_ERROR([Octave cannot be found])
28

29
30
# Let mkoctfile set the default compilers and flags (except for FC and FCFLAGS which are not supported)
# NB: mkoctfile honors overrides via environment variables
31
32
CC=$($MKOCTFILE -p CC)
CXX=$($MKOCTFILE -p CXX)
33
34
AR=$($MKOCTFILE -p AR)
RANLIB=$($MKOCTFILE -p RANLIB)
35
36
CFLAGS=$($MKOCTFILE -p CFLAGS)
CXXFLAGS=$($MKOCTFILE -p CXXFLAGS)
37
LDFLAGS="$($MKOCTFILE -p LFLAGS) $($MKOCTFILE -p LDFLAGS)"
38

39
40
AC_CANONICAL_HOST

41
OCTAVE_VERSION=$($MKOCTFILE -v 2>&1 | sed 's/mkoctfile, version //')
42
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).])])
43

44
AC_PROG_FC
45
AC_PROG_CC
46
AC_PROG_CC_C99
47
AC_PROG_CXX
Sébastien Villemot's avatar
Sébastien Villemot committed
48
AX_CXX_COMPILE_STDCXX_17
sebastien's avatar
sebastien committed
49
AC_PROG_RANLIB
50
AX_PROG_LN_S
51
AC_PROG_MKDIR_P
52
AM_PROG_AR
53
54
55

AX_CXX11_THREAD

56
# Check for dlopen(), needed by k_order_perturbation DLL
57
58
AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
AC_SUBST([LIBADD_DLOPEN])
59
60
61
62
63
64
65
66
67
68
69

# 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])

70
# Check for GSL, needed by MS-SBVAR
71
72
if test "$enable_mex_ms_sbvar" = yes; then
  AX_GSL
73
  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.])
74
fi
75

76
# 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)
77
78
if test "$enable_mex_dynareplusplus" = yes -o "$enable_mex_ms_sbvar" = yes; then
  AX_MATIO
79
  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.])
80
fi
81

82
# Check for libslicot, needed by kalman_steady_state
83
84
if test "$enable_mex_kalman_steady_state" = yes; then
  AX_SLICOT([octave])
85
  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.])
86
fi
87

88
# Check for UMFPACK, needed by bytecode
89
90
AC_CHECK_LIB([umfpack], [umfpack_dl_defaults], [LIBADD_UMFPACK="-lumfpack"], [AC_MSG_ERROR([Can't find UMFPACK])])
AC_SUBST([LIBADD_UMFPACK])
91

92
93
94
95
96
97
98
99
100
# 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

101
102
103
# Construct final output message
if test "$enable_mex_dynareplusplus" = yes; then
   BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE="yes"
104
else
105
   BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE="no"
106
107
fi

108
if test "$enable_mex_kalman_steady_state" = yes; then
109
   BUILD_KALMAN_STEADY_STATE_OCTAVE="yes"
110
else
111
   BUILD_KALMAN_STEADY_STATE_OCTAVE="no"
112
113
fi

114
if test "$enable_mex_ms_sbvar" = yes; then
115
116
   BUILD_MS_SBVAR_MEX_OCTAVE="yes"
else
117
   BUILD_MS_SBVAR_MEX_OCTAVE="no"
118
119
fi

120
121
122
123
124
AC_MSG_NOTICE([

Dynare is now configured for building the following components...

Binaries (with "make"):
125
 MEX files for Octave (except those listed below):                   yes
126
 Gensylv, k-order and dynare_simul MEX for Octave:                   $BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE
127
128
 MS-SBVAR MEX files for Octave:                                      $BUILD_MS_SBVAR_MEX_OCTAVE
 Kalman Steady State MEX file for Octave:                            $BUILD_KALMAN_STEADY_STATE_OCTAVE
129
130
131
132
133
134
135

])

AC_CONFIG_FILES([Makefile
                 mjdgges/Makefile
                 kronecker/Makefile
                 bytecode/Makefile
sebastien's avatar
sebastien committed
136
137
138
                 libdynare++/Makefile
                 gensylv/Makefile
                 k_order_perturbation/Makefile
139
                 dynare_simul_/Makefile
140
                 kalman_steady_state/Makefile
141
                 ms_sbvar/Makefile
142
                 block_kalman_filter/Makefile
143
144
		         sobol/Makefile
		         local_state_space_iterations/Makefile
145
                 perfect_foresight_problem/Makefile
146
                 num_procs/Makefile
147
                 block_trust_region/Makefile
148
                 disclyap_fast/Makefile])
149
150

AC_OUTPUT