]> Savannah Git Hosting - gnulib.git/commitdiff
Resolve conflicts for functions introduced in Android API level 34.
authorBruno Haible <bruno@clisp.org>
Thu, 25 Jan 2024 23:18:55 +0000 (00:18 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 31 Jan 2024 16:54:15 +0000 (17:54 +0100)
* m4/copy-file-range.m4 (gl_FUNC_COPY_FILE_RANGE): On platforms without
glibc, test for copy_file_range using gl_CHECK_FUNCS_ANDROID instead of
AC_CHECK_FUNCS_ONCE. Conditionally set REPLACE_COPY_FILE_RANGE.
* doc/glibc-functions/copy_file_range.texi: Mention the Android API
levels.

ChangeLog
doc/glibc-functions/copy_file_range.texi
m4/copy-file-range.m4

index da4bce70310dc51bfd26ac99353c7e0ca88e56f0..ec68ae525e63779602bfd0d91223e44639b90f59 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,12 @@
 
        Resolve conflicts for functions introduced in Android API level 34.
 
+       * m4/copy-file-range.m4 (gl_FUNC_COPY_FILE_RANGE): On platforms without
+       glibc, test for copy_file_range using gl_CHECK_FUNCS_ANDROID instead of
+       AC_CHECK_FUNCS_ONCE. Conditionally set REPLACE_COPY_FILE_RANGE.
+       * doc/glibc-functions/copy_file_range.texi: Mention the Android API
+       levels.
+
        * m4/posix_spawn.m4 (gl_POSIX_SPAWN_BODY): Test for
        posix_spawn_file_actions_addchdir_np and
        posix_spawn_file_actions_addfchdir_np using gl_CHECK_FUNCS_ANDROID
index f10271c1574d5a7598becd0a8b5e2a7d50c02ffa..979a3ffd696dd1cbeb0617bd438d973036a34f32 100644 (file)
@@ -21,8 +21,8 @@ Portability problems fixed by Gnulib:
 @itemize
 @item
 This function exists only on Linux and FreeBSD and is therefore
-missing on many non-glibc platforms:
-glibc 2.26, macOS 11.1, FreeBSD 12.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.
+missing on many platforms:
+glibc 2.26, macOS 11.1, FreeBSD 12.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android API level 33.
 But the replacement function is only a stub: It always fails with error ENOSYS.
 
 @item
index e91985495109ea1e2740ccaa98d5d6d58728ecc2..443e598ba55e895645add2d93cd6b12fb018e72e 100644 (file)
@@ -1,4 +1,4 @@
-# copy-file-range.m4
+# copy-file-range.m4 serial 5
 dnl Copyright 2019-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -17,22 +17,33 @@ AC_DEFUN([gl_FUNC_COPY_FILE_RANGE],
   dnl Programs that use copy_file_range must fall back on read+write
   dnl anyway, and there's little point to substituting the Gnulib stub
   dnl for a glibc stub.
-  AC_CACHE_CHECK([for copy_file_range], [gl_cv_func_copy_file_range],
-    [AC_LINK_IFELSE(
-       [AC_LANG_PROGRAM(
-          [[#include <unistd.h>
-          ]],
-          [[ssize_t (*func) (int, off_t *, int, off_t *, size_t, unsigned)
-              = copy_file_range;
-            return func (0, 0, 0, 0, 0, 0) & 127;
-          ]])
-       ],
-       [gl_cv_func_copy_file_range=yes],
-       [gl_cv_func_copy_file_range=no])
-    ])
-
+  case "$host_os" in
+    *-gnu* | gnu*)
+      AC_CACHE_CHECK([for copy_file_range], [gl_cv_func_copy_file_range],
+        [AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <unistd.h>
+              ]],
+              [[ssize_t (*func) (int, off_t *, int, off_t *, size_t, unsigned)
+                  = copy_file_range;
+                return func (0, 0, 0, 0, 0, 0) & 127;
+              ]])
+           ],
+           [gl_cv_func_copy_file_range=yes],
+           [gl_cv_func_copy_file_range=no])
+        ])
+      gl_cv_onwards_func_copy_file_range="$gl_cv_func_copy_file_range"
+      ;;
+    *)
+      gl_CHECK_FUNCS_ANDROID([copy_file_range], [[#include <unistd.h>]])
+      gl_cv_func_copy_file_range="$ac_cv_func_copy_file_range"
+      ;;
+  esac
   if test "$gl_cv_func_copy_file_range" != yes; then
     HAVE_COPY_FILE_RANGE=0
+    case "$gl_cv_onwards_func_copy_file_range" in
+      future*) REPLACE_COPY_FILE_RANGE=1 ;;
+    esac
   else
     AC_DEFINE([HAVE_COPY_FILE_RANGE], 1,
       [Define to 1 if the function copy_file_range exists.])