summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-01-05 16:36:52 +0100
committerBruno Haible <bruno@clisp.org>2023-01-05 16:36:52 +0100
commitcf2937d427fd4fc5841b12f2da7ca38297738bf6 (patch)
tree5c5e4d7698f9a5df86309074ae1030b429f165ce /m4
parentc11db345baddcd05f96f57e0318fbf0b028d4536 (diff)
downloadgnulib-cf2937d427fd4fc5841b12f2da7ca38297738bf6.tar.gz
Recognize functions added in future versions of Android.
* m4/gnulib-common.m4 (gl_CHECK_FUNCS_ANDROID): New macro. * m4/aligned_alloc.m4 (gl_FUNC_ALIGNED_ALLOC): Use gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. * m4/freading.m4 (gl_FUNC_FREADING): Likewise. * m4/fseterr.m4 (gl_FUNC_FSETERR): Likewise. * m4/fwriting.m4 (gl_FUNC_FWRITING): Likewise. * m4/getentropy.m4 (gl_FUNC_GETENTROPY): Likewise. * m4/getlogin_r.m4 (gl_CHECK_FUNCS_ANDROID): Likewise. * m4/getrandom.m4 (gl_FUNC_GETRANDOM): Likewise. * m4/glob.m4 (gl_PREREQ_GLOB): Likewise. * m4/spawn_h.m4 (gl_HAVE_POSIX_SPAWN): Likewise. * doc/glibc-functions/getentropy.texi: Mark function as existing in Android 9.0. * doc/glibc-functions/getrandom.texi: Likewise. * doc/posix-functions/pthread_attr_getinheritsched.texi: Likewise. * doc/posix-functions/pthread_attr_setinheritsched.texi: Likewise.
Diffstat (limited to 'm4')
-rw-r--r--m4/aligned_alloc.m44
-rw-r--r--m4/freading.m47
-rw-r--r--m4/fseterr.m47
-rw-r--r--m4/fwriting.m47
-rw-r--r--m4/getentropy.m411
-rw-r--r--m4/getlogin_r.m44
-rw-r--r--m4/getrandom.m410
-rw-r--r--m4/glob.m45
-rw-r--r--m4/gnulib-common.m426
-rw-r--r--m4/spawn_h.m44
10 files changed, 66 insertions, 19 deletions
diff --git a/m4/aligned_alloc.m4 b/m4/aligned_alloc.m4
index 31681ac52a..d088701dbc 100644
--- a/m4/aligned_alloc.m4
+++ b/m4/aligned_alloc.m4
@@ -1,4 +1,4 @@
-# aligned_alloc.m4 serial 3
+# aligned_alloc.m4 serial 4
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_ALIGNED_ALLOC],
dnl Persuade glibc and OpenBSD <stdlib.h> to declare aligned_alloc().
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_CHECK_FUNCS_ONCE([aligned_alloc])
+ gl_CHECK_FUNCS_ANDROID([aligned_alloc], [[#include <stdlib.h>]])
if test $ac_cv_func_aligned_alloc = yes; then
dnl On macOS 11.1 and AIX 7.2, aligned_alloc returns NULL when the alignment
dnl argument is smaller than sizeof (void *).
diff --git a/m4/freading.m4 b/m4/freading.m4
index 35333369df..f0f4893335 100644
--- a/m4/freading.m4
+++ b/m4/freading.m4
@@ -1,4 +1,4 @@
-# freading.m4 serial 2
+# freading.m4 serial 3
dnl Copyright (C) 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,
@@ -7,5 +7,8 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_FREADING],
[
AC_CHECK_HEADERS_ONCE([stdio_ext.h])
- AC_CHECK_FUNCS_ONCE([__freading])
+ gl_CHECK_FUNCS_ANDROID([__freading],
+ [[#include <stdio.h>
+ #include <stdio_ext.h>
+ ]])
])
diff --git a/m4/fseterr.m4 b/m4/fseterr.m4
index ecdc81e769..61ac03d49d 100644
--- a/m4/fseterr.m4
+++ b/m4/fseterr.m4
@@ -1,4 +1,4 @@
-# fseterr.m4 serial 1
+# fseterr.m4 serial 2
dnl Copyright (C) 2012-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 +6,8 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_FSETERR],
[
- AC_CHECK_FUNCS_ONCE([__fseterr])
+ gl_CHECK_FUNCS_ANDROID([__fseterr],
+ [[#include <stdio.h>
+ #include <stdio_ext.h>
+ ]])
])
diff --git a/m4/fwriting.m4 b/m4/fwriting.m4
index eee7d50678..8631fdf323 100644
--- a/m4/fwriting.m4
+++ b/m4/fwriting.m4
@@ -1,4 +1,4 @@
-# fwriting.m4 serial 3
+# fwriting.m4 serial 4
dnl Copyright (C) 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,
@@ -7,5 +7,8 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_FWRITING],
[
AC_CHECK_HEADERS_ONCE([stdio_ext.h])
- AC_CHECK_FUNCS_ONCE([__fwriting])
+ gl_CHECK_FUNCS_ANDROID([__fwriting],
+ [[#include <stdio.h>
+ #include <stdio_ext.h>
+ ]])
])
diff --git a/m4/getentropy.m4 b/m4/getentropy.m4
index 0c6cda88f5..352b04ee4f 100644
--- a/m4/getentropy.m4
+++ b/m4/getentropy.m4
@@ -1,4 +1,4 @@
-# getentropy.m4
+# getentropy.m4 serial 2
dnl Copyright 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,
@@ -9,7 +9,14 @@ dnl Written by Paul Eggert.
AC_DEFUN([gl_FUNC_GETENTROPY],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
- AC_CHECK_FUNCS_ONCE([getentropy])
+ gl_CHECK_FUNCS_ANDROID([getentropy],
+ [[#include <unistd.h>
+ /* Additional includes are needed before <sys/random.h> on uClibc
+ and Mac OS X. */
+ #include <sys/types.h>
+ #include <stdlib.h>
+ #include <sys/random.h>
+ ]])
if test $ac_cv_func_getentropy = no; then
HAVE_GETENTROPY=0
fi
diff --git a/m4/getlogin_r.m4 b/m4/getlogin_r.m4
index db9e37af45..cbfe255ee1 100644
--- a/m4/getlogin_r.m4
+++ b/m4/getlogin_r.m4
@@ -1,4 +1,4 @@
-#serial 13
+#serial 14
# Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc.
#
@@ -25,7 +25,7 @@ AC_DEFUN([gl_FUNC_GETLOGIN_R],
HAVE_DECL_GETLOGIN_R=0
fi
- AC_CHECK_FUNCS_ONCE([getlogin_r])
+ gl_CHECK_FUNCS_ANDROID([getlogin_r], [[#include <unistd.h>]])
if test $ac_cv_func_getlogin_r = no; then
HAVE_GETLOGIN_R=0
else
diff --git a/m4/getrandom.m4 b/m4/getrandom.m4
index 95111567d7..f2010c0213 100644
--- a/m4/getrandom.m4
+++ b/m4/getrandom.m4
@@ -1,4 +1,4 @@
-# getrandom.m4 serial 8
+# getrandom.m4 serial 9
dnl Copyright 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,
@@ -9,7 +9,13 @@ dnl Written by Paul Eggert.
AC_DEFUN([gl_FUNC_GETRANDOM],
[
AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS])
- AC_CHECK_FUNCS_ONCE([getrandom])
+ gl_CHECK_FUNCS_ANDROID([getrandom],
+ [[/* Additional includes are needed before <sys/random.h> on uClibc
+ and Mac OS X. */
+ #include <sys/types.h>
+ #include <stdlib.h>
+ #include <sys/random.h>
+ ]])
if test "$ac_cv_func_getrandom" != yes; then
HAVE_GETRANDOM=0
else
diff --git a/m4/glob.m4 b/m4/glob.m4
index 4254b6e572..354581b3be 100644
--- a/m4/glob.m4
+++ b/m4/glob.m4
@@ -1,4 +1,4 @@
-# glob.m4 serial 26
+# glob.m4 serial 27
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,
@@ -125,5 +125,6 @@ AC_DEFUN([gl_PREREQ_GLOB],
[
AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])
AC_CHECK_HEADERS_ONCE([unistd.h])
- AC_CHECK_FUNCS_ONCE([getlogin_r getpwnam_r])
+ gl_CHECK_FUNCS_ANDROID([getlogin_r], [[#include <unistd.h>]])
+ AC_CHECK_FUNCS_ONCE([getpwnam_r])
])
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index fb7fed41f8..26239caa2b 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 75
+# gnulib-common.m4 serial 76
dnl Copyright (C) 2007-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,
@@ -1023,6 +1023,30 @@ AC_DEFUN([gl_CONDITIONAL_HEADER],
m4_popdef([gl_header_name])
])
+dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]])
+dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem
+dnl on Android.
+dnl Namely, if func was added to Android API level, say, 28, then the libc.so
+dnl has the symbol func always, whereas the header file <foo.h> declares func
+dnl conditionally:
+dnl #if __ANDROID_API__ >= 28
+dnl ... func (...) __INTRODUCED_IN(28);
+dnl #endif
+dnl Thus, when compiling with "clang -target armv7a-unknown-linux-android28",
+dnl the function func is declared and exists in libc.
+dnl Whereas when compiling with "clang -target armv7a-unknown-linux-android27",
+dnl the function func is not declared but exists in libc. We need to treat this
+dnl case like the case where func does not exist.
+AC_DEFUN([gl_CHECK_FUNCS_ANDROID],
+[
+ AC_CHECK_DECL([$1], , , [$2])
+ if test $ac_cv_have_decl_[$1] = yes; then
+ AC_CHECK_FUNCS([$1])
+ else
+ ac_cv_func_[$1]=no
+ fi
+])
+
dnl Expands to some code for use in .c programs that, on native Windows, defines
dnl the Microsoft deprecated alias function names to the underscore-prefixed
dnl actual function names. With this macro, these function names are available
diff --git a/m4/spawn_h.m4 b/m4/spawn_h.m4
index d2c5242326..118490adb7 100644
--- a/m4/spawn_h.m4
+++ b/m4/spawn_h.m4
@@ -1,4 +1,4 @@
-# spawn_h.m4 serial 21
+# spawn_h.m4 serial 22
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,
@@ -71,7 +71,7 @@ AC_DEFUN([gl_HAVE_POSIX_SPAWN],
AC_SEARCH_LIBS([posix_spawn], [rt],
[test "$ac_cv_search_posix_spawn" = "none required" ||
LIB_POSIX_SPAWN=$ac_cv_search_posix_spawn])
- AC_CHECK_FUNCS([posix_spawn])
+ gl_CHECK_FUNCS_ANDROID([posix_spawn], [[#include <spawn.h>]])
LIBS=$gl_saved_libs
if test $ac_cv_func_posix_spawn != yes; then