How to detect Mac OS X version using C preprocessor?

925 views Asked by At

I want my C code to be compiled successfully on different versions of Mac OS X. One problem I have is before OS X Yosemite I need to #include <vecLib/clapack.h> to make lapack work. However, vecLib can't be founded on later versions.

How can I detect the version of Mac OS X and then include the header I have depending on the system?

1

There are 1 answers

2
TheNextman On BEST ANSWER
include <Availability.h>

#ifdef __MAC_OS_X_VERSION_MAX_ALLOWED
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101000
    #include <vecLib/clapack.h>
#endif
#endif