From 7925cc0d63f09ae7016ed5a7945a3bf286ede86f Mon Sep 17 00:00:00 2001
From: sebastien <sebastien@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Fri, 11 Dec 2009 15:34:47 +0000
Subject: [PATCH] preprocessor: fixed USE_DLL under Linux and add a provision
 for MacOS (need to be tested)

git-svn-id: https://www.dynare.org/svn/dynare/trunk@3226 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 preprocessor/ModFile.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/preprocessor/ModFile.cc b/preprocessor/ModFile.cc
index eca9e5ae1d..0695a53703 100644
--- a/preprocessor/ModFile.cc
+++ b/preprocessor/ModFile.cc
@@ -320,7 +320,11 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all
 	  exit(EXIT_FAILURE);
 	}
 #else
-      mOutputFile << "    eval('mex -O LDFLAGS=\"-pthread -shared -Wl,--no-undefined\" " << basename << "_dynamic.c')" << endl; // MATLAB/Linux|Mac
+# ifdef __linux__
+      mOutputFile << "    eval('mex -O LDFLAGS=''-pthread -shared -Wl,--no-undefined'' " << basename << "_dynamic.c')" << endl; // MATLAB/Linux
+# else // MacOS
+      mOutputFile << "    eval('mex -O LDFLAGS=''-Wl,-twolevel_namespace -undefined error -arch \\$ARCHS -Wl,-syslibroot,\\$SDKROOT -mmacosx-version-min=\\$MACOSX_DEPLOYMENT_TARGET -bundle'' " << basename << "_dynamic.c')" << endl; // MATLAB/MacOS
+# endif
 #endif
       mOutputFile << "else" << endl
 		  << "    mex "  << basename << "_dynamic.c" << endl // Octave
-- 
GitLab