[Top][All Lists]

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

bug#27810: macOS runtime feature detection

From: Alan Third
Subject: bug#27810: macOS runtime feature detection
Date: Wed, 26 Jul 2017 17:06:38 +0100
User-agent: Mutt/1.7.2 (2016-11-26)

On Tue, Jul 25, 2017 at 10:59:38PM -0400, Richard Stallman wrote:
> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>   > We should be able to build a single binary that can detect new OS
>   > features at runtime rather than depend on compile‐time macros.
> One reason to avoid doing it that way
> is for the sake of cross-compilation.

I’m afraid I don’t understand why it’s a problem for cross
compilation. At the moment we don’t even provide any way of building
Emacs on one version of macOS that is guaranteed to work on another
version of macOS, never mind cross‐compiling the NS port from another

For example, macOS 10.12 requires us to disable ‘tabbing mode’,
otherwise it causes problems with fullscreen. However, the way we do
that is incompatible with every previous version of macOS, and GNUstep
too. Currently we just wrap the code in a compile‐time version check,
but this means that to run Emacs on 10.12, it has to have been built
on 10.12, and an Emacs built on 10.12 cannot run on 10.11.

Objective C gives us a couple of ways of checking whether we can run
the code at runtime, though. For example we can check whether an
object has a particular method before calling it:

    if ([win respondsToSelector: @selector(setTabbingMode:)])
      [win setTabbingMode: NSWindowTabbingModeDisallowed];

This allows us to bypass the problem with having to build on the
target OS version.

I hope this explains what I’m trying to achieve.
Alan Third

reply via email to

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