Dynare 4.4.2 configure and MatIO

I have been unable to configure 4.4.2 with MatIO 1.5.2. I found that the library check failed because it did not load the hdf5 and z libraries in addition to matio. I modified the configure script as follows, but that is insufficient.

[root@seldon dynare-4.4.2.newconf]# diff configure configure.orig | ediff

-------- 1 line changed at 5770 from:
LIBS="-lmatio -lhdf5 -lz $LIBS"
-------- to:
LIBS="-lmatio $LIBS"

-------- 1 line changed at 5801 from:
LIBADD_MATIO="-lmatio -lhdf5 -lz $LIBS"
-------- to:
[root@seldon dynare-4.4.2.newconf]# diff configure.orig configure | ediff

-------- 1 line changed at 5770 from:
LIBS="-lmatio $LIBS"
-------- to:
LIBS="-lmatio -lhdf5 -lz $LIBS"

-------- 1 line changed at 5801 from:
-------- to:
LIBADD_MATIO="-lmatio -lhdf5 -lz $LIBS"

[root@seldon dynare-4.4.2.newconf]# module load matio
[root@seldon dynare-4.4.2.newconf]# pkg-config --libs matio
-L/sscc/opt/matio-1.5.2/lib -lmatio -lhdf5 -lz

[root@seldon dynare-4.4.2.newconf]# module show matio


module-whatis This module adds MatIO, the MAT File I/O Library version 1.5.2
prepend-path PATH /sscc/opt/matio-1.5.2/bin
prepend-path MANPATH /sscc/opt/matio-1.5.2/share/man
prepend-path LD_LIBRARY_PATH /sscc/opt/matio-1.5.2/lib
prepend-path PKG_CONFIG_PATH /sscc/opt/matio-1.5.2/lib/pkgconfig
prepend-path C_INCLUDE_PATH /sscc/opt/matio-1.5.2/include

Here’s the way I run configure:

[root@seldon dynare-4.4.2.newconf]# cat Configure



rm -f config.cache

source /sscc/opt/matlab.d/r2014a/zzGCC473.sh


module load texlive
export PDFLATEX=/sscc/opt/texlive/2014/bin/x86_64-linux/pdflatex

source /sscc/opt/boost.1.42.0/bin/Boost

export PATH={BIN}:{PATH}
export LD_LIBRARY_PATH={LIB}:/opt/acml4.4.0/gfortran64/lib:{LD_LIBRARY_PATH}

export BLAS_LIBS="-L/opt/acml4.4.0/gfortran64/lib -lacml -lacml_mv"

module load matio

LIBS="-L/opt/acml4.4.0/gfortran64/lib -lacml -lacml_mv -L/sscc/opt/matio-1.5.2/lib -lmatio -lhdf5 -lz"
CFLAGS="-O3" CXXFLAGS="-O3" F77=gfortran
./configure --prefix=/sscc/opt/dynare-{NUVERSION} \ --with-boost=/sscc/opt/boost.1.42.0 \ --with-boost-libdir=/sscc/opt/boost.1.42.0/lib \ --with-blas="-lacml -lacml_mv"\ --with-matlab=/sscc/opt/matlab.{MATLABLOC} MATLAB_VERSION=${MATLABVER}
2>&1 | tee NUInstall.configure

The configuration summary:


Dynare is now configured for building the following components…

Binaries (with “make”):
MEX files for MATLAB (except those listed below): yes
k-order and dynare_simul MEX files for MATLAB: no (missing MatIO library)
MS-SBVAR MEX files for MATLAB: yes
Kalman Steady State MEX file for MATLAB: no (missing SLICOT)
M2HTML documentation: no

I have attached config.log and the output of running the Configure script.

Your assistance is appreciated!

NUInstall.configure.txt (11.6 KB)
config.log.txt (248 KB)

What OS are you compiling on?

Did you compile matio yourself or did you get it from your package manager?

Is the directory that contains the shared libraries libz and libhdf5 in your directory path?

You sent the top level config.log but you need to send the config.log from mex/build/matlab

OS: # cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)

MatIO was built by me from source. That’s why its location is non-standard. It is installed in NFS for cluster-wide consistency.

The libz and libhdf5 directories are in the system directory path. They come from Red Hat.



I looked at the config.log in mex/build/matlab and found that the configure script in that directory was NOT LOADING hdf5. I didn’t know that script existed, and did not change it. The config.log file is attached under the name mex.config.log.txt which shows the error.

I modified mex/build/matlab/configure to load hdf5 with matio and that solved my problem.

mex.config.log.txt (46.6 KB)


Could you drop the attached file into the dynare/m4 directory, rename it to ax_matio.m4, undo the changes you made to mex/build/matlab/configure.ac, then do autoreconf -si and configure with your matlab arguments? Does that work?
ax_matio.m4.txt (1.75 KB)

That new file worked perfectly. I did get autoreconf errors:

[root@seldon dynare-4.4.2]# autoreconf -si
configure.ac:58: warning: macro AM_PROG_AR' not found in library configure.ac:62: warning: macroAM_PROG_AR’ not found in library
configure.ac:62: error: possibly undefined macro: AM_PROG_AR
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

I ignored those errors and ran the configuration script with success.


I should add that the need for hdf5 and zlib are MATIO optional dependencies. zlib supports compressed MAT files, and HDF5 supports MAT file version 7.3. So these are not Red Hat / Fedora issues, they are really dependent on the release of MATLAB people are using.

The dependencies are explained in the MATIO README file.


It’s dependent on how you chose to compile matio (with libhdf5 and and libz support). They’re not dependent on the version of Matlab you intend to use but, rather, the type of .mat file you want to create (a compressed older .mat file needs libz and a newer .mat file needs libhdf5). But, all versions of Matlab read the uncompressed/older versions of .mat files, so support for these two libraries is not necessary.

What version of autoconf do you have on your system? That m4 file should not have resulted in an error. To make sure you didn’t run the stale configure file, delete mex/matlab/configure, then run autoreconf -si and your configure statement again.

I chose to compile matio with the hdf5 and libz support because I have absolutely no control over what people will try to do with it. They are probably unaware of their options when they save files.

The choice was simple … support as much as possible and avoid grief down the line.

I used a fresh extraction of the tar distribution, so there were no stale files involved.

$ autoreconf --version
autoreconf (GNU Autoconf) 2.63
Copyright © 2008 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.


What I’m saying is that it will make no difference to the user. As long as s/he has the file that works on all versions of matlab (the default, with out libz and libhdf5 support), s/he will not need another file. The only thing it would change is the file size.

Anyway, your autoconf version is out of date as it was released in 2008. To get rid of the errors, you’d need to update to the latest version, 2.69, released in 2012 and your problem should go away. See ftp.gnu.org/gnu/autoconf/. But, given that you’re working from the tar ball and not the git repository, you don’t need to run autoreconf -si as the configure script comes with the source tar ball.