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

3
dnl Copyright (C) 2009-2011 Dynare Team
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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_PREREQ([2.61])
Sébastien Villemot's avatar
Sébastien Villemot committed
21
AC_INIT([dynare], [4.3.0])
22
23
24
AC_CONFIG_SRCDIR([configure.ac])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

sebastien's avatar
sebastien committed
25
26
27
dnl The following must occur before we modify CFLAGS/CXXFLAGS
AC_CANONICAL_HOST

28
29
30
AX_MATLAB

if test "x$ax_enable_matlab" = "xyes"; then
31
  AX_MATLAB_VERSION
32
33
34
35
36
37
38
39
40
  AX_DOT_MEXEXT
  AX_MATLAB_ARCH

  if test "x$ax_matlab_version_ok" = "xyes"; then
    AX_MEXOPTS
  fi

  CFLAGS="$MATLAB_CFLAGS"
  CXXFLAGS="$MATLAB_CXXFLAGS"
41
  FFLAGS="$MATLAB_FFLAGS"
42
43
fi

44
45
case ${host_os} in
  *cygwin*)
46
47
48
    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.])
49
50
51
    ;;
esac

52
CFLAGS="$CFLAGS -Wall -Wno-parentheses"
53
FFLAGS="$FFLAGS -Wall"
54
CXXFLAGS="$CXXFLAGS -Wall -Wno-parentheses"
55

56
AC_PROG_F77([gfortran g77 f77])
57
58
AC_PROG_CC
AC_PROG_CXX
sebastien's avatar
sebastien committed
59
AC_PROG_RANLIB
60
AX_PROG_LN_S
61
AC_PROG_MKDIR_P
62
AX_PTHREAD
63
64
# Check for boost libraries used in estimation DLL
AC_LANG_PUSH([C++])
65
AX_BOOST_BASE([1.36])
66
67
68
69
70
71
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
AC_CHECK_HEADER([boost/random/linear_congruential.hpp], [], [AC_MSG_ERROR([Can't find Boost Random Library])])
AC_CHECK_HEADER([boost/math/distributions/beta.hpp], [], [AC_MSG_ERROR([Can't find Boost Math Library])])
CPPFLAGS="$CPPFLAGS_SAVED"
AC_LANG_POP([C++])
72
# Check for dlopen(), needed by k_order_perturbation DLL
73
74
AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
AC_SUBST([LIBADD_DLOPEN])
75
# Check for GSL, needed by MS-SBVAR
76
77
AX_GSL
AM_CONDITIONAL([HAVE_GSL], [test "x$has_gsl" = "xyes"])
78

79
# Check for libslicot, needed by kalman_steady_state
80
81
AX_SLICOT([matlab])
AM_CONDITIONAL([HAVE_SLICOT], [test "x$has_slicot" = "xyes"])
82

83
84
85
86
87
88
89
90
91
92
93
94
AM_CONDITIONAL([DO_SOMETHING], [test "x$ax_enable_matlab" = "xyes" -a "x$ax_matlab_version_ok" = "xyes" -a "x$ax_mexopts_ok" = "xyes"])

if test "x$ax_enable_matlab" = "xyes" -a "x$ax_matlab_version_ok" = "xyes" -a "x$ax_mexopts_ok" = "xyes"; then
  if test x"$ax_pthread_ok" = "xyes"; then
     BUILD_MEX_MATLAB="yes"
  else
     BUILD_MEX_MATLAB="yes (without POSIX threads)"
  fi
else
  BUILD_MEX_MATLAB="no (missing MATLAB, or unknown version, or unknown architecture)"
fi

95
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
96
   BUILD_KALMAN_STEADY_STATE_MATLAB="yes"
97
else
98
   BUILD_KALMAN_STEADY_STATE_MATLAB="no (missing SLICOT)"
99
100
fi

101
102
103
104
105
106
if test "x$ax_enable_matlab" = "xyes" -a "x$ax_matlab_version_ok" = "xyes" -a "x$ax_mexopts_ok" = "xyes" -a "x$has_gsl" = "xyes"; then
   BUILD_MS_SBVAR_MEX_MATLAB="yes"
else
   BUILD_MS_SBVAR_MEX_MATLAB="no (missing GSL)"
fi

Sébastien Villemot's avatar
Sébastien Villemot committed
107
108
109
110
111
112
113
114
AC_ARG_ENABLE([openmp], AS_HELP_STRING([--enable-openmp], [use OpenMP for parallelization of some MEX files]), [
  if test "x$enable_openmp" = "xyes"; then
    CPPFLAGS="$CPPFLAGS -DUSE_OMP"
    CFLAGS="$CFLAGS -fopenmp"
    CXXFLAGS="$CXXFLAGS -fopenmp"
  fi
])

115
116
117
118
119
120
121
122
123
124
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"])

125
126
127
128
129
AC_MSG_NOTICE([

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

Binaries (with "make"):
130
131
132
133
 MEX files for MATLAB (except MS-SBVAR and Kalman Steady State):     $BUILD_MEX_MATLAB
 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
134
135
136

])

137
138
139
140
AC_CONFIG_FILES([Makefile
                 mjdgges/Makefile
                 kronecker/Makefile
                 bytecode/Makefile
141
142
                 libdynare++/Makefile
                 gensylv/Makefile
143
144
                 k_order_perturbation/Makefile
                 dynare_simul_/Makefile
145
                 kalman_steady_state/Makefile
146
                 ms_sbvar/Makefile
147
                 block_kalman_filter/Makefile
148
149
	         sobol/Makefile
		 local_state_space_iterations/Makefile])
150

151
AC_OUTPUT