bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#27810: NS runtime feature detection


From: Anders Lindgren
Subject: bug#27810: NS runtime feature detection
Date: Tue, 1 Aug 2017 17:38:03 +0200

It's always a good idea to enable warnings when undefined preprocessor symbols are used. In gcc this is -Wundef and I gess it's the same in clang.

    -- Anders

On Mon, Jul 31, 2017 at 9:05 PM, Charles A. Roelli <charles@aurox.ch> wrote:
Shouldn't MIN_ALLOWED be MIN_REQUIRED?  As in here:

+#if defined (NS_IMPL_COCOA) \
+  && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+#if MAC_OS_X_VERSION_MIN_ALLOWED < MAC_OS_X_VERSION_10_7

There are a few more places that have a MIN_ALLOWED thing.  This
always trips me up, so I'm not sure.

And also, it's apparently feasible to do a runtime check for a
specific macOS, according to this:

https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/cross_development/Using/using.html#//apple_ref/doc/uid/20002000-SW7

which mentions APPKIT_EXTERN double NSAppKitVersionNumber.  I'm not
sure if they still define this on Sierra, though.  But if they do,
then we can use this to fix the nsmenu.m problem.



On 26/07/2017 23:57, Alan Third wrote:
On Mon, Jul 24, 2017 at 09:44:04PM +0100, Alan Third wrote:
I'm confused why the macro call you wrote doesn't prevent this. But
when I change it to #if MAC_OS_X_VERSION_MIN_ALLOWED <=
MAC_OS_X_VERSION_10_6, then it compiles.  This min/max stuff always
confuses me...
I’m unclear where we should be using MIN_REQUIRED vs MAX_ALLOWED, but
I think we’re OK with MAX everywhere for what we’re doing. I’ve just
used MAX in both my new macros.
I think I finally worked it out by reading macfont.m. I’ve attached
YET ANOTHER version of this which doesn't use any custom macros.

To compile for multiple versions you do something like:

./configure --with-ns CFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=1070 -DMAC_OS_X_VERSION_MAX_ALLOWED=101200 -g -O3"

By default max and min are set to the version you’re running on,
afaict. Please be aware that 10.6 isn’t fully compatible with this at
the moment, as there is at least one place (nsmenu.m:535) where
there’s a bug fix for it that I can’t see an immediate way of making
dynamic.

Additionally the native fullscreen stuff is based on a simple check
against MAX. I expect I’ll be able to fix that with a bit of work,
though.

I’d be interested to see if this builds on systems lower than 10.10
with the above configure command. There are probably bits and pieces
I’ve not quite got right.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]