On Wed, Feb 18, 2015 at 11:30 PM, Paul Eggert <egg...@cs.ucla.edu> wrote:
> 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?

dup2 is guessed correctly:

    checking whether dup2 works... guessing yes

F_DUPFD is not, due to a minor C&P error (patch attached):

    checking whether fcntl handles F_DUPFD correctly...
    checking whether fcntl understands F_DUPFD_CLOEXEC... needs runtime check

However, I don't see how any of the m4 changes address the problem
that is causing the test cases to fail: lib/getdtablesize.c still
wants to rely on sysconf(_SC_OPEN_MAX) on Android, and that call just
blindly returns 256 on all released versions of the OS.  This is why
my earlier submission changed it to use getrlimit() instead.
From ee54270cba91ec73e398234c02a62192d542c403 Mon Sep 17 00:00:00 2001
From: Kevin Cernekee <cerne...@google.com>
Date: Thu, 19 Feb 2015 10:11:19 -0800
Subject: [PATCH] fcntl: Fix cross compiling

* m4/fcntl.m4 (gl_FUNC_FCNTL): Assign the guessed result to the
correct variable name (gl_cv_func_fcntl_f_dupfd_works).
---
 ChangeLog   | 6 ++++++
 m4/fcntl.m4 | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 53468afae26c..61bd393c5648 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-19  Kevin Cernekee  <cerne...@google.com>
+
+	fcntl: Fix cross compiling
+	* m4/fcntl.m4 (gl_FUNC_FCNTL): Assign the guessed result to the
+	correct variable name (gl_cv_func_fcntl_f_dupfd_works).
+
 2015-02-18  Paul Eggert  <egg...@cs.ucla.edu>
 
 	dup2, fcntl: cross-compiler better for Android
diff --git a/m4/fcntl.m4 b/m4/fcntl.m4
index 046ac5f7e966..218e78628ba0 100644
--- a/m4/fcntl.m4
+++ b/m4/fcntl.m4
@@ -53,8 +53,8 @@ AC_DEFUN([gl_FUNC_FCNTL],
          [gl_cv_func_fcntl_f_dupfd_works=no],
          [case $host_os in
             aix* | cygwin* | haiku*)
-               gl_cv_func_dup2_works="guessing no" ;;
-            *) gl_cv_func_dup2_works="guessing yes" ;;
+               gl_cv_func_fcntl_f_dupfd_works="guessing no" ;;
+            *) gl_cv_func_fcntl_f_dupfd_works="guessing yes" ;;
           esac])])
     case $gl_cv_func_fcntl_f_dupfd_works in
       *yes) ;;
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to