]> Savannah Git Hosting - gnulib.git/commitdiff
Recognize functions added in future versions of Android.
authorBruno Haible <bruno@clisp.org>
Thu, 5 Jan 2023 15:36:52 +0000 (16:36 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 5 Jan 2023 15:36:52 +0000 (16:36 +0100)
* 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.

15 files changed:
ChangeLog
doc/glibc-functions/getentropy.texi
doc/glibc-functions/getrandom.texi
doc/posix-functions/pthread_attr_getinheritsched.texi
doc/posix-functions/pthread_attr_setinheritsched.texi
m4/aligned_alloc.m4
m4/freading.m4
m4/fseterr.m4
m4/fwriting.m4
m4/getentropy.m4
m4/getlogin_r.m4
m4/getrandom.m4
m4/glob.m4
m4/gnulib-common.m4
m4/spawn_h.m4

index b0a6cf4d5ea7b817dc620bf5defff081ec38c188..7327d57a4c3b69d9f20f9ba783bdfd86675bf7c3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2023-01-05  Bruno Haible  <bruno@clisp.org>
+
+       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.
+
 2023-01-05  Bruno Haible  <bruno@clisp.org>
 
        copy-file, supersede: Fix link-time requirements.
index 4cee07840238c0432b069f60bb5fa4c1df4d48ea..4b2551c465e4ebea88b11586d559e95472f238c8 100644 (file)
@@ -21,7 +21,7 @@ Portability problems fixed by Gnulib:
 @itemize
 @item
 This function is missing on some platforms:
-glibc 2.24, Mac OS X 10.11, FreeBSD 11.0, NetBSD 9.0, OpenBSD 5.5, Minix 3.3, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.0, Cygwin 1.7.x, mingw, MSVC 14, Android 9.0.
+glibc 2.24, Mac OS X 10.11, FreeBSD 11.0, NetBSD 9.0, OpenBSD 5.5, Minix 3.3, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.0, Cygwin 1.7.x, mingw, MSVC 14, Android 8.1.
 @item
 This function is declared in @code{<sys/random.h>}, not in @code{<unistd.h>},
 on some platforms:
index db817363cd88fb3e27cd5b25046672f9828a8740..66e8588b3202a088813cccefd85f8923277f161a 100644 (file)
@@ -21,7 +21,7 @@ Portability problems fixed by Gnulib:
 @itemize
 @item
 This function is missing on some platforms:
-glibc 2.24, macOS 11.1, FreeBSD 11.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.3, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.0, Cygwin 1.7.x, mingw, MSVC 14, Android 9.0.
+glibc 2.24, macOS 11.1, FreeBSD 11.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.3, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.0, Cygwin 1.7.x, mingw, MSVC 14, Android 8.1.
 @item
 This function has a different return type on some platforms:
 Solaris 11.4.
index 12a5f955db53dce38e0dbff58c5e8f994c477e73..2d135a545a3ab82fe07e9f070a0650486917601f 100644 (file)
@@ -14,5 +14,5 @@ Portability problems not fixed by Gnulib:
 @itemize
 @item
 This function is missing on some platforms:
-Minix 3.1.8, mingw, MSVC 14, Android 9.0.
+Minix 3.1.8, mingw, MSVC 14, Android 8.1.
 @end itemize
index 652e41e616f50e431ffd6d7aade8886031289251..6fad04c670022b57769f2d9cbbef401f77f6429d 100644 (file)
@@ -14,5 +14,5 @@ Portability problems not fixed by Gnulib:
 @itemize
 @item
 This function is missing on some platforms:
-Minix 3.1.8, mingw, MSVC 14, Android 9.0.
+Minix 3.1.8, mingw, MSVC 14, Android 8.1.
 @end itemize
index 31681ac52a29f4a0342a0854ad051b7b7f3ec47b..d088701dbc7edd017cb022b690c8f4c597ce79c6 100644 (file)
@@ -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 *).
index 35333369dfd6d60e16b00813144c5537659ca5f1..f0f4893335a7ff43cf39a1fd3887850cf020f4ea 100644 (file)
@@ -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>
+    ]])
 ])
index ecdc81e769e8477997009a00cfec35de6e5ec313..61ac03d49d11601ade4e470c288a4924ec0e3c90 100644 (file)
@@ -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>
+    ]])
 ])
index eee7d506783fb5ea454c468475cd9a5ccc5a51d0..8631fdf32347a068138792bcf934e8fea1db9ee2 100644 (file)
@@ -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>
+    ]])
 ])
index 0c6cda88f5801150b4d04507dfc4e791630b4fa1..352b04ee4f3e78056a094fadb7903b5b92d5d138 100644 (file)
@@ -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
index db9e37af4561645de9f2fe6563b6c3ea5fc13063..cbfe255ee12fd5aab52051339dee1269dbbf1886 100644 (file)
@@ -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
index 95111567d794cd1ab5085b21dff4e6f985a7b77e..f2010c0213fd326097d266e7c6c6937cc1a4beec 100644 (file)
@@ -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
index 4254b6e572bd77833734c50f81ad06447f8164aa..354581b3beebdc7d3804c225e5cc80fbe0a226a6 100644 (file)
@@ -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])
 ])
index fb7fed41f86eba882ea930094ee009f7dde6ec1e..26239caa2b148937420807c3be1765ff015921b9 100644 (file)
@@ -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
index d2c524232633fe50da3a3466810df8c2bff12c91..118490adb7eb8a811f74965375859c98ac7b51ce 100644 (file)
@@ -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