Paul Eggert wrote:
> It is relatively easy to support O_DIRECTORY on platforms that
> lack it, so let’s do that instead of having to work around bugs
> like <https://bugs.gnu.org/78509#95>.

Nice. Let me update the platforms list:
  - The configure test reports
      checking for working fcntl.h... no (bad O_NOATIME)
    on Mac OS X 10.5 and AIX 7.1 (cfarm111.cfarm.net).
  - Cygwin 1.5.x did not have it, see
    https://cygwin.com/cygwin-ug-net/ov-new.html


2025-05-27  Bruno Haible  <br...@clisp.org>

        fcntl-h: Update platforms list re O_DIRECTORY.
        * doc/posix-headers/fcntl.texi: Update platforms list.
        * doc/posix-functions/open.texi: Likewise.
        * doc/posix-functions/openat.texi: Likewise.
        * m4/fcntl-o.m4 (gl_FCNTL_O_FLAGS): Guess that O_DIRECTORY works for
        Mac OS X >= 10.5. Use prefix 'gl_', not 'ac_', for our variables.

diff --git a/doc/posix-functions/open.texi b/doc/posix-functions/open.texi
index 1f10f30ca9..26bb757646 100644
--- a/doc/posix-functions/open.texi
+++ b/doc/posix-functions/open.texi
@@ -16,8 +16,7 @@
 Mac OS X 10.6, FreeBSD 8.4, NetBSD 5.1, OpenBSD 4.9, Minix 3.1.8, AIX 7.1, 
HP-UX 11, Solaris 10, Cygwin 1.7.x, mingw, MSVC 14.
 @item
 Some platforms do not support @code{O_DIRECTORY}:
-mingw, MSVC 14, glibc 2.0, OS X 10.9, FreeBSD 7.4, NetBSD 4.0.1, OpenBSD 4.9,
-AIX 7.1, HP-UX 11, Solaris 10.
+glibc 2.0, Mac OS X 10.4, FreeBSD 7.4, NetBSD 4.0.1, OpenBSD 4.9, HP-UX 11, 
Solaris 10, Cygwin 1.5.x, mingw, MSVC 14.
 @item
 On platforms where @code{off_t} is a 32-bit type, @code{open} may not work
 correctly with files 2 GiB and larger.  @xref{Large File Support}.
diff --git a/doc/posix-functions/openat.texi b/doc/posix-functions/openat.texi
index 5c114dfe6d..8e39853629 100644
--- a/doc/posix-functions/openat.texi
+++ b/doc/posix-functions/openat.texi
@@ -19,8 +19,7 @@
 AIX 7.1, Solaris 10.
 @item
 Some platforms do not support @code{O_DIRECTORY}:
-mingw, MSVC 14, glibc 2.0, OS X 10.9, FreeBSD 7.4, NetBSD 4.0.1, OpenBSD 4.9,
-AIX 7.1, HP-UX 11, Solaris 10.
+glibc 2.0, Mac OS X 10.4, FreeBSD 7.4, NetBSD 4.0.1, OpenBSD 4.9, HP-UX 11, 
Solaris 10, Cygwin 1.5.x, mingw, MSVC 14.
 @item
 On platforms where @code{off_t} is a 32-bit type, @code{open} may not work
 correctly with files 2 GiB and larger.  @xref{Large File Support}.
diff --git a/doc/posix-headers/fcntl.texi b/doc/posix-headers/fcntl.texi
index 22e791b5a8..d3ead0d310 100644
--- a/doc/posix-headers/fcntl.texi
+++ b/doc/posix-headers/fcntl.texi
@@ -93,8 +93,7 @@
 
 @item
 @samp{O_DIRECTORY} is not defined on some platforms:
-mingw, MSVC 14, glibc 2.0, OS X 10.9, FreeBSD 7.4, NetBSD 4.0.1, OpenBSD 4.9,
-AIX 7.1, HP-UX 11, Solaris 10.
+glibc 2.0, Mac OS X 10.4, FreeBSD 7.4, NetBSD 4.0.1, OpenBSD 4.9, HP-UX 11, 
Solaris 10, Cygwin 1.5.x, mingw, MSVC 14.
 
 @item
 @samp{FD_CLOEXEC}, @samp{F_DUPFD}, and @samp{F_GETFD} are not defined
diff --git a/m4/fcntl-o.m4 b/m4/fcntl-o.m4
index 2f0faebdd1..9c19b582f8 100644
--- a/m4/fcntl-o.m4
+++ b/m4/fcntl-o.m4
@@ -1,5 +1,5 @@
 # fcntl-o.m4
-# serial 9
+# serial 10
 dnl Copyright (C) 2006, 2009-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -140,10 +140,9 @@ AC_DEFUN([gl_FCNTL_O_FLAGS]
        [AS_CASE([$host_os,$gl_cross_guess_normal],
           # The O_DIRECTORY test is known to fail on Mac OS X 10.4.11 (2007)
           # (see <https://bugs.gnu.org/78509#95>)
-          # and to succeed on macOS 12.6 [darwin21.6.0] (2021).
-          # For now, guess it fails on macOS 12.5 and earlier.
-          [darwin[[0-9]].*yes | darwin1[[0-9]]*.*yes | darwin20.*yes | \
-           darwin21.[[0-5]].*yes],
+          # and to succeed on Mac OS X 10.5.8 [darwin9.8.0] (2009).
+          # Guess it fails on Mac OS X 10.4.x and earlier.
+          [darwin[[0-8]].*yes],
              [gl_cv_header_working_fcntl_h="guessing no (bad O_DIRECTORY)"],
           # Known to be "no" on native MS-Windows.
           [mingw* | windows*],
@@ -151,17 +150,17 @@ AC_DEFUN([gl_FCNTL_O_FLAGS]
           [gl_cv_header_working_fcntl_h=$gl_cross_guess_normal])])])
 
   AS_CASE([$gl_cv_header_working_fcntl_h],
-    [*O_DIRECTORY* | *no], [ac_val=0], [ac_val=1])
-  AC_DEFINE_UNQUOTED([HAVE_WORKING_O_DIRECTORY], [$ac_val],
+    [*O_DIRECTORY* | *no], [gl_val=0], [gl_val=1])
+  AC_DEFINE_UNQUOTED([HAVE_WORKING_O_DIRECTORY], [$gl_val],
     [Define to 1 if O_DIRECTORY works, 0 otherwise.])
 
   AS_CASE([$gl_cv_header_working_fcntl_h],
-    [*O_NOATIME* | *no], [ac_val=0], [ac_val=1])
-  AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
+    [*O_NOATIME* | *no], [gl_val=0], [gl_val=1])
+  AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$gl_val],
     [Define to 1 if O_NOATIME works, 0 otherwise.])
 
   AS_CASE([$gl_cv_header_working_fcntl_h],
-    [*O_NOFOLLOW* | *no], [ac_val=0], [ac_val=1])
-  AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
+    [*O_NOFOLLOW* | *no], [gl_val=0], [gl_val=1])
+  AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$gl_val],
     [Define to 1 if O_NOFOLLOW works, 0 otherwise.])
 ])




Reply via email to