diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2011-11-03 04:37:51 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2011-11-03 04:37:51 +0000 |
commit | aa72cd89981f7e63a383580c9599d6233f188661 (patch) | |
tree | 9e45bba3902fce561c34bb0937d3640a70b57213 /smc.c | |
parent | 1b82a2c209290f7a8d395de89b04c9f6c5674d56 (diff) |
use Gestalt for runtime Mac OS X version detection, and let this build on < 10.5
svn path=/trunk/externals/apple/; revision=15695
Diffstat (limited to 'smc.c')
-rw-r--r-- | smc.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -31,6 +31,7 @@ #include <string.h> #include <ctype.h> #include <IOKit/IOKitLib.h> +#include <CoreServices/CoreServices.h> #include "m_pd.h" #include "smc.h" @@ -167,9 +168,11 @@ kern_return_t SMCCall(int index, SMCKeyData_t *inputStructure, SMCKeyData_t *out structureOutputSize = sizeof(SMCKeyData_t); #if !defined(__LP64__) // Check if Mac OS X 10.5 API is available... - if (IOConnectCallStructMethod != NULL) { + SInt32 MacVersion; + if ((Gestalt(gestaltSystemVersion, &MacVersion) == noErr) && (MacVersion >= 0x1050)) { // ...and use it if it is. #endif +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER return IOConnectCallStructMethod( conn, // an io_connect_t returned from IOServiceOpen(). index, // selector of the function to be called via the user client. @@ -178,6 +181,7 @@ kern_return_t SMCCall(int index, SMCKeyData_t *inputStructure, SMCKeyData_t *out outputStructure, // pointer to the output struct parameter. &structureOutputSize// pointer to the size of the output structure parameter. ); +#endif #if !defined(__LP64__) } else { |