diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e8161d9ebc2d2a0a1d0be16245d698df49297d40..0348ff10082f1772062746ce3212a5653af8354f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -66,7 +66,7 @@ pkg_source: script: - 'for f in configure.ac preprocessor/configure.ac mex/build/matlab/configure.ac mex/build/octave/configure.ac; do sed -i "s/^AC_INIT(\[\(.*\)\],\s*\[\(.*\)\])/AC_INIT([\1], [$VERSION])/" $f; done' - autoreconf -si - - ./configure + - ./configure --disable-matlab --disable-octave - make dist artifacts: paths: diff --git a/Makefile.am b/Makefile.am index a9b288cefc4a94adf36e507f1fb97ce0c096d2d9..cec400b5d35cebeb544060863226a5004c545eba 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,14 +1,9 @@ SUBDIRS = preprocessor doc tests mex/sources -if HAVE_BLAS -if HAVE_LAPACK -if HAVE_MATIO +if ENABLE_DYNAREPLUSPLUS SUBDIRS += dynare++ endif -endif -endif -# MEX must be built after dynare++ (because of kordepert) if ENABLE_MATLAB SUBDIRS += mex/build/matlab endif diff --git a/configure.ac b/configure.ac index fb6da82b97c868ad04cd6d29fc6a69bc470d10c5..a8dae8f5904d3a1df7f4e70edde00fbe18edb1b4 100644 --- a/configure.ac +++ b/configure.ac @@ -73,140 +73,98 @@ if test -z "$YACC"; then AM_MISSING_PROG([YACC], [bison]) fi -# Check for libmatio, needed by Dynare++ -AX_MATIO -AM_CONDITIONAL([HAVE_MATIO], [test "$has_matio" = yes]) +# Define optional components and their corresponding flags and Automake conditionals +AC_ARG_ENABLE([doc], AS_HELP_STRING([--disable-doc], [disable compilation of documentation]), [], [enable_doc=yes]) +AM_CONDITIONAL([ENABLE_DOC], [test "$enable_doc" = yes]) -AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex]) -AM_CONDITIONAL([HAVE_PDFLATEX], [test -n "$PDFLATEX"]) +AC_ARG_ENABLE([dynare++], AS_HELP_STRING([--disable-dynare++], [disable compilation of Dynare++]), [], [enable_dynareplusplus=yes]) +AM_CONDITIONAL([ENABLE_DYNAREPLUSPLUS], [test "$enable_dynareplusplus" = yes]) -AC_CHECK_PROG([BIBTEX], [bibtex], [bibtex]) -AM_CONDITIONAL([HAVE_BIBTEX], [test -n "$BIBTEX"]) - -AC_CHECK_PROG([SPHINXBUILD], [sphinx-build], [sphinx-build]) -AM_CONDITIONAL([HAVE_SPHINXBUILD], [test -n "$SPHINXBUILD"]) +AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation of MEX files for MATLAB]), [], [enable_matlab=yes]) +AM_CONDITIONAL([ENABLE_MATLAB], [test "$enable_matlab" = yes]) -if test -n "$PDFLATEX" -a -n "$BIBTEX"; then - AX_LATEX_CLASS([beamer], [ax_latex_have_beamer]) -fi -AM_CONDITIONAL([HAVE_BEAMER], [test "$ax_latex_have_beamer" = yes]) +AC_ARG_ENABLE([octave], AS_HELP_STRING([--disable-octave], [disable compilation of MEX files for Octave]), [], [enable_octave=yes]) +AM_CONDITIONAL([ENABLE_OCTAVE], [test "$enable_octave" = yes]) -AC_PROG_F77 -AC_F77_LIBRARY_LDFLAGS -case ${host_os} in - *darwin*) - # * OS X doesn't need to link against the Fortran libraries because - # everything is contained within the vecLib framework. - FLIBS='' - ;; -esac +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 -n "$enable_org_export"]) -if test -n "$F77"; then - AX_BLAS - AX_LAPACK +# Check utilities needed for documentation +if test "$enable_doc" = yes; then + AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex], [AC_MSG_ERROR([pdflatex cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])]) + AC_CHECK_PROG([BIBTEX], [bibtex], [bibtex], [AC_MSG_ERROR([bibtex cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])]) + AC_CHECK_PROG([SPHINXBUILD], [sphinx-build], [sphinx-build], [AC_MSG_ERROR([sphinx-build cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])]) + 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.])]) fi -AM_CONDITIONAL([HAVE_BLAS], [test "$ax_blas_ok" = yes]) -AM_CONDITIONAL([HAVE_LAPACK], [test "$ax_lapack_ok" = yes]) -AC_CONFIG_FILES([Makefile - VERSION - doc/Makefile - doc/manual/Makefile - doc/manual/utils/version.py - doc/parallel/Makefile - doc/internals/Makefile - doc/gsa/Makefile - doc/dseries-and-reporting/Makefile - tests/Makefile - matlab/dynare_version.m - 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 - dynare++/tests/Makefile - mex/sources/Makefile -]) +# Check for BLAS, LAPACK and MATIO, needed by Dynare++ +if test "$enable_dynareplusplus" = yes; then + AC_PROG_F77 + AC_F77_LIBRARY_LDFLAGS + case ${host_os} in + *darwin*) + # * OS X doesn't need to link against the Fortran libraries because + # everything is contained within the vecLib framework. + FLIBS='' + ;; + esac + AX_BLAS + AX_LAPACK + AX_MATIO + if test "$ax_blas_ok" != yes -o "$ax_lapack_ok" != yes -o "$has_matio" != yes; then + AC_MSG_ERROR([Some dependencies of Dynare++ cannot be found. If you want to skip the compilation of Dynare++, pass the --disable-dynare++ flag.]) + fi +fi -AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation of MEX files for MATLAB]), [], [enable_matlab=yes]) +# Check for MATLAB if test "$enable_matlab" = yes; then AC_CONFIG_SUBDIRS([mex/build/matlab]) AX_MATLAB AX_MATLAB_BATCH_OPTIONS + if test "$ax_enable_matlab" != yes; then + AC_MSG_ERROR([MATLAB cannot be found. If you want to compile Dynare without MATLAB support, pass the --disable-matlab flag.]) + fi fi -AM_CONDITIONAL([ENABLE_MATLAB], [test "$enable_matlab" = yes]) -AM_CONDITIONAL([HAVE_MATLAB], [test "$ax_enable_matlab" = yes]) -AC_ARG_ENABLE([octave], AS_HELP_STRING([--disable-octave], [disable compilation of MEX files for Octave]), [], [enable_octave=yes]) +# Check for Octave if test "$enable_octave" = yes; then AC_CONFIG_SUBDIRS([mex/build/octave]) - AC_CHECK_PROG([OCTAVE], [octave], [octave]) + AC_CHECK_PROG([OCTAVE], [octave], [octave], [AC_MSG_ERROR([Octave cannot be found. If you want to compile Dynare without Octave support, pass the --disable-octave flag.])]) fi -AM_CONDITIONAL([ENABLE_OCTAVE], [test "$enable_octave" = yes]) -AM_CONDITIONAL([HAVE_OCTAVE], [test "$enable_octave" = yes -a -n "$OCTAVE"]) - -# 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 -n "$enable_org_export"]) # Construct final output message - -if test "$ax_blas_ok" = yes -a "$ax_lapack_ok" = yes -a "$has_matio" = yes; then +if test "$enable_dynareplusplus" = yes; then BUILD_DYNAREPLUSPLUS="yes" + TESTSUITE_DYNAREPLUSPLUS="yes" else - BUILD_DYNAREPLUSPLUS="no (missing one of: BLAS, LAPACK, MatIO)" -fi - -if test -n "$PDFLATEX" -a "$ax_latex_have_beamer" = yes; then - BUILD_BEAMER_DOC="yes" -else - BUILD_BEAMER_DOC="no (missing one of: pdflatex, beamer)" + BUILD_DYNAREPLUSPLUS="no" + TESTSUITE_DYNAREPLUSPLUS="no" fi -if test "x$PDFLATEX" != "x"; then - BUILD_OTHER_PDF_DOC="yes" +if test "$enable_doc" = yes; then + BUILD_DOC="yes" else - BUILD_OTHER_PDF_DOC="no (missing pdflatex)" + BUILD_DOC="no" fi if test -n "$enable_org_export"; then - BUILD_DYNARE_INTERNAL_DOC="yes" + BUILD_INTERNAL_DOC="yes" else - BUILD_DYNARE_INTERNAL_DOC="no (Org export not enabled)" + BUILD_INTERNAL_DOC="no" fi -if test -n "$SPHINXBUILD"; then - BUILD_DYNARE_HTML_MANUAL="yes" - BUILD_DYNARE_PDF_MANUAL="yes" +if test "$enable_matlab" = yes; then + TESTSUITE_MATLAB="yes" else - BUILD_DYNARE_HTML_MANUAL="no (missing sphinx-build)" - BUILD_DYNARE_PDF_MANUAL="no (missing sphinx-build)" + TESTSUITE_MATLAB="no" fi -if test -n "$OCTAVE"; then +if test "$enable_octave" = yes; then TESTSUITE_OCTAVE="yes" else TESTSUITE_OCTAVE="no" fi -if test "$ax_blas_ok" = yes -a "$ax_lapack_ok" = yes; then - TESTSUITE_DYNAREPLUSPLUS="yes" -else - TESTSUITE_DYNAREPLUSPLUS="no" -fi - AC_MSG_NOTICE([ Dynare is now configured for building the following components... @@ -214,18 +172,45 @@ 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 - Beamer presentations: $BUILD_BEAMER_DOC - Various other documents: $BUILD_OTHER_PDF_DOC - -HTML documentation (with "make html"): - Dynare reference manual: $BUILD_DYNARE_HTML_MANUAL - Dynare internal doc: $BUILD_DYNARE_INTERNAL_DOC +Documentation (with "make html pdf"): + Manual and other documents $BUILD_DOC + Dynare internal doc: $BUILD_INTERNAL_DOC Testsuites (run with "make check"): + Dynare for MATLAB: $TESTSUITE_MATLAB Dynare for Octave: $TESTSUITE_OCTAVE Dynare++: $TESTSUITE_DYNAREPLUSPLUS ]) +AC_CONFIG_FILES([Makefile + VERSION + doc/Makefile + doc/manual/Makefile + doc/manual/utils/version.py + doc/parallel/Makefile + doc/internals/Makefile + doc/gsa/Makefile + doc/dseries-and-reporting/Makefile + tests/Makefile + matlab/dynare_version.m + 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 + dynare++/tests/Makefile + mex/sources/Makefile +]) + AC_OUTPUT diff --git a/doc/Makefile.am b/doc/Makefile.am index 278fd4251875a74dc4583c351fb32aaa5593214b..f16874bbbb282f7cd98d3d60256c5660651831c6 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,20 +1,10 @@ SUBDIRS = parallel internals gsa dseries-and-reporting -if HAVE_SPHINXBUILD +if ENABLE_DOC SUBDIRS += manual +pdf-local: guide.pdf bvar-a-la-sims.pdf dr.pdf endif -PDF_TARGETS = - -if HAVE_PDFLATEX -PDF_TARGETS += guide.pdf bvar-a-la-sims.pdf -if HAVE_BIBTEX -PDF_TARGETS += dr.pdf -endif -endif - -pdf-local: $(PDF_TARGETS) - EXTRA_DIST = guide.tex guide.bbl bibmad.sty bvar-a-la-sims.tex dr.tex dr.bib dynare.plots guide.pdf: guide.tex guide.bbl bibmad.sty diff --git a/doc/dseries-and-reporting/Makefile.am b/doc/dseries-and-reporting/Makefile.am index 5d1ff915c19804bda7bdf5e905ca789ea9386ad1..809b9bbc2faa833abfa73ea5a7c8d10a344dbe92 100644 --- a/doc/dseries-and-reporting/Makefile.am +++ b/doc/dseries-and-reporting/Makefile.am @@ -1,8 +1,6 @@ -if HAVE_PDFLATEX -if HAVE_BEAMER +if ENABLE_DOC pdf-local: dseriesReporting.pdf endif -endif SRC = dseriesReporting.tex diff --git a/doc/gsa/Makefile.am b/doc/gsa/Makefile.am index 5e99bf96f37b08878f801588446e7cedd8f55f24..9a6c418f1d5915aa1e6130a10b4eba09ac8a6332 100644 --- a/doc/gsa/Makefile.am +++ b/doc/gsa/Makefile.am @@ -1,8 +1,6 @@ -if HAVE_PDFLATEX -if HAVE_BIBTEX +if ENABLE_DOC pdf-local: gsa.pdf endif -endif SRC = gsa.tex marco.bib diff --git a/doc/parallel/Makefile.am b/doc/parallel/Makefile.am index 0b1ef771e7437c6145060947034aed1eaab73dd9..9b5818fed7bcc36727ddd5fb7aebaecd0f7eb48d 100644 --- a/doc/parallel/Makefile.am +++ b/doc/parallel/Makefile.am @@ -1,8 +1,6 @@ -if HAVE_PDFLATEX -if HAVE_BIBTEX +if ENABLE_DOC pdf-local: parallel.pdf endif -endif SRC = AvenueParadigm.pdf iVaNo_gain.pdf iVaNo_time_comp.pdf marco.bib \ netbook_complete_comp.pdf netbook_complete_openclose.pdf \ diff --git a/dynare++/doc/Makefile.am b/dynare++/doc/Makefile.am index 3206bc011d4fc16454ad0230a6c9d5ae9dd18090..9d787d9b04db654e149f38f72da5645958001a86 100644 --- a/dynare++/doc/Makefile.am +++ b/dynare++/doc/Makefile.am @@ -6,7 +6,7 @@ EXTRA_DIST = \ changelog-old.html \ changelog-sylv-old.html -if HAVE_PDFLATEX +if ENABLE_DOC pdf-local: dynare++-ramsey.pdf dynare++-tutorial.pdf sylvester.pdf tl.pdf endif diff --git a/mex/build/matlab/Makefile.am b/mex/build/matlab/Makefile.am index 4fc41e759bd021e9844efdef42d42725ba656da5..a4aedc2c3386eb42b9e0b0f822f9b39c2e958e4a 100644 --- a/mex/build/matlab/Makefile.am +++ b/mex/build/matlab/Makefile.am @@ -1,18 +1,17 @@ ACLOCAL_AMFLAGS = -I ../../../m4 -if DO_SOMETHING SUBDIRS = mjdgges kronecker bytecode block_kalman_filter sobol local_state_space_iterations perfect_foresight_problem num_procs # libdynare++ must come before gensylv, k_order_perturbation, dynare_simul_ -if HAVE_MATIO +if ENABLE_MEX_DYNAREPLUSPLUS SUBDIRS += libdynare++ gensylv k_order_perturbation dynare_simul_ endif -if HAVE_GSL +if ENABLE_MEX_MS_SBVAR SUBDIRS += ms_sbvar endif -if HAVE_SLICOT +if ENABLE_MEX_KALMAN_STEADY_STATE SUBDIRS += kalman_steady_state endif @@ -31,6 +30,5 @@ endif install-exec-local: $(MKDIR_P) $(DESTDIR)$(pkglibdir)/mex/matlab -endif EXTRA_DIST = mex.def mexFunction-MacOSX.map diff --git a/mex/build/matlab/configure.ac b/mex/build/matlab/configure.ac index cc4c771b1442adf3affa8b6b306073dd85a35bcd..0fbb0b0e202a26f79739ea5f2c38165c01ec8d39 100644 --- a/mex/build/matlab/configure.ac +++ b/mex/build/matlab/configure.ac @@ -26,22 +26,17 @@ dnl The following must occur before we modify CFLAGS/CXXFLAGS AC_CANONICAL_HOST AX_MATLAB +AX_MATLAB_VERSION +AX_DOT_MEXEXT +AX_MATLAB_ARCH +AX_MEXOPTS -if test "$ax_enable_matlab" = yes; then - AX_MATLAB_VERSION - AX_DOT_MEXEXT - AX_MATLAB_ARCH - - if test "$ax_matlab_version_ok" = yes; then - AX_MEXOPTS - AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [7.9], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to version 7.9 (R2009b) at least.])]) - fi - - CFLAGS="$MATLAB_CFLAGS" - CXXFLAGS="$MATLAB_CXXFLAGS" - FFLAGS="$MATLAB_FFLAGS" +if test "$ax_enable_matlab" != yes -o "$ax_matlab_version_ok" != yes -o "$ax_mexopts_ok" != yes; then + AC_MSG_ERROR([MATLAB cannot be found]) fi +AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [7.9], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to version 7.9 (R2009b) at least (or disable MATLAB support with --disable-matlab).])]) + case ${host_os} in *cygwin*) AC_MSG_WARN([You are compiling for the Cygwin target. This means that the MEX files will]) @@ -50,9 +45,9 @@ case ${host_os} in ;; esac -CFLAGS="$CFLAGS -Wall -Wno-parentheses" -FFLAGS="$FFLAGS -Wall" -CXXFLAGS="$CXXFLAGS -Wall -Wno-parentheses -Wold-style-cast" +CFLAGS="$MATLAB_CFLAGS -Wall -Wno-parentheses" +FFLAGS="$MATLAB_FFLAGS -Wall" +CXXFLAGS="$MATLAB_CXXFLAGS -Wall -Wno-parentheses -Wold-style-cast" AC_PROG_F77([gfortran g77 f77]) AC_PROG_CC @@ -82,17 +77,40 @@ AX_CXX11_THREAD # Check for dlopen(), needed by k_order_perturbation DLL AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], []) AC_SUBST([LIBADD_DLOPEN]) -# Check for GSL, needed by MS-SBVAR -AX_GSL -AM_CONDITIONAL([HAVE_GSL], [test "$has_gsl" = yes]) + +# 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]) + +# Check for GSL, needed by MS-SBVAR MEX +if test "$enable_mex_ms_sbvar" = yes; then + AX_GSL + if test "$has_gsl" != yes; then + 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.]) + fi +fi # Check for libmatio, needed by MEX files using Dynare++ code -AX_MATIO -AM_CONDITIONAL([HAVE_MATIO], [test "$has_matio" = yes]) +if test "$enable_mex_dynareplusplus" = yes; then + AX_MATIO + if test "$has_matio" != yes; then + AC_MSG_ERROR([libmatio cannot be found. If you want to skip the compilation of MEX files based Dynare++, pass the --disable-mex-dynare++ flag.]) + fi +fi # Check for libslicot, needed by kalman_steady_state -AX_SLICOT([matlab]) -AM_CONDITIONAL([HAVE_SLICOT], [test "$has_slicot" = yes]) +if test "$enable_mex_kalman_steady_state" = yes; then + AX_SLICOT([matlab]) + if test "$has_slicot" != yes; then + 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.]) + fi +fi # On Windows, we want static linking of the external libraries case ${host_os} in @@ -103,48 +121,42 @@ case ${host_os} in ;; esac -AM_CONDITIONAL([DO_SOMETHING], [test "$ax_enable_matlab" = yes -a "$ax_matlab_version_ok" = yes -a "$ax_mexopts_ok" = yes]) - -if test "$ax_enable_matlab" = yes -a "$ax_matlab_version_ok" = yes -a "$ax_mexopts_ok" = yes; then - BUILD_MEX_MATLAB="yes" -else - BUILD_MEX_MATLAB="no (missing MATLAB, or unknown version, or unknown architecture)" -fi +# Support for M2HTML +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"]) -if test "$ax_enable_matlab" = yes -a "$has_matio" = yes; then +# Construct final output message +if test "$enable_mex_dynareplusplus" = yes; then BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_MATLAB="yes" else - BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_MATLAB="no (missing MatIO library)" + BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_MATLAB="no" fi -if test "$ax_enable_matlab" = yes -a "$ax_matlab_version_ok" = yes -a "$ax_mexopts_ok" = yes -a "$has_slicot" = yes; then +if test "$enable_mex_kalman_steady_state" = yes; then BUILD_KALMAN_STEADY_STATE_MATLAB="yes" else - BUILD_KALMAN_STEADY_STATE_MATLAB="no (missing SLICOT)" + BUILD_KALMAN_STEADY_STATE_MATLAB="no" fi -if test "$ax_enable_matlab" = yes -a "$ax_matlab_version_ok" = yes -a "$ax_mexopts_ok" = yes -a "$has_gsl" = yes; then +if test "$enable_mex_ms_sbvar" = yes; then BUILD_MS_SBVAR_MEX_MATLAB="yes" else - BUILD_MS_SBVAR_MEX_MATLAB="no (missing GSL)" + BUILD_MS_SBVAR_MEX_MATLAB="no" fi -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"]) - AC_MSG_NOTICE([ Dynare is now configured for building the following components... Binaries (with "make"): - MEX files for MATLAB (except those listed below): $BUILD_MEX_MATLAB + MEX files for MATLAB (except those listed below): yes Gensylv, k-order and dynare_simul MEX files for MATLAB: $BUILD_GENSYLV_KORDER_DYNSIMUL_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 diff --git a/mex/build/octave/Makefile.am b/mex/build/octave/Makefile.am index c982f9efa9ac1cdf2358edbce8b26989ebd5c8dd..09d85162d8addde2be0b42e47adb37f9b8f6da68 100644 --- a/mex/build/octave/Makefile.am +++ b/mex/build/octave/Makefile.am @@ -1,24 +1,19 @@ ACLOCAL_AMFLAGS = -I ../../../m4 -if DO_SOMETHING SUBDIRS = mjdgges kronecker bytecode block_kalman_filter sobol local_state_space_iterations perfect_foresight_problem num_procs # libdynare++ must come before gensylv, k_order_perturbation, dynare_simul_ -if HAVE_MATIO +if ENABLE_MEX_DYNAREPLUSPLUS SUBDIRS += libdynare++ gensylv k_order_perturbation dynare_simul_ endif -if HAVE_GSL -if HAVE_MATIO +if ENABLE_MEX_MS_SBVAR SUBDIRS += ms_sbvar endif -endif -if HAVE_SLICOT +if ENABLE_MEX_KALMAN_STEADY_STATE SUBDIRS += kalman_steady_state endif install-exec-local: $(MKDIR_P) $(DESTDIR)$(pkglibdir)/mex/octave - -endif diff --git a/mex/build/octave/configure.ac b/mex/build/octave/configure.ac index 1e14e5948cee7777dae5a363556af5c67f207ff4..fb914a7f16cbb38201f7c472334d98cd86e405a4 100644 --- a/mex/build/octave/configure.ac +++ b/mex/build/octave/configure.ac @@ -22,22 +22,17 @@ AC_INIT([dynare], [4.6-unstable]) AC_CONFIG_SRCDIR([configure.ac]) AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign]) -AC_CHECK_PROG([MKOCTFILE], [mkoctfile], [mkoctfile]) - -if test -n "$MKOCTFILE"; then - CC=$($MKOCTFILE -p CC) - CXX=$($MKOCTFILE -p CXX) - CFLAGS=$($MKOCTFILE -p CFLAGS) - FFLAGS=$($MKOCTFILE -p FFLAGS) - CXXFLAGS=$($MKOCTFILE -p CXXFLAGS) - LDFLAGS="$($MKOCTFILE -p LFLAGS) $($MKOCTFILE -p LDFLAGS)" - OCTAVE_VERSION=$($MKOCTFILE -v 2>&1 | sed 's/mkoctfile, version //') - AX_COMPARE_VERSION([$OCTAVE_VERSION], [lt], [4.2], [AC_MSG_ERROR([Your Octave is too old, please upgrade to version 4.2 at least.])]) -fi +AC_CHECK_PROG([MKOCTFILE], [mkoctfile], [mkoctfile], [AC_MSG_ERROR([Octave cannot be found])]) + +CC=$($MKOCTFILE -p CC) +CXX=$($MKOCTFILE -p CXX) +CFLAGS="$($MKOCTFILE -p CFLAGS) -Wall -Wno-parentheses" +FFLAGS="$($MKOCTFILE -p FFLAGS) -Wall" +CXXFLAGS="$($MKOCTFILE -p CXXFLAGS) -Wall -Wno-parentheses -Wold-style-cast" +LDFLAGS="$($MKOCTFILE -p LFLAGS) $($MKOCTFILE -p LDFLAGS)" -CFLAGS="$CFLAGS -Wall -Wno-parentheses" -FFLAGS="$FFLAGS -Wall" -CXXFLAGS="$CXXFLAGS -Wall -Wno-parentheses -Wold-style-cast" +OCTAVE_VERSION=$($MKOCTFILE -v 2>&1 | sed 's/mkoctfile, version //') +AX_COMPARE_VERSION([$OCTAVE_VERSION], [lt], [4.2], [AC_MSG_ERROR([Your Octave is too old, please upgrade to version 4.2 at least (or disable Octave support with --disable-octave).])]) AC_PROG_F77([gfortran g77 f77]) AC_PROG_CC @@ -54,46 +49,62 @@ AX_CXX11_THREAD # Check for dlopen(), needed by k_order_perturbation DLL AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], []) AC_SUBST([LIBADD_DLOPEN]) + +# 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]) + # Check for GSL, needed by MS-SBVAR -AX_GSL -AM_CONDITIONAL([HAVE_GSL], [test "$has_gsl" = yes]) +if test "$enable_mex_ms_sbvar" = yes; then + AX_GSL + if test "$has_gsl" != yes; then + 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.]) + fi +fi # 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) -AX_MATIO -AM_CONDITIONAL([HAVE_MATIO], [test "$has_matio" = yes]) +if test "$enable_mex_dynareplusplus" = yes -o "$enable_mex_ms_sbvar" = yes; then + AX_MATIO + if test "$has_matio" != yes; then + 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.]) + fi +fi # Check for libslicot, needed by kalman_steady_state -AX_SLICOT([octave]) -AM_CONDITIONAL([HAVE_SLICOT], [test "$has_slicot" = yes]) +if test "$enable_mex_kalman_steady_state" = yes; then + AX_SLICOT([octave]) + if test "$has_slicot" != yes; then + 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.]) + fi +fi # Check for UMFPACK, needed by bytecode AC_CHECK_LIB([umfpack], [umfpack_dl_defaults], [LIBADD_UMFPACK="-lumfpack"], [AC_MSG_ERROR([Can't find UMFPACK])]) AC_SUBST([LIBADD_UMFPACK]) -AM_CONDITIONAL([DO_SOMETHING], [test -n "$MKOCTFILE"]) - -if test -n "$MKOCTFILE"; then - BUILD_MEX_OCTAVE="yes" -else - BUILD_MEX_OCTAVE="no (missing mkoctfile)" -fi - -if test -n "$MKOCTFILE" -a "$has_matio" = yes; then - BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE="yes" +# Construct final output message +if test "$enable_mex_dynareplusplus" = yes; then + BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE="yes" else - BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE="no (missing MatIO library)" + BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE="no" fi -if test -n "$MKOCTFILE" -a "$has_slicot" = yes; then +if test "$enable_mex_kalman_steady_state" = yes; then BUILD_KALMAN_STEADY_STATE_OCTAVE="yes" else - BUILD_KALMAN_STEADY_STATE_OCTAVE="no (missing SLICOT)" + BUILD_KALMAN_STEADY_STATE_OCTAVE="no" fi -if test -n "$MKOCTFILE" -a "$has_gsl" = yes -a "$has_matio" = yes; then +if test "$enable_mex_ms_sbvar" = yes; then BUILD_MS_SBVAR_MEX_OCTAVE="yes" else - BUILD_MS_SBVAR_MEX_OCTAVE="no (missing GSL or MatIO library)" + BUILD_MS_SBVAR_MEX_OCTAVE="no" fi AC_MSG_NOTICE([ @@ -101,7 +112,7 @@ AC_MSG_NOTICE([ Dynare is now configured for building the following components... Binaries (with "make"): - MEX files for Octave (except those listed below): $BUILD_MEX_OCTAVE + MEX files for Octave (except those listed below): yes Gensylv, k-order and dynare_simul MEX for Octave: $BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE MS-SBVAR MEX files for Octave: $BUILD_MS_SBVAR_MEX_OCTAVE Kalman Steady State MEX file for Octave: $BUILD_KALMAN_STEADY_STATE_OCTAVE diff --git a/preprocessor b/preprocessor index a61565bd016d5d165550a4a37849c0ebf6fdd1aa..1ec3923a6b9075526a24947ae10dab25b9a0d5d4 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit a61565bd016d5d165550a4a37849c0ebf6fdd1aa +Subproject commit 1ec3923a6b9075526a24947ae10dab25b9a0d5d4 diff --git a/tests/Makefile.am b/tests/Makefile.am index 95bf5b5d137359eb0d6b43c3ccc64918cbc31161..2851280a8489cc22259ec745af653c6ab2fec395 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -881,11 +881,11 @@ EXTRA_DIST = \ deterministic_simulations/lola_data.mat -if HAVE_MATLAB +if ENABLE_MATLAB check-local: check-matlab endif -if HAVE_OCTAVE +if ENABLE_OCTAVE check-local: check-octave endif