bug-gnulib
[Top][All Lists]
Advanced

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

More Android patches


From: Po Lu
Subject: More Android patches
Date: Wed, 18 Jan 2023 21:10:27 +0800

With the NDK 16.1.4479499 and __ANDROID_API__ set to 8, utimensat and
ftruncate appear in libc.so but not in the system headers.  This patch
seems to fix the problem, except for one part: REPLACE_UTIMENSAT is not
defined.  Would adding:

     REPLACE_UTIMENSAT=1

to the "ac_cv_func_utimensat" = no branch be enough to fix that?

Thanks.

2023-01-18  Po Lu  <luangruo@yahoo.com>

        Fix uses of utimensat and ftruncate on Android API 8 or earlier.

        * m4/unistd_h.m4 (gl_UNISTD_H): Check that ftruncate is really
        there on Android.
        * m4/utimensat.m4: (gl_FUNC_UTIMENSAT): Check that utimensat is
        really present when cross compiling for Android.


diff --git a/m4/utimensat.m4 b/m4/utimensat.m4
index dd210fc989a..f3d1dd9efaa 100644
--- a/m4/utimensat.m4
+++ b/m4/utimensat.m4
@@ -14,6 +14,9 @@ AC_DEFUN
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CHECK_FUNCS_ONCE([utimensat])
+  # This is necessary for cross-compiles, because otherwise utimensat
+  # will appear to work.
+  gl_CHECK_FUNCS_ANDROID([utimensat], [[#include <sys/stat.h>]])
   if test $ac_cv_func_utimensat = no; then
     HAVE_UTIMENSAT=0
   else
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index f4384027e37..dd799ae27db 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -50,6 +50,7 @@ AC_DEFUN_ONCE
     group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite
     readlink readlinkat rmdir sethostname sleep symlink symlinkat
     truncate ttyname_r unlink unlinkat usleep])
+  gl_CHECK_FUNCS_ANDROID([ftruncate], [[#include <unistd.h>]])
 
   AC_REQUIRE([AC_C_RESTRICT])
 


reply via email to

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