configure.ac 11.4 KB
Newer Older
sebastien's avatar
sebastien committed
1
2
dnl Process this file with autoconf to produce a configure script.

3
dnl Copyright (C) 2009-2012 Dynare Team
sebastien's avatar
sebastien committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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/>.
sebastien's avatar
trunk:  
sebastien committed
19

20
AC_PREREQ([2.62])
Sébastien Villemot's avatar
Sébastien Villemot committed
21
AC_INIT([dynare], [4.4-unstable])
sebastien's avatar
trunk:  
sebastien committed
22
AC_CONFIG_SRCDIR([preprocessor/DynareMain.cc])
Sébastien Villemot's avatar
Sébastien Villemot committed
23
AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign no-dist-gzip dist-xz tar-pax])
sebastien's avatar
trunk:  
sebastien committed
24

sebastien's avatar
sebastien committed
25
AC_PROG_CC
sebastien's avatar
trunk:  
sebastien committed
26
27
AC_PROG_CXX

sebastien's avatar
sebastien committed
28
29
30
AC_CANONICAL_HOST
case ${host_os} in
  *mingw32*)
31
32
    # On mingw32, we don't want dynamic libgcc
    # Note that static-libstdc++ is only supported since GCC 4.5 (but generates no error on older versions)
33
    LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++ -static-libgfortran"
34
    have_windows="yes"
sebastien's avatar
sebastien committed
35
    ;;
36
  *cygwin*)
37
38
39
    AC_MSG_WARN([You are compiling for the Cygwin target. This means that the preprocessor will])
    AC_MSG_WARN([not run from MATLAB unless you add the Cygwin DLL to the path.])
    AC_MSG_WARN([This is probably not what you want. Consider using a MinGW cross-compiler.])
40
41
42
43
44
    if test "x$F77" = "x"; then
      # On Cygwin 1.7, g77 comes has version 3, and is not compatible with default gcc/g++ which has version 4
      # And by default, the AC_PROG_F77 will pick up g77 if it is present (even if gfortran is also here)
      F77=gfortran
    fi
45
    have_windows="yes"
46
    ;;
sebastien's avatar
sebastien committed
47
48
esac

sebastien's avatar
trunk:  
sebastien committed
49
50
51
# Use C++ for testing headers
AC_LANG([C++])

52
CXXFLAGS="$CXXFLAGS -Wall -Wno-parentheses"
sebastien's avatar
trunk:  
sebastien committed
53

54
55
56
# If default 'ar' is not available, try to find one with a host prefix (see ticket #145)
AC_CHECK_PROGS([AR], [ar ${host_alias}-ar])

57
AC_PROG_RANLIB
58

59
AX_PROG_LN_S
60

sebastien's avatar
sebastien committed
61
AC_PROG_MKDIR_P
62
63

AM_PROG_LEX
sebastien's avatar
trunk:  
sebastien committed
64

65
66
67
68
69
AC_CHECK_PROG([YACC], [bison], [bison])
if test "x$YACC" = "x"; then
  unset YACC # AM_MISSING_PROG needs an unset variable: an empty variable won't do
  AM_MISSING_PROG([YACC], [bison])
fi
sebastien's avatar
trunk:  
sebastien committed
70

71
72
# We need 1.36 because of unordered_{set,hash} used by Dynare++
AX_BOOST_BASE([1.36])
73
74
75

CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
sebastien's avatar
trunk:  
sebastien committed
76
AC_CHECK_HEADERS([boost/graph/adjacency_list.hpp], [], [AC_MSG_ERROR([Can't find Boost Graph Library])])
77
78
79
AC_CHECK_HEADERS([boost/algorithm/string/trim.hpp], [], [AC_MSG_ERROR([Can't find Boost String Library])])
AC_CHECK_HEADERS([boost/algorithm/string/split.hpp], [], [AC_MSG_ERROR([Can't find Boost String Library])])
AC_CHECK_HEADERS([boost/lexical_cast.hpp], [], [AC_MSG_ERROR([Can't find Boost Lexical Cast Header])])
80
CPPFLAGS="$CPPFLAGS_SAVED"
sebastien's avatar
trunk:  
sebastien committed
81
82

# Don't use deprecated hash structures
83
AC_DEFINE([BOOST_NO_HASH], [], [Don't use deprecated STL hash structures])
sebastien's avatar
trunk:  
sebastien committed
84

85
86
87
88
# Check for dlopen(), needed by tests for estimation DLL
AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
AC_SUBST([LIBADD_DLOPEN])

89
# Check for libmatio, needed by Dynare++
90
91
AX_MATIO
AM_CONDITIONAL([HAVE_MATIO], [test "x$has_matio" = "xyes"])
92

93
94
AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo])

95
96
97
AC_CHECK_PROG([PDFTEX], [pdftex], [pdftex])
AM_CONDITIONAL([HAVE_PDFTEX], [test "x$PDFTEX" != "x"])

98
99
100
AC_CHECK_PROG([PDFETEX], [pdfetex], [pdfetex])
AM_CONDITIONAL([HAVE_PDFETEX], [test "x$PDFETEX" != "x"])

101
102
103
104
105
106
107
108
109
if test "x$PDFTEX" != "x"; then
  AC_MSG_CHECKING([for eplain])
  AX_TEX_TEST([\input eplain
\end
], [ax_tex_have_eplain])
  AC_MSG_RESULT([$ax_tex_have_eplain])
fi
AM_CONDITIONAL([HAVE_EPLAIN], [test "x$ax_tex_have_eplain" = "xyes"])

110
AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex])
111
112
AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$PDFLATEX" != "x"])

113
AC_CHECK_PROG([BIBTEX], [bibtex], [bibtex])
114
115
AM_CONDITIONAL([HAVE_BIBTEX], [test "x$BIBTEX" != "x"])

116
117
118
119
120
121
AC_CHECK_PROG([TEXI2HTML], [texi2html], [texi2html])
AM_CONDITIONAL([HAVE_TEXI2HTML], [test "x$TEXI2HTML" != "x"])

AC_CHECK_PROG([LATEX2HTML], [latex2html], [latex2html])
AM_CONDITIONAL([HAVE_LATEX2HTML], [test "x$LATEX2HTML" != "x"])

122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
if test "x$PDFLATEX" != "x" -a "x$BIBTEX" != "x"; then
  AC_MSG_CHECKING([for econometrica BST])
  AX_LATEX_BIBTEX_TEST([\documentclass{article}
\begin{document}
\cite{Juillard1996}
\bibliography{conftest}
\bibliographystyle{econometrica}
\end{document}
], [@techreport{Juillard1996,
	Author = {Juillard, Michel},
	Institution = {CEPREMAP},
	Number = {9602},
	Title = {Dynare : a program for the resolution and simulation of dynamic models with forward variables through the use of a relaxation algorithm},
	Type = {CEPREMAP working papers},
	Year = {1996}}
], [ax_latex_have_econometrica])
  AC_MSG_RESULT([$ax_latex_have_econometrica])
139
140

  AX_LATEX_CLASS([beamer], [ax_latex_have_beamer])
141
142
fi
AM_CONDITIONAL([HAVE_ECONOMETRICA], [test "x$ax_latex_have_econometrica" = "xyes"])
143
AM_CONDITIONAL([HAVE_BEAMER], [test "x$ax_latex_have_beamer" = "xyes"])
144

sebastien's avatar
sebastien committed
145
146
AC_CHECK_PROG([DOXYGEN], [doxygen], [doxygen])
AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$DOXYGEN" != "x"])
147

148
AC_CHECK_PROG([OCTAVE], [octave], [octave])
149
AM_CONDITIONAL([HAVE_OCTAVE], [test "x$OCTAVE" != "x"])
150

151
152
AC_CHECK_PROG([CTANGLE], [ctangle], [ctangle])
AM_CONDITIONAL([HAVE_CTANGLE], [test "x$CTANGLE" != "x"])
153
154
155
156
if test "x$CTANGLE" = "x"; then
  unset CTANGLE # AM_MISSING_PROG needs an unset variable: an empty variable won't do
  AM_MISSING_PROG([CTANGLE], [ctangle])
fi
157
158
159
160

AC_CHECK_PROG([CWEAVE], [cweave], [cweave])
AM_CONDITIONAL([HAVE_CWEAVE], [test "x$CWEAVE" != "x"])

sebastien's avatar
sebastien committed
161
AC_PROG_F77
162
163
164
165
166
167
168
169
170
AC_F77_LIBRARY_LDFLAGS
# Hack to get static linking of libgfortran on MinGW
# (-static-libgfortran doesn't act on gcc/g++)
case ${host_os} in
  *mingw32*)
    FLIBS=`echo $FLIBS | sed 's/-lgfortran/-Wl,-Bstatic -lgfortran -Wl,-Bdynamic/'`
    ;;
esac

sebastien's avatar
sebastien committed
171
172
173
174
if test "x$F77" != "x"; then
   AX_BLAS
   AX_LAPACK
fi
175
176
177
178
AM_CONDITIONAL([HAVE_BLAS], [test x"$ax_blas_ok" = "xyes"])
AM_CONDITIONAL([HAVE_LAPACK], [test x"$ax_lapack_ok" = "xyes"])

AX_PTHREAD
sebastien's avatar
sebastien committed
179

sebastien's avatar
sebastien committed
180
AC_CONFIG_FILES([Makefile
181
                 preprocessor/macro/Makefile
sebastien's avatar
sebastien committed
182
183
184
185
186
                 preprocessor/Makefile
                 doc/Makefile
                 doc/preprocessor/Makefile
                 doc/macroprocessor/Makefile
                 doc/userguide/Makefile
187
                 doc/parallel/Makefile
188
                 doc/internals/Makefile
189
                 doc/gsa/Makefile
190
                 tests/Makefile
sebastien's avatar
sebastien committed
191
                 matlab/dynare_version.m
192
                 windows/dynare-version.nsi
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
                 dynare++/Makefile
                 dynare++/parser/cc/Makefile
                 dynare++/sylv/Makefile
                 dynare++/sylv/cc/Makefile
                 dynare++/sylv/testing/Makefile
                 dynare++/tl/Makefile
                 dynare++/tl/cc/Makefile
                 dynare++/tl/testing/Makefile
                 dynare++/doc/Makefile
                 dynare++/utils/cc/Makefile
                 dynare++/integ/Makefile
                 dynare++/integ/cc/Makefile
                 dynare++/integ/src/Makefile
                 dynare++/integ/testing/Makefile
                 dynare++/kord/Makefile
                 dynare++/src/Makefile
209
210
                 mex/sources/Makefile
                 mex/sources/estimation/Makefile
211
                 mex/sources/estimation/tests/Makefile
212
                 mex/sources/estimation/libmat/Makefile
213
                 mex/sources/estimation/libmat/tests/Makefile
214
])
sebastien's avatar
trunk:  
sebastien committed
215

sebastien's avatar
sebastien committed
216
217
218
AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation of MEX files for MATLAB]), [], [enable_matlab=yes])
if test "x$enable_matlab" = "xyes"; then
  AC_CONFIG_SUBDIRS([mex/build/matlab])
219
  AX_MATLAB
sebastien's avatar
sebastien committed
220
221
fi
AM_CONDITIONAL([ENABLE_MATLAB], [test "x$enable_matlab" = "xyes"])
222
AM_CONDITIONAL([HAVE_CMD_LINE_MATLAB], [test "x$ax_enable_matlab" = "xyes" -a "x$have_windows" = "x"])
sebastien's avatar
sebastien committed
223
224
225
226
227
228

AC_ARG_ENABLE([octave], AS_HELP_STRING([--disable-octave], [disable compilation of MEX files for Octave]), [], [enable_octave=yes])
if test "x$enable_octave" = "xyes"; then
  AC_CONFIG_SUBDIRS([mex/build/octave])
fi
AM_CONDITIONAL([ENABLE_OCTAVE], [test "x$enable_octave" = "xyes"])
229

230
231
232
233
234
# Enable exporting of Org files
# The clean way would be to test for Emacs, Org-mode, latex, dvipng...
AC_ARG_ENABLE([org-export], AS_HELP_STRING([--enable-org-export], [enable exporting of Org files (requires Emacs, org-mode and other external programs)]))
AM_CONDITIONAL([ENABLE_ORG_EXPORT], [test "x$enable_org_export" != "x"])

sebastien's avatar
sebastien committed
235
236
237
238
# Construct final output message

BUILD_PREPROCESSOR="yes"

239
if test "x$ax_blas_ok" = "xyes" -a "x$ax_lapack_ok" = "xyes" -a "x$has_matio" = "xyes"; then
240
241
242
243
244
  if test x"$ax_pthread_ok" = "xyes"; then
     BUILD_DYNAREPLUSPLUS="yes"
  else
     BUILD_DYNAREPLUSPLUS="yes (without POSIX threads)"
  fi
sebastien's avatar
sebastien committed
245
else
246
  BUILD_DYNAREPLUSPLUS="no (missing one of: BLAS, LAPACK, MatIO)"
sebastien's avatar
sebastien committed
247
248
fi

249
if test "x$CWEAVE" != "x" -a x"$PDFTEX" != "x" -a "x$ax_tex_have_eplain" = "xyes"; then
sebastien's avatar
sebastien committed
250
251
  BUILD_DYNAREPLUSPLUS_SRCDOC="yes"
else
252
  BUILD_DYNAREPLUSPLUS_SRCDOC="no (missing one of: cweave, pdftex, eplain)"
sebastien's avatar
sebastien committed
253
254
fi

255
if test "x$PDFLATEX" != "x" -a "x$BIBTEX" != "x" -a "x$ax_latex_have_econometrica" = "xyes"; then
sebastien's avatar
sebastien committed
256
257
  BUILD_DYNARE_USERGUIDE="yes"
else
258
  BUILD_DYNARE_USERGUIDE="no (missing one of: pdflatex, bibtex, econometrica BST)"
sebastien's avatar
sebastien committed
259
260
fi

261
262
263
264
265
266
if test "x$PDFLATEX" != "x" -a "x$ax_latex_have_beamer" = "xyes"; then
  BUILD_BEAMER_DOC="yes"
else
  BUILD_BEAMER_DOC="no (missing one of: pdflatex, beamer)"
fi

sebastien's avatar
sebastien committed
267
268
269
270
271
272
273
274
275
276
277
278
if test "x$PDFLATEX" != "x"; then
  BUILD_OTHER_PDF_DOC="yes"
else
  BUILD_OTHER_PDF_DOC="no (missing pdflatex)"
fi

if test "x$DOXYGEN" != "x"; then
  BUILD_DYNARE_PREPROC_DOC="yes"
else
  BUILD_DYNARE_PREPROC_DOC="no (missing doxygen)"
fi

279
280
281
282
283
284
if test "x$enable_org_export" != "x"; then
  BUILD_DYNARE_INTERNAL_DOC="yes"
else
  BUILD_DYNARE_INTERNAL_DOC="no (Org export not enabled)"
fi

285
if test "x$MAKEINFO" != "x"; then
286
  BUILD_DYNARE_INFO="yes"
287
288
289
290
291
292
  if test "x$TEXI2HTML" != "x" -a "x$LATEX2HTML" != "x"; then
    BUILD_DYNARE_HTML_MANUAL="yes"
  else
    BUILD_DYNARE_HTML_MANUAL="yes (but with ugly math formulas, missing texi2html or latex2html)"
  fi
  BUILD_DYNARE_PDF_MANUAL="yes"
293
else
294
295
296
  BUILD_DYNARE_INFO="no (missing makeinfo)"
  BUILD_DYNARE_HTML_MANUAL="no (missing makeinfo)"
  BUILD_DYNARE_PDF_MANUAL="no (missing makeinfo)"
297
298
fi

sebastien's avatar
sebastien committed
299
300
301
302
303
304
if test "x$OCTAVE" != "x"; then
  TESTSUITE_OCTAVE="yes"
else
  TESTSUITE_OCTAVE="no"
fi

305
if test "x$ax_blas_ok" = "xyes" -a "x$ax_lapack_ok" = "xyes"; then
sebastien's avatar
sebastien committed
306
307
  TESTSUITE_DYNAREPLUSPLUS="yes"
else
sebastien's avatar
sebastien committed
308
  TESTSUITE_DYNAREPLUSPLUS="no"
sebastien's avatar
sebastien committed
309
310
311
312
313
314
315
316
317
318
319
320
321
322
fi

AC_MSG_NOTICE([

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

Binaries (with "make"):
 Dynare preprocessor:                   $BUILD_PREPROCESSOR
 Dynare++:                              $BUILD_DYNAREPLUSPLUS

PDF documentation (with "make pdf"):
 Dynare reference manual:               $BUILD_DYNARE_PDF_MANUAL
 Dynare user guide:                     $BUILD_DYNARE_USERGUIDE
 Dynare++ developer documentation:      $BUILD_DYNAREPLUSPLUS_SRCDOC
323
 Beamer presentations:                  $BUILD_BEAMER_DOC
sebastien's avatar
sebastien committed
324
325
326
327
328
 Various other documents:               $BUILD_OTHER_PDF_DOC

HTML documentation (with "make html"):
 Dynare reference manual:               $BUILD_DYNARE_HTML_MANUAL
 Dynare preprocessor developer doc:     $BUILD_DYNARE_PREPROC_DOC
329
 Dynare internal doc:                   $BUILD_DYNARE_INTERNAL_DOC
sebastien's avatar
sebastien committed
330

331
332
Info documentation (with "make info"):  $BUILD_DYNARE_INFO

sebastien's avatar
sebastien committed
333
334
335
336
337
Testsuites (run with "make check"):
 Dynare for Octave:                     $TESTSUITE_OCTAVE
 Dynare++:                              $TESTSUITE_DYNAREPLUSPLUS
])

sebastien's avatar
trunk:  
sebastien committed
338
AC_OUTPUT