From d239ac39ced0c5cf247cd962c9d378170ee1bfa0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Thu, 22 Nov 2012 11:59:57 +0100
Subject: [PATCH] =?UTF-8?q?Still=20fixing=20the=20matio=20test=E2=80=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 m4/ax_matio.m4 | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/m4/ax_matio.m4 b/m4/ax_matio.m4
index 7b74d271d2..57d6907cf3 100644
--- a/m4/ax_matio.m4
+++ b/m4/ax_matio.m4
@@ -40,11 +40,13 @@ AC_ARG_WITH(matio, AC_HELP_STRING([--with-matio=DIR], [prefix to MATIO installat
   CPPFLAGS="$CPPFLAGS_MATIO $CPPFLAGS"
   LDFLAGS="$LDFLAGS_MATIO $LDFLAGS"
 
+  dnl Workaround for the matio from RHEL 6 + EPEL 6
+  dnl If detected, libz is added to LIBS, used for matio test
+  LIBS=""
+  AC_CHECK_LIB([z], [compress])
+
   AC_CHECK_HEADER([matio.h], [], [has_matio=no])
-  AC_CHECK_LIB([matio], [Mat_Open], [LIBADD_MATIO="-lmatio"], [
-    dnl Retest with libz explicitly added, as a workaround for the matio from RHEL 6 + EPEL 6
-    AC_CHECK_LIB([matio], [Mat_Open], [LIBADD_MATIO="-lmatio -lz"], [has_matio=no], [-lz])
-  ])
+  AC_CHECK_LIB([matio], [Mat_Open], [LIBADD_MATIO="-lmatio $LIBS"], [has_matio=no])
 
   CPPFLAGS="$ac_save_CPPFLAGS"
   LDFLAGS="$ac_save_LDFLAGS"
-- 
GitLab