From 5be04ec2ceb1df77afbca4fcbf9e92a712612d6f Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:27:12 +0100 Subject: Sync with the latest Gnulib code (d4ec02b3cc) --- gl/m4/lseek.m4 | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) (limited to 'gl/m4/lseek.m4') diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4 index fd4f1f27..0bc3d65e 100644 --- a/gl/m4/lseek.m4 +++ b/gl/m4/lseek.m4 @@ -1,5 +1,6 @@ -# lseek.m4 serial 12 -dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. +# lseek.m4 +# serial 15 +dnl Copyright (C) 2007, 2009-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, dnl with or without modifications, as long as this notice is preserved. @@ -13,13 +14,15 @@ AC_DEFUN([gl_FUNC_LSEEK], AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe], [case "$host_os" in - mingw*) + mingw* | windows*) dnl Native Windows. dnl The result of lseek (fd, (off_t)0, SEEK_CUR) or dnl SetFilePointer(handle, 0, NULL, FILE_CURRENT) - dnl for a pipe depends on the environment: In a Cygwin 1.5 - dnl environment it succeeds (wrong); in a Cygwin 1.7 environment - dnl it fails with a wrong errno value. + dnl for a pipe depends on the environment: + dnl In a Cygwin 1.5 environment it succeeds (wrong); + dnl in a Cygwin 1.7 environment it fails with a wrong errno value; + dnl in a Cygwin 2.9.0 environment it fails correctly; + dnl in a Cygwin 3.4.6 environment it succeeds again (wrong). gl_cv_func_lseek_pipe=no ;; *) @@ -70,9 +73,29 @@ AC_DEFUN([gl_FUNC_LSEEK], REPLACE_LSEEK=1 fi - dnl macOS SEEK_DATA is incompatible with other platforms. - case $host_os in - darwin*) - REPLACE_LSEEK=1;; - esac + AS_IF([test $REPLACE_LSEEK = 0], + [AC_CACHE_CHECK([whether SEEK_DATA works but is incompatible with GNU], + [gl_cv_func_lseek_works_but_incompatible], + [AC_PREPROC_IFELSE( + [AC_LANG_SOURCE( + dnl Use macOS "9999" to stand for a future fixed macOS version. + dnl See ../lib/unistd.in.h and . + [[#include + #if defined __APPLE__ && defined __MACH__ && defined SEEK_DATA + # ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ + # include + # endif + # if 99990000 <= MAC_OS_X_VERSION_MIN_REQUIRED + # define LSEEK_WORKS_BUT_IS_INCOMPATIBLE_WITH_GNU + # endif + #endif + #ifndef LSEEK_WORKS_BUT_IS_INCOMPATIBLE_WITH_GNU + #error "No need to work around the bug" + #endif + ]])], + [gl_cv_func_lseek_works_but_incompatible=yes], + [gl_cv_func_lseek_works_but_incompatible=no])]) + if test "$gl_cv_func_lseek_works_but_incompatible" = yes; then + REPLACE_LSEEK=1 + fi]) ]) -- cgit v1.2.3-74-g34f1