[R-SIG-Mac] Compling rgl for Mavericks

Simon Urbanek simon.urbanek at r-project.org
Tue Apr 29 16:50:31 CEST 2014


On Apr 26, 2014, at 2:50 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:

> The rgl package compiles and runs on Mavericks, though it only displays in X11 currently, and it gets a number of compile-time warnings like
> 
> glgui.cpp:50:5: warning: 'gluUnProject' is deprecated: first deprecated in OS X 10.9
>      - "Use GLKMathUnproject" [-Wdeprecated-declarations]
> 
> There are also warnings about gluProject, gluErrorString, and some others.
> 
> I can probably write conditional workarounds for each of these, but I have a very basic question:  how do I write a conditional to depend on an OS X version?  Do I need to write my own autoconf macro, or is there one available in the standard collection, or online somewhere?
> 

You can simply use conditionals MAC_OS_X_VERSION_MIN_REQUIRED and MAC_OS_X_VERSION_MAX_ALLOWED depending on what you want to achieve (lower bound allows weakly-linked symbols, so you have to check for their availability, upper bound defines what will be a hard error), .e.g to enable AppNap support in Mavericks buils we use

#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
#define USE_APPNAP_API
@property (strong) id  activity;
#endif

Note, however, that older SDKs don't have version numbers for more recent OS X version, so it's a good idea to provide fallbacks:

#import <Availability.h>
#ifndef MAC_OS_X_VERSION_10_9
#define MAC_OS_X_VERSION_10_9 1090
#endif

Cheers,
Simon



More information about the R-SIG-Mac mailing list