From 95547b3d09773f0c21a503f1e86b9a75f1a39e8c Mon Sep 17 00:00:00 2001
From: sebastien <sebastien@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Wed, 2 Dec 2009 13:42:25 +0000
Subject: [PATCH] Build system: for MATLAB < 7.1, require that the user
 provides MEXEXT on the configure command line

git-svn-id: https://www.dynare.org/svn/dynare/trunk@3190 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 m4/ax_matlab_version.m4       | 1 -
 m4/ax_mexext.m4               | 3 +++
 mex/build/matlab/configure.ac | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/m4/ax_matlab_version.m4 b/m4/ax_matlab_version.m4
index 7d254f56c8..f82bad1ab8 100644
--- a/m4/ax_matlab_version.m4
+++ b/m4/ax_matlab_version.m4
@@ -18,7 +18,6 @@ dnl along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 AC_DEFUN([AX_MATLAB_VERSION],
 [dnl
 AC_REQUIRE([AX_MATLAB])
-AC_REQUIRE([AX_MATLAB_ARCH])
 
 AC_MSG_CHECKING([for MATLAB version])
 if test "x$MATLAB_VERSION" != "x"; then
diff --git a/m4/ax_mexext.m4 b/m4/ax_mexext.m4
index 9b4e51c8be..569a9c9a73 100644
--- a/m4/ax_mexext.m4
+++ b/m4/ax_mexext.m4
@@ -33,11 +33,14 @@ AC_DEFUN([AX_MEXEXT],
 [dnl
 AC_PREREQ([2.50])
 AC_REQUIRE([AX_MATLAB])
+AC_REQUIRE([AX_MATLAB_VERSION])
 AC_REQUIRE([AC_CANONICAL_BUILD])
 AC_CACHE_CHECK([for MEX-file suffix], [ax_cv_mexext],
 [if test "${MEXEXT+set}" = set ; then
     ax_cv_mexext="$MEXEXT"
 else
+    # The mexext script appeared in MATLAB 7.1
+    AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [7.1], [AC_MSG_ERROR([I can't determine the MEX file extension. Please explicitly indicate it to the configure script with the MEXEXT variable.])])
     case $build_os in
       *cygwin*)
         ax_cv_mexext=`$MATLAB/bin/mexext.bat | sed 's/\r//'`
diff --git a/mex/build/matlab/configure.ac b/mex/build/matlab/configure.ac
index e36adaaffd..e5d91e51c0 100644
--- a/mex/build/matlab/configure.ac
+++ b/mex/build/matlab/configure.ac
@@ -25,9 +25,9 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 AX_MATLAB
 
 if test "x$ax_enable_matlab" = "xyes"; then
+  AX_MATLAB_VERSION
   AX_DOT_MEXEXT
   AX_MATLAB_ARCH
-  AX_MATLAB_VERSION
 
   if test "x$ax_matlab_version_ok" = "xyes"; then
     AX_MEXOPTS
-- 
GitLab