2012-09-18 17:14:02 +02:00
|
|
|
dnl Detect the MATIO Library.
|
|
|
|
dnl
|
2023-03-20 15:19:12 +01:00
|
|
|
dnl Copyright © 2012-2023 Dynare Team
|
2012-09-18 17:14:02 +02:00
|
|
|
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
|
2021-06-09 17:33:48 +02:00
|
|
|
dnl along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
2012-09-18 17:14:02 +02:00
|
|
|
|
|
|
|
AC_DEFUN([AX_MATIO],
|
|
|
|
[
|
2021-09-28 17:28:49 +02:00
|
|
|
AC_ARG_WITH(matio, AS_HELP_STRING([--with-matio=DIR], [prefix to MATIO installation]),
|
2012-09-18 17:14:02 +02:00
|
|
|
matio_prefix="$withval", matio_prefix="")
|
|
|
|
|
2023-03-20 15:19:12 +01:00
|
|
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
|
|
|
|
2012-09-18 17:14:02 +02:00
|
|
|
has_matio=yes
|
|
|
|
|
2019-03-25 16:14:36 +01:00
|
|
|
if test -n "$matio_prefix"; then
|
2012-09-20 07:50:04 +02:00
|
|
|
CPPFLAGS_MATIO="-I$withval/include"
|
2012-09-18 17:14:02 +02:00
|
|
|
LDFLAGS_MATIO="-L$withval/lib"
|
|
|
|
else
|
2012-09-20 07:50:04 +02:00
|
|
|
CPPFLAGS_MATIO=""
|
2012-09-18 17:14:02 +02:00
|
|
|
LDFLAGS_MATIO=""
|
|
|
|
fi
|
|
|
|
|
2012-09-20 07:50:04 +02:00
|
|
|
ac_save_CPPFLAGS="$CPPFLAGS"
|
2012-09-18 17:14:02 +02:00
|
|
|
ac_save_LDFLAGS="$LDFLAGS"
|
2012-09-20 07:51:17 +02:00
|
|
|
ac_save_LIBS="$LIBS"
|
2012-09-18 17:14:02 +02:00
|
|
|
|
|
|
|
LIBADD_MATIO=""
|
2012-09-20 07:50:04 +02:00
|
|
|
CPPFLAGS="$CPPFLAGS_MATIO $CPPFLAGS"
|
2012-09-18 17:14:02 +02:00
|
|
|
LDFLAGS="$LDFLAGS_MATIO $LDFLAGS"
|
|
|
|
|
2023-03-20 15:19:12 +01:00
|
|
|
dnl Under Windows and macOS, add hdf5 and its dependencies since we are linking statically
|
|
|
|
case ${host_os} in
|
|
|
|
*mingw32*)
|
|
|
|
dnl Partly inspired by /mingw64/lib/pkgconfig/{hdf5,libcurl}.pc (in particular for the system libraries)
|
|
|
|
LIBS="-lhdf5 -lcurl -lnghttp2 -lidn2 -lssh2 -lpsl -lunistring -liconv -lbcrypt -ladvapi32 -lcrypt32 -lbcrypt -lgdi32 -lwldap32 -lzstd -lbrotlidec -lbrotlicommon -lssl -lcrypto -lws2_32 -lz -lsz"
|
|
|
|
;;
|
|
|
|
*darwin*)
|
|
|
|
LIBS="-lhdf5 -lz -lsz"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
LIBS=""
|
|
|
|
;;
|
|
|
|
esac
|
2012-11-22 11:59:57 +01:00
|
|
|
|
2012-09-18 17:14:02 +02:00
|
|
|
AC_CHECK_HEADER([matio.h], [], [has_matio=no])
|
2012-11-22 11:59:57 +01:00
|
|
|
AC_CHECK_LIB([matio], [Mat_Open], [LIBADD_MATIO="-lmatio $LIBS"], [has_matio=no])
|
2012-09-18 17:14:02 +02:00
|
|
|
|
2012-09-20 07:50:04 +02:00
|
|
|
CPPFLAGS="$ac_save_CPPFLAGS"
|
2012-09-18 17:14:02 +02:00
|
|
|
LDFLAGS="$ac_save_LDFLAGS"
|
|
|
|
LIBS="$ac_save_LIBS"
|
|
|
|
|
2012-09-20 07:50:04 +02:00
|
|
|
AC_SUBST(CPPFLAGS_MATIO)
|
2012-09-18 17:14:02 +02:00
|
|
|
AC_SUBST(LIBADD_MATIO)
|
|
|
|
AC_SUBST(LDFLAGS_MATIO)
|
|
|
|
])
|