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

3
dnl Copyright (C) 2009-2010 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])
21
AC_INIT([dynare], [4.2-unstable])
22 23 24 25 26 27 28 29 30
AC_CONFIG_SRCDIR([configure.ac])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

AC_CHECK_PROG([MKOCTFILE], [mkoctfile], [mkoctfile])

if test "x$MKOCTFILE" != "x"; then
  CC=`$MKOCTFILE -p CC`
  CXX=`$MKOCTFILE -p CXX`
  CFLAGS=`$MKOCTFILE -p CFLAGS`
31
  FFLAGS=`$MKOCTFILE -p FFLAGS`
32 33 34
  CXXFLAGS=`$MKOCTFILE -p CXXFLAGS`
fi

35
CFLAGS="$CFLAGS -Wall"
36
FFLAGS="$FFLAGS -Wall"
37 38
CXXFLAGS="$CXXFLAGS -Wall"

39
AC_PROG_F77
40
AM_CONDITIONAL([HAVE_FORT], [test "x$F77" != "x"])
41 42
AC_PROG_CC
AC_PROG_CXX
sebastien's avatar
sebastien committed
43
AC_PROG_RANLIB
44
AX_PROG_LN_S
45
AC_PROG_MKDIR_P
46
AX_PTHREAD
47 48 49 50 51 52 53 54 55
# Check for boost libraries used in estimation DLL
AC_LANG_PUSH([C++])
AX_BOOST_BASE([1.34])
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++])
56
# Check for dlopen(), needed by k_order_perturbation DLL
57 58
AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
AC_SUBST([LIBADD_DLOPEN])
59
# Check for GSL, needed by SWZ
60 61
AX_GSL
AM_CONDITIONAL([HAVE_GSL], [test "x$has_gsl" = "xyes"])
62

63 64 65 66 67 68
# Check for libmatio, needed by estimation DLL (only under Octave, as an alternative to MATLAB's libmat)
AC_CHECK_HEADER([matio.h])
AC_CHECK_LIB([matio], [Mat_Open], [LIBADD_MATIO="-lmatio"])
AC_SUBST([LIBADD_MATIO])
AM_CONDITIONAL([HAVE_MATIO], [test "x$ac_cv_header_matio_h" = "xyes" -a "x$ac_cv_lib_matio_Mat_Open" = "xyes"])

69 70 71 72 73 74 75 76 77 78 79 80
AM_CONDITIONAL([DO_SOMETHING], [test "x$MKOCTFILE" != "x"])

if test "x$MKOCTFILE" != "x"; then
  if test x"$ax_pthread_ok" = "xyes"; then
     BUILD_MEX_OCTAVE="yes"
  else
     BUILD_MEX_OCTAVE="yes (without POSIX threads)"
  fi
else
  BUILD_MEX_OCTAVE="no (missing mkoctfile)"
fi

81
if test "x$MKOCTFILE" != "x" -a "x$has_gsl" = "xyes"; then
82 83 84 85 86
   BUILD_SWZ_MEX_OCTAVE="yes"
else
   BUILD_SWZ_MEX_OCTAVE="no (missing GSL)"
fi

87 88 89 90 91 92
if test "x$MKOCTFILE" != "x" -a "x$ac_cv_header_matio_h" = "xyes" -a "x$ac_cv_lib_matio_Mat_Open" = "xyes"; then
  BUILD_ESTIMATION_MEX_OCTAVE="yes"
else
  BUILD_ESTIMATION_MEX_OCTAVE="no (missing MatIO library)"
fi

93
if  test "x$MKOCTFILE" != "x" -a "x$F77" != "x"; then
94
   BUILD_KALMAN_STEADY_STATE_OCTAVE="yes"
95
else
96
   BUILD_KALMAN_STEADY_STATE_OCTAVE="no (missing Fortran Compiler for compilation of libslicot)"
97 98
fi

Sébastien Villemot's avatar
Sébastien Villemot committed
99 100 101 102 103 104 105
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
])
106

107 108 109 110 111
AC_MSG_NOTICE([

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

Binaries (with "make"):
112 113 114 115
 MEX files for Octave (except SWZ and Kalman Steady State):     $BUILD_MEX_OCTAVE
 SWZ MEX files for Octave:                                      $BUILD_SWZ_MEX_OCTAVE
 Kalman Steady State MEX file for Octave:                       $BUILD_KALMAN_STEADY_STATE_OCTAVE
 Estimation MEX for Octave:                                     $BUILD_ESTIMATION_MEX_OCTAVE
116 117 118 119 120 121 122

])

AC_CONFIG_FILES([Makefile
                 mjdgges/Makefile
                 kronecker/Makefile
                 bytecode/Makefile
sebastien's avatar
sebastien committed
123 124 125
                 libdynare++/Makefile
                 gensylv/Makefile
                 k_order_perturbation/Makefile
126
                 dynare_simul_/Makefile
127
                 swz/Makefile
128
                 logposterior/Makefile
129
                 logMHMCMCposterior/Makefile
130
                 qzcomplex/Makefile
131
                 ordschur/Makefile
132 133
		 libslicot/Makefile
		 kalman_steady_state/Makefile])
134 135

AC_OUTPUT