From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 4CF5E1F453 for ; Fri, 25 Jan 2019 01:17:31 +0000 (UTC) Received: from localhost ([127.0.0.1]:36396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmq7d-0007Ax-Mk for normalperson@yhbt.net; Thu, 24 Jan 2019 20:17:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmq7V-0007Ai-Ox for bug-gnulib@gnu.org; Thu, 24 Jan 2019 20:17:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmq5G-0002eb-SI for bug-gnulib@gnu.org; Thu, 24 Jan 2019 20:15:06 -0500 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::9]:18718) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmq5E-0002bT-Kw for bug-gnulib@gnu.org; Thu, 24 Jan 2019 20:15:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1548378896; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From: Subject:Sender; bh=dHaDP2MwWjUvSNupV6FEt9cY7ZFX+2lIcHR0pIMKz2k=; b=nhL8pOrXqPk3gGTIj3fmvT4yONfiYLiJC+ncfty8wESisPqx7JZ4V7MJEhRGvsCnFr iQYf1S7eoyBS+km8FGSxKVRAyKlS2HUDshqxmBpLEZR274JR4QjWuZ+9TNLe7d2z9BCX eR5vWnGzJhO1E6tkp+B2gRGrguTYW8iLQ/rG8wu46VJV3SKfGBDy9hIrg7ffH5O8UjK4 5YPjw/hvfSoGCqMz8QewcTj92pSVmmzXT1zD1tUF6OvJ/VEx4OsMBiRdIUAPsSjj9830 9DLILbjl33HpXBmFt1C262QUTa7stQDvbPbSXuiSIsOXUoPGnlJgHBeCQNxIV1exyo7U Jpjw== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOGKf2y/s=" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 44.9 DYNA|AUTH) with ESMTPSA id v0a34ev0P1EthWM (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Fri, 25 Jan 2019 02:14:55 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: fix some build errors on Android 4.3 Date: Fri, 25 Jan 2019 02:14:54 +0100 Message-ID: <1598905.455ImBSGp7@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-141-generic; KDE/5.18.0; x86_64; ; ) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart14211233.Yyp2yvHnxB" Content-Transfer-Encoding: 7Bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5300::9 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" This is a multi-part message in MIME format. --nextPart14211233.Yyp2yvHnxB Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" On Android 4.3 (native compilation environment, through the 'Terminal IDE' app), I'm seeing a number of build errors when building testdirs. I) There is no /bin/sh. The shell is /system/bin/sh and is available through $PATH. This causes problems in a couple of places. One of them is that all tests that are shell scripts fail with 'Bad interpreter' - because the test-driver installed by Automake assumes that all tests are executable, but all these shell scripts start with '#!/bin/sh'. The fix is to change gnulib-tool to tweak the test-driver, in a way that is suitable for gnulib (but not suitable in general). II) The environment uses a Bionic libc whose headers declare some functions which are not present in libc.so. (In newer Bionic libcs the declarations are conditionalized depending on the Android level.) 1) terminal-gcc -mandroid -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I../../gltests -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. -I../../gltests/.. -I../gllib -I../../gltests/../gllib -I/data/data/com.spartacusrex.spartacuside/files/local/include -Wall -g -O2 -c -o test-fchownat.o ../../gltests/test-fchownat.c ../../gltests/test-fchownat.c:24: error: 'fchownat' undeclared here (not in a function) make[4]: *** [test-fchownat.o] Error 1 libc.so has fchownat. It is declared in , not in . 2) terminal-gcc -mandroid -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I../../gltests -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. -I../../gltests/.. -I../gllib -I../../gltests/../gllib -I/data/data/com.spartacusrex.spartacuside/files/local/include -Wall -g -O2 -c -o test-renameat.o ../../gltests/test-renameat.c ../../gltests/test-renameat.c:24: error: 'renameat' undeclared here (not in a function) make[4]: *** [test-renameat.o] Error 1 libc.so has renameat. It is declared in , not in . 3) terminal-gcc -mandroid -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I../../gltests -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. -I../../gltests/.. -I../gllib -I../../gltests/../gllib -I/data/data/com.spartacusrex.spartacuside/files/local/include -Wall -g -O2 -c -o test-unlinkat.o ../../gltests/test-unlinkat.c ../../gltests/test-unlinkat.c:24: error: 'unlinkat' undeclared here (not in a function) make[4]: *** [test-unlinkat.o] Error 1 libc.so has unlinkat. It is declared in , not in . 4) terminal-gcc -mandroid -std=gnu99 -g -O2 -L/data/data/com.spartacusrex.spartacuside/files/local/lib -o test-fdatasync test-fdatasync.o libtests.a ../gllib/libgnu.a libtests.a test-fdatasync.o: In function `main': /data/data/com.spartacusrex.spartacuside/files/testdir-posix/build/gltests/../../gltests/test-fdatasync.c:38: undefined reference to `fdatasync' /data/data/com.spartacusrex.spartacuside/files/testdir-posix/build/gltests/../../gltests/test-fdatasync.c:50: undefined reference to `fdatasync' /data/data/com.spartacusrex.spartacuside/files/testdir-posix/build/gltests/../../gltests/test-fdatasync.c:56: undefined reference to `fdatasync' /data/data/com.spartacusrex.spartacuside/files/testdir-posix/build/gltests/../../gltests/test-fdatasync.c:63: undefined reference to `fdatasync' test-fdatasync.o:(.debug_info+0x2fb): undefined reference to `fdatasync' collect2: ld returned 1 exit status make[4]: *** [test-fdatasync] Error 1 libc.so does not have fdatasync. It is declared in . 5) terminal-gcc -mandroid -std=gnu99 -g -O2 -L/data/data/com.spartacusrex.spartacuside/files/local/lib -o test-wcrtomb test-wcrtomb.o libtests.a ../gllib/libgnu.a libtests.a test-wcrtomb.o: In function `check_character': /data/data/com.spartacusrex.spartacuside/files/testdir-posix/build/gltests/../../gltests/test-wcrtomb.c:42: undefined reference to `mbtowc' collect2: ld returned 1 exit status make[4]: *** [test-wcrtomb] Error 1 libc.so does not have mbtowc. It is declared in . 6) terminal-gcc -mandroid -std=gnu99 -g -O2 -L/data/data/com.spartacusrex.spartacuside/files/local/lib -o test-random test-random.o libtests.a ../gllib/libgnu.a libtests.a test-random.o: In function `main': /data/data/com.spartacusrex.spartacuside/files/testdir-posix/build/gltests/../../gltests/test-random.c:38: undefined reference to `initstate' test-random.o:(.debug_info+0x37b): undefined reference to `initstate' test-random.o:(.debug_info+0x3a0): undefined reference to `setstate' collect2: ld returned 1 exit status make[4]: *** [test-random] Error 1 libc.so does not have initstate and setstate, but has random and srandom. All these problems are fixed through the attached patches. --nextPart14211233.Yyp2yvHnxB Content-Disposition: attachment; filename="0001-gnulib-tool-Support-running-testdirs-on-Android.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-gnulib-tool-Support-running-testdirs-on-Android.patch" >From cd3b12d530aa48bd460a8795aec6da06cea595b4 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 23 Jan 2019 05:11:54 +0100 Subject: [PATCH 1/7] gnulib-tool: Support running testdirs on Android. * build-aux/test-driver.diff: New file. * gnulib-tool (func_create_testdir, func_create_megatestdir): Patch build-aux/test-driver after running automake. --- ChangeLog | 7 +++++++ build-aux/test-driver.diff | 14 ++++++++++++++ gnulib-tool | 40 ++++++++++++++++++++++++---------------- 3 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 build-aux/test-driver.diff diff --git a/ChangeLog b/ChangeLog index a8e03c5..7ba92a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2019-01-23 Bruno Haible + + gnulib-tool: Support running testdirs on Android. + * build-aux/test-driver.diff: New file. + * gnulib-tool (func_create_testdir, func_create_megatestdir): Patch + build-aux/test-driver after running automake. + 2019-01-23 Akim Demaille relocatable-prog: avoid warnings from Automake diff --git a/build-aux/test-driver.diff b/build-aux/test-driver.diff new file mode 100644 index 0000000..5f49e34 --- /dev/null +++ b/build-aux/test-driver.diff @@ -0,0 +1,14 @@ +--- test-driver.bak 2019-01-23 03:22:06.672283432 +0100 ++++ test-driver 2019-01-23 04:23:21.201060757 +0100 +@@ -104,7 +104,10 @@ + trap "st=143; $do_exit" 15 + + # Test script is run here. +-"$@" >$log_file 2>&1 ++case "$1" in ++ *.sh) sh "$@" >$log_file 2>&1 ;; ++ *) "$@" >$log_file 2>&1 ;; ++esac + estatus=$? + + if test $enable_hard_errors = no && test $estatus -eq 99; then diff --git a/gnulib-tool b/gnulib-tool index 9545796..44cfeb3 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -6654,27 +6654,32 @@ func_create_testdir () if test -n "$distributed_built_sources" || test -n "$tests_distributed_built_sources"; then (cd "$testdir" ./configure || func_exit 1 - if test -n "$distributed_built_sources"; then - cd "$sourcebase" - echo 'built_sources: $(BUILT_SOURCES)' >> Makefile - $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \ - built_sources \ - || func_exit 1 - cd .. - fi - if test -n "$tests_distributed_built_sources"; then - cd "$testsbase" - echo 'built_sources: $(BUILT_SOURCES)' >> Makefile - $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \ - built_sources \ - || func_exit 1 - cd .. - fi + if test -n "$distributed_built_sources"; then + cd "$sourcebase" + echo 'built_sources: $(BUILT_SOURCES)' >> Makefile + $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \ + built_sources \ + || func_exit 1 + cd .. + fi + if test -n "$tests_distributed_built_sources"; then + cd "$testsbase" + echo 'built_sources: $(BUILT_SOURCES)' >> Makefile + $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \ + built_sources \ + || func_exit 1 + cd .. + fi $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \ distclean \ || func_exit 1 ) || func_exit 1 fi + (cd "$testdir" + if test -f build-aux/test-driver; then + patch build-aux/test-driver < "$gnulib_dir"/build-aux/test-driver.diff || func_exit 1 + fi + ) || func_exit 1 } # func_create_megatestdir megatestdir allmodules @@ -6775,6 +6780,9 @@ func_create_megatestdir () func_execute_command ${AUTOCONF} || func_exit 1 func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1 rm -rf autom4te.cache + if test -f build-aux/test-driver; then + patch build-aux/test-driver < "$gnulib_dir"/build-aux/test-driver.diff || func_exit 1 + fi ) || func_exit 1 } -- 2.7.4 --nextPart14211233.Yyp2yvHnxB Content-Disposition: attachment; filename="0002-fchownat-Fix-compilation-error-on-Android-4.3.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0002-fchownat-Fix-compilation-error-on-Android-4.3.patch" >From 239485d0b3f04fd9ba8d3bd4bb99473b00ab9078 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 24 Jan 2019 23:51:11 +0100 Subject: [PATCH 2/7] fchownat: Fix compilation error on Android 4.3. * lib/unistd.in.h: Include when module 'fchownat' is in use. * m4/fchownat.m4 (gl_FUNC_FCHOWNAT_DEREF_BUG, gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG): Include also . * doc/posix-functions/fchownat.texi: Mention the issue. --- ChangeLog | 9 +++++++++ doc/posix-functions/fchownat.texi | 20 ++++++++++++-------- lib/unistd.in.h | 7 +++++++ m4/fchownat.m4 | 6 +++++- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ba92a9..5606681 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2019-01-24 Bruno Haible + + fchownat: Fix compilation error on Android 4.3. + * lib/unistd.in.h: Include when module 'fchownat' is in + use. + * m4/fchownat.m4 (gl_FUNC_FCHOWNAT_DEREF_BUG, + gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG): Include also . + * doc/posix-functions/fchownat.texi: Mention the issue. + 2019-01-23 Bruno Haible gnulib-tool: Support running testdirs on Android. diff --git a/doc/posix-functions/fchownat.texi b/doc/posix-functions/fchownat.texi index c33bdc4..47a7225 100644 --- a/doc/posix-functions/fchownat.texi +++ b/doc/posix-functions/fchownat.texi @@ -9,6 +9,18 @@ Gnulib module: fchownat Portability problems fixed by Gnulib: @itemize @item +This function is missing on some platforms: +glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, +AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Cygwin 1.5.x, mingw, MSVC 14, Interix 3.5, BeOS. +But the replacement function is not safe to be used in libraries and +is not multithread-safe. Also, the replacement may fail to change +symlinks if @code{lchown} is unsupported, or fail altogether if +@code{chown} is unsupported. +@item +This function is declared in @code{}, not in @code{}, +on some platforms: +Android 4.3. +@item Some platforms fail to detect trailing slash on non-directories, as in @code{fchown(dir,"link-to-file/",uid,gid,flag)}: Solaris 9. @@ -19,14 +31,6 @@ Linux kernel 2.6.17. @item This function does not fail for an empty filename on some platforms: Linux with glibc < 2.11. -@item -This function is missing on some platforms: -glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, -AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Cygwin 1.5.x, mingw, MSVC 14, Interix 3.5, BeOS. -But the replacement function is not safe to be used in libraries and -is not multithread-safe. Also, the replacement may fail to change -symlinks if @code{lchown} is unsupported, or fail altogether if -@code{chown} is unsupported. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 49e5673..eb2534e 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -113,6 +113,13 @@ # include #endif +/* Android 4.3 declares fchownat in , not in . */ +/* But avoid namespace pollution on glibc systems. */ +#if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ + && !defined __GLIBC__ +# include +#endif + /* MSVC defines off_t in . May also define off_t to a 64-bit type on native Windows. */ #if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@ diff --git a/m4/fchownat.m4 b/m4/fchownat.m4 index 5cca8b5..023e3cb 100644 --- a/m4/fchownat.m4 +++ b/m4/fchownat.m4 @@ -1,4 +1,4 @@ -# fchownat.m4 serial 2 +# fchownat.m4 serial 3 dnl Copyright (C) 2004-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -56,6 +56,8 @@ AC_DEFUN([gl_FUNC_FCHOWNAT_DEREF_BUG], [[ #include #include +/* Android 4.3 declares fchownat() in instead. */ +#include #include #include #include @@ -86,6 +88,8 @@ AC_DEFUN([gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG], [AC_LANG_PROGRAM( [[#include #include + /* Android 4.3 declares fchownat() in instead. */ + #include ]], [[int fd; int ret; -- 2.7.4 --nextPart14211233.Yyp2yvHnxB Content-Disposition: attachment; filename="0003-renameat-Fix-compilation-error-on-Android-4.3.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0003-renameat-Fix-compilation-error-on-Android-4.3.patch" >From 881edc83d5cdf29b7697353db5e6800a6deb46d5 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 25 Jan 2019 00:03:12 +0100 Subject: [PATCH 3/7] renameat: Fix compilation error on Android 4.3. * lib/stdio.in.h: Include when module 'renameat' is in use. * doc/posix-functions/renameat.texi: Mention the issue. --- ChangeLog | 6 ++++++ doc/posix-functions/renameat.texi | 25 +++++++++++++++---------- lib/stdio.in.h | 7 +++++++ 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5606681..fad53ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2019-01-24 Bruno Haible + renameat: Fix compilation error on Android 4.3. + * lib/stdio.in.h: Include when module 'renameat' is in use. + * doc/posix-functions/renameat.texi: Mention the issue. + +2019-01-24 Bruno Haible + fchownat: Fix compilation error on Android 4.3. * lib/unistd.in.h: Include when module 'fchownat' is in use. diff --git a/doc/posix-functions/renameat.texi b/doc/posix-functions/renameat.texi index 1411e2e..bbd1110 100644 --- a/doc/posix-functions/renameat.texi +++ b/doc/posix-functions/renameat.texi @@ -9,6 +9,21 @@ Gnulib module: renameat Portability problems fixed by Gnulib: @itemize @item +This function is missing on some platforms: +glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, +AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 8, Cygwin 1.5.x, mingw, MSVC 14, +Interix 3.5, BeOS. +But the replacement function is not safe to be used in libraries and is not +multithread-safe. +@item +This function is declared in @code{}, not in @code{}, +on some platforms: +NetBSD 7.0, Solaris 11.4. +@item +This function is declared in @code{}, not in @code{}, +on some platforms: +Android 4.3. +@item This function does not reject trailing slashes on non-directories on some platforms, as in @code{renameat(fd,"file",fd,"new/")}: Solaris 11.4. @@ -16,16 +31,6 @@ Solaris 11.4. This function ignores trailing slashes on symlinks on some platforms, such that @code{renameat(fd,"link/",fd,"new")} corrupts @file{link}: Solaris 9. -@item -This function is declared in @code{} instead of @code{} -on some platforms: -NetBSD 7.0, Solaris 11.4. -@item -This function is missing on some platforms: -glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, -AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 8, Cygwin 1.5.x, mingw, MSVC 14, -Interix 3.5, BeOS. -But the replacement function is not safe to be used in libraries and is not multithread-safe. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/stdio.in.h b/lib/stdio.in.h index c7acb66..98c8093 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -118,6 +118,13 @@ # include #endif +/* Android 4.3 declares renameat in , not in . */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ + && ! defined __GLIBC__ +# include +#endif + /* MSVC declares 'perror' in , not in . We must include it before we #define perror rpl_perror. */ /* But in any case avoid namespace pollution on glibc systems. */ -- 2.7.4 --nextPart14211233.Yyp2yvHnxB Content-Disposition: attachment; filename="0004-unlinkat-Fix-compilation-error-on-Android-4.3.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0004-unlinkat-Fix-compilation-error-on-Android-4.3.patch" >From 3842cd1d67868fdd3a5aeeaa37e6a8f0d7818c3f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 25 Jan 2019 00:08:52 +0100 Subject: [PATCH 4/7] unlinkat: Fix compilation error on Android 4.3. * lib/unistd.in.h: Include when module 'unlinkat' is in use also on Android. * doc/posix-functions/unlinkat.texi: Mention the issue. --- ChangeLog | 7 +++++++ doc/posix-functions/unlinkat.texi | 8 ++++---- lib/unistd.in.h | 6 ++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index fad53ae..baa8590 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2019-01-24 Bruno Haible + unlinkat: Fix compilation error on Android 4.3. + * lib/unistd.in.h: Include when module 'unlinkat' is in use + also on Android. + * doc/posix-functions/unlinkat.texi: Mention the issue. + +2019-01-24 Bruno Haible + renameat: Fix compilation error on Android 4.3. * lib/stdio.in.h: Include when module 'renameat' is in use. * doc/posix-functions/renameat.texi: Mention the issue. diff --git a/doc/posix-functions/unlinkat.texi b/doc/posix-functions/unlinkat.texi index de9d517..fb4e69f 100644 --- a/doc/posix-functions/unlinkat.texi +++ b/doc/posix-functions/unlinkat.texi @@ -14,15 +14,15 @@ glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Cygwin 1.5.x, mingw, MSVC 14, Interix 3.5, BeOS. But the replacement function is not safe to be used in libraries and is not multithread-safe. @item +This function is declared in @code{}, not in @code{}, +on some platforms: +Cygwin 1.7.1, Android 4.3. +@item On Mac OS X 10.10, in a writable HFS mount, @code{unlinkat(fd, "..", 0)} succeeds without doing anything. @item Some systems mistakenly succeed on @code{unlinkat(fd,"file/",flag)}: GNU/Hurd, Solaris 9. -@item -Some platforms declare this function in @code{fcntl.h} instead of -@code{unistd.h}: -Cygwin 1.7.1. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/unistd.in.h b/lib/unistd.in.h index eb2534e..0ff7396 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -68,9 +68,11 @@ # include #endif -/* Cygwin 1.7.1 declares unlinkat in , not in . */ +/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in , not in + . */ /* But avoid namespace pollution on glibc systems. */ -#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \ +#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ + && (defined __CYGWIN__ || defined __ANDROID__) \ && ! defined __GLIBC__ # include #endif -- 2.7.4 --nextPart14211233.Yyp2yvHnxB Content-Disposition: attachment; filename="0005-fdatasync-Fix-compilation-error-on-Android-4.3.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0005-fdatasync-Fix-compilation-error-on-Android-4.3.patch" >From d591eab8486390c258151b0e3ec94285c75a86d8 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 25 Jan 2019 00:15:50 +0100 Subject: [PATCH 5/7] fdatasync: Fix compilation error on Android 4.3. * m4/fdatasync.m4 (gl_FUNC_FDATASYNC): On platforms other than Solaris, test whether fdatasync() exists. --- ChangeLog | 6 ++++++ m4/fdatasync.m4 | 28 ++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index baa8590..4955af1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2019-01-24 Bruno Haible + fdatasync: Fix compilation error on Android 4.3. + * m4/fdatasync.m4 (gl_FUNC_FDATASYNC): On platforms other than Solaris, + test whether fdatasync() exists. + +2019-01-24 Bruno Haible + unlinkat: Fix compilation error on Android 4.3. * lib/unistd.in.h: Include when module 'unlinkat' is in use also on Android. diff --git a/m4/fdatasync.m4 b/m4/fdatasync.m4 index c2ea85e..fe221cc 100644 --- a/m4/fdatasync.m4 +++ b/m4/fdatasync.m4 @@ -1,4 +1,4 @@ -# fdatasync.m4 serial 4 +# fdatasync.m4 serial 5 dnl Copyright (C) 2008-2019 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,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FDATASYNC], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl Using AC_CHECK_FUNCS_ONCE would break our subsequent AC_SEARCH_LIBS AC_CHECK_DECLS_ONCE([fdatasync]) @@ -21,12 +22,23 @@ AC_DEFUN([gl_FUNC_FDATASYNC], HAVE_FDATASYNC=0 fi else - dnl Solaris <= 2.6 has fdatasync() in libposix4. - dnl Solaris 7..10 has it in librt. - gl_saved_libs=$LIBS - AC_SEARCH_LIBS([fdatasync], [rt posix4], - [test "$ac_cv_search_fdatasync" = "none required" || - LIB_FDATASYNC=$ac_cv_search_fdatasync]) - LIBS=$gl_saved_libs + case "$host_os" in + solaris*) + dnl Solaris <= 2.6 has fdatasync() in libposix4. + dnl Solaris 7..10 has it in librt. + gl_saved_libs=$LIBS + AC_SEARCH_LIBS([fdatasync], [rt posix4], + [test "$ac_cv_search_fdatasync" = "none required" || + LIB_FDATASYNC=$ac_cv_search_fdatasync]) + LIBS=$gl_saved_libs + ;; + *) + dnl Android 4.3 does not have fdatasync but declares it. + AC_CHECK_FUNCS([fdatasync]) + if test $ac_cv_func_fdatasync = no; then + HAVE_FDATASYNC=0 + fi + ;; + esac fi ]) -- 2.7.4 --nextPart14211233.Yyp2yvHnxB Content-Disposition: attachment; filename="0006-mbtowc-Fix-compilation-error-on-Android-4.3.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0006-mbtowc-Fix-compilation-error-on-Android-4.3.patch" >From 02611ab0826cb35f4c5c6c2a2198ada0d6f20296 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 25 Jan 2019 00:42:40 +0100 Subject: [PATCH 6/7] mbtowc: Fix compilation error on Android 4.3. * lib/stdlib.in.h (mbtowc): Test also HAVE_MBTOWC. * m4/mbtowc.m4 (gl_FUNC_MBTOWC): Test whether mbtowc exists. Set HAVE_MBTOWC. * m4/stdlib_h.m4 (gl_STDLIB_H): Test whether mbtowc is declared. (gl_STDLIB_H_DEFAULTS): Initialize HAVE_MBTOWC. * modules/stdlib (Makefile.am): Substitute HAVE_MBTOWC. * modules/mbtowc (Depends-on, configure.ac): Test also HAVE_MBTOWC. * doc/posix-functions/mbtowc.texi: Mention the change. --- ChangeLog | 12 ++++++++++++ doc/posix-functions/mbtowc.texi | 6 +++--- lib/stdlib.in.h | 9 +++++++++ m4/mbtowc.m4 | 11 ++++++++--- m4/stdlib_h.m4 | 5 +++-- modules/mbtowc | 6 +++--- modules/stdlib | 1 + 7 files changed, 39 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4955af1..24d5755 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2019-01-24 Bruno Haible + mbtowc: Fix compilation error on Android 4.3. + * lib/stdlib.in.h (mbtowc): Test also HAVE_MBTOWC. + * m4/mbtowc.m4 (gl_FUNC_MBTOWC): Test whether mbtowc exists. Set + HAVE_MBTOWC. + * m4/stdlib_h.m4 (gl_STDLIB_H): Test whether mbtowc is declared. + (gl_STDLIB_H_DEFAULTS): Initialize HAVE_MBTOWC. + * modules/stdlib (Makefile.am): Substitute HAVE_MBTOWC. + * modules/mbtowc (Depends-on, configure.ac): Test also HAVE_MBTOWC. + * doc/posix-functions/mbtowc.texi: Mention the change. + +2019-01-24 Bruno Haible + fdatasync: Fix compilation error on Android 4.3. * m4/fdatasync.m4 (gl_FUNC_FDATASYNC): On platforms other than Solaris, test whether fdatasync() exists. diff --git a/doc/posix-functions/mbtowc.texi b/doc/posix-functions/mbtowc.texi index 022e1a2..5188a7f 100644 --- a/doc/posix-functions/mbtowc.texi +++ b/doc/posix-functions/mbtowc.texi @@ -8,14 +8,14 @@ Gnulib module: mbtowc Portability problems fixed by Gnulib: @itemize +@item +This function is missing on some platforms: +Android 4.4. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: -Android 4.4. -@item This function accumulates hidden state on some platforms: glibc 2.8 (see @url{https://sourceware.org/bugzilla/show_bug.cgi?id=9674}). @item diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index d80d7ec..0f581d9 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -306,9 +306,18 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); # else +# if !@HAVE_MBTOWC@ +_GL_FUNCDECL_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +# endif _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); # endif _GL_CXXALIASWARN (mbtowc); +#elif defined GNULIB_POSIXCHECK +# undef mbtowc +# if HAVE_RAW_DECL_MBTOWC +_GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " + "use gnulib module mbtowc for portability"); +# endif #endif #if @GNULIB_MKDTEMP@ diff --git a/m4/mbtowc.m4 b/m4/mbtowc.m4 index 202c3fb..5a4b92e 100644 --- a/m4/mbtowc.m4 +++ b/m4/mbtowc.m4 @@ -1,4 +1,4 @@ -# mbtowc.m4 serial 2 +# mbtowc.m4 serial 3 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,8 +8,13 @@ AC_DEFUN([gl_FUNC_MBTOWC], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - if false; then - REPLACE_MBTOWC=1 + AC_CHECK_FUNCS([mbtowc]) + if test $ac_cv_func_mbtowc = no; then + HAVE_MBTOWC=0 + else + if false; then + REPLACE_MBTOWC=1 + fi fi ]) diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index cf06428..c449a54 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 45 +# stdlib_h.m4 serial 46 dnl Copyright (C) 2007-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -23,7 +23,7 @@ AC_DEFUN([gl_STDLIB_H], # include #endif ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt - initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps + initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps posix_openpt ptsname ptsname_r qsort_r random random_r reallocarray realpath rpmatch secure_getenv setenv setstate setstate_r srandom srandom_r strtod strtoll strtoull unlockpt unsetenv]) @@ -82,6 +82,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) HAVE_DECL_INITSTATE=1; AC_SUBST([HAVE_DECL_INITSTATE]) + HAVE_MBTOWC=1; AC_SUBST([HAVE_MBTOWC]) HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) diff --git a/modules/mbtowc b/modules/mbtowc index a665e22..2db32de 100644 --- a/modules/mbtowc +++ b/modules/mbtowc @@ -8,12 +8,12 @@ m4/mbtowc.m4 Depends-on: stdlib -mbrtowc [test $REPLACE_MBTOWC = 1] -wchar [test $REPLACE_MBTOWC = 1] +mbrtowc [test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1] +wchar [test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1] configure.ac: gl_FUNC_MBTOWC -if test $REPLACE_MBTOWC = 1; then +if test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1; then AC_LIBOBJ([mbtowc]) gl_PREREQ_MBTOWC fi diff --git a/modules/stdlib b/modules/stdlib index 62224e8..dd1556e 100644 --- a/modules/stdlib +++ b/modules/stdlib @@ -73,6 +73,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ -e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \ + -e 's|@''HAVE_MBTOWC''@|$(HAVE_MBTOWC)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ -- 2.7.4 --nextPart14211233.Yyp2yvHnxB Content-Disposition: attachment; filename="0007-random-Fix-compilation-error-on-Android-4.3.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0007-random-Fix-compilation-error-on-Android-4.3.patch" >From de9ed4e371d8bde6c2fd47ca9612ed150da51c10 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 25 Jan 2019 01:36:26 +0100 Subject: [PATCH 7/7] random: Fix compilation error on Android 4.3. * lib/stdlib.in.h (random, srandom): Test also REPLACE_RANDOM. (initstate): Test REPLACE_INITSTATE and HAVE_INITSTATE, not HAVE_RANDOM. (setstate): Test REPLACE_SETSTATE and HAVE_SETSTATE, not HAVE_RANDOM. * m4/random.m4 (gl_FUNC_RANDOM): Set HAVE_INITSTATE, HAVE_SETSTATE, REPLACE_RANDOM, REPLACE_INITSTATE, REPLACE_SETSTATE. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_INITSTATE, HAVE_SETSTATE, REPLACE_RANDOM, REPLACE_INITSTATE, REPLACE_SETSTATE. * modules/stdlib (Makefile.am): Substitute HAVE_INITSTATE, HAVE_SETSTATE, REPLACE_RANDOM, REPLACE_INITSTATE, REPLACE_SETSTATE. * modules/random (Depends-on, configure.ac): Test also REPLACE_RANDOM, REPLACE_INITSTATE, REPLACE_SETSTATE. * doc/posix-functions/random.texi: Correct the description of the situation on Android. * doc/posix-functions/srandom.texi: Likewise. * doc/posix-functions/rand.texi: Likewise. * doc/posix-functions/srand.texi: Likewise. --- ChangeLog | 20 ++++++++++++++ doc/posix-functions/rand.texi | 2 +- doc/posix-functions/random.texi | 7 ++++- doc/posix-functions/srand.texi | 2 +- doc/posix-functions/srandom.texi | 5 +++- lib/stdlib.in.h | 59 +++++++++++++++++++++++++++++++++------- m4/random.m4 | 23 +++++++++++++++- m4/stdlib_h.m4 | 7 ++++- modules/random | 8 +++--- modules/stdlib | 5 ++++ 10 files changed, 118 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24d5755..cd89cc3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,25 @@ 2019-01-24 Bruno Haible + random: Fix compilation error on Android 4.3. + * lib/stdlib.in.h (random, srandom): Test also REPLACE_RANDOM. + (initstate): Test REPLACE_INITSTATE and HAVE_INITSTATE, not HAVE_RANDOM. + (setstate): Test REPLACE_SETSTATE and HAVE_SETSTATE, not HAVE_RANDOM. + * m4/random.m4 (gl_FUNC_RANDOM): Set HAVE_INITSTATE, HAVE_SETSTATE, + REPLACE_RANDOM, REPLACE_INITSTATE, REPLACE_SETSTATE. + * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_INITSTATE, + HAVE_SETSTATE, REPLACE_RANDOM, REPLACE_INITSTATE, REPLACE_SETSTATE. + * modules/stdlib (Makefile.am): Substitute HAVE_INITSTATE, HAVE_SETSTATE, + REPLACE_RANDOM, REPLACE_INITSTATE, REPLACE_SETSTATE. + * modules/random (Depends-on, configure.ac): Test also REPLACE_RANDOM, + REPLACE_INITSTATE, REPLACE_SETSTATE. + * doc/posix-functions/random.texi: Correct the description of the + situation on Android. + * doc/posix-functions/srandom.texi: Likewise. + * doc/posix-functions/rand.texi: Likewise. + * doc/posix-functions/srand.texi: Likewise. + +2019-01-24 Bruno Haible + mbtowc: Fix compilation error on Android 4.3. * lib/stdlib.in.h (mbtowc): Test also HAVE_MBTOWC. * m4/mbtowc.m4 (gl_FUNC_MBTOWC): Test whether mbtowc exists. Set diff --git a/doc/posix-functions/rand.texi b/doc/posix-functions/rand.texi index d8446ea..decf1fc 100644 --- a/doc/posix-functions/rand.texi +++ b/doc/posix-functions/rand.texi @@ -13,6 +13,6 @@ Portability problems fixed by Gnulib: Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: +This function is only defined as an inline function on some platforms: Android 4.4. @end itemize diff --git a/doc/posix-functions/random.texi b/doc/posix-functions/random.texi index 9280102..36b5857 100644 --- a/doc/posix-functions/random.texi +++ b/doc/posix-functions/random.texi @@ -10,7 +10,12 @@ Portability problems fixed by Gnulib: @itemize @item This function is missing on some platforms: -Solaris 2.4, mingw, MSVC 14, Android 4.4. +Solaris 2.4, mingw, MSVC 14. +@item +This function is only defined as an inline function on some platforms: +Android 4.4. +@item + @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/srand.texi b/doc/posix-functions/srand.texi index 344f631..5a6e6b7 100644 --- a/doc/posix-functions/srand.texi +++ b/doc/posix-functions/srand.texi @@ -13,6 +13,6 @@ Portability problems fixed by Gnulib: Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: +This function is only defined as an inline function on some platforms: Android 4.4. @end itemize diff --git a/doc/posix-functions/srandom.texi b/doc/posix-functions/srandom.texi index 7c3292a..09d033e 100644 --- a/doc/posix-functions/srandom.texi +++ b/doc/posix-functions/srandom.texi @@ -10,7 +10,10 @@ Portability problems fixed by Gnulib: @itemize @item This function is missing on some platforms: -Solaris 2.4, mingw, MSVC 14, Android 4.4. +Solaris 2.4, mingw, MSVC 14. +@item +This function is only defined as an inline function on some platforms: +Android 4.4. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 0f581d9..be8ab3b 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -582,10 +582,19 @@ _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ +# if @REPLACE_RANDOM@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef random +# define random rpl_random +# endif +_GL_FUNCDECL_RPL (random, long, (void)); +_GL_CXXALIAS_RPL (random, long, (void)); +# else +# if !@HAVE_RANDOM@ _GL_FUNCDECL_SYS (random, long, (void)); -# endif +# endif _GL_CXXALIAS_SYS (random, long, (void)); +# endif _GL_CXXALIASWARN (random); #elif defined GNULIB_POSIXCHECK # undef random @@ -596,10 +605,19 @@ _GL_WARN_ON_USE (random, "random is unportable - " #endif #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ +# if @REPLACE_RANDOM@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef srandom +# define srandom rpl_srandom +# endif +_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); +_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); +# else +# if !@HAVE_RANDOM@ _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); -# endif +# endif _GL_CXXALIAS_SYS (srandom, void, (unsigned int seed)); +# endif _GL_CXXALIASWARN (srandom); #elif defined GNULIB_POSIXCHECK # undef srandom @@ -610,31 +628,52 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - " #endif #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ || !@HAVE_DECL_INITSTATE@ +# if @REPLACE_INITSTATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef initstate +# define initstate rpl_initstate +# endif +_GL_FUNCDECL_RPL (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size)); +# else +# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ _GL_FUNCDECL_SYS (initstate, char *, (unsigned int seed, char *buf, size_t buf_size) _GL_ARG_NONNULL ((2))); -# endif +# endif _GL_CXXALIAS_SYS (initstate, char *, (unsigned int seed, char *buf, size_t buf_size)); +# endif _GL_CXXALIASWARN (initstate); #elif defined GNULIB_POSIXCHECK # undef initstate -# if HAVE_RAW_DECL_INITSTATE_R +# if HAVE_RAW_DECL_INITSTATE _GL_WARN_ON_USE (initstate, "initstate is unportable - " "use gnulib module random for portability"); # endif #endif #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ || !@HAVE_DECL_SETSTATE@ +# if @REPLACE_SETSTATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef setstate +# define setstate rpl_setstate +# endif +_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); +# else +# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); -# endif +# endif _GL_CXXALIAS_SYS (setstate, char *, (char *arg_state)); +# endif _GL_CXXALIASWARN (setstate); #elif defined GNULIB_POSIXCHECK # undef setstate -# if HAVE_RAW_DECL_SETSTATE_R +# if HAVE_RAW_DECL_SETSTATE _GL_WARN_ON_USE (setstate, "setstate is unportable - " "use gnulib module random for portability"); # endif diff --git a/m4/random.m4 b/m4/random.m4 index 996c406..15da67e 100644 --- a/m4/random.m4 +++ b/m4/random.m4 @@ -1,4 +1,4 @@ -# random.m4 serial 3 +# random.m4 serial 4 dnl Copyright (C) 2012-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -21,6 +21,27 @@ AC_DEFUN([gl_FUNC_RANDOM], ]) if test $gl_cv_func_random = no; then HAVE_RANDOM=0 + HAVE_INITSTATE=0 + HAVE_SETSTATE=0 + else + AC_CHECK_FUNCS([initstate setstate]) + if test $ac_cv_func_initstate = no; then + HAVE_INITSTATE=0 + fi + if test $ac_cv_func_setstate = no; then + HAVE_SETSTATE=0 + fi + if test $ac_cv_func_initstate = no || test $ac_cv_func_setstate = no; then + dnl In order to define initstate or setstate, we need to define all the + dnl functions at once. + REPLACE_RANDOM=1 + if test $ac_cv_func_initstate = yes; then + REPLACE_INITSTATE=1 + fi + if test $ac_cv_func_setstate = yes; then + REPLACE_SETSTATE=1 + fi + fi fi AC_CHECK_DECLS_ONCE([initstate]) diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index c449a54..c5db804 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 46 +# stdlib_h.m4 serial 47 dnl Copyright (C) 2007-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -81,6 +81,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) + HAVE_INITSTATE=1; AC_SUBST([HAVE_INITSTATE]) HAVE_DECL_INITSTATE=1; AC_SUBST([HAVE_DECL_INITSTATE]) HAVE_MBTOWC=1; AC_SUBST([HAVE_MBTOWC]) HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) @@ -101,6 +102,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV]) HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV]) + HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) @@ -111,6 +113,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC]) REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) + REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE]) REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) @@ -118,10 +121,12 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) + REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) + REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) diff --git a/modules/random b/modules/random index 706096b..e58ebd1 100644 --- a/modules/random +++ b/modules/random @@ -6,14 +6,14 @@ lib/random.c m4/random.m4 Depends-on: -libc-config [test $HAVE_RANDOM = 0] +libc-config [test $HAVE_RANDOM = 0 || test $REPLACE_RANDOM = 1 || test $REPLACE_INITSTATE = 1 || test $REPLACE_SETSTATE = 1] stdlib -stdint [test $HAVE_RANDOM = 0] -random_r [test $HAVE_RANDOM = 0] +stdint [test $HAVE_RANDOM = 0 || test $REPLACE_RANDOM = 1 || test $REPLACE_INITSTATE = 1 || test $REPLACE_SETSTATE = 1] +random_r [test $HAVE_RANDOM = 0 || test $REPLACE_RANDOM = 1 || test $REPLACE_INITSTATE = 1 || test $REPLACE_SETSTATE = 1] configure.ac: gl_FUNC_RANDOM -if test $HAVE_RANDOM = 0; then +if test $HAVE_RANDOM = 0 || test $REPLACE_RANDOM = 1 || test $REPLACE_INITSTATE = 1 || test $REPLACE_SETSTATE = 1; then AC_LIBOBJ([random]) gl_PREREQ_RANDOM fi diff --git a/modules/stdlib b/modules/stdlib index dd1556e..a43f79c 100644 --- a/modules/stdlib +++ b/modules/stdlib @@ -72,6 +72,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ + -e 's|@''HAVE_INITSTATE''@|$(HAVE_INITSTATE)|g' \ -e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \ -e 's|@''HAVE_MBTOWC''@|$(HAVE_MBTOWC)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ @@ -91,6 +92,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \ -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ + -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \ -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ @@ -101,6 +103,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ + -e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \ -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ @@ -108,10 +111,12 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \ + -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \ -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ + -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ -- 2.7.4 --nextPart14211233.Yyp2yvHnxB--