From 4bc13ec71b77e585bccbf9f103f92bf8a34f9045 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 5 Feb 2006 21:53:37 +0000 Subject: [PATCH] From David Guthrie, OSX marco reworking to better handling different OSX versions. --- include/osg/Math | 13 +++++++++---- src/osgDB/DynamicLibrary.cpp | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/include/osg/Math b/include/osg/Math index cd7074e68..a31a784ea 100644 --- a/include/osg/Math +++ b/include/osg/Math @@ -16,10 +16,15 @@ #include -// for OSX users : -// comment in if you want backwards compatibility with 10.1.x versions -// otherwise you'll have problems with missing floorf and __isnan*() -// #define APPLE_PRE_10_2 + +//certain math functions were not defined until 10.2 +//so this code checks the version so it can add in workarounds for older versions. +#ifdef __APPLE__ +#include +#if !defined(MAC_OS_X_VERSION_10_2) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2) +#define APPLE_PRE_10_2 +#endif +#endif #if defined(_MSC_VER) #include diff --git a/src/osgDB/DynamicLibrary.cpp b/src/osgDB/DynamicLibrary.cpp index 6bfad164e..6e29a2c67 100644 --- a/src/osgDB/DynamicLibrary.cpp +++ b/src/osgDB/DynamicLibrary.cpp @@ -10,11 +10,20 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ + +//The dlopen calls were not adding to OS X until 10.3 +#ifdef __APPLE__ +#include +#if !defined(MAC_OS_X_VERSION_10_3) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3) +#define APPLE_PRE_10_3 +#endif +#endif + #if defined(WIN32) && !defined(__CYGWIN__) #include #include #include -#elif defined(__APPLE__) +#elif defined(__APPLE__) && defined(APPLE_PRE_10_3) #include #else // all other unix #include @@ -51,7 +60,7 @@ DynamicLibrary::~DynamicLibrary() osg::notify(osg::INFO)<<"Closing DynamicLibrary "<<_name<(_handle), FALSE); #elif defined(__hpux__) // fortunately, shl_t is a pointer @@ -85,7 +94,7 @@ DynamicLibrary::HANDLE DynamicLibrary::getLibraryHandle( const std::string& libr #if defined(WIN32) && !defined(__CYGWIN__) handle = LoadLibrary( libraryName.c_str() ); -#elif defined(__APPLE__) +#elif defined(__APPLE__) && defined(APPLE_PRE_10_3) NSObjectFileImage image; // NSModule os_handle = NULL; if (NSCreateObjectFileImageFromFile(libraryName.c_str(), &image) == NSObjectFileImageSuccess) { @@ -119,7 +128,7 @@ DynamicLibrary::PROC_ADDRESS DynamicLibrary::getProcAddress(const std::string& p #if defined(WIN32) && !defined(__CYGWIN__) return (DynamicLibrary::PROC_ADDRESS)GetProcAddress( (HMODULE)_handle, procName.c_str() ); -#elif defined(__APPLE__) +#elif defined(__APPLE__) && defined(APPLE_PRE_10_3) std::string temp("_"); NSSymbol symbol; temp += procName; // Mac OS X prepends an underscore on function names