bug-gnulib
[Top][All Lists]
Advanced

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

Follow up to last post


From: Po Lu
Subject: Follow up to last post
Date: Wed, 18 Jan 2023 21:53:18 +0800

Okay, the problem seems to be a little more involved than I initially
thought.

Apparently, it is not ok to use gl_CHECK_FUNCS_ANDROID without removing
utimensat from AC_CHECK_FUNCS_ONCE, because the latter will define
HAVE_UTIMENSAT, leading to a build failure later (I only found this
after running `make maintainer-clean' in lib.)

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])
 
diff --git a/m4/utimens.m4 b/m4/utimens.m4
index c5d9b69e6f5..2b87f0149b5 100644
--- a/m4/utimens.m4
+++ b/m4/utimens.m4
@@ -11,7 +11,8 @@ AC_DEFUN
   AC_REQUIRE([gl_FUNC_UTIMES])
   AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-  AC_CHECK_FUNCS_ONCE([futimens utimensat lutimes])
+  AC_CHECK_FUNCS_ONCE([futimens lutimes])
+  gl_CHECK_FUNCS_ANDROID([utimensat], [[#include <sys/stat.h>]])
   gl_CHECK_FUNCS_ANDROID([futimes], [[#include <sys/time.h>]])
   gl_CHECK_FUNCS_ANDROID([futimesat], [[#include <sys/time.h>]])
 
diff --git a/m4/utimensat.m4 b/m4/utimensat.m4
index dd210fc989a..8edea60bd10 100644
--- a/m4/utimensat.m4
+++ b/m4/utimensat.m4
@@ -13,9 +13,12 @@ AC_DEFUN
   AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
   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
+    REPLACE_UTIMENSAT=1
   else
     AC_CACHE_CHECK([whether utimensat works],
       [gl_cv_func_utimensat_works],


reply via email to

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