bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: bug-gnulib@gnu.org
Subject: More Android patches
Date: Wed, 18 Jan 2023 21:10:27 +0800	[thread overview]
Message-ID: <87zgag6la4.fsf@yahoo.com> (raw)
In-Reply-To: 87zgag6la4.fsf.ref@yahoo.com

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	other threads:[~2023-01-18 13:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87zgag6la4.fsf.ref@yahoo.com>
2023-01-18 13:10 ` Po Lu [this message]
2023-01-18 23:07   ` More Android patches Bruno Haible
2023-01-19 21:02     ` Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgag6la4.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).