Commit 4f271781 authored by sebastien's avatar sebastien
Browse files

Build system:

* updated autoconf tests for MATLAB, to make them work with recent versions of MATLAB
* added autoconf test for Dynare++ source tree
* incorporated these tests in the configure script


git-svn-id: https://www.dynare.org/svn/dynare/trunk@2815 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 27a884f9
......@@ -29,7 +29,8 @@ srctarball $(TARBASENAME).tar.gz: distclean
tar cvzf ../$(TARBASENAME).tar.gz --transform 's,^\./,$(TARBASENAME)/,' --exclude='*~' --exclude-vcs .
.PHONY: srctarball
configure: configure.ac
configure: configure.ac m4/matlab.m4 m4/matlabarch.m4 m4/matlabver.m4 m4/mex.m4 m4/mexext.m4 m4/mexopt.m4
aclocal -I m4
autoconf
Makefile: Makefile.in config.status
......
# generated automatically by aclocal 1.11 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_include([m4/dynarepp.m4])
m4_include([m4/matlab.m4])
m4_include([m4/matlabarch.m4])
m4_include([m4/mex.m4])
m4_include([m4/mexext.m4])
m4_include([m4/mexopt.m4])
......@@ -637,6 +637,15 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
LIBOBJS
DYNAREPP
MATLAB_ARCH
MEXEXT
MEXLDADD
MEXFLAGS
MEX
MEXOPTS
mexopts_sh
MATLAB
OCTAVE
XSLTPROC
DBLATEX
......@@ -702,6 +711,9 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
with_matlab
with_mex_options
with_dynarepp
'
ac_precious_vars='build_alias
host_alias
......@@ -1334,6 +1346,13 @@ if test -n "$ac_init_help"; then
esac
cat <<\_ACEOF
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-matlab=ARG check for Matlab [yes]
--with-mex-options=ARG use MEX options file ARG [standard]
--with-dynarepp=ARG path to Dynare++ [yes]
Some influential environment variables:
CXX C++ compiler command
CXXFLAGS C++ compiler flags
......@@ -3994,6 +4013,332 @@ fi
ax_enable_matlab=
# Check whether --with-matlab was given.
if test "${with_matlab+set}" = set; then
withval=$with_matlab; case $withval in
yes | no)
# Explicitly enable or disable Matlab but determine
# Matlab prefix automatically.
ax_enable_matlab=$withval
;;
*)
# Enable Matlab and use ARG as the Matlab prefix.
# ARG must be an existing directory.
ax_enable_matlab=yes
MATLAB=`cd "${withval-/}" > /dev/null 2>&1 && pwd`
if test -z "$MATLAB" ; then
{ { $as_echo "$as_me:$LINENO: error: invalid value '$withval' for --with-matlab" >&5
$as_echo "$as_me: error: invalid value '$withval' for --with-matlab" >&2;}
{ (exit 1); exit 1; }; }
fi
;;
esac
fi
{ $as_echo "$as_me:$LINENO: checking for Matlab prefix" >&5
$as_echo_n "checking for Matlab prefix... " >&6; }
if test "${ax_cv_matlab+set}" = set; then
$as_echo_n "(cached) " >&6
else
if test "${MATLAB+set}" = set ; then
ax_cv_matlab=`cd "${MATLAB-/}" > /dev/null 2>&1 && pwd`
else
ax_cv_matlab=
IFS=${IFS= } ; ax_ifs=$IFS ; IFS=:
for ax_dir in ${PATH-/opt/bin:/usr/local/bin:/usr/bin:/bin} ; do
if test -z "$ax_dir" ; then
ax_dir=.
fi
if test -x "$ax_dir/matlab" ; then
ax_dir=`echo "$ax_dir" | sed 's,/bin$,,'`
# Directory sanity check.
ax_cv_matlab=`cd "${ax_dir-/}" > /dev/null 2>&1 && pwd`
if test -n "$ax_cv_matlab" ; then
break
fi
fi
done
IFS=$ax_ifs
fi
if test -z "$ax_cv_matlab" ; then
ax_cv_matlab="not found"
fi
fi
{ $as_echo "$as_me:$LINENO: result: $ax_cv_matlab" >&5
$as_echo "$ax_cv_matlab" >&6; }
if test "$ax_cv_matlab" = "not found" ; then
unset MATLAB
else
# Strip trailing dashes.
MATLAB=`echo "$ax_cv_matlab" | sed 's,/*$,,'`
fi
{ $as_echo "$as_me:$LINENO: checking whether to enable Matlab support" >&5
$as_echo_n "checking whether to enable Matlab support... " >&6; }
if test x$ax_enable_matlab != xno ; then
if test "${MATLAB+set}" = set && test -d "$MATLAB/extern/include" ; then
ax_enable_matlab=yes
elif test x$ax_enable_matlab = x ; then
ax_enable_matlab=no
else
# Fail if Matlab was explicitly enabled.
{ $as_echo "$as_me:$LINENO: result: failure" >&5
$as_echo "failure" >&6; }
{ { $as_echo "$as_me:$LINENO: error: check your Matlab setup" >&5
$as_echo "$as_me: error: check your Matlab setup" >&2;}
{ (exit 1); exit 1; }; }
fi
fi
{ $as_echo "$as_me:$LINENO: result: $ax_enable_matlab" >&5
$as_echo "$ax_enable_matlab" >&6; }
if test x$ax_enable_matlab = xyes ; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_MATLAB 1
_ACEOF
fi
if test "$ax_enable_matlab" = "yes"
then
mex_options=yes
# Check whether --with-mex-options was given.
if test "${with_mex_options+set}" = set; then
withval=$with_mex_options; mex_options=$withval
fi
{ $as_echo "$as_me:$LINENO: checking for MEX options file handling" >&5
$as_echo_n "checking for MEX options file handling... " >&6; }
case $mex_options in
yes)
{ $as_echo "$as_me:$LINENO: result: standard" >&5
$as_echo "standard" >&6; }
mexopts_sh=
;;
no)
{ $as_echo "$as_me:$LINENO: result: disabled" >&5
$as_echo "disabled" >&6; }
mexopts_sh=$ac_aux_dir/noopts.sh
;;
*)
{ $as_echo "$as_me:$LINENO: result: enabled" >&5
$as_echo "enabled" >&6; }
mexopts_sh=$mex_options
;;
esac
if test -n "$mexopts_sh" ; then
{ $as_echo "$as_me:$LINENO: checking whether MEX options file exists" >&5
$as_echo_n "checking whether MEX options file exists... " >&6; }
if test -f "$mexopts_sh" ; then
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
# Canonicalize file name.
mexopts_sh_dir=`echo "$mexopts_sh" | sed 's,[^/]*$,,'`
mexopts_sh_dir=`cd "${mexopts_sh_dir-.}" && pwd`
mexopts_sh_name=`echo "$mexopts_sh" | sed 's,.*/,,'`
mexopts_sh="$mexopts_sh_dir/$mexopts_sh_name"
else
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:$LINENO: error: $mexopts_sh: no such file" >&5
$as_echo "$as_me: error: $mexopts_sh: no such file" >&2;}
{ (exit 1); exit 1; }; }
fi
MEXOPTS="-f $mexopts_sh"
else
MEXOPTS=
fi
if test "${MEX+set}" != set ; then
case $host_os in
*cygwin* | *mingw32*)
ax_list='mextool mex mex.bat'
;;
*)
ax_list='mex'
;;
esac
for ac_prog in $ax_list
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if test "${ac_cv_path_MEX+set}" = set; then
$as_echo_n "(cached) " >&6
else
case $MEX in
[\\/]* | ?:[\\/]*)
ac_cv_path_MEX="$MEX" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_dummy="$MATLAB/bin:$PATH"
for as_dir in $as_dummy
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_MEX="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
MEX=$ac_cv_path_MEX
if test -n "$MEX"; then
{ $as_echo "$as_me:$LINENO: result: $MEX" >&5
$as_echo "$MEX" >&6; }
else
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$MEX" && break
done
test -n "$MEX" || MEX="mex"
fi
if test "${MEXFLAGS+set}" != set ; then
MEXFLAGS=-O
fi
if test "${MEXLDADD+set}" != set ; then
MEXLDADD=
fi
{ $as_echo "$as_me:$LINENO: checking for MEX-file suffix" >&5
$as_echo_n "checking for MEX-file suffix... " >&6; }
if test "${ax_cv_mexext+set}" = set; then
$as_echo_n "(cached) " >&6
else
if test "${MEXEXT+set}" = set ; then
ax_cv_mexext="$MEXEXT"
else
case $host_os in
*cygwin* | *mingw32*)
ax_cv_mexext=`$MATLAB/bin/mexext.bat | sed 's/\r//'`
;;
*)
ax_cv_mexext=`$MATLAB/bin/mexext`
;;
esac
fi
fi
{ $as_echo "$as_me:$LINENO: result: $ax_cv_mexext" >&5
$as_echo "$ax_cv_mexext" >&6; }
MEXEXT="$ax_cv_mexext"
{ $as_echo "$as_me:$LINENO: checking for Matlab machine architecture" >&5
$as_echo_n "checking for Matlab machine architecture... " >&6; }
if test "${ax_cv_matlab_arch+set}" = set; then
$as_echo_n "(cached) " >&6
else
if test "${MATLAB_ARCH+set}" = set ; then
ax_cv_matlab_arch="$MATLAB_ARCH"
else
case $MEXEXT in
dll)
ax_cv_matlab_arch=win32
;;
mexw32)
ax_cv_matlab_arch=win32
;;
mexw64)
ax_cv_matlab_arch=win64
;;
mexglx)
ax_cv_matlab_arch=glnx86
;;
mexa64)
ax_cv_matlab_arch=glnxa64
;;
*)
ax_cv_matlab_arch=unknown
;;
esac
fi
fi
{ $as_echo "$as_me:$LINENO: result: $ax_cv_matlab_arch" >&5
$as_echo "$ax_cv_matlab_arch" >&6; }
MATLAB_ARCH="$ax_cv_matlab_arch"
fi
ax_enable_dynarepp=
# Check whether --with-dynarepp was given.
if test "${with_dynarepp+set}" = set; then
withval=$with_dynarepp; case $withval in
no)
# Explicitly enable or disable Dynare++ but determine
# Matlab prefix automatically.
ax_enable_dynarepp=no
;;
*)
# Enable Dynare++ and use ARG as the Dynare++ prefix.
# ARG must be an existing directory.
ax_enable_dynarepp=yes
DYNAREPP=`cd "${withval-/}" > /dev/null 2>&1 && pwd`
if test -z "$DYNAREPP" ; then
{ { $as_echo "$as_me:$LINENO: error: invalid value '$withval' for --with-dynarepp" >&5
$as_echo "$as_me: error: invalid value '$withval' for --with-dynarepp" >&2;}
{ (exit 1); exit 1; }; }
fi
;;
esac
fi
{ $as_echo "$as_me:$LINENO: checking for Dynare++" >&5
$as_echo_n "checking for Dynare++... " >&6; }
if test x$ax_enable_dynarepp != xno ; then
if test "${DYNAREPP+set}" = set && test -d "$DYNAREPP/kord" ; then
ax_enable_dynarepp=yes
elif test x$ax_enable_dynarepp = x ; then
ax_enable_dynarepp=no
else
# Fail if Matlab was explicitly enabled.
{ $as_echo "$as_me:$LINENO: result: failure" >&5
$as_echo "failure" >&6; }
{ { $as_echo "$as_me:$LINENO: error: check your Dynare++ setup" >&5
$as_echo "$as_me: error: check your Dynare++ setup" >&2;}
{ (exit 1); exit 1; }; }
fi
fi
{ $as_echo "$as_me:$LINENO: result: $ax_enable_dynarepp" >&5
$as_echo "$ax_enable_dynarepp" >&6; }
ac_config_files="$ac_config_files Makefile preprocessor/Makefile doc/Makefile doc/preprocessor/Makefile doc/macroprocessor/Makefile doc/userguide/Makefile tests/Makefile matlab/dynare_version.m windows/dynare-version.nsi"
......
# Process this file with autoconf to produce a configure script.
dnl Process this file with autoconf to produce a configure script.
dnl Copyright (C) 2009 Dynare Team
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.63])
AC_INIT([dynare], [4.1-unstable])
......@@ -63,6 +80,17 @@ fi
AC_CHECK_PROG([OCTAVE], [octave], [octave])
AX_MATLAB
if test "$ax_enable_matlab" = "yes"
then
AX_PATH_MEX
AX_MEXEXT
AX_MATLAB_ARCH
fi
AX_DYNAREPP
AC_CONFIG_FILES([Makefile
preprocessor/Makefile
doc/Makefile
......
dnl dynarepp.m4 --- check for Dynare++
dnl
dnl Copyright (C) 2009 Dynare Team
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/>.
dnl
dnl Code:
# AX_DYNAREPP
# ---------
# Check for Dynare++.
AC_DEFUN([AX_DYNAREPP],
[dnl
AC_PREREQ([2.63])
ax_enable_dynarepp=
AC_ARG_WITH([dynarepp], AC_HELP_STRING([--with-dynarepp=ARG], [path to Dynare++ [[yes]]]),
[case $withval in
no)
# Explicitly enable or disable Dynare++ but determine
# Matlab prefix automatically.
ax_enable_dynarepp=no
;;
*)
# Enable Dynare++ and use ARG as the Dynare++ prefix.
# ARG must be an existing directory.
ax_enable_dynarepp=yes
DYNAREPP=`cd "${withval-/}" > /dev/null 2>&1 && pwd`
if test -z "$DYNAREPP" ; then
AC_MSG_ERROR([invalid value '$withval' for --with-dynarepp])
fi
;;
esac])
AC_MSG_CHECKING([for Dynare++])
if test x$ax_enable_dynarepp != xno ; then
if test "${DYNAREPP+set}" = set && test -d "$DYNAREPP/kord" ; then
ax_enable_dynarepp=yes
elif test x$ax_enable_dynarepp = x ; then
ax_enable_dynarepp=no
else
# Fail if Matlab was explicitly enabled.
AC_MSG_RESULT([failure])
AC_MSG_ERROR([check your Dynare++ setup])
fi
fi
AC_MSG_RESULT([$ax_enable_dynarepp])
AC_SUBST([DYNAREPP])
])
dnl dynarepp.m4 ends here
dnl Local variables:
dnl tab-width: 8
dnl End:
......@@ -121,3 +121,7 @@ AM_CONDITIONAL([MATLAB], [test x$ax_enable_matlab = xyes])
])
dnl matlab.m4 ends here
dnl Local variables:
dnl tab-width: 8
dnl End:
dnl matlabarch.m4 --- check for Matlab machine architecture.
dnl
dnl Copyright (C) 2002, 2003 Ralph Schleicher
dnl Copyright (C) 2009 Dynare Team
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License as
......@@ -40,29 +41,17 @@ else
dll)
ax_cv_matlab_arch=win32
;;
mex)
ax_cv_matlab_arch=mac
mexw32)
ax_cv_matlab_arch=win32
;;
mexaxp)
ax_cv_matlab_arch=alpha
mexw64)
ax_cv_matlab_arch=win64
;;
mexglx)
ax_cv_matlab_arch=glnx86
;;
mexhp7)
ax_cv_matlab_arch=hp700
;;
mexhpux)
ax_cv_matlab_arch=hpux
;;
mexrs6)
ax_cv_matlab_arch=ibm_rs
;;
mexsg)
ax_cv_matlab_arch=sgi
;;
mexsol)
ax_cv_matlab_arch=sol2
mexa64)
ax_cv_matlab_arch=glnxa64
;;
*)
ax_cv_matlab_arch=unknown
......@@ -74,3 +63,7 @@ AC_SUBST([MATLAB_ARCH])
])
dnl matlabarch.m4 ends here
dnl Local variables:
dnl tab-width: 8
dnl End:
......@@ -131,3 +131,7 @@ fi])
])
dnl matlabver.m4 ends here
dnl Local variables:
dnl tab-width: 8
dnl End:
......@@ -57,3 +57,7 @@ AC_SUBST([MEXLDADD])
])
dnl mex.m4 ends here
dnl Local variables:
dnl tab-width: 8
dnl End:
dnl mexext.m4 --- check for MEX-file suffix.
dnl
dnl Copyright (C) 2000--2003 Ralph Schleicher
dnl Copyright (C) 2009 Dynare Team
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License as
......@@ -31,35 +32,20 @@ dnl Code:
AC_DEFUN([AX_MEXEXT],
[dnl
AC_PREREQ([2.50])
AC_REQUIRE([AX_PATH_MEX])
AC_REQUIRE([AX_MATLAB])
AC_REQUIRE([AC_CANONICAL_HOST])
AC_CACHE_CHECK([for MEX-file suffix], [ax_cv_mexext],
[if test "${MEXEXT+set}" = set ; then
ax_cv_mexext="$MEXEXT"
else
echo 'mexFunction () {}' > ax_c_test.c
$MEX $MEXOPTS $MEXFLAGS -output ax_c_test ax_c_test.c $MEXLDADD 2> /dev/null 1>&2
if test -f ax_c_test.dll ; then
ax_cv_mexext=dll
elif test -f ax_c_test.mex ; then
ax_cv_mexext=mex
elif test -f ax_c_test.mexaxp ; then
ax_cv_mexext=mexaxp
elif test -f ax_c_test.mexglx ; then
ax_cv_mexext=mexglx
elif test -f ax_c_test.mexhp7 ; then
ax_cv_mexext=mexhp7
elif test -f ax_c_test.mexhpux ; then
ax_cv_mexext=mexhpux
elif test -f ax_c_test.mexrs6 ; then
ax_cv_mexext=mexrs6
elif test -f ax_c_test.mexsg ; then
ax_cv_mexext=mexsg
elif test -f ax_c_test.mexsol ; then
ax_cv_mexext=mexsol
else
ax_cv_mexext=unknown
fi
rm -f ax_c_test*
case $host_os in
*cygwin* | *mingw32*)
ax_cv_mexext=`$MATLAB/bin/mexext.bat | sed 's/\r//'`
;;
*)
ax_cv_mexext=`$MATLAB/bin/mexext`
;;
esac
fi])