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

3
dnl Copyright (C) 2009-2017 Dynare Team
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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/>.

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([configure.ac])
23
AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign])
24
25
26
27
28
29
30

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
  CXXFLAGS=`$MKOCTFILE -p CXXFLAGS`
33
  LDFLAGS="`$MKOCTFILE -p LFLAGS` `$MKOCTFILE -p LDFLAGS`"
34
35
  OCTAVE_VERSION=`$MKOCTFILE -v 2>&1 | sed 's/mkoctfile, version //'`
  AX_COMPARE_VERSION([$OCTAVE_VERSION], [lt], [3.6], [AC_MSG_ERROR([Your Octave is too old, please upgrade to version 3.6 at least.])])
36
37
fi

38
CFLAGS="$CFLAGS -Wall -Wno-parentheses"
39
FFLAGS="$FFLAGS -Wall"
40
CXXFLAGS="$CXXFLAGS -Wall -Wno-parentheses"
41

42
AC_PROG_F77([gfortran g77 f77])
43
AC_PROG_CC
44
AC_PROG_CC_C99 # mjdgges DLL now uses C99 features (variable declared in for loop)
45
AC_PROG_CXX
sebastien's avatar
sebastien committed
46
AC_PROG_RANLIB
47
AX_PROG_LN_S
48
AC_PROG_MKDIR_P
49
AM_PROG_AR
50
AX_PTHREAD
51
# Check for dlopen(), needed by k_order_perturbation DLL
52
53
AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
AC_SUBST([LIBADD_DLOPEN])
54
# Check for GSL, needed by MS-SBVAR
55
56
AX_GSL
AM_CONDITIONAL([HAVE_GSL], [test "x$has_gsl" = "xyes"])
57

58
# Check for libmatio, needed by k-order, dynare_simul, ms-sbvar (only under Octave, as an alternative to MATLAB's libmat)
59
60
AX_MATIO
AM_CONDITIONAL([HAVE_MATIO], [test "x$has_matio" = "xyes"])
61

62
# Check for libslicot, needed by kalman_steady_state
63
64
AX_SLICOT([octave])
AM_CONDITIONAL([HAVE_SLICOT], [test "x$has_slicot" = "xyes"])
65

66
# Check for UMFPACK, needed by bytecode
67
AC_CHECK_LIB([umfpack], [umfpack_dl_defaults], [LIBADD_UMFPACK="-lumfpack"], [AC_MSG_ERROR([Can't find UMFPACK])])
68
69
70
71
72
73
74
# For OS X, explicitly add libraries that libumfpack depends on as Homebrew
# doesn't support the creation of shared libraries for suite-sparse 3.7.0
case ${host_os} in
  darwin*)
    LIBADD_UMFPACK="-lumfpack -lcholmod -lcolamd -lamd"
    ;;
esac
75
AC_SUBST([LIBADD_UMFPACK])
76

77
78
79
80
81
82
83
84
85
86
87
88
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

89
if test "x$MKOCTFILE" != "x" -a "x$has_matio" = "xyes"; then
90
  BUILD_KORDER_DYNSIMUL_MEX_OCTAVE="yes"
91
else
92
  BUILD_KORDER_DYNSIMUL_MEX_OCTAVE="no (missing MatIO library)"
93
94
fi

95
if  test "x$MKOCTFILE" != "x" -a "x$has_slicot" = "xyes"; then
96
   BUILD_KALMAN_STEADY_STATE_OCTAVE="yes"
97
else
98
   BUILD_KALMAN_STEADY_STATE_OCTAVE="no (missing SLICOT)"
99
100
fi

101
if test "x$MKOCTFILE" != "x" -a "x$has_gsl" = "xyes" -a "x$has_matio" = "xyes"; then
102
103
   BUILD_MS_SBVAR_MEX_OCTAVE="yes"
else
104
   BUILD_MS_SBVAR_MEX_OCTAVE="no (missing GSL or MatIO library)"
105
106
fi

Sébastien Villemot's avatar
Sébastien Villemot committed
107
108
109
110
111
112
113
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
])
114

115
116
117
118
119
AC_MSG_NOTICE([

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

Binaries (with "make"):
120
 MEX files for Octave (except those listed below):                   $BUILD_MEX_OCTAVE
121
122
 MS-SBVAR MEX files for Octave:                                      $BUILD_MS_SBVAR_MEX_OCTAVE
 Kalman Steady State MEX file for Octave:                            $BUILD_KALMAN_STEADY_STATE_OCTAVE
123
 K-order and dynare_simul MEX for Octave:                            $BUILD_KORDER_DYNSIMUL_MEX_OCTAVE
124
125
126
127
128
129
130

])

AC_CONFIG_FILES([Makefile
                 mjdgges/Makefile
                 kronecker/Makefile
                 bytecode/Makefile
sebastien's avatar
sebastien committed
131
132
133
                 libdynare++/Makefile
                 gensylv/Makefile
                 k_order_perturbation/Makefile
134
                 dynare_simul_/Makefile
135
                 qzcomplex/Makefile
136
                 kalman_steady_state/Makefile
137
                 ms_sbvar/Makefile
138
                 block_kalman_filter/Makefile
139
		 sobol/Makefile
140
		 local_state_space_iterations/Makefile])
141
142

AC_OUTPUT