On 2016-08-25, at 8:20 PM, Kevin Walzer wrote:
> On 8/25/16 10:02 PM, Ryan Schmidt wrote:
>> I just haven't researched whether one is supposed to use
>> MAC_OS_X_VERSION_MIN_REQUIRED or MAC_OS_X_VERSION_MAX_ALLOWED or
>> __MAC_OS_X_VERSION_MAX_ALLOWED or something else.
> Can someone try something like this:
>
> #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
>
> [do someStuff:here andHere];
>
> #endif
>
> and see if it builds on 10.6? If so, send me a patch and I'll test it on
> 10.11 and commit if it works. I have no access to 10.6.
>
> Thanks,
> Kevin
>
> --
> Kevin Walzer
> Code by Kevin/Mobile Code by Kevin
> http://www.codebykevin.com
> http://www.wtmobilesoftware.com
>
> ___
> macports-dev mailing list
> macports-dev@lists.macosforge.org
> https://lists.macosforge.org/mailman/listinfo/macports-dev
It looks like it works as expected. There are different ways to do the same
thing, but the easy-to-read, non-underscore version of these tests uses
rather than the newer but more complicated
, and worked like this:
Testing out the following code on snow leopard:
--
#include
#include
#define MY_CURRENT_OS MAC_OS_X_VERSION_MAX_ALLOWED
int main() {
printf("%d\n", MAC_OS_X_VERSION_MAX_ALLOWED);
printf("%d\n", MAC_OS_X_VERSION_MIN_REQUIRED);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
printf("This code will only be seen and compiled Lion or greater!\n");
// and more
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED == 1060
printf("This code is only seen and compiled on Snow Leopard\n");
// and more
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050
printf("This code is only seen and compiled on Leopard or Older\n");
// and more
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
printf("This MIN version specifies code that is only seen and compiled
on Snow Leopard or earlier\n");
// and more
#endif
return 0;
}
--
produces the following output:
KensMacBookPro:compiler tests cunningh$ clang test.c -o test
KensMacBookPro:compiler tests cunningh$ ./test
1060
1060
This code is only seen and compiled on Snow Leopard
This MIN version specifies code that is only seen and compiled on Snow Leopard
or earlier
___
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev