Paul Eggert wrote:
> I came up with the attached Gnulib patch but did not install it as I am no 
> macOS expert. Comments would be welcome.

Oops, I had not seen your second mail on this topic, when I installed an
identical patch to yours. Sorry. Now, let me at least fix the attribution
in the ChangeLog.

> In <https://bugs.gnu.org/81846> Jacob Faibussowitsch reported problems with 
> pipe2 when he built GNU Emacs with a macOS 27 development kit but ran on 
> macOS 26.

Yes, the patch is correct. The reporter states:

pipe2.c:57:22: warning: 'pipe2' is only available on macOS 27.0 or newer 
[-Wunguarded-availability-new]
   57 |         int result = pipe2 (fd, flags);
      |                      ^~~~~

and that setting HAVE_PIPE2 to 0 fixes the problem. This matches our comments
in m4/gnulib-common.m4:

dnl When code is compiled on macOS, it is in the context of a certain minimum
dnl macOS version, that can be set through the option '-mmacosx-version-min='.
dnl In other words, you don't compile for a specific version of macOS. You
dnl compile for all versions of macOS, onwards from the given version.
dnl Thus, the question "does the OS have the function func" has three possible
dnl answers:
dnl   - yes, in all versions starting from the given version,
dnl   - no, in no version,
dnl   - not in the given version, but in a later version of macOS.
...
dnl This macro sets two variables:
dnl   - gl_cv_onwards_func_<func>   to yes / no / "future OS version"
dnl   - ac_cv_func_<func>           to yes / no / no
dnl The first variable allows distinguishing all three cases.
dnl The second variable is set, so that an invocation
dnl   gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]])
dnl can be used as a drop-in replacement for
dnl   AC_CHECK_FUNCS([func]).

Bruno




Reply via email to