Commit f63015c4 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

build system: add MATLAB_MEX_* flags to allow user to override default mex...

build system: add MATLAB_MEX_* flags to allow user to override default mex compilation flags in the call to the configure script, #1121
parent 3dc02055
......@@ -114,10 +114,15 @@ Alternatively, you can disable the compilation of MEX files for MATLAB with the
You may need to specify additional options to the configure script, see the platform specific instructions below.
Note that if you don't want to compile with debugging information, you can specify the `CFLAGS` and `CXXFLAGS` variables to configure, such as:
Note that if you don't want to compile the C/C++ programs with debugging information, you can specify the `CFLAGS` and `CXXFLAGS` variables to the configure script, such as:
```
./configure CFLAGS="-O3" CXXFLAGS="-O3"
```
To remove debugging information for Matlab mex functions, the analagous call would be:
```
./configure MATLAB_MEX_CFLAGS="-O3" MATLAB_MEX_CXXFLAGS="-O3"
```
If you want to give a try to the parallelized versions of some mex files (`A_times_B_kronecker_C` and `sparse_hessian_times_B_kronecker_C` used to get the reduced form of the second order approximation of the model) you can add the `--enable-openmp` flag, for instance:
```
./configure --with-matlab=/usr/local/matlab78 MATLAB_VERSION=7.8 --enable-openmp
......
......@@ -98,6 +98,32 @@ else
AC_MSG_RESULT([unknown])
fi
# Allow user to override default Matlab compilation flags
# Github ticket #1121
if test "x$MATLAB_MEX_CPPFLAGS" != "x"; then
MATLAB_CPPFLAGS="$MATLAB_CPPFLAGS $MATLAB_MEX_CPPFLAGS"
fi
if test "x$MATLAB_MEX_DEFS" != "x"; then
MATLAB_DEFS="$MATLAB_DEFS $MATLAB_MEX_DEFS"
fi
if test "x$MATLAB_MEX_CFLAGS" != "x"; then
MATLAB_CFLAGS="$MATLAB_CFLAGS $MATLAB_MEX_CFLAGS"
fi
if test "x$MATLAB_MEX_CXXFLAGS" != "x"; then
MATLAB_CXXFLAGS="$MATLAB_CXXFLAGS $MATLAB_MEX_CXXFLAGS"
fi
if test "x$MATLAB_MEX_LDFLAGS" != "x"; then
MATLAB_LDFLAGS="$MATLAB_LDFLAGS $MATLAB_MEX_LDFLAGS"
fi
if test "x$MATLAB_MEX_LIBS" != "x"; then
MATLAB_LIBS="$MATLAB_LIBS $MATLAB_MEX_LIBS"
fi
AC_SUBST([MATLAB_CPPFLAGS])
AC_SUBST([MATLAB_DEFS])
AC_SUBST([MATLAB_CFLAGS])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment