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

3
dnl Copyright © 2009-2018 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])
Stéphane Adjemian's avatar
Stéphane Adjemian committed
21
AC_INIT([dynare], [4.6-unstable])
22
AC_CONFIG_SRCDIR([preprocessor/src/DynareMain.cc])
23
AM_INIT_AUTOMAKE([1.11 -Wall -Wno-portability foreign no-dist-gzip dist-xz tar-pax])
sebastien's avatar
trunk:  
sebastien committed
24

25
26
AC_CONFIG_SUBDIRS([preprocessor])

sebastien's avatar
sebastien committed
27
AC_PROG_CC
sebastien's avatar
trunk:  
sebastien committed
28
AC_PROG_CXX
29
AX_CXX_COMPILE_STDCXX_14
sebastien's avatar
trunk:  
sebastien committed
30

sebastien's avatar
sebastien committed
31
32
33
AC_CANONICAL_HOST
case ${host_os} in
  *mingw32*)
34
35
36
    # On Windows, we want Dynare++ to be statically linked
    AM_LDFLAGS="-static"
    AC_SUBST([AM_LDFLAGS])
sebastien's avatar
sebastien committed
37
    ;;
38
  *cygwin*)
39
40
41
    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.])
42
    if test -z "$F77"; then
43
44
45
46
47
      # 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
    ;;
sebastien's avatar
sebastien committed
48
49
esac

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

53
AM_CXXFLAGS="-Wall -Wno-parentheses -Wold-style-cast"
54
AC_SUBST([AM_CXXFLAGS])
sebastien's avatar
trunk:  
sebastien committed
55

56
57
58
# 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])

59
AC_PROG_RANLIB
60
AM_PROG_AR
61

62
AX_PROG_LN_S
63

sebastien's avatar
sebastien committed
64
AC_PROG_MKDIR_P
65

66
67
AX_CXX11_THREAD

68
69
70
71
72
73
74
75
AM_PROG_LEX

AC_CHECK_PROG([YACC], [bison], [bison])
if test -z "$YACC"; then
  unset YACC # AM_MISSING_PROG needs an unset variable: an empty variable won't do
  AM_MISSING_PROG([YACC], [bison])
fi

76
# Check for libmatio, needed by Dynare++
77
AX_MATIO
78
AM_CONDITIONAL([HAVE_MATIO], [test "$has_matio" = yes])
79

80
AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex])
81
AM_CONDITIONAL([HAVE_PDFLATEX], [test -n "$PDFLATEX"])
82

83
AC_CHECK_PROG([BIBTEX], [bibtex], [bibtex])
84
AM_CONDITIONAL([HAVE_BIBTEX], [test -n "$BIBTEX"])
85

86
AC_CHECK_PROG([SPHINXBUILD], [sphinx-build], [sphinx-build])
87
AM_CONDITIONAL([HAVE_SPHINXBUILD], [test -n "$SPHINXBUILD"])
88

89
if test -n "$PDFLATEX" -a -n "$BIBTEX"; then
90
  AX_LATEX_CLASS([beamer], [ax_latex_have_beamer])
91
fi
92
AM_CONDITIONAL([HAVE_BEAMER], [test "$ax_latex_have_beamer" = yes])
93

sebastien's avatar
sebastien committed
94
AC_PROG_F77
95
96
AC_F77_LIBRARY_LDFLAGS
case ${host_os} in
Houtan Bastani's avatar
Houtan Bastani committed
97
98
99
100
101
  *darwin*)
    # * OS X doesn't need to link against the Fortran libraries because
    #   everything is contained within the vecLib framework.
    FLIBS=''
    ;;
102
103
esac

104
if test -n "$F77"; then
sebastien's avatar
sebastien committed
105
106
107
   AX_BLAS
   AX_LAPACK
fi
108
109
AM_CONDITIONAL([HAVE_BLAS], [test "$ax_blas_ok" = yes])
AM_CONDITIONAL([HAVE_LAPACK], [test "$ax_lapack_ok" = yes])
110

sebastien's avatar
sebastien committed
111
AC_CONFIG_FILES([Makefile
Stéphane Adjemian's avatar
Stéphane Adjemian committed
112
                 VERSION
sebastien's avatar
sebastien committed
113
                 doc/Makefile
114
115
                 doc/manual/Makefile
                 doc/manual/utils/version.py
116
                 doc/parallel/Makefile
117
                 doc/internals/Makefile
118
                 doc/gsa/Makefile
119
                 doc/dseries-and-reporting/Makefile
120
                 tests/Makefile
sebastien's avatar
sebastien committed
121
                 matlab/dynare_version.m
122
                 windows/dynare-version.nsi
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
                 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
139
                 mex/sources/Makefile
140
])
sebastien's avatar
trunk:  
sebastien committed
141

sebastien's avatar
sebastien committed
142
AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation of MEX files for MATLAB]), [], [enable_matlab=yes])
143
if test "$enable_matlab" = yes; then
sebastien's avatar
sebastien committed
144
  AC_CONFIG_SUBDIRS([mex/build/matlab])
145
  AX_MATLAB
146
  AX_MATLAB_BATCH_OPTIONS
sebastien's avatar
sebastien committed
147
fi
148
AM_CONDITIONAL([ENABLE_MATLAB], [test "$enable_matlab" = yes])
149
AM_CONDITIONAL([HAVE_MATLAB], [test "$ax_enable_matlab" = yes])
sebastien's avatar
sebastien committed
150
151

AC_ARG_ENABLE([octave], AS_HELP_STRING([--disable-octave], [disable compilation of MEX files for Octave]), [], [enable_octave=yes])
152
if test "$enable_octave" = yes; then
sebastien's avatar
sebastien committed
153
  AC_CONFIG_SUBDIRS([mex/build/octave])
154
  AC_CHECK_PROG([OCTAVE], [octave], [octave])
sebastien's avatar
sebastien committed
155
fi
156
157
AM_CONDITIONAL([ENABLE_OCTAVE], [test "$enable_octave" = yes])
AM_CONDITIONAL([HAVE_OCTAVE], [test "$enable_octave" = yes -a -n "$OCTAVE"])
158

159
160
161
# 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)]))
162
AM_CONDITIONAL([ENABLE_ORG_EXPORT], [test -n "$enable_org_export"])
163

sebastien's avatar
sebastien committed
164
165
# Construct final output message

166
if test "$ax_blas_ok" = yes -a "$ax_lapack_ok" = yes -a "$has_matio" = yes; then
167
  BUILD_DYNAREPLUSPLUS="yes"
sebastien's avatar
sebastien committed
168
else
169
  BUILD_DYNAREPLUSPLUS="no (missing one of: BLAS, LAPACK, MatIO)"
sebastien's avatar
sebastien committed
170
171
fi

172
if test -n "$PDFLATEX" -a "$ax_latex_have_beamer" = yes; then
173
174
175
176
177
  BUILD_BEAMER_DOC="yes"
else
  BUILD_BEAMER_DOC="no (missing one of: pdflatex, beamer)"
fi

sebastien's avatar
sebastien committed
178
179
180
181
182
183
if test "x$PDFLATEX" != "x"; then
  BUILD_OTHER_PDF_DOC="yes"
else
  BUILD_OTHER_PDF_DOC="no (missing pdflatex)"
fi

184
if test -n "$enable_org_export"; then
185
186
187
188
189
  BUILD_DYNARE_INTERNAL_DOC="yes"
else
  BUILD_DYNARE_INTERNAL_DOC="no (Org export not enabled)"
fi

190
if test -n "$SPHINXBUILD"; then
191
  BUILD_DYNARE_HTML_MANUAL="yes"
192
  BUILD_DYNARE_PDF_MANUAL="yes"
193
else
194
195
  BUILD_DYNARE_HTML_MANUAL="no (missing sphinx-build)"
  BUILD_DYNARE_PDF_MANUAL="no (missing sphinx-build)"
196
197
fi

198
if test -n "$OCTAVE"; then
sebastien's avatar
sebastien committed
199
200
201
202
203
  TESTSUITE_OCTAVE="yes"
else
  TESTSUITE_OCTAVE="no"
fi

204
if test "$ax_blas_ok" = yes -a "$ax_lapack_ok" = yes; then
sebastien's avatar
sebastien committed
205
206
  TESTSUITE_DYNAREPLUSPLUS="yes"
else
sebastien's avatar
sebastien committed
207
  TESTSUITE_DYNAREPLUSPLUS="no"
sebastien's avatar
sebastien committed
208
209
210
211
212
213
214
215
216
217
218
fi

AC_MSG_NOTICE([

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

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

PDF documentation (with "make pdf"):
 Dynare reference manual:               $BUILD_DYNARE_PDF_MANUAL
219
 Beamer presentations:                  $BUILD_BEAMER_DOC
sebastien's avatar
sebastien committed
220
221
222
223
 Various other documents:               $BUILD_OTHER_PDF_DOC

HTML documentation (with "make html"):
 Dynare reference manual:               $BUILD_DYNARE_HTML_MANUAL
224
 Dynare internal doc:                   $BUILD_DYNARE_INTERNAL_DOC
sebastien's avatar
sebastien committed
225
226
227
228
229
230

Testsuites (run with "make check"):
 Dynare for Octave:                     $TESTSUITE_OCTAVE
 Dynare++:                              $TESTSUITE_DYNAREPLUSPLUS
])

sebastien's avatar
trunk:  
sebastien committed
231
AC_OUTPUT