Kevin Cernekee wrote:
The changes to the AC_RUN_IFELSE test programs do not have an effect
on Android since we are cross-compiling:
checking whether dup2 works... guessing no
[...]
checking whether fcntl handles F_DUPFD correctly... guessing no
How about if we stop guessing no on Android when cross-compiling? Does the
attached patch (which I installed) fix things for you?
>From 66b4ceb0312ac4b047820a4b847fc8494a325f5d Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Wed, 18 Feb 2015 23:20:55 -0800
Subject: [PATCH] dup2, fcntl: cross-compiler better for Android
Problem reported by Kevin Cernekee in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00109.html
* m4/dup2.m4 (gl_FUNC_DUP2): Don't guess no when cross-compiling
for a Linux kernel. That kernel bug was fixed on 2009-05-11, and
there's little need to cross-compile for older kernels nowadays.
* m4/fcntl.m4 (gl_FUNC_FCNTL): When cross-compiling, guess no only
for systems where the bug is known to occur (AIX, Cygwin, Haiku).
---
ChangeLog | 11 +++++++++++
m4/dup2.m4 | 5 +----
m4/fcntl.m4 | 10 +++++-----
3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index eacb80b..53468af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2015-02-18 Paul Eggert <egg...@cs.ucla.edu>
+
+ dup2, fcntl: cross-compiler better for Android
+ Problem reported by Kevin Cernekee in:
+ http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00109.html
+ * m4/dup2.m4 (gl_FUNC_DUP2): Don't guess no when cross-compiling
+ for a Linux kernel. That kernel bug was fixed on 2009-05-11, and
+ there's little need to cross-compile for older kernels nowadays.
+ * m4/fcntl.m4 (gl_FUNC_FCNTL): When cross-compiling, guess no only
+ for systems where the bug is known to occur (AIX, Cygwin, Haiku).
+
2015-02-18 Pádraig Brady <p...@draigbrady.com>
getopt: don't crash on memory exhaustion
diff --git a/m4/dup2.m4 b/m4/dup2.m4
index fec42b0..9aa2ea8 100644
--- a/m4/dup2.m4
+++ b/m4/dup2.m4
@@ -1,4 +1,4 @@
-#serial 21
+#serial 22
dnl Copyright (C) 2002, 2005, 2007, 2009-2015 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -64,9 +64,6 @@ AC_DEFUN([gl_FUNC_DUP2],
gl_cv_func_dup2_works="guessing no" ;;
cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0
gl_cv_func_dup2_works="guessing no" ;;
- linux*) # On linux between 2008-07-27 and 2009-05-11, dup2 of a
- # closed fd may yield -EBADF instead of -1 / errno=EBADF.
- gl_cv_func_dup2_works="guessing no" ;;
aix* | freebsd*)
# on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE,
# not EBADF.
diff --git a/m4/fcntl.m4 b/m4/fcntl.m4
index 1fce0f7..046ac5f 100644
--- a/m4/fcntl.m4
+++ b/m4/fcntl.m4
@@ -1,4 +1,4 @@
-# fcntl.m4 serial 6
+# fcntl.m4 serial 7
dnl Copyright (C) 2009-2015 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -51,10 +51,10 @@ AC_DEFUN([gl_FUNC_FCNTL],
return result;]])],
[gl_cv_func_fcntl_f_dupfd_works=yes],
[gl_cv_func_fcntl_f_dupfd_works=no],
- [# Guess that it works on glibc systems
- case $host_os in #((
- *-gnu*) gl_cv_func_fcntl_f_dupfd_works="guessing yes";;
- *) gl_cv_func_fcntl_f_dupfd_works="guessing no";;
+ [case $host_os in
+ aix* | cygwin* | haiku*)
+ gl_cv_func_dup2_works="guessing no" ;;
+ *) gl_cv_func_dup2_works="guessing yes" ;;
esac])])
case $gl_cv_func_fcntl_f_dupfd_works in
*yes) ;;
--
2.1.0