1dnl Process this file with autoconf to produce a configure script.
2
3dnl Copyright © 2009-2019 Dynare Team
4dnl
5dnl This file is part of Dynare.
6dnl
7dnl Dynare is free software: you can redistribute it and/or modify
8dnl it under the terms of the GNU General Public License as published by
9dnl the Free Software Foundation, either version 3 of the License, or
10dnl (at your option) any later version.
11dnl
12dnl Dynare is distributed in the hope that it will be useful,
13dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15dnl GNU General Public License for more details.
16dnl
17dnl You should have received a copy of the GNU General Public License
18dnl along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
19
20AC_PREREQ([2.62])
21AC_INIT([dynare-preprocessor], [4.6.4])
22AC_CONFIG_AUX_DIR([build-aux])
23AC_CONFIG_SRCDIR([src/DynareMain.cc])
24AM_INIT_AUTOMAKE([1.11 -Wall -Wno-portability foreign no-dist-gzip dist-xz tar-pax])
25
26AC_PROG_CC
27AC_PROG_CXX
28AX_CXX_COMPILE_STDCXX_17
29
30AC_CANONICAL_HOST
31case ${host_os} in
32  *mingw32*)
33    # On Windows, we don't want dynamic linking
34    AM_LDFLAGS="-static"
35    AC_SUBST([AM_LDFLAGS])
36    ;;
37  *cygwin*)
38    AC_MSG_WARN([You are compiling for the Cygwin target. This means that the preprocessor will])
39    AC_MSG_WARN([not run from MATLAB unless you add the Cygwin DLL to the path.])
40    AC_MSG_WARN([This is probably not what you want. Consider using a MinGW cross-compiler.])
41    ;;
42esac
43
44# Use C++ for testing headers
45AC_LANG([C++])
46
47AM_CXXFLAGS="-Wall -Wno-parentheses -Wold-style-cast"
48AC_SUBST([AM_CXXFLAGS])
49
50# If default 'ar' is not available, try to find one with a host prefix (see ticket #145)
51AC_CHECK_PROGS([AR], [ar ${host_alias}-ar])
52
53AC_PROG_RANLIB
54AM_PROG_AR
55
56AM_PROG_LEX
57# Hack to get lex include dir, ticket #575
58AC_SUBST([LEXINC], [$(echo "$(dirname "$(which $LEX)")"/../include)])
59
60AC_CHECK_PROG([YACC], [bison], [bison])
61if test -z "$YACC"; then
62  unset YACC # AM_MISSING_PROG needs an unset variable: an empty variable won't do
63  AM_MISSING_PROG([YACC], [bison])
64fi
65
66# We need 1.36 because of unordered_{set,hash} used by Dynare++
67AX_BOOST_BASE([1.36], [], [AC_MSG_ERROR([Can't find Boost >= 1.36])])
68
69CPPFLAGS_SAVED="$CPPFLAGS"
70CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
71AC_CHECK_HEADERS([boost/graph/adjacency_list.hpp], [], [AC_MSG_ERROR([Can't find Boost Graph Library])])
72AC_CHECK_HEADERS([boost/algorithm/string/trim.hpp], [], [AC_MSG_ERROR([Can't find Boost String Library])])
73AC_CHECK_HEADERS([boost/algorithm/string/split.hpp], [], [AC_MSG_ERROR([Can't find Boost String Library])])
74CPPFLAGS="$CPPFLAGS_SAVED"
75
76# Don't use deprecated hash structures
77AC_DEFINE([BOOST_NO_HASH], [], [Don't use deprecated STL hash structures])
78
79# Check if internal documentation can be built
80AC_CHECK_PROG([DOXYGEN], [doxygen], [doxygen])
81AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
82
83# Check if user documentation can be built
84AC_ARG_ENABLE([doc], AS_HELP_STRING([--disable-doc], [disable compilation of documentation]), [], [enable_doc=yes])
85AM_CONDITIONAL([ENABLE_DOC], [test "$enable_doc" = yes])
86
87if test "$enable_doc" = yes; then
88  AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex], [no])
89  test "$PDFLATEX" = no && AC_MSG_ERROR([pdflatex cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])
90  AC_CHECK_PROG([BIBTEX], [bibtex], [bibtex], [no])
91  test "$BIBTEX" = no && AC_MSG_ERROR([bibtex cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])
92  AX_LATEX_CLASS([beamer], [ax_latex_have_beamer], [], [AC_MSG_ERROR([beamer cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])])
93fi
94
95
96AC_CONFIG_FILES([Makefile
97                 src/Makefile
98                 src/macro/Makefile
99                 doc/Makefile
100                 doc/preprocessor/Makefile
101                 doc/macroprocessor/Makefile
102])
103
104if test -n "$DOXYGEN"; then
105  BUILD_INTERNAL_DOC="yes"
106else
107  BUILD_INTERNAL_DOC="no (missing doxygen)"
108fi
109
110if test "$enable_doc" = yes; then
111  BUILD_DOC="yes"
112else
113  BUILD_DOC="no"
114fi
115
116AC_MSG_NOTICE([
117
118The Dynare Preprocessor is now configured to build...
119
120Binaries (with "make")
121 Dynare preprocessor:                         yes
122
123PDF documentation (with "make pdf"):
124 Preprocessor & Macroprocessor presentations: $BUILD_DOC
125
126HTML documentation (with "make html"):
127 Dynare preprocessor internal doc:            $BUILD_INTERNAL_DOC
128
129])
130
131AC_OUTPUT
132