Po Lu wrote: > 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.
Thanks for the report. The problem, however, is much larger than these two symbols. Previously I handled the __INTRODUCED_IN that I found in the Termux /usr/include files. But you are right: Any developer can use any NDK from 16b to 25b, since these are those than a developer can currently download through Android Studio. In a first step, I searched for the symbols marked with __INTRODUCED_IN(x) or __INTRODUCED_IN_NO_GUARD_FOR_NDK(x) for x = 2 ... 35. This gave me the symbol lists in the attached android-introduced.zip. In a second step, I looked for occurrences to AC_CHECK_FUNC[S] or AC_CHECK_FUNCS_ONCE of these symbols. E.g. for s in `cat in-8.txt`; do grep -rw "$s" m4 modules | grep CHECK_FUNC; echo ; done and replaced these with gl_CHECK_FUNCS_ANDROID invocations. > REPLACE_UTIMENSAT is not defined. For the moment, it appears OK to treat these symbols like absent from the header files and from libc (i.e. HAVE_UTIMENSAT=0). In theory, you are right: it will be better to mark them as REPLACEd, so that Gnulib will define a function named 'rpl_utimensat' rather than 'utimensat'. But as this matters only for rare situations with shared libraries (since on Android, everything links against libc.so, not libc.a), it can wait a bit. Here's my current work-in-progress; I'll continue with it tomorrow.
<<attachment: android-introduced.zip>>
>From bf80de33fe355df9944579416e38a48984b57091 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Wed, 18 Jan 2023 19:49:35 +0100 Subject: [PATCH 1/6] Fix warnings for functions introduced in Android API level 8. * m4/ttyname_r.m4 (gl_FUNC_TTYNAME_R): Test for ttyname_r using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. --- ChangeLog | 6 ++++++ m4/ttyname_r.m4 | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 854820e5cf..f314c07671 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2023-01-18 Bruno Haible <br...@clisp.org> + + Fix warnings for functions introduced in Android API level 8. + * m4/ttyname_r.m4 (gl_FUNC_TTYNAME_R): Test for ttyname_r using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. + 2023-01-18 Bruno Haible <br...@clisp.org> getcwd: Speed up on Linux. Add support for Android. diff --git a/m4/ttyname_r.m4 b/m4/ttyname_r.m4 index 3f027da45a..4a76155469 100644 --- a/m4/ttyname_r.m4 +++ b/m4/ttyname_r.m4 @@ -1,4 +1,4 @@ -# ttyname_r.m4 serial 11 +# ttyname_r.m4 serial 12 dnl Copyright (C) 2010-2023 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,7 +17,7 @@ AC_DEFUN([gl_FUNC_TTYNAME_R], HAVE_DECL_TTYNAME_R=0 fi - AC_CHECK_FUNCS([ttyname_r]) + gl_CHECK_FUNCS_ANDROID([ttyname_r], [[#include <unistd.h>]]) if test $ac_cv_func_ttyname_r = no; then HAVE_TTYNAME_R=0 else -- 2.34.1
>From f321df595150d01f3e8f60da8c6ff8372a91c650 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Wed, 18 Jan 2023 20:05:11 +0100 Subject: [PATCH 2/6] Fix warnings for functions introduced in Android API level 9. * m4/pipe2.m4 (gl_FUNC_PIPE2): Test for pipe2 using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. * m4/fdatasync.m4 (gl_FUNC_FDATASYNC): Update comments. --- ChangeLog | 7 +++++++ m4/fdatasync.m4 | 3 ++- m4/pipe2.m4 | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f314c07671..1b04e507fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-01-18 Bruno Haible <br...@clisp.org> + + Fix warnings for functions introduced in Android API level 9. + * m4/pipe2.m4 (gl_FUNC_PIPE2): Test for pipe2 using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. + * m4/fdatasync.m4 (gl_FUNC_FDATASYNC): Update comments. + 2023-01-18 Bruno Haible <br...@clisp.org> Fix warnings for functions introduced in Android API level 8. diff --git a/m4/fdatasync.m4 b/m4/fdatasync.m4 index 8c5cc4fdaf..201d7ffb27 100644 --- a/m4/fdatasync.m4 +++ b/m4/fdatasync.m4 @@ -1,4 +1,4 @@ -# fdatasync.m4 serial 7 +# fdatasync.m4 serial 8 dnl Copyright (C) 2008-2023 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,6 +17,7 @@ AC_DEFUN([gl_FUNC_FDATASYNC], if test $ac_cv_have_decl_fdatasync = no; then HAVE_DECL_FDATASYNC=0 dnl Mac OS X 10.7 has fdatasync but does not declare it. + dnl Likewise Android with API level < 9. Cf. gl_CHECK_FUNCS_ANDROID. AC_CHECK_FUNCS([fdatasync]) if test $ac_cv_func_fdatasync = no; then HAVE_FDATASYNC=0 diff --git a/m4/pipe2.m4 b/m4/pipe2.m4 index 501f3a4303..c7ec02e873 100644 --- a/m4/pipe2.m4 +++ b/m4/pipe2.m4 @@ -1,4 +1,4 @@ -# pipe2.m4 serial 2 +# pipe2.m4 serial 3 dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,7 +11,7 @@ AC_DEFUN([gl_FUNC_PIPE2], dnl Persuade glibc <unistd.h> to declare pipe2(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_CHECK_FUNCS_ONCE([pipe2]) + gl_CHECK_FUNCS_ANDROID([pipe2], [[#include <unistd.h>]]) if test $ac_cv_func_pipe2 != yes; then HAVE_PIPE2=0 fi -- 2.34.1
>From 88a444d933a2fc67e2c90df3bc6af5b1a95146ff Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Wed, 18 Jan 2023 20:41:48 +0100 Subject: [PATCH 3/6] Fix warnings for functions introduced in Android API level 12. * m4/ftruncate.m4 (gl_FUNC_FTRUNCATE): Test for ftruncate using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. * m4/glob.m4 (gl_PREREQ_GLOB): Test for getpwnam_r using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. * m4/nproc.m4 (gl_PREREQ_NPROC): Test for sched_getaffinity using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. * m4/pread.m4 (gl_FUNC_PREAD): Test for pread using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. * m4/pwrite.m4 (gl_FUNC_PWRITE): Test for pwrite using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. * m4/thread.m4 (gl_THREAD): Test for pthread_atfork using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. * m4/timegm.m4 (gl_FUNC_TIMEGM): Test for timegm using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. * m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Test for utimensat using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. * m4/utimens.m4 (gl_UTIMENS): Likewise. --- ChangeLog | 21 +++++++++++++++++++++ m4/ftruncate.m4 | 4 ++-- m4/glob.m4 | 4 ++-- m4/nproc.m4 | 6 +++--- m4/pread.m4 | 4 ++-- m4/pwrite.m4 | 4 ++-- m4/thread.m4 | 4 ++-- m4/timegm.m4 | 4 ++-- m4/utimens.m4 | 5 +++-- m4/utimensat.m4 | 4 ++-- 10 files changed, 41 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b04e507fa..738b2de22a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2023-01-18 Bruno Haible <br...@clisp.org> + + Fix warnings for functions introduced in Android API level 12. + * m4/ftruncate.m4 (gl_FUNC_FTRUNCATE): Test for ftruncate using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. + * m4/glob.m4 (gl_PREREQ_GLOB): Test for getpwnam_r using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. + * m4/nproc.m4 (gl_PREREQ_NPROC): Test for sched_getaffinity using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. + * m4/pread.m4 (gl_FUNC_PREAD): Test for pread using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. + * m4/pwrite.m4 (gl_FUNC_PWRITE): Test for pwrite using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. + * m4/thread.m4 (gl_THREAD): Test for pthread_atfork using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. + * m4/timegm.m4 (gl_FUNC_TIMEGM): Test for timegm using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. + * m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Test for utimensat using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. + * m4/utimens.m4 (gl_UTIMENS): Likewise. + 2023-01-18 Bruno Haible <br...@clisp.org> Fix warnings for functions introduced in Android API level 9. diff --git a/m4/ftruncate.m4 b/m4/ftruncate.m4 index 74c347598d..f48126e856 100644 --- a/m4/ftruncate.m4 +++ b/m4/ftruncate.m4 @@ -1,4 +1,4 @@ -# serial 21 +# serial 22 # See if we need to emulate a missing ftruncate function using _chsize. @@ -10,7 +10,7 @@ AC_DEFUN([gl_FUNC_FTRUNCATE], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - AC_CHECK_FUNCS_ONCE([ftruncate]) + gl_CHECK_FUNCS_ANDROID([ftruncate], [[#include <unistd.h>]]) if test $ac_cv_func_ftruncate = yes; then m4_ifdef([gl_LARGEFILE], [ AC_REQUIRE([AC_CANONICAL_HOST]) diff --git a/m4/glob.m4 b/m4/glob.m4 index 354581b3be..847f88038f 100644 --- a/m4/glob.m4 +++ b/m4/glob.m4 @@ -1,4 +1,4 @@ -# glob.m4 serial 27 +# glob.m4 serial 28 dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -126,5 +126,5 @@ AC_DEFUN([gl_PREREQ_GLOB], AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE]) AC_CHECK_HEADERS_ONCE([unistd.h]) gl_CHECK_FUNCS_ANDROID([getlogin_r], [[#include <unistd.h>]]) - AC_CHECK_FUNCS_ONCE([getpwnam_r]) + gl_CHECK_FUNCS_ANDROID([getpwnam_r], [[#include <pwd.h>]]) ]) diff --git a/m4/nproc.m4 b/m4/nproc.m4 index 3065b7b9bf..c892ad74b7 100644 --- a/m4/nproc.m4 +++ b/m4/nproc.m4 @@ -1,4 +1,4 @@ -# nproc.m4 serial 5 +# nproc.m4 serial 6 dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -25,8 +25,8 @@ AC_DEFUN([gl_PREREQ_NPROC], #endif ]) - AC_CHECK_FUNCS([sched_getaffinity sched_getaffinity_np \ - pstat_getdynamic sysmp sysctl]) + AC_CHECK_FUNCS([sched_getaffinity_np pstat_getdynamic sysmp sysctl]) + gl_CHECK_FUNCS_ANDROID([sched_getaffinity], [[#include <sched.h>]]) dnl Test whether sched_getaffinity has the expected declaration. dnl glibc 2.3.[0-2]: diff --git a/m4/pread.m4 b/m4/pread.m4 index ac3c1b7d51..8031f910d4 100644 --- a/m4/pread.m4 +++ b/m4/pread.m4 @@ -1,4 +1,4 @@ -# pread.m4 serial 6 +# pread.m4 serial 7 dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,7 +12,7 @@ AC_DEFUN([gl_FUNC_PREAD], dnl Persuade glibc <unistd.h> to declare pread(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_CHECK_FUNCS_ONCE([pread]) + gl_CHECK_FUNCS_ANDROID([pread], [[#include <unistd.h>]]) if test $ac_cv_func_pread = yes; then dnl On HP-UX 11.11 with _FILE_OFFSET_BITS=64, pread() on a file returns 0 dnl instead of a positive value. diff --git a/m4/pwrite.m4 b/m4/pwrite.m4 index f77d4210d6..48c5255f30 100644 --- a/m4/pwrite.m4 +++ b/m4/pwrite.m4 @@ -1,4 +1,4 @@ -# pwrite.m4 serial 6 +# pwrite.m4 serial 7 dnl Copyright (C) 2010-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,7 +12,7 @@ AC_DEFUN([gl_FUNC_PWRITE], dnl Persuade glibc <unistd.h> to declare pwrite(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_CHECK_FUNCS_ONCE([pwrite]) + gl_CHECK_FUNCS_ANDROID([pwrite], [[#include <unistd.h>]]) if test $ac_cv_func_pwrite = yes; then dnl On HP-UX 11.11 with _FILE_OFFSET_BITS=64, pwrite() on a file does not dnl fail when an invalid (negative) offset is passed and uses an arbitrary diff --git a/m4/thread.m4 b/m4/thread.m4 index 12515f6a93..9c63df39da 100644 --- a/m4/thread.m4 +++ b/m4/thread.m4 @@ -1,4 +1,4 @@ -# thread.m4 serial 3 +# thread.m4 serial 4 dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,7 +11,7 @@ AC_DEFUN([gl_THREAD], if test $gl_threads_api = posix; then gl_save_LIBS="$LIBS" LIBS="$LIBS $LIBMULTITHREAD" - AC_CHECK_FUNCS([pthread_atfork]) + gl_CHECK_FUNCS_ANDROID([pthread_atfork], [[#include <pthread.h>]]) LIBS="$gl_save_LIBS" fi ]) diff --git a/m4/timegm.m4 b/m4/timegm.m4 index 6079f1a39c..fa84e98db3 100644 --- a/m4/timegm.m4 +++ b/m4/timegm.m4 @@ -1,4 +1,4 @@ -# timegm.m4 serial 13 +# timegm.m4 serial 14 dnl Copyright (C) 2003, 2007, 2009-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_TIMEGM], AC_REQUIRE([gl_TIME_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) REPLACE_TIMEGM=0 - AC_CHECK_FUNCS_ONCE([timegm]) + gl_CHECK_FUNCS_ANDROID([timegm], [[#include <time.h>]]) if test $ac_cv_func_timegm = yes; then if test "$gl_cv_func_working_mktime" != yes; then # Assume that timegm is buggy if mktime is. diff --git a/m4/utimens.m4 b/m4/utimens.m4 index c5d9b69e6f..900b4f6aa3 100644 --- a/m4/utimens.m4 +++ b/m4/utimens.m4 @@ -3,7 +3,7 @@ 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. -dnl serial 12 +dnl serial 13 AC_DEFUN([gl_UTIMENS], [ @@ -11,9 +11,10 @@ AC_DEFUN([gl_UTIMENS], 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([futimes], [[#include <sys/time.h>]]) gl_CHECK_FUNCS_ANDROID([futimesat], [[#include <sys/time.h>]]) + gl_CHECK_FUNCS_ANDROID([utimensat], [[#include <sys/stat.h>]]) if test $ac_cv_func_futimens = no && test $ac_cv_func_futimesat = yes; then dnl FreeBSD 8.0-rc2 mishandles futimesat(fd,NULL,time). It is not diff --git a/m4/utimensat.m4 b/m4/utimensat.m4 index dd210fc989..1d3db2efa2 100644 --- a/m4/utimensat.m4 +++ b/m4/utimensat.m4 @@ -1,4 +1,4 @@ -# serial 9 +# serial 10 # See if we need to provide utimensat replacement. dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. @@ -13,7 +13,7 @@ AC_DEFUN([gl_FUNC_UTIMENSAT], 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]) + gl_CHECK_FUNCS_ANDROID([utimensat], [[#include <sys/stat.h>]]) if test $ac_cv_func_utimensat = no; then HAVE_UTIMENSAT=0 else -- 2.34.1
>From 607dbad8e68c39992a87b98c8fe4d183d6bfe71a Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Wed, 18 Jan 2023 21:25:30 +0100 Subject: [PATCH 4/6] Fix warnings for functions introduced in Android API level 16. * m4/faccessat.m4 (gl_FUNC_FACCESSAT): Test for faccessat using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. * m4/canonicalize.m4 (gl_FUNC_CANONICALIZE_FILENAME_MODE, gl_CANONICALIZE_LGPL_SEPARATE): Likewise. * m4/euidaccess.m4 (gl_PREREQ_EUIDACCESS): Likewise. * m4/tsearch.m4 (gl_FUNC_TSEARCH): Test for tsearch using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. * m4/setenv.m4 (gl_PREREQ_SETENV): Likewise. --- ChangeLog | 12 ++++++++++++ m4/canonicalize.m4 | 8 +++++--- m4/euidaccess.m4 | 4 ++-- m4/faccessat.m4 | 4 ++-- m4/setenv.m4 | 4 ++-- m4/tsearch.m4 | 5 +++-- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 738b2de22a..ad6884812c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2023-01-18 Bruno Haible <br...@clisp.org> + + Fix warnings for functions introduced in Android API level 16. + * m4/faccessat.m4 (gl_FUNC_FACCESSAT): Test for faccessat using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. + * m4/canonicalize.m4 (gl_FUNC_CANONICALIZE_FILENAME_MODE, + gl_CANONICALIZE_LGPL_SEPARATE): Likewise. + * m4/euidaccess.m4 (gl_PREREQ_EUIDACCESS): Likewise. + * m4/tsearch.m4 (gl_FUNC_TSEARCH): Test for tsearch using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. + * m4/setenv.m4 (gl_PREREQ_SETENV): Likewise. + 2023-01-18 Bruno Haible <br...@clisp.org> Fix warnings for functions introduced in Android API level 12. diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4 index 03cb0aec93..d319645fd3 100644 --- a/m4/canonicalize.m4 +++ b/m4/canonicalize.m4 @@ -1,4 +1,4 @@ -# canonicalize.m4 serial 37 +# canonicalize.m4 serial 38 dnl Copyright (C) 2003-2007, 2009-2023 Free Software Foundation, Inc. @@ -12,7 +12,8 @@ AC_DEFUN([gl_FUNC_CANONICALIZE_FILENAME_MODE], [ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) - AC_CHECK_FUNCS_ONCE([canonicalize_file_name faccessat]) + AC_CHECK_FUNCS_ONCE([canonicalize_file_name]) + gl_CHECK_FUNCS_ANDROID([faccessat], [[#include <unistd.h>]]) AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) AC_REQUIRE([gl_FUNC_REALPATH_WORKS]) if test $ac_cv_func_canonicalize_file_name = no; then @@ -58,7 +59,8 @@ AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE], [ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) - AC_CHECK_FUNCS_ONCE([canonicalize_file_name faccessat]) + AC_CHECK_FUNCS_ONCE([canonicalize_file_name]) + gl_CHECK_FUNCS_ANDROID([faccessat], [[#include <unistd.h>]]) dnl On native Windows, we use _getcwd(), regardless whether getcwd() is dnl available through the linker option '-loldnames'. diff --git a/m4/euidaccess.m4 b/m4/euidaccess.m4 index f0eb5bde84..7429779c15 100644 --- a/m4/euidaccess.m4 +++ b/m4/euidaccess.m4 @@ -1,4 +1,4 @@ -# euidaccess.m4 serial 16 +# euidaccess.m4 serial 17 dnl Copyright (C) 2002-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -32,7 +32,7 @@ AC_DEFUN([gl_FUNC_EUIDACCESS], # Prerequisites of lib/euidaccess.c. AC_DEFUN([gl_PREREQ_EUIDACCESS], [ dnl Prefer POSIX faccessat over non-standard euidaccess. - AC_CHECK_FUNCS_ONCE([faccessat]) + gl_CHECK_FUNCS_ANDROID([faccessat], [[#include <unistd.h>]]) dnl Try various other non-standard fallbacks. AC_CHECK_HEADERS([libgen.h]) AC_FUNC_GETGROUPS diff --git a/m4/faccessat.m4 b/m4/faccessat.m4 index 934c1f4154..958c4978b7 100644 --- a/m4/faccessat.m4 +++ b/m4/faccessat.m4 @@ -1,4 +1,4 @@ -# serial 10 +# serial 11 # See if we need to provide faccessat replacement. dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. @@ -16,7 +16,7 @@ AC_DEFUN([gl_FUNC_FACCESSAT], dnl Persuade glibc <unistd.h> to declare faccessat(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - AC_CHECK_FUNCS_ONCE([faccessat]) + gl_CHECK_FUNCS_ANDROID([faccessat], [[#include <unistd.h>]]) if test $ac_cv_func_faccessat = no; then HAVE_FACCESSAT=0 else diff --git a/m4/setenv.m4 b/m4/setenv.m4 index 16f9eb5531..c0b7475606 100644 --- a/m4/setenv.m4 +++ b/m4/setenv.m4 @@ -1,4 +1,4 @@ -# setenv.m4 serial 30 +# setenv.m4 serial 31 dnl Copyright (C) 2001-2004, 2006-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -155,7 +155,7 @@ AC_DEFUN([gl_PREREQ_SETENV], AC_REQUIRE([gl_ENVIRON]) AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CHECK_HEADERS([search.h]) - AC_CHECK_FUNCS([tsearch]) + gl_CHECK_FUNCS_ANDROID([tsearch], [[#include <search.h>]]) ]) # Prerequisites of lib/unsetenv.c. diff --git a/m4/tsearch.m4 b/m4/tsearch.m4 index d24b2ca4a5..8e6a894f83 100644 --- a/m4/tsearch.m4 +++ b/m4/tsearch.m4 @@ -1,4 +1,4 @@ -# tsearch.m4 serial 8 +# tsearch.m4 serial 9 dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,7 +7,8 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_TSEARCH], [ AC_REQUIRE([gl_SEARCH_H_DEFAULTS]) - AC_CHECK_FUNCS([tsearch twalk]) + AC_CHECK_FUNCS([twalk]) + gl_CHECK_FUNCS_ANDROID([tsearch], [[#include <search.h>]]) if test $ac_cv_func_tsearch = yes; then dnl On OpenBSD 4.0, the return value of tdelete() is incorrect. AC_REQUIRE([AC_PROG_CC]) -- 2.34.1
>From 398231de226d2839cc60d5e0c825e99169aabfdc Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Wed, 18 Jan 2023 21:30:02 +0100 Subject: [PATCH 5/6] Fix warnings for functions introduced in Android API level 16 or 17. * m4/posix_memalign.m4 (gl_FUNC_POSIX_MEMALIGN): Test for posix_memalign using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. * m4/alignalloc.m4 (gl_ALIGNALLOC): Likewise. * m4/pagealign_alloc.m4 (gl_PREREQ_PAGEALIGN_ALLOC): Likewise. * modules/aligned-malloc (configure.ac): Likewise. --- ChangeLog | 9 +++++++++ m4/alignalloc.m4 | 3 ++- m4/pagealign_alloc.m4 | 4 ++-- m4/posix_memalign.m4 | 4 ++-- modules/aligned-malloc | 3 ++- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad6884812c..366c85feec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2023-01-18 Bruno Haible <br...@clisp.org> + + Fix warnings for functions introduced in Android API level 16 or 17. + * m4/posix_memalign.m4 (gl_FUNC_POSIX_MEMALIGN): Test for posix_memalign + using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. + * m4/alignalloc.m4 (gl_ALIGNALLOC): Likewise. + * m4/pagealign_alloc.m4 (gl_PREREQ_PAGEALIGN_ALLOC): Likewise. + * modules/aligned-malloc (configure.ac): Likewise. + 2023-01-18 Bruno Haible <br...@clisp.org> Fix warnings for functions introduced in Android API level 16. diff --git a/m4/alignalloc.m4 b/m4/alignalloc.m4 index fa8fb7cd2b..ec199ed01c 100644 --- a/m4/alignalloc.m4 +++ b/m4/alignalloc.m4 @@ -1,3 +1,4 @@ +# alignalloc.m4 serial 1 dnl Copyright 2022-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,5 +7,5 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_ALIGNALLOC], [ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_CHECK_FUNCS_ONCE([posix_memalign]) + gl_CHECK_FUNCS_ANDROID([posix_memalign], [[#include <stdlib.h>]]) ]) diff --git a/m4/pagealign_alloc.m4 b/m4/pagealign_alloc.m4 index cdf2e182b4..1cfb3beca8 100644 --- a/m4/pagealign_alloc.m4 +++ b/m4/pagealign_alloc.m4 @@ -1,4 +1,4 @@ -#serial 6 +#serial 7 dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -16,6 +16,6 @@ AC_DEFUN([gl_PAGEALIGN_ALLOC], AC_DEFUN([gl_PREREQ_PAGEALIGN_ALLOC], [ AC_REQUIRE([gl_FUNC_MMAP_ANON]) - AC_CHECK_FUNCS_ONCE([posix_memalign]) + gl_CHECK_FUNCS_ANDROID([posix_memalign], [[#include <stdlib.h>]]) AC_CHECK_HEADERS_ONCE([unistd.h]) ]) diff --git a/m4/posix_memalign.m4 b/m4/posix_memalign.m4 index b29f573adf..36d88e0323 100644 --- a/m4/posix_memalign.m4 +++ b/m4/posix_memalign.m4 @@ -1,4 +1,4 @@ -# posix_memalign.m4 serial 1 +# posix_memalign.m4 serial 2 dnl Copyright (C) 2020-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,7 +12,7 @@ AC_DEFUN([gl_FUNC_POSIX_MEMALIGN], dnl Persuade glibc <stdlib.h> to declare posix_memalign(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_CHECK_FUNCS_ONCE([posix_memalign]) + gl_CHECK_FUNCS_ANDROID([posix_memalign], [[#include <stdlib.h>]]) if test $ac_cv_func_posix_memalign = yes; then dnl On OpenBSD 6.1, posix_memalign (&p, 32, 2406) returns a pointer dnl that is not a multiple of 32. diff --git a/modules/aligned-malloc b/modules/aligned-malloc index 1ef05d1b76..ce22972436 100644 --- a/modules/aligned-malloc +++ b/modules/aligned-malloc @@ -14,8 +14,9 @@ memalign configure.ac: gl_MALLOC_ALIGNMENT AC_REQUIRE([AC_C_INLINE]) -AC_CHECK_FUNCS_ONCE([posix_memalign memalign]) +AC_CHECK_FUNCS_ONCE([memalign]) gl_CHECK_FUNCS_ANDROID([aligned_alloc], [[#include <stdlib.h>]]) +gl_CHECK_FUNCS_ANDROID([posix_memalign], [[#include <stdlib.h>]]) Makefile.am: -- 2.34.1
>From f6993392af03040b7008c7f1c55be7a7e3b11a67 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Wed, 18 Jan 2023 21:48:51 +0100 Subject: [PATCH 6/6] Fix warnings for functions introduced in Android API level 18. * m4/getdelim.m4 (gl_FUNC_GETDELIM): Test for getdelim using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. * m4/getline.m4 (gl_FUNC_GETLINE): Test for getline using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNC. * m4/log2.m4 (gl_FUNC_LOG2): Test for log2 using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. * m4/log2f.m4 (gl_FUNC_LOG2F): Test for log2f using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. * m4/log2l.m4 (gl_FUNC_LOG2L): Test for log2l using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. --- ChangeLog | 14 ++++++++++++++ m4/getdelim.m4 | 4 ++-- m4/getline.m4 | 13 ++++++------- m4/log2.m4 | 4 ++-- m4/log2f.m4 | 4 ++-- m4/log2l.m4 | 4 ++-- 6 files changed, 28 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 366c85feec..b830f5cea2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2023-01-18 Bruno Haible <br...@clisp.org> + + Fix warnings for functions introduced in Android API level 18. + * m4/getdelim.m4 (gl_FUNC_GETDELIM): Test for getdelim using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. + * m4/getline.m4 (gl_FUNC_GETLINE): Test for getline using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNC. + * m4/log2.m4 (gl_FUNC_LOG2): Test for log2 using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. + * m4/log2f.m4 (gl_FUNC_LOG2F): Test for log2f using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. + * m4/log2l.m4 (gl_FUNC_LOG2L): Test for log2l using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. + 2023-01-18 Bruno Haible <br...@clisp.org> Fix warnings for functions introduced in Android API level 16 or 17. diff --git a/m4/getdelim.m4 b/m4/getdelim.m4 index 9aaed202ab..bbd7c03bcb 100644 --- a/m4/getdelim.m4 +++ b/m4/getdelim.m4 @@ -1,4 +1,4 @@ -# getdelim.m4 serial 16 +# getdelim.m4 serial 17 dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc. dnl @@ -18,7 +18,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], AC_CHECK_DECLS_ONCE([getdelim]) - AC_CHECK_FUNCS_ONCE([getdelim]) + gl_CHECK_FUNCS_ANDROID([getdelim], [[#include <stdio.h>]]) if test $ac_cv_func_getdelim = yes; then HAVE_GETDELIM=1 dnl Found it in some library. Verify that it works. diff --git a/m4/getline.m4 b/m4/getline.m4 index 03569f06b2..f68fa3a1ac 100644 --- a/m4/getline.m4 +++ b/m4/getline.m4 @@ -1,4 +1,4 @@ -# getline.m4 serial 30 +# getline.m4 serial 31 dnl Copyright (C) 1998-2003, 2005-2007, 2009-2023 Free Software Foundation, dnl Inc. @@ -23,12 +23,9 @@ AC_DEFUN([gl_FUNC_GETLINE], AC_CHECK_DECLS_ONCE([getline]) - gl_getline_needs_run_time_check=no - AC_CHECK_FUNC([getline], - [dnl Found it in some library. Verify that it works. - gl_getline_needs_run_time_check=yes], - [am_cv_func_working_getline=no]) - if test $gl_getline_needs_run_time_check = yes; then + gl_CHECK_FUNCS_ANDROID([getline], [[#include <stdio.h>]]) + if test $ac_cv_func_getline = yes; then + dnl Found it in some library. Verify that it works. AC_CACHE_CHECK([for working getline function], [am_cv_func_working_getline], [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data @@ -85,6 +82,8 @@ AC_DEFUN([gl_FUNC_GETLINE], ]) ]) ]) + else + am_cv_func_working_getline=no fi if test $ac_cv_have_decl_getline = no; then diff --git a/m4/log2.m4 b/m4/log2.m4 index acf092fed1..4e08f48fe8 100644 --- a/m4/log2.m4 +++ b/m4/log2.m4 @@ -1,4 +1,4 @@ -# log2.m4 serial 10 +# log2.m4 serial 11 dnl Copyright (C) 2010-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -18,7 +18,7 @@ AC_DEFUN([gl_FUNC_LOG2], dnl Test whether log2() exists. save_LIBS="$LIBS" LIBS="$LIBS $LOG2_LIBM" - AC_CHECK_FUNCS([log2]) + gl_CHECK_FUNCS_ANDROID([log2], [[#include <math.h>]]) LIBS="$save_LIBS" if test $ac_cv_func_log2 = yes; then HAVE_LOG2=1 diff --git a/m4/log2f.m4 b/m4/log2f.m4 index f9da22e097..b85993c2c2 100644 --- a/m4/log2f.m4 +++ b/m4/log2f.m4 @@ -1,4 +1,4 @@ -# log2f.m4 serial 10 +# log2f.m4 serial 11 dnl Copyright (C) 2010-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,7 +19,7 @@ AC_DEFUN([gl_FUNC_LOG2F], dnl Test whether log2f() exists. save_LIBS="$LIBS" LIBS="$LIBS $LOG2F_LIBM" - AC_CHECK_FUNCS([log2f]) + gl_CHECK_FUNCS_ANDROID([log2f], [[#include <math.h>]]) LIBS="$save_LIBS" if test $ac_cv_func_log2f = yes; then HAVE_LOG2F=1 diff --git a/m4/log2l.m4 b/m4/log2l.m4 index f65c00398e..e4810d5a94 100644 --- a/m4/log2l.m4 +++ b/m4/log2l.m4 @@ -1,4 +1,4 @@ -# log2l.m4 serial 3 +# log2l.m4 serial 4 dnl Copyright (C) 2010-2023 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,7 +17,7 @@ AC_DEFUN([gl_FUNC_LOG2L], dnl defined in the same library as log2(). save_LIBS="$LIBS" LIBS="$LIBS $LOG2_LIBM" - AC_CHECK_FUNCS([log2l]) + gl_CHECK_FUNCS_ANDROID([log2l], [[#include <math.h>]]) LIBS="$save_LIBS" if test $ac_cv_func_log2l = yes; then LOG2L_LIBM="$LOG2_LIBM" -- 2.34.1