This series of patches implements the REPLACE_* logic for symbols that do not exist in the *minimum* Android version on which the compiled binaries should run, but *do* exist in some later Android version (in which the compiled binaries should also run). The problem description is at https://lists.gnu.org/archive/html/bug-gnulib/2023-01/msg00167.html 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 29. * m4/reallocarray.m4 (gl_FUNC_REALLOCARRAY): Conditionally set REPLACE_REALLOCARRAY. * lib/stdlib.in.h (reallocarray): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * lib/stdlib.in.h (getloadavg): Consider REPLACE_GETLOADAVG. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_GETLOADAVG. * modules/stdlib (Makefile.am): Substitute REPLACE_GETLOADAVG. * m4/getloadavg.m4 (gl_GETLOADAVG): Conditionally set REPLACE_GETLOADAVG. * modules/getloadavg (Depends-on, configure.ac): Consider REPLACE_GETLOADAVG. * lib/time.in.h (timespec_get): Consider REPLACE_TIMESPEC_GET. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/time_h.m4 (gl_TIME_H_DEFAULTS): Initialize REPLACE_TIMESPEC_GET. * modules/time (Makefile.am): Substitute REPLACE_TIMESPEC_GET. * m4/gettime.m4 (gl_CHECK_FUNC_TIMESPEC_GET): Set also gl_cv_onwards_func_timespec_get. * m4/timespec_get.m4 (gl_FUNC_TIMESPEC_GET): Conditionally set REPLACE_TIMESPEC_GET. * modules/timespec_get (Depends-on, configure.ac): Consider REPLACE_TIMESPEC_GET. 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 28. * m4/aligned_alloc.m4 (gl_FUNC_ALIGNED_ALLOC): Conditionally set REPLACE_ALIGNED_ALLOC. * m4/getrandom.m4 (gl_FUNC_GETRANDOM): Conditionally set REPLACE_GETRANDOM. * m4/getlogin_r.m4 (gl_FUNC_GETLOGIN_R): Conditionally set REPLACE_GETLOGIN_R. * lib/unistd.in.h (getlogin_r): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/spawn_h.m4 (gl_HAVE_POSIX_SPAWN): Conditionally set REPLACE_POSIX_SPAWN. * lib/spawn.in.h: Adapt logic for defining the POSIX_SPAWN_* constants. (posix_spawn, posix_spawnp, posix_spawnattr_init, posix_spawnattr_destroy, posix_spawnattr_getsigdefault, posix_spawnattr_setsigdefault, posix_spawnattr_getsigmask, posix_spawnattr_setsigmask, posix_spawnattr_getflags, posix_spawnattr_setflags, posix_spawnattr_getpgroup, posix_spawnattr_setpgroup, posix_spawn_file_actions_init, posix_spawn_file_actions_destroy, posix_spawn_file_actions_addchdir, posix_spawn_file_actions_addfchdir): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/glob.m4 (gl_GLOB): Conditionally set REPLACE_GLOB. * lib/glob.in.h (glob): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * lib/unistd.in.h (getentropy): Consider REPLACE_GETENTROPY. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_GETENTROPY. * modules/unistd (Makefile.am): Substitute REPLACE_GETENTROPY. * m4/getentropy.m4 (gl_FUNC_GETENTROPY): Conditionally set REPLACE_GETENTROPY. * modules/getentropy (Depends-on, configure.ac): Consider REPLACE_GETENTROPY. 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 26. * m4/getdomainname.m4 (gl_FUNC_GETDOMAINNAME): Test for getdomainname using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. Conditionally set REPLACE_GETSUBOPT. * m4/nl_langinfo.m4 (gl_FUNC_NL_LANGINFO): Conditionally set REPLACE_NL_LANGINFO. * lib/langinfo.in.h (nl_langinfo): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * lib/stdlib.in.h (getsubopt): Consider REPLACE_GETSUBOPT. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_GETSUBOPT. * modules/stdlib (Makefile.am): Substitute REPLACE_GETSUBOPT. * m4/getsubopt.m4 (gl_FUNC_GETSUBOPT): Conditionally set REPLACE_GETSUBOPT. * modules/getsubopt (Depends-on, configure.ac): Consider REPLACE_GETSUBOPT. 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 24. * m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Conditionally set REPLACE_STRCHRNUL. 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 23. * m4/login_tty.m4 (gl_FUNC_LOGIN_TTY): Conditionally set REPLACE_LOGIN_TTY. * lib/utmp.in.h (login_tty): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/mkfifoat.m4 (gl_FUNC_MKFIFOAT): Conditionally set REPLACE_MKFIFOAT. * lib/sys_stat.in.h (mkfifoat): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/strerror_r.m4 (gl_FUNC_STRERROR_R_WORKS): Conditionally set REPLACE_STRERROR_R. * lib/string.in.h (strerror_r): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/error_h.m4 (gl_ERROR_H): Conditionally set REPLACE_ERROR. * lib/error.in.h (error): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * lib/wchar.in.h (wmempcpy): Consider REPLACE_WMEMPCPY. * m4/wchar_h.m4 (gl_WCHAR_H_DEFAULTS): Initialize REPLACE_WMEMPCPY. * modules/wchar (Makefile.am): Substitute REPLACE_WMEMPCPY. * m4/wmempcpy.m4 (gl_FUNC_WMEMPCPY): Conditionally set REPLACE_WMEMPCPY. * modules/wmempcpy (configure.ac): Consider REPLACE_WMEMPCPY. * lib/unistd.in.h (sethostname): Consider REPLACE_SETHOSTNAME. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_SETHOSTNAME. * modules/unistd (Makefile.am): Substitute REPLACE_SETHOSTNAME. * m4/sethostname.m4 (gl_FUNC_SETHOSTNAME): Conditionally set REPLACE_SETHOSTNAME. * modules/sethostname (Depends-on, configure.ac): Consider REPLACE_SETHOSTNAME. * lib/string.in.h (mempcpy): Consider REPLACE_MEMPCPY. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/string_h.m4 (gl_STRING_H_DEFAULTS): Initialize REPLACE_MEMPCPY. * modules/string (Makefile.am): Substitute REPLACE_MEMPCPY. * m4/mempcpy.m4 (gl_FUNC_MEMPCPY): Conditionally set REPLACE_MEMPCPY. * modules/mempcpy (configure.ac): Consider REPLACE_MEMPCPY. * lib/stdlib.in.h (mkostemp): Consider REPLACE_MKOSTEMP. Disable _GL_CXXALIASWARN invocation on non-glibc systems. (mkostemps): Consider REPLACE_MKOSTEMPS. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_MKOSTEMP, REPLACE_MKOSTEMPS. * modules/stdlib (Makefile.am): Substitute REPLACE_MKOSTEMP, REPLACE_MKOSTEMPS. * m4/mkostemp.m4 (gl_FUNC_MKOSTEMP): Conditionally set REPLACE_MKOSTEMP. * modules/mkostemp (Depends-on, configure.ac): Consider REPLACE_MKOSTEMP. * m4/mkostemps.m4 (gl_FUNC_MKOSTEMPS): Conditionally set REPLACE_MKOSTEMPS. * modules/mkostemps (Depends-on, configure.ac): Consider REPLACE_MKOSTEMPS. 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 21. * m4/fts.m4 (gl_FUNC_FTS_CORE): Use rpl_* symbols also when the system will have fts_open in a future version. * m4/iswblank.m4 (gl_FUNC_ISWBLANK): Conditionally set REPLACE_ISWBLANK. * m4/mbtowc.m4 (gl_FUNC_MBTOWC): Conditionally set REPLACE_MBTOWC. * m4/vdprintf.m4 (gl_REPLACE_VDPRINTF): Conditionally set REPLACE_VDPRINTF. * m4/wcsnrtombs.m4 (gl_FUNC_WCSNRTOMBS): Conditionally set REPLACE_WCSNRTOMBS. * m4/mbsnrtowcs.m4 (gl_FUNC_MBSNRTOWCS): Conditionally set REPLACE_MBSNRTOWCS. * lib/wchar.in.h (mbsnrtowcs): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/execvpe.m4 (gl_FUNC_EXECVPE): Conditionally set REPLACE_EXECVPE. * m4/linkat.m4 (gl_FUNC_LINKAT): Conditionally set REPLACE_LINKAT. * m4/readlinkat.m4 (gl_FUNC_READLINKAT): Conditionally set REPLACE_READLINKAT. * m4/symlinkat.m4 (gl_FUNC_SYMLINKAT): Conditionally set REPLACE_SYMLINKAT. * m4/truncate.m4 (gl_FUNC_TRUNCATE): Conditionally set REPLACE_TRUNCATE. * lib/unistd.in.h (execvpe, linkat, readlinkat, symlinkat, truncate): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/mkfifoat.m4 (gl_FUNC_MKFIFOAT): Conditionally set REPLACE_MKNODAT. * lib/sys_stat.in.h (mknodat): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/stpncpy.m4 (gl_FUNC_STPNCPY): Conditionally set REPLACE_STPNCPY. * lib/string.in.h (stpncpy): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/random.m4 (gl_FUNC_RANDOM): Conditionally set REPLACE_INITSTATE, REPLACE_SETSTATE. * lib/stdlib.in.h (initstate, setstate): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/dprintf.m4 (gl_REPLACE_DPRINTF): Conditionally set REPLACE_DPRINTF. * lib/stdio.in.h (dprintf): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/duplocale.m4 (gl_FUNC_DUPLOCALE): Conditionally set REPLACE_DUPLOCALE. * m4/localename.m4 (gl_LOCALENAME): Conditionally set REPLACE_NEWLOCALE, REPLACE_DUPLOCALE, REPLACE_FREELOCALE. * lib/locale.in.h (newlocale, duplocale, freelocale): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * lib/unistd.in.h (dup3): Consider REPLACE_DUP3. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_DUP3. * modules/unistd (Makefile.am): Substitute REPLACE_DUP3. * m4/dup3.m4 (gl_FUNC_DUP3): Conditionally set REPLACE_DUP3. * lib/string.in.h (stpcpy): Consider REPLACE_STPCPY. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/string_h.m4 (gl_STRING_H_DEFAULTS): Initialize REPLACE_STPCPY. * modules/string (Makefile.am): Substitute REPLACE_STPCPY. * m4/stpcpy.m4 (gl_FUNC_STPCPY): Conditionally set REPLACE_STPCPY. * modules/stpcpy (configure.ac): Consider REPLACE_STPCPY. * lib/stdlib.in.h (_Exit): Consider REPLACE__EXIT. Disable _GL_CXXALIASWARN invocation on non-glibc systems. (getprogname): Consider REPLACE_GETPROGNAME. Disable _GL_CXXALIASWARN invocation on non-glibc systems. (posix_openpt): Consider REPLACE_POSIX_OPENPT. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE__EXIT, REPLACE_GETPROGNAME, REPLACE_POSIX_OPENPT. * modules/stdlib (Makefile.am): Substitute REPLACE__EXIT, REPLACE_GETPROGNAME, REPLACE_POSIX_OPENPT. * m4/_Exit.m4 (gl_FUNC__EXIT): Conditionally set REPLACE__EXIT. * modules/_Exit (configure.ac): Consider REPLACE__EXIT. * m4/getprogname.m4 (gl_FUNC_GETPROGNAME): Conditionally set REPLACE_GETPROGNAME. * modules/getprogname (configure.ac): Consider REPLACE_GETPROGNAME. * m4/posix_openpt.m4 (gl_FUNC_POSIX_OPENPT): Conditionally set REPLACE_POSIX_OPENPT. * modules/posix_openpt (configure.ac): Consider REPLACE_POSIX_OPENPT. * lib/search.in.h (twalk): Consider REPLACE_TWALK. * m4/search_h.m4 (gl_SEARCH_H_DEFAULTS): Initialize REPLACE_TWALK. * modules/search (Makefile.am): Substitute REPLACE_TWALK. * m4/tsearch.m4 (gl_FUNC_TSEARCH): Conditionally set REPLACE_TWALK. * modules/tsearch (configure.ac): Consider REPLACE_TWALK. 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 19. * lib/inttypes.in.h (imaxabs): Consider REPLACE_IMAXABS. Disable _GL_CXXALIASWARN invocation on non-glibc systems. (imaxdiv): Consider REPLACE_IMAXDIV. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/inttypes.m4 (gl_INTTYPES_H_DEFAULTS): Initialize HAVE_IMAXABS, HAVE_IMAXDIV, REPLACE_IMAXABS, REPLACE_IMAXDIV. * modules/inttypes-incomplete (Makefile.am): Substitute REPLACE_IMAXABS, REPLACE_IMAXDIV. * m4/imaxabs.m4 (gl_FUNC_IMAXABS): Conditionally set HAVE_IMAXABS, REPLACE_IMAXABS. * modules/imaxabs (configure.ac): Consider HAVE_IMAXABS, REPLACE_IMAXABS. * m4/imaxdiv.m4 (gl_FUNC_IMAXDIV): Conditionally set HAVE_IMAXDIV, REPLACE_IMAXDIV. * modules/imaxdiv (configure.ac): Consider HAVE_IMAXDIV, REPLACE_IMAXDIV. * m4/futimens.m4 (gl_FUNC_FUTIMENS): Conditionally set REPLACE_FUTIMENS. * lib/sys_stat.in.h (futimens): Disable _GL_CXXALIASWARN invocation on non-glibc systems. 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 18. * m4/log2.m4 (gl_FUNC_LOG2): Conditionally set REPLACE_LOG2. * m4/log2f.m4 (gl_FUNC_LOG2F): Conditionally set REPLACE_LOG2F. * m4/log2l.m4 (gl_FUNC_LOG2L): Conditionally set REPLACE_LOG2L. * lib/math.in.h (log2f): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/getdelim.m4 (gl_FUNC_GETDELIM): Conditionally set REPLACE_GETDELIM. * m4/getline.m4 (gl_FUNC_GETLINE): Conditionally set REPLACE_GETLINE. * lib/stdio.in.h (getdelim, getline): Disable _GL_CXXALIASWARN invocation on non-glibc systems. 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 16-17. * m4/posix_memalign.m4 (gl_FUNC_POSIX_MEMALIGN): Conditionally set REPLACE_POSIX_MEMALIGN. * lib/stdlib.in.h (posix_memalign): Disable _GL_CXXALIASWARN invocation on non-glibc systems. 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 16. * m4/tsearch.m4 (gl_FUNC_TSEARCH): Conditionally set REPLACE_TSEARCH. * lib/search.in.h (tsearch, tfind, tdelete, twalk): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/faccessat.m4 (gl_FUNC_FACCESSAT): Conditionally set REPLACE_FACCESSAT. * lib/unistd.in.h (faccessat): Disable _GL_CXXALIASWARN invocation on non-glibc systems. 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 12. * m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Conditionally set REPLACE_UTIMENSAT. * lib/sys_stat.in.h (utimensat): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/timegm.m4 (gl_FUNC_TIMEGM): Conditionally set REPLACE_TIMEGM. * lib/time.in.h (timegm): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/pwrite.m4 (gl_FUNC_PWRITE): Conditionally set REPLACE_PWRITE. * lib/unistd.in.h (pwrite): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/pread.m4 (gl_FUNC_PREAD): Conditionally set REPLACE_PREAD. * lib/unistd.in.h (pread): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/ftruncate.m4 (gl_FUNC_FTRUNCATE): Conditionally set REPLACE_FTRUNCATE. * lib/unistd.in.h (ftruncate): Disable _GL_CXXALIASWARN invocation on non-glibc systems. 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 9. * lib/unistd.in.h (fdatasync): Consider REPLACE_FDATASYNC. Disable _GL_CXXALIASWARN invocation on non-glibc systems. (pipe2): Consider REPLACE_PIPE2. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_FDATASYNC, REPLACE_PIPE2. * modules/unistd (Makefile.am): Substitute REPLACE_FDATASYNC, REPLACE_PIPE2. * m4/fdatasync.m4 (gl_FUNC_FDATASYNC): Test for fdatasync using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. Conditionally set REPLACE_FDATASYNC. * modules/fdatasync (Depends-on, configure.ac): Consider REPLACE_FDATASYNC. * m4/pipe2.m4 (gl_FUNC_PIPE2): Conditionally set REPLACE_PIPE2. 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 8. * m4/ttyname_r.m4 (gl_FUNC_TTYNAME_R): Conditionally set REPLACE_TTYNAME_R. * lib/unistd.in.h (ttyname_r): Disable _GL_CXXALIASWARN invocation on non-glibc systems. 2023-01-22 Bruno Haible Prepare for resolving conflicts regarding future Android API levels. * m4/gnulib-common.m4 (gl_CHECK_FUNCS_ANDROID): Don't check for the function declaration on platforms other than Android. Set a variable gl_cv_onwards_func_.