bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: bug-gnulib@gnu.org, landfillbaby69@gmail.com
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH 2/2] strerror_r-posix: port better to Android
Date: Wed,  8 Sep 2021 09:47:17 -0700	[thread overview]
Message-ID: <20210908164717.71331-2-eggert@cs.ucla.edu> (raw)
In-Reply-To: <20210908164717.71331-1-eggert@cs.ucla.edu>

* m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Move requirement of
gl_USE_SYSTEM_EXTENSIONS from here ...
(gl_FUNC_STRERROR_R_WORKS): ... to here, which is the macro that
actually needs it.  This avoids a bug where 'configure' tests
whether strerror_r has the POSIX API before enabling GNU
extensions.  On Android, enabling GNU extensions switches from the
POSIX to the GNU API.  Problem reported by Lucy Phipps in:
https://lists.gnu.org/r/bug-gnulib/2021-09/msg00026.html
---
 ChangeLog        | 10 ++++++++++
 m4/strerror_r.m4 | 10 ++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d2dd671c5b..1db7e333bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2021-09-08  Paul Eggert  <eggert@cs.ucla.edu>
 
+	strerror_r-posix: port better to Android
+	* m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Move requirement of
+	gl_USE_SYSTEM_EXTENSIONS from here ...
+	(gl_FUNC_STRERROR_R_WORKS): ... to here, which is the macro that
+	actually needs it.  This avoids a bug where 'configure' tests
+	whether strerror_r has the POSIX API before enabling GNU
+	extensions.  On Android, enabling GNU extensions switches from the
+	POSIX to the GNU API.  Problem reported by Lucy Phipps in:
+	https://lists.gnu.org/r/bug-gnulib/2021-09/msg00026.html
+
 	string, wchar: port rpl_free decl to Android
 	* lib/string.in.h, lib/wchar.in.h:
 	(free): When replacing it, declare the unreplaced version too.
diff --git a/m4/strerror_r.m4 b/m4/strerror_r.m4
index 0689e46dc6..29b309221f 100644
--- a/m4/strerror_r.m4
+++ b/m4/strerror_r.m4
@@ -1,4 +1,4 @@
-# strerror_r.m4 serial 21
+# strerror_r.m4 serial 22
 dnl Copyright (C) 2002, 2007-2021 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,9 +9,6 @@ AC_DEFUN([gl_FUNC_STRERROR_R],
   AC_REQUIRE([gl_STRING_H_DEFAULTS])
   AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS])
 
-  dnl Persuade Solaris <string.h> to declare strerror_r().
-  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
   dnl Some systems don't declare strerror_r() if _THREAD_SAFE and _REENTRANT
   dnl are not defined.
   AC_CHECK_DECLS_ONCE([strerror_r])
@@ -52,6 +49,11 @@ AC_DEFUN([gl_FUNC_STRERROR_R_WORKS],
 [
   AC_REQUIRE([gl_HEADER_ERRNO_H])
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl Persuade Android <string.h> to use the GNU strerror_r API,
+  dnl and Solaris <string.h> to declare strerror_r.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
   AC_REQUIRE([gl_FUNC_STRERROR_0])
 
   AC_CHECK_FUNCS_ONCE([strerror_r])
-- 
2.31.1



      reply	other threads:[~2021-09-08 16:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08 16:47 [PATCH 1/2] string, wchar: port rpl_free decl to Android Paul Eggert
2021-09-08 16:47 ` Paul Eggert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210908164717.71331-2-eggert@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=bug-gnulib@gnu.org \
    --cc=landfillbaby69@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).