From 11dc0707c3d2bab43a7330b7cd5081cc32a92ba4 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
---
 ModFile.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ModFile.cc b/ModFile.cc
index eca9e5ae..0695a537 100644
--- a/ModFile.cc
+++ b/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