diff -Nru bison-3.5.1+dfsg/aclocal.m4 bison-3.8.2+dfsg/aclocal.m4 --- bison-3.5.1+dfsg/aclocal.m4 2020-01-19 13:15:55.000000000 +0000 +++ bison-3.8.2+dfsg/aclocal.m4 2021-09-25 04:53:54.000000000 +0000 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.1 -*- Autoconf -*- +# generated automatically by aclocal 1.16.4 -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,13 +14,13 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2018 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,7 @@ [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.16.1], [], +m4_if([$1], [1.16.4], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.16.1])dnl +[AM_AUTOMAKE_VERSION([1.16.4])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -141,7 +141,7 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -332,7 +332,7 @@ # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -371,7 +371,9 @@ done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi @@ -398,7 +400,7 @@ # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -462,7 +464,7 @@ [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl @@ -514,6 +516,20 @@ [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This @@ -595,7 +611,7 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -616,7 +632,7 @@ fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2018 Free Software Foundation, Inc. +# Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -637,7 +653,7 @@ # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -680,7 +696,7 @@ # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -701,12 +717,7 @@ [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -719,7 +730,7 @@ # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -748,7 +759,7 @@ AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -795,7 +806,7 @@ # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -814,7 +825,7 @@ # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -895,7 +906,7 @@ rm -f conftest.file ]) -# Copyright (C) 2009-2018 Free Software Foundation, Inc. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -955,7 +966,7 @@ _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -983,7 +994,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2018 Free Software Foundation, Inc. +# Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1002,7 +1013,7 @@ # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2018 Free Software Foundation, Inc. +# Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1136,51 +1147,74 @@ m4_include([m4/00gnulib.m4]) m4_include([m4/__inline.m4]) m4_include([m4/absolute-header.m4]) +m4_include([m4/access.m4]) m4_include([m4/alloca.m4]) m4_include([m4/asm-underscore.m4]) m4_include([m4/assert.m4]) m4_include([m4/bison-check-compiler-flag.m4]) m4_include([m4/bison-cxx-std.m4]) m4_include([m4/bison-i18n.m4]) +m4_include([m4/builtin-expect.m4]) m4_include([m4/c-working.m4]) m4_include([m4/calloc.m4]) m4_include([m4/canonicalize.m4]) +m4_include([m4/chdir-long.m4]) m4_include([m4/clock_time.m4]) m4_include([m4/close.m4]) +m4_include([m4/closedir.m4]) m4_include([m4/codeset.m4]) m4_include([m4/config-h.m4]) m4_include([m4/configmake.m4]) m4_include([m4/cxx.m4]) -m4_include([m4/dirname.m4]) +m4_include([m4/d-ino.m4]) +m4_include([m4/dirent_h.m4]) +m4_include([m4/dirfd.m4]) m4_include([m4/double-slash-root.m4]) +m4_include([m4/dup.m4]) m4_include([m4/dup2.m4]) +m4_include([m4/eaccess.m4]) m4_include([m4/eealloc.m4]) m4_include([m4/environ.m4]) m4_include([m4/errno_h.m4]) m4_include([m4/error.m4]) +m4_include([m4/execute.m4]) m4_include([m4/exponentd.m4]) m4_include([m4/exponentf.m4]) m4_include([m4/exponentl.m4]) m4_include([m4/extensions.m4]) m4_include([m4/extern-inline.m4]) m4_include([m4/fatal-signal.m4]) +m4_include([m4/fchdir.m4]) m4_include([m4/fcntl-o.m4]) m4_include([m4/fcntl.m4]) m4_include([m4/fcntl_h.m4]) +m4_include([m4/fdopendir.m4]) +m4_include([m4/ffs.m4]) +m4_include([m4/ffsl.m4]) +m4_include([m4/filenamecat.m4]) +m4_include([m4/findprog-in.m4]) m4_include([m4/flex.m4]) m4_include([m4/float_h.m4]) m4_include([m4/fopen.m4]) m4_include([m4/fpending.m4]) m4_include([m4/fpieee.m4]) m4_include([m4/fprintf-posix.m4]) +m4_include([m4/free.m4]) m4_include([m4/frexp.m4]) m4_include([m4/frexpl.m4]) m4_include([m4/fseterr.m4]) m4_include([m4/fstat.m4]) +m4_include([m4/fstatat.m4]) m4_include([m4/fsync.m4]) +m4_include([m4/getcwd-abort-bug.m4]) +m4_include([m4/getcwd-path-max.m4]) +m4_include([m4/getcwd.m4]) +m4_include([m4/getdelim.m4]) m4_include([m4/getdtablesize.m4]) m4_include([m4/gethrxtime.m4]) +m4_include([m4/getline.m4]) m4_include([m4/getopt.m4]) +m4_include([m4/getpagesize.m4]) m4_include([m4/getprogname.m4]) m4_include([m4/getrusage.m4]) m4_include([m4/gettext.m4]) @@ -1190,10 +1224,12 @@ m4_include([m4/gnulib-comp.m4]) m4_include([m4/host-cpu-c-abi.m4]) m4_include([m4/iconv.m4]) +m4_include([m4/iconv_h.m4]) +m4_include([m4/iconv_open.m4]) m4_include([m4/include_next.m4]) +m4_include([m4/inline.m4]) m4_include([m4/intlmacosx.m4]) m4_include([m4/intmax_t.m4]) -m4_include([m4/inttypes-pri.m4]) m4_include([m4/inttypes.m4]) m4_include([m4/inttypes_h.m4]) m4_include([m4/isnan.m4]) @@ -1201,6 +1237,8 @@ m4_include([m4/isnanf.m4]) m4_include([m4/isnanl.m4]) m4_include([m4/iswblank.m4]) +m4_include([m4/iswdigit.m4]) +m4_include([m4/iswxdigit.m4]) m4_include([m4/javacomp.m4]) m4_include([m4/javaexec.m4]) m4_include([m4/jm-winsz1.m4]) @@ -1220,7 +1258,6 @@ m4_include([m4/locale-ja.m4]) m4_include([m4/locale-zh.m4]) m4_include([m4/locale_h.m4]) -m4_include([m4/localtime-buffer.m4]) m4_include([m4/lock.m4]) m4_include([m4/lstat.m4]) m4_include([m4/m4.m4]) @@ -1234,12 +1271,15 @@ m4_include([m4/mbstate_t.m4]) m4_include([m4/mbswidth.m4]) m4_include([m4/memchr.m4]) +m4_include([m4/mempcpy.m4]) +m4_include([m4/memrchr.m4]) m4_include([m4/minmax.m4]) m4_include([m4/mmap-anon.m4]) m4_include([m4/mode_t.m4]) m4_include([m4/msvc-inval.m4]) m4_include([m4/msvc-nothrow.m4]) m4_include([m4/multiarch.m4]) +m4_include([m4/musl.m4]) m4_include([m4/nls.m4]) m4_include([m4/nocrash.m4]) m4_include([m4/non-recursive-gnulib-prefix-hack.m4]) @@ -1249,11 +1289,15 @@ m4_include([m4/open-cloexec.m4]) m4_include([m4/open-slash.m4]) m4_include([m4/open.m4]) +m4_include([m4/openat.m4]) +m4_include([m4/opendir.m4]) m4_include([m4/pathmax.m4]) m4_include([m4/perror.m4]) +m4_include([m4/pipe.m4]) m4_include([m4/pipe2.m4]) m4_include([m4/po.m4]) m4_include([m4/posix_spawn.m4]) +m4_include([m4/posix_spawn_faction_addchdir.m4]) m4_include([m4/printf-frexp.m4]) m4_include([m4/printf-frexpl.m4]) m4_include([m4/printf-posix-rpl.m4]) @@ -1264,12 +1308,17 @@ m4_include([m4/quotearg.m4]) m4_include([m4/raise.m4]) m4_include([m4/rawmemchr.m4]) +m4_include([m4/readdir.m4]) +m4_include([m4/readline.m4]) m4_include([m4/readlink.m4]) m4_include([m4/realloc.m4]) +m4_include([m4/reallocarray.m4]) m4_include([m4/relocatable-lib.m4]) m4_include([m4/relocatable.m4]) m4_include([m4/rename.m4]) +m4_include([m4/rewinddir.m4]) m4_include([m4/rmdir.m4]) +m4_include([m4/save-cwd.m4]) m4_include([m4/sched_h.m4]) m4_include([m4/setenv.m4]) m4_include([m4/setlocale_null.m4]) @@ -1288,7 +1337,7 @@ m4_include([m4/ssize_t.m4]) m4_include([m4/stat-time.m4]) m4_include([m4/stat.m4]) -m4_include([m4/std-gnu11.m4]) +m4_include([m4/stdalign.m4]) m4_include([m4/stdbool.m4]) m4_include([m4/stddef_h.m4]) m4_include([m4/stdint.m4]) @@ -1296,14 +1345,18 @@ m4_include([m4/stdio_h.m4]) m4_include([m4/stdlib_h.m4]) m4_include([m4/stpcpy.m4]) +m4_include([m4/stpncpy.m4]) m4_include([m4/strchrnul.m4]) m4_include([m4/strdup.m4]) m4_include([m4/strerror.m4]) m4_include([m4/strerror_r.m4]) m4_include([m4/string_h.m4]) +m4_include([m4/strings_h.m4]) m4_include([m4/strndup.m4]) m4_include([m4/strnlen.m4]) +m4_include([m4/strtod.m4]) m4_include([m4/strverscmp.m4]) +m4_include([m4/sys_ioctl_h.m4]) m4_include([m4/sys_resource_h.m4]) m4_include([m4/sys_socket_h.m4]) m4_include([m4/sys_stat_h.m4]) @@ -1311,10 +1364,12 @@ m4_include([m4/sys_times_h.m4]) m4_include([m4/sys_types_h.m4]) m4_include([m4/sys_wait_h.m4]) +m4_include([m4/termios_h.m4]) m4_include([m4/threadlib.m4]) m4_include([m4/time_h.m4]) m4_include([m4/timespec.m4]) m4_include([m4/tls.m4]) +m4_include([m4/unicodeio.m4]) m4_include([m4/unistd-safer.m4]) m4_include([m4/unistd_h.m4]) m4_include([m4/unlink.m4]) @@ -1339,3 +1394,5 @@ m4_include([m4/xalloc.m4]) m4_include([m4/xsize.m4]) m4_include([m4/xstrndup.m4]) +m4_include([m4/year2038.m4]) +m4_include([m4/zzgnulib.m4]) diff -Nru bison-3.5.1+dfsg/AUTHORS bison-3.8.2+dfsg/AUTHORS --- bison-3.5.1+dfsg/AUTHORS 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/AUTHORS 2021-06-23 04:48:48.000000000 +0000 @@ -24,7 +24,7 @@ ----- -Copyright (C) 1998-2015, 2018-2020 Free Software Foundation, Inc. +Copyright (C) 1998-2015, 2018-2021 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -39,4 +39,4 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . diff -Nru bison-3.5.1+dfsg/build-aux/announce-gen bison-3.8.2+dfsg/build-aux/announce-gen --- bison-3.5.1+dfsg/build-aux/announce-gen 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/announce-gen 2021-08-08 06:36:37.000000000 +0000 @@ -3,7 +3,7 @@ # Generate a release announcement message. -# Copyright (C) 2002-2020 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,16 +31,18 @@ # are valid code in both sh and perl. When executed by sh, they re-execute # the script through the perl program found in $PATH. The '-x' option # is essential as well; without it, perl would re-execute the script -# through /bin/sh. When executed by perl, the next two lines are a no-op. +# through /bin/sh. When executed by perl, the next two lines are a no-op. eval 'exec perl -wSx "$0" "$@"' if 0; -my $VERSION = '2018-03-07 03:46'; # UTC +my $VERSION = '2021-08-04 09:17'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook # do its job. Otherwise, update this string manually. +my $copyright_year = '2021'; + use strict; use Getopt::Long; use POSIX qw(strftime); @@ -48,13 +50,7 @@ (my $ME = $0) =~ s|.*/||; my %valid_release_types = map {$_ => 1} qw (alpha beta stable); -my @archive_suffixes = ('tar.gz', 'tar.bz2', 'tar.lzma', 'tar.xz'); -my %digest_classes = - ( - 'md5' => (eval { require Digest::MD5; } and 'Digest::MD5'), - 'sha1' => ((eval { require Digest::SHA; } and 'Digest::SHA') - or (eval { require Digest::SHA1; } and 'Digest::SHA1')) - ); +my @archive_suffixes = qw (tar.gz tar.bz2 tar.lz tar.lzma tar.xz); my $srcdir = '.'; sub usage ($) @@ -94,7 +90,7 @@ VERSION is the result of running git describe in the gnulib source directory. required if gnulib is in TOOL_LIST. - --no-print-checksums do not emit MD5 or SHA1 checksums + --no-print-checksums do not emit SHA1 or SHA256 checksums --archive-suffix=SUF add SUF to the list of archive suffixes --mail-headers=HEADERS a space-separated list of mail headers, e.g., To: x\@example.com Cc: y-announce\@example.com,... @@ -161,7 +157,7 @@ =item C. +Print the SHA1 and SHA256 signature section for each C<@file>. =cut @@ -169,23 +165,18 @@ { my (@file) = @_; - print "Here are the MD5 and SHA1 checksums:\n"; + print "Here are the SHA1 and SHA256 checksums:\n"; print "\n"; - foreach my $meth (qw (md5 sha1)) + use Digest::file qw(digest_file_hex digest_file_base64); + + foreach my $f (@file) { - my $class = $digest_classes{$meth} or next; - foreach my $f (@file) - { - open IN, '<', $f - or die "$ME: $f: cannot open for reading: $!\n"; - binmode IN; - my $dig = $class->new->addfile(*IN)->hexdigest; - close IN; - print "$dig $f\n"; - } + print digest_file_hex($f, "SHA-1"), " $f\n"; + print digest_file_base64($f, "SHA-256"), " $f\n"; } - print "\n"; + print "\nThe SHA256 checksum is base64 encoded, instead of the\n"; + print "hexadecimal encoding that most checksum tools default to.\n\n"; } =item C \@archive_suffixes, help => sub { usage 0 }, - version => sub { print "$ME version $VERSION\n"; exit }, + version => + sub + { + print "$ME version $VERSION\n"; + print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n"; + print "License GPLv3+: GNU GPL version 3 or later .\n" + . "This is free software: you are free to change and redistribute it.\n" + . "There is NO WARRANTY, to the extent permitted by law.\n"; + print "\n"; + my $author = "Jim Meyering"; + print "Written by $author.\n"; + exit + }, ) or usage 1; my $fail = 0; diff -Nru bison-3.5.1+dfsg/build-aux/compile bison-3.8.2+dfsg/build-aux/compile --- bison-3.5.1+dfsg/build-aux/compile 2019-10-29 20:22:22.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/compile 2021-09-25 04:54:03.000000000 +0000 @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -53,7 +53,7 @@ MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) diff -Nru bison-3.5.1+dfsg/build-aux/config.guess bison-3.8.2+dfsg/build-aux/config.guess --- bison-3.5.1+dfsg/build-aux/config.guess 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/config.guess 2021-08-03 05:51:08.000000000 +0000 @@ -1,8 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2020 Free Software Foundation, Inc. +# Copyright 1992-2021 Free Software Foundation, Inc. -timestamp='2020-01-01' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2021-06-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -27,11 +29,19 @@ # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ @@ -50,7 +60,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2020 Free Software Foundation, Inc. +Copyright 1992-2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -84,6 +94,9 @@ exit 1 fi +# Just in case it came from the environment. +GUESS= + # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a @@ -102,7 +115,7 @@ # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" - # shellcheck disable=SC2039 + # shellcheck disable=SC2039,SC3028 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || @@ -112,7 +125,7 @@ ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD="$driver" + CC_FOR_BUILD=$driver break fi done @@ -133,14 +146,12 @@ UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "$UNAME_SYSTEM" in +case $UNAME_SYSTEM in Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu + LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" @@ -149,24 +160,37 @@ LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc - #else + #elif defined(__GLIBC__) LIBC=gnu + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" - # If ldd exists, use it to detect musl libc. - if command -v ldd >/dev/null && \ - ldd --version 2>&1 | grep -q ^musl - then - LIBC=musl + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. -case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -178,12 +202,12 @@ # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - "/sbin/$sysctl" 2>/dev/null || \ - "/usr/sbin/$sysctl" 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; @@ -192,13 +216,13 @@ earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` - machine="${arch}${endian}"-unknown + machine=${arch}${endian}-unknown ;; - *) machine="$UNAME_MACHINE_ARCH"-unknown ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; @@ -219,7 +243,7 @@ ;; esac # Determine ABI tags. - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` @@ -230,7 +254,7 @@ # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. - case "$UNAME_VERSION" in + case $UNAME_VERSION in Debian*) release='-gnu' ;; @@ -241,51 +265,57 @@ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "$machine-${os}${release}${abi-}" - exit ;; + GUESS=$machine-${os}${release}${abi-} + ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; *:MidnightBSD:*:*) - echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; *:ekkoBSD:*:*) - echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; *:SolidBSD:*:*) - echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; *:OS108:*:*) - echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; *:MirBSD:*:*) - echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; *:Sortix:*:*) - echo "$UNAME_MACHINE"-unknown-sortix - exit ;; + GUESS=$UNAME_MACHINE-unknown-sortix + ;; *:Twizzler:*:*) - echo "$UNAME_MACHINE"-unknown-twizzler - exit ;; + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; *:Redox:*:*) - echo "$UNAME_MACHINE"-unknown-redox - exit ;; + GUESS=$UNAME_MACHINE-unknown-redox + ;; mips:OSF1:*.*) - echo mips-dec-osf1 - exit ;; + GUESS=mips-dec-osf1 + ;; alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -299,7 +329,7 @@ # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in + case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") @@ -336,75 +366,76 @@ # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; + GUESS=m68k-unknown-sysv4 + ;; *:[Aa]miga[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-amigaos - exit ;; + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; *:[Mm]orph[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-morphos - exit ;; + GUESS=$UNAME_MACHINE-unknown-morphos + ;; *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; + GUESS=i370-ibm-openedition + ;; *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; + GUESS=s390-ibm-zvmoe + ;; *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; + GUESS=powerpc-ibm-os400 + ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix"$UNAME_RELEASE" - exit ;; + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; + GUESS=arm-unknown-riscos + ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; + GUESS=hppa1.1-hitachi-hiuxmpp + ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; + GUESS=pyramid-pyramid-svr4 + ;; DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; + GUESS=sparc-icl-nx6 + ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; s390x:SunOS:*:*) - echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux"$UNAME_RELEASE" - exit ;; + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null @@ -412,41 +443,44 @@ SUN_ARCH=x86_64 fi fi - echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in + case `/usr/bin/arch -k` in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; sun3*:SunOS:*:*) - echo m68k-sun-sunos"$UNAME_RELEASE" - exit ;; + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 - case "`/bin/arch`" in + case `/bin/arch` in sun3) - echo m68k-sun-sunos"$UNAME_RELEASE" + GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) - echo sparc-sun-sunos"$UNAME_RELEASE" + GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac - exit ;; + ;; aushp:SunOS:*:*) - echo sparc-auspex-sunos"$UNAME_RELEASE" - exit ;; + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -456,41 +490,41 @@ # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; m68k:machten:*:*) - echo m68k-apple-machten"$UNAME_RELEASE" - exit ;; + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; powerpc:machten:*:*) - echo powerpc-apple-machten"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; + GUESS=mips-dec-mach_bsd4.3 + ;; RISC*:ULTRIX:*:*) - echo mips-dec-ultrix"$UNAME_RELEASE" - exit ;; + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix"$UNAME_RELEASE" - exit ;; + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix"$UNAME_RELEASE" - exit ;; + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" @@ -518,75 +552,76 @@ dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos"$UNAME_RELEASE" - exit ;; + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; + GUESS=powerpc-motorola-powermax + ;; Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; + GUESS=powerpc-harris-powerunix + ;; m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; + GUESS=m88k-harris-cxux7 + ;; m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; + GUESS=m88k-motorola-sysv4 + ;; m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then - if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ - [ "$TARGET_BINARY_INTERFACE"x = x ] + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x then - echo m88k-dg-dgux"$UNAME_RELEASE" + GUESS=m88k-dg-dgux$UNAME_RELEASE else - echo m88k-dg-dguxbcs"$UNAME_RELEASE" + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else - echo i586-dg-dgux"$UNAME_RELEASE" + GUESS=i586-dg-dgux$UNAME_RELEASE fi - exit ;; + ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; + GUESS=m88k-dolphin-sysv3 + ;; M88*:*:R3*:*) # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; + GUESS=m88k-tektronix-sysv3 + ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; + GUESS=m68k-tektronix-bsd + ;; *:IRIX*:*:*) - echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" - exit ;; + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; + GUESS=i386-ibm-aix + ;; ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then + if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" - exit ;; + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build @@ -603,16 +638,16 @@ EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then - echo "$SYSTEM_NAME" + GUESS=$SYSTEM_NAME else - echo rs6000-ibm-aix3.2.5 + GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 + GUESS=rs6000-ibm-aix3.2.4 else - echo rs6000-ibm-aix3.2 + GUESS=rs6000-ibm-aix3.2 fi - exit ;; + ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then @@ -620,56 +655,56 @@ else IBM_ARCH=powerpc fi - if [ -x /usr/bin/lslpp ] ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + if test -x /usr/bin/lslpp ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo "$IBM_ARCH"-ibm-aix"$IBM_REV" - exit ;; + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; + GUESS=rs6000-ibm-aix + ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) - echo romp-ibm-bsd4.4 - exit ;; + GUESS=romp-ibm-bsd4.4 + ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; + GUESS=rs6000-bull-bosx + ;; DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; + GUESS=m68k-bull-sysv3 + ;; 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; + GUESS=m68k-hp-bsd + ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; + GUESS=m68k-hp-bsd4.4 + ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - case "$UNAME_MACHINE" in + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then + if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "$sc_cpu_version" in + case $sc_cpu_version in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 - case "$sc_kernel_bits" in + case $sc_kernel_bits in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi - if [ "$HP_ARCH" = "" ]; then + if test "$HP_ARCH" = ""; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" @@ -708,7 +743,7 @@ test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ "$HP_ARCH" = hppa2.0w ] + if test "$HP_ARCH" = hppa2.0w then set_cc_for_build @@ -729,12 +764,12 @@ HP_ARCH=hppa64 fi fi - echo "$HP_ARCH"-hp-hpux"$HPUX_REV" - exit ;; + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; ia64:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux"$HPUX_REV" - exit ;; + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" @@ -764,36 +799,36 @@ EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; + GUESS=unknown-hitachi-hiuxwe2 + ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) - echo hppa1.1-hp-bsd - exit ;; + GUESS=hppa1.1-hp-bsd + ;; 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; + GUESS=hppa1.0-hp-bsd + ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; + GUESS=hppa1.0-hp-mpeix + ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) - echo hppa1.1-hp-osf - exit ;; + GUESS=hppa1.1-hp-osf + ;; hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; + GUESS=hppa1.0-hp-osf + ;; i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo "$UNAME_MACHINE"-unknown-osf1mk + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk else - echo "$UNAME_MACHINE"-unknown-osf1 + GUESS=$UNAME_MACHINE-unknown-osf1 fi - exit ;; + ;; parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; + GUESS=hppa1.1-hp-lites + ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; + GUESS=c1-convex-bsd + ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd @@ -801,17 +836,18 @@ fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; + GUESS=c34-convex-bsd + ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; + GUESS=c38-convex-bsd + ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; + GUESS=c4-convex-bsd + ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ @@ -819,112 +855,124 @@ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) - echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; CRAY*SV1:*:*:*) - echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; *:BSD/OS:*:*) - echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi else - echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf fi - exit ;; + ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` - case "$UNAME_PROCESSOR" in + case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac - echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" - exit ;; + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; i*:CYGWIN*:*) - echo "$UNAME_MACHINE"-pc-cygwin - exit ;; + GUESS=$UNAME_MACHINE-pc-cygwin + ;; *:MINGW64*:*) - echo "$UNAME_MACHINE"-pc-mingw64 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; *:MINGW*:*) - echo "$UNAME_MACHINE"-pc-mingw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; *:MSYS*:*) - echo "$UNAME_MACHINE"-pc-msys - exit ;; + GUESS=$UNAME_MACHINE-pc-msys + ;; i*:PW*:*) - echo "$UNAME_MACHINE"-pc-pw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-pw32 + ;; *:Interix*:*) - case "$UNAME_MACHINE" in + case $UNAME_MACHINE in x86) - echo i586-pc-interix"$UNAME_RELEASE" - exit ;; + GUESS=i586-pc-interix$UNAME_RELEASE + ;; authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix"$UNAME_RELEASE" - exit ;; + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; IA64) - echo ia64-unknown-interix"$UNAME_RELEASE" - exit ;; + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; esac ;; i*:UWIN*:*) - echo "$UNAME_MACHINE"-pc-uwin - exit ;; + GUESS=$UNAME_MACHINE-pc-uwin + ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-pc-cygwin - exit ;; + GUESS=x86_64-pc-cygwin + ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; *:GNU:*:*) # the GNU system - echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" - exit ;; + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" - exit ;; + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; *:Minix:*:*) - echo "$UNAME_MACHINE"-unknown-minix - exit ;; + GUESS=$UNAME_MACHINE-unknown-minix + ;; aarch64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -937,60 +985,63 @@ esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi - exit ;; + ;; avr32*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; cris:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; crisv32:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; e2k:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; frv:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; hexagon:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; ia64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; k1om:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m32r*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m68*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 @@ -1035,113 +1086,124 @@ #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`" + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; openrisc*:Linux:*:*) - echo or1k-unknown-linux-"$LIBC" - exit ;; + GUESS=or1k-unknown-linux-$LIBC + ;; or32:Linux:*:* | or1k*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; padre:Linux:*:*) - echo sparc-unknown-linux-"$LIBC" - exit ;; + GUESS=sparc-unknown-linux-$LIBC + ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-"$LIBC" - exit ;; + GUESS=hppa64-unknown-linux-$LIBC + ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; - PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; - *) echo hppa-unknown-linux-"$LIBC" ;; + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; esac - exit ;; + ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc64-unknown-linux-$LIBC + ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc-unknown-linux-$LIBC + ;; ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc64le-unknown-linux-$LIBC + ;; ppcle:Linux:*:*) - echo powerpcle-unknown-linux-"$LIBC" - exit ;; - riscv32:Linux:*:* | riscv64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; s390:Linux:*:* | s390x:Linux:*:*) - echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; sh64*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sh*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; tile*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; vax:Linux:*:*) - echo "$UNAME_MACHINE"-dec-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; x86_64:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" - exit ;; + set_cc_for_build + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_X32 >/dev/null + then + LIBCABI=${LIBC}x32 + fi + fi + GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI + ;; xtensa*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; + GUESS=i386-sequent-sysv4 + ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. - echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" - exit ;; + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. - echo "$UNAME_MACHINE"-pc-os2-emx - exit ;; + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; i*86:XTS-300:*:STOP) - echo "$UNAME_MACHINE"-unknown-stop - exit ;; + GUESS=$UNAME_MACHINE-unknown-stop + ;; i*86:atheos:*:*) - echo "$UNAME_MACHINE"-unknown-atheos - exit ;; + GUESS=$UNAME_MACHINE-unknown-atheos + ;; i*86:syllable:*:*) - echo "$UNAME_MACHINE"-pc-syllable - exit ;; + GUESS=$UNAME_MACHINE-pc-syllable + ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; i*86:*DOS:*:*) - echo "$UNAME_MACHINE"-pc-msdosdjgpp - exit ;; + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else - echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi - exit ;; + ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in @@ -1149,12 +1211,12 @@ *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" - exit ;; + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 @@ -1164,11 +1226,11 @@ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else - echo "$UNAME_MACHINE"-pc-sysv32 + GUESS=$UNAME_MACHINE-pc-sysv32 fi - exit ;; + ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about @@ -1176,31 +1238,31 @@ # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; + GUESS=i586-pc-msdosdjgpp + ;; Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; + GUESS=i386-pc-mach3 + ;; paragon:*:*:*) - echo i860-intel-osf1 - exit ;; + GUESS=i860-intel-osf1 + ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi - exit ;; + ;; mini*:CTIX:SYS*5:*) # "miniframe" - echo m68010-convergent-sysv - exit ;; + GUESS=m68010-convergent-sysv + ;; mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; + GUESS=m68k-convergent-sysv + ;; M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; + GUESS=m68k-diab-dnix + ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) @@ -1225,113 +1287,116 @@ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; + GUESS=m68k-atari-sysv4 + ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv"$UNAME_RELEASE" - exit ;; + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo "$UNAME_MACHINE"-sni-sysv4 + GUESS=$UNAME_MACHINE-sni-sysv4 else - echo ns32k-sni-sysv + GUESS=ns32k-sni-sysv fi - exit ;; + ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says - echo i586-unisys-sysv4 - exit ;; + GUESS=i586-unisys-sysv4 + ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; + GUESS=hppa1.1-stratus-sysv4 + ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; + GUESS=i860-stratus-sysv4 + ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. - echo "$UNAME_MACHINE"-stratus-vos - exit ;; + GUESS=$UNAME_MACHINE-stratus-vos + ;; *:VOS:*:*) # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; + GUESS=hppa1.1-stratus-vos + ;; mc68*:A/UX:*:*) - echo m68k-apple-aux"$UNAME_RELEASE" - exit ;; + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; + GUESS=mips-sony-newsos6 + ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv"$UNAME_RELEASE" + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE else - echo mips-unknown-sysv"$UNAME_RELEASE" + GUESS=mips-unknown-sysv$UNAME_RELEASE fi - exit ;; + ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; + GUESS=powerpc-be-beos + ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; + GUESS=powerpc-apple-beos + ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; + GUESS=i586-pc-beos + ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; + GUESS=i586-pc-haiku + ;; x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; + GUESS=x86_64-unknown-haiku + ;; SX-4:SUPER-UX:*:*) - echo sx4-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; SX-5:SUPER-UX:*:*) - echo sx5-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; SX-6:SUPER-UX:*:*) - echo sx6-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; SX-7:SUPER-UX:*:*) - echo sx7-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; SX-8:SUPER-UX:*:*) - echo sx8-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; SX-ACE:SUPER-UX:*:*) - echo sxace-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; *:Rhapsody:*:*) - echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in @@ -1346,7 +1411,7 @@ else set_cc_for_build fi - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null @@ -1367,109 +1432,116 @@ # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi - echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; *:QNX:*:4*) - echo i386-pc-qnx - exit ;; + GUESS=i386-pc-qnx + ;; NEO-*:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; NSR-*:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; NSV-*:NONSTOP_KERNEL:*:*) - echo nsv-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; NSX-*:NONSTOP_KERNEL:*:*) - echo nsx-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; + GUESS=mips-compaq-nonstopux + ;; BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; + GUESS=bs2000-siemens-sysv + ;; DS/*:UNIX_System_V:*:*) - echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - # shellcheck disable=SC2154 - if test "$cputype" = 386; then + if test "${cputype-}" = 386; then UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype fi - echo "$UNAME_MACHINE"-unknown-plan9 - exit ;; + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; + GUESS=pdp10-unknown-tops10 + ;; *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; + GUESS=pdp10-unknown-tenex + ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; + GUESS=pdp10-dec-tops20 + ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; + GUESS=pdp10-xkl-tops20 + ;; *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; + GUESS=pdp10-unknown-tops20 + ;; *:ITS:*:*) - echo pdp10-unknown-its - exit ;; + GUESS=pdp10-unknown-its + ;; SEI:*:*:SEIUX) - echo mips-sei-seiux"$UNAME_RELEASE" - exit ;; + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; *:DragonFly:*:*) - echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" - exit ;; + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "$UNAME_MACHINE" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; + GUESS=i386-pc-xenix + ;; i*86:skyos:*:*) - echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" - exit ;; + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; i*86:rdos:*:*) - echo "$UNAME_MACHINE"-pc-rdos - exit ;; - i*86:AROS:*:*) - echo "$UNAME_MACHINE"-pc-aros - exit ;; + GUESS=$UNAME_MACHINE-pc-rdos + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; x86_64:VMkernel:*:*) - echo "$UNAME_MACHINE"-unknown-esx - exit ;; + GUESS=$UNAME_MACHINE-unknown-esx + ;; amd64:Isilon\ OneFS:*:*) - echo x86_64-unknown-onefs - exit ;; + GUESS=x86_64-unknown-onefs + ;; *:Unleashed:*:*) - echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; esac +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" </dev/null && SYSTEM_NAME=`$dummy` && +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. @@ -1609,7 +1681,7 @@ echo "$0: unable to guess system type" >&2 -case "$UNAME_MACHINE:$UNAME_SYSTEM" in +case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <, 1996 # @@ -66,7 +66,7 @@ dgux*) shlibpath_var=LD_LIBRARY_PATH ;; - freebsd* | dragonfly*) + freebsd* | dragonfly* | midnightbsd*) shlibpath_var=LD_LIBRARY_PATH ;; gnu*) diff -Nru bison-3.5.1+dfsg/build-aux/config.rpath bison-3.8.2+dfsg/build-aux/config.rpath --- bison-3.5.1+dfsg/build-aux/config.rpath 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/config.rpath 2021-03-10 05:41:24.000000000 +0000 @@ -2,7 +2,7 @@ # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # -# Copyright 1996-2020 Free Software Foundation, Inc. +# Copyright 1996-2021 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit , 1996 # @@ -371,7 +371,7 @@ hardcode_direct=yes hardcode_minus_L=yes ;; - freebsd* | dragonfly*) + freebsd* | dragonfly* | midnightbsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; @@ -547,7 +547,7 @@ freebsd[23].*) library_names_spec='$libname$shrext$versuffix' ;; - freebsd* | dragonfly*) + freebsd* | dragonfly* | midnightbsd*) library_names_spec='$libname$shrext' ;; gnu*) diff -Nru bison-3.5.1+dfsg/build-aux/config.sub bison-3.8.2+dfsg/build-aux/config.sub --- bison-3.5.1+dfsg/build-aux/config.sub 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/config.sub 2021-09-14 04:58:45.000000000 +0000 @@ -1,8 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2020 Free Software Foundation, Inc. +# Copyright 1992-2021 Free Software Foundation, Inc. -timestamp='2020-01-01' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2021-08-14' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -33,7 +35,7 @@ # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -50,6 +52,13 @@ # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ @@ -67,7 +76,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2020 Free Software Foundation, Inc. +Copyright 1992-2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -112,9 +121,11 @@ # Split fields of configuration type # shellcheck disable=SC2162 +saved_IFS=$IFS IFS="-" read field1 field2 field3 field4 <&2 - exit 1 + # No normalization, but not necessarily accepted, that comes below. ;; esac + else # Here we handle the default operating systems that come with various machines. @@ -1528,6 +1522,7 @@ # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. +kernel= case $cpu-$vendor in score-*) os=elf @@ -1539,7 +1534,8 @@ os=riscix1.2 ;; arm*-rebel) - os=linux + kernel=linux + os=gnu ;; arm*-semi) os=aout @@ -1705,84 +1701,179 @@ os=none ;; esac + fi +# Now, validate our (potentially fixed-up) OS. +case $os in + # Sometimes we do "kernel-libc", so those need to count as OSes. + musl* | newlib* | relibc* | uclibc*) + ;; + # Likewise for "kernel-abi" + eabi* | gnueabi*) + ;; + # VxWorks passes extra cpu info in the 4th filed. + simlinux | simwindows | spe) + ;; + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. + gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ + | hiux* | abug | nacl* | netware* | windows* \ + | os9* | macos* | osx* | ios* \ + | mpw* | magic* | mmixware* | mon960* | lnews* \ + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ + | aos* | aros* | cloudabi* | sortix* | twizzler* \ + | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ + | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ + | mirbsd* | netbsd* | dicos* | openedition* | ose* \ + | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ + | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ + | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ + | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ + | udi* | lites* | ieee* | go32* | aux* | hcos* \ + | chorusrdb* | cegcc* | glidix* | serenity* \ + | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ + | midipix* | mingw32* | mingw64* | mint* \ + | uxpv* | beos* | mpeix* | udk* | moxiebox* \ + | interix* | uwin* | mks* | rhapsody* | darwin* \ + | openstep* | oskit* | conix* | pw32* | nonstopux* \ + | storm-chaos* | tops10* | tenex* | tops20* | its* \ + | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ + | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ + | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr*) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + ;; + none) + ;; + *) + echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ + | linux-musl* | linux-relibc* | linux-uclibc* ) + ;; + uclinux-uclibc* ) + ;; + -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + vxworks-simlinux | vxworks-simwindows | vxworks-spe) + ;; + nto-qnx*) + ;; + os2-emx) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) - case $os in - riscix*) + case $cpu-$os in + *-riscix*) vendor=acorn ;; - sunos*) + *-sunos*) vendor=sun ;; - cnk*|-aix*) + *-cnk* | *-aix*) vendor=ibm ;; - beos*) + *-beos*) vendor=be ;; - hpux*) + *-hpux*) vendor=hp ;; - mpeix*) + *-mpeix*) vendor=hp ;; - hiux*) + *-hiux*) vendor=hitachi ;; - unos*) + *-unos*) vendor=crds ;; - dgux*) + *-dgux*) vendor=dg ;; - luna*) + *-luna*) vendor=omron ;; - genix*) + *-genix*) vendor=ns ;; - clix*) + *-clix*) vendor=intergraph ;; - mvs* | opened*) + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) vendor=ibm ;; - os400*) + s390-* | s390x-*) vendor=ibm ;; - ptx*) + *-ptx*) vendor=sequent ;; - tpf*) + *-tpf*) vendor=ibm ;; - vxsim* | vxworks* | windiss*) + *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; - aux*) + *-aux*) vendor=apple ;; - hms*) + *-hms*) vendor=hitachi ;; - mpw* | macos*) + *-mpw* | *-macos*) vendor=apple ;; - *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; - vos*) + *-vos*) vendor=stratus ;; esac ;; esac -echo "$cpu-$vendor-$os" +echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: diff -Nru bison-3.5.1+dfsg/build-aux/cross-options.pl bison-3.8.2+dfsg/build-aux/cross-options.pl --- bison-3.5.1+dfsg/build-aux/cross-options.pl 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/cross-options.pl 2021-06-23 04:48:48.000000000 +0000 @@ -2,7 +2,7 @@ # Generate a release announcement message. -# Copyright (C) 2007-2020 Free Software Foundation, Inc. +# Copyright (C) 2007-2021 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Written by Akimn Demaille. +# Written by Akim Demaille. use warnings; use 5.005; diff -Nru bison-3.5.1+dfsg/build-aux/Darwin.valgrind bison-3.8.2+dfsg/build-aux/Darwin.valgrind --- bison-3.5.1+dfsg/build-aux/Darwin.valgrind 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/Darwin.valgrind 2021-06-23 04:48:48.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2015, 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2012-2015, 2018-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -11,7 +11,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # Valgrind suppression file for Bison. diff -Nru bison-3.5.1+dfsg/build-aux/depcomp bison-3.8.2+dfsg/build-aux/depcomp --- bison-3.5.1+dfsg/build-aux/depcomp 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/depcomp 2021-08-03 05:51:08.000000000 +0000 @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff -Nru bison-3.5.1+dfsg/build-aux/do-release-commit-and-tag bison-3.8.2+dfsg/build-aux/do-release-commit-and-tag --- bison-3.5.1+dfsg/build-aux/do-release-commit-and-tag 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/do-release-commit-and-tag 2021-03-10 05:41:24.000000000 +0000 @@ -7,7 +7,7 @@ # Note: this is a bash script (could be zsh or dash) -# Copyright (C) 2009-2020 Free Software Foundation, Inc. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff -Nru bison-3.5.1+dfsg/build-aux/gendocs.sh bison-3.8.2+dfsg/build-aux/gendocs.sh --- bison-3.5.1+dfsg/build-aux/gendocs.sh 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/gendocs.sh 2021-08-03 05:51:08.000000000 +0000 @@ -2,9 +2,9 @@ # gendocs.sh -- generate a GNU manual in many formats. This script is # mentioned in maintain.texi. See the help message below for usage details. -scriptversion=2020-01-01.00 +scriptversion=2021-07-19.18 -# Copyright 2003-2020 Free Software Foundation, Inc. +# Copyright 2003-2021 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -58,7 +58,7 @@ commonarg= # passed to all makeinfo/texi2html invcations. dirargs= # passed to all tools (-I dir). dirs= # -I directories. -htmlarg="--css-ref=/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual" +htmlarg="--css-ref=https://www.gnu.org/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual" default_htmlarg=true infoarg=--no-split generate_ascii=true @@ -73,7 +73,7 @@ version="gendocs.sh $scriptversion -Copyright 2020 Free Software Foundation, Inc. +Copyright 2021 Free Software Foundation, Inc. There is NO warranty. You may redistribute this software under the terms of the GNU General Public License. For more information about these matters, see the files named COPYING." @@ -202,7 +202,7 @@ if $default_htmlarg && test -n "$use_texi2html"; then # The legacy texi2html doesn't support TOP_NODE_UP_URL - htmlarg="--css-ref=/software/gnulib/manual.css" + htmlarg="--css-ref=https://www.gnu.org/software/gnulib/manual.css" fi if test -n "$srcfile"; then diff -Nru bison-3.5.1+dfsg/build-aux/gitlog-to-changelog bison-3.8.2+dfsg/build-aux/gitlog-to-changelog --- bison-3.5.1+dfsg/build-aux/gitlog-to-changelog 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/gitlog-to-changelog 2021-03-10 06:08:13.000000000 +0000 @@ -3,7 +3,7 @@ # Convert git log output to ChangeLog format. -# Copyright (C) 2008-2020 Free Software Foundation, Inc. +# Copyright (C) 2008-2021 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,11 +31,11 @@ # are valid code in both sh and perl. When executed by sh, they re-execute # the script through the perl program found in $PATH. The '-x' option # is essential as well; without it, perl would re-execute the script -# through /bin/sh. When executed by perl, the next two lines are a no-op. +# through /bin/sh. When executed by perl, the next two lines are a no-op. eval 'exec perl -wSx "$0" "$@"' if 0; -my $VERSION = '2018-03-07 03:47'; # UTC +my $VERSION = '2021-02-24 23:42'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook @@ -455,7 +455,8 @@ # If there were any lines if (@line == 0) { - warn "$ME: warning: empty commit message:\n $date_line\n"; + warn "$ME: warning: empty commit message:\n" + . " commit $sha\n $date_line\n"; } else { diff -Nru bison-3.5.1+dfsg/build-aux/git-version-gen bison-3.8.2+dfsg/build-aux/git-version-gen --- bison-3.5.1+dfsg/build-aux/git-version-gen 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/git-version-gen 2021-06-23 05:08:39.000000000 +0000 @@ -1,8 +1,8 @@ #!/bin/sh # Print a version string. -scriptversion=2018-03-07.03; # UTC +scriptversion=2019-10-13.15; # UTC -# Copyright (C) 2007-2020 Free Software Foundation, Inc. +# Copyright (C) 2007-2021 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -75,10 +75,10 @@ year=`expr "$scriptversion" : '\([^-]*\)'` version="git-version-gen $scriptversion -Copyright $year Free Software Foundation, Inc. -There is NO warranty. You may redistribute this software -under the terms of the GNU General Public License. -For more information about these matters, see the files named COPYING." +Copyright (C) ${year} Free Software Foundation, Inc. +License GPLv3+: GNU GPL version 3 or later . +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law." usage="\ Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT] diff -Nru bison-3.5.1+dfsg/build-aux/gnupload bison-3.8.2+dfsg/build-aux/gnupload --- bison-3.5.1+dfsg/build-aux/gnupload 2020-01-10 18:57:40.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/gnupload 2021-06-23 05:08:39.000000000 +0000 @@ -1,13 +1,13 @@ #!/bin/sh # Sign files and upload them. -scriptversion=2018-05-19.18; # UTC +scriptversion=2021-04-11.09; # UTC -# Copyright (C) 2004-2020 Free Software Foundation, Inc. +# Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) +# the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, @@ -27,8 +27,8 @@ GPG=gpg # Choose the proper version of gpg, so as to avoid a # "gpg-agent is not available in this session" error -# when gpg-agent is version 3 but gpg is still version 1. -# FIXME-2020: remove, once all major distros ship gpg version 3 as /usr/bin/gpg +# when gpg-agent is version 2 but gpg is still version 1. +# FIXME-2020: remove, once all major distros ship gpg version 2 as /usr/bin/gpg gpg_agent_version=`(gpg-agent --version) 2>/dev/null | sed -e '2,$d' -e 's/^[^0-9]*//'` case "$gpg_agent_version" in 2.*) @@ -145,6 +145,12 @@ Send patches and bug reports to ." +copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'` +copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc. +License GPLv2+: GNU GPL version 2 or later . +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law." + # Read local configuration file if test -r "$conffile"; then echo "$0: Reading configuration file $conffile" @@ -209,7 +215,8 @@ ;; --version) echo "gnupload $scriptversion" - exit $? + echo "$copyright" + exit 0 ;; --) shift diff -Nru bison-3.5.1+dfsg/build-aux/gnu-web-doc-update bison-3.8.2+dfsg/build-aux/gnu-web-doc-update --- bison-3.5.1+dfsg/build-aux/gnu-web-doc-update 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/gnu-web-doc-update 2021-03-10 05:41:24.000000000 +0000 @@ -2,9 +2,9 @@ # Run this after each non-alpha release, to update the web documentation at # https://www.gnu.org/software/$pkg/manual/ -VERSION=2018-03-07.03; # UTC +VERSION=2021-01-09.09; # UTC -# Copyright (C) 2009-2020 Free Software Foundation, Inc. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -41,6 +41,7 @@ -C, --builddir=DIR location of (configured) Makefile (default: .) -n, --dry-run don't actually commit anything -m, --mirror remove out of date files from document server + -u, --user the name of the CVS user on Savannah --help print this help, then exit --version print version number, then exit @@ -109,6 +110,7 @@ builddir=. dryrun= rm_stale='echo' +cvs_user="$USER" while test $# != 0 do # Handle --option=value by splitting apart and putting back on argv. @@ -126,6 +128,7 @@ -C|--builddir) shift; builddir=$1; shift ;; -n|--dry-run) dryrun=echo; shift;; -m|--mirror) rm_stale=''; shift;; + -u|--user) shift; cvs_user=$1; shift ;; --*) die "unrecognized option: $1";; *) break;; esac @@ -172,7 +175,7 @@ tmp=$(mktemp -d web-doc-update.XXXXXX) || exit 1 ( cd $tmp \ - && $CVS -d $USER@cvs.sv.gnu.org:/webcvs/$pkg co $pkg ) + && $CVS -d $cvs_user@cvs.sv.gnu.org:/webcvs/$pkg co $pkg ) $RSYNC -avP "$builddir"/doc/manual/ $tmp/$pkg/manual ( diff -Nru bison-3.5.1+dfsg/build-aux/install-reloc bison-3.8.2+dfsg/build-aux/install-reloc --- bison-3.5.1+dfsg/build-aux/install-reloc 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/install-reloc 2021-03-10 05:41:24.000000000 +0000 @@ -1,6 +1,6 @@ #!/bin/sh # install-reloc - install a program including a relocating wrapper -# Copyright (C) 2003-2020 Free Software Foundation, Inc. +# Copyright (C) 2003-2021 Free Software Foundation, Inc. # Written by Bruno Haible , 2003. # # This program is free software: you can redistribute it and/or modify @@ -237,8 +237,16 @@ "$srcdir"/readlink.c \ "$srcdir"/stat.c \ "$srcdir"/canonicalize-lgpl.c \ + "$srcdir"/malloc/scratch_buffer_dupfree.c \ + "$srcdir"/malloc/scratch_buffer_grow.c \ + "$srcdir"/malloc/scratch_buffer_grow_preserve.c \ + "$srcdir"/malloc/scratch_buffer_set_array_size.c \ + "$srcdir"/malloc.c \ + "$srcdir"/realloc.c \ + "$srcdir"/free.c \ + "$srcdir"/mempcpy.c \ + "$srcdir"/rawmemchr.c \ "$srcdir"/malloca.c \ - "$srcdir"/lstat.c \ "$srcdir"/relocatable.c \ "$srcdir"/setenv.c \ "$srcdir"/c-ctype.c \ @@ -255,8 +263,16 @@ readlink.o \ stat.o \ canonicalize-lgpl.o \ + scratch_buffer_dupfree.o \ + scratch_buffer_grow.o \ + scratch_buffer_grow_preserve.o \ + scratch_buffer_set_array_size.o \ + malloc.o \ + realloc.o \ + free.o \ + mempcpy.o \ + rawmemchr.o \ malloca.o \ - lstat.o \ relocatable.o \ setenv.o \ c-ctype.o diff -Nru bison-3.5.1+dfsg/build-aux/install-sh bison-3.8.2+dfsg/build-aux/install-sh --- bison-3.5.1+dfsg/build-aux/install-sh 2019-10-29 20:28:54.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/install-sh 2021-03-10 05:41:24.000000000 +0000 @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2018-03-11.20; # UTC +scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -69,6 +69,11 @@ # Desired mode of installed file. mode=0755 +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= @@ -99,18 +104,28 @@ --version display version info and exit. -c (ignored) - -C install only if different (preserve the last data modification time) + -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do @@ -137,8 +152,13 @@ -o) chowncmd="$chownprog $2" shift;; + -p) cpprog="$cpprog -p";; + -s) stripcmd=$stripprog;; + -S) backupsuffix="$2" + shift;; + -t) is_target_a_directory=always dst_arg=$2 @@ -255,6 +275,10 @@ dstdir=$dst test -d "$dstdir" dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command @@ -301,22 +325,6 @@ if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then @@ -326,52 +334,49 @@ fi posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - # Note that $RANDOM variable is not portable (e.g. dash); Use it - # here however when possible just to lower collision chance. - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - - trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 - - # Because "mkdir -p" follows existing symlinks and we likely work - # directly in world-writeable /tmp, make sure that the '$tmpdir' - # directory is successfully created first before we actually test - # 'mkdir -p' feature. - if (umask $mkdir_umask && - $mkdirprog $mkdir_mode "$tmpdir" && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - test_tmpdir="$tmpdir/a" - ls_ld_tmpdir=`ls -ld "$test_tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null - fi - trap '' 0;; - esac;; + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; esac if @@ -382,7 +387,7 @@ then : else - # The umask is ridiculous, or mkdir does not conform to POSIX, + # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. @@ -411,7 +416,7 @@ prefixes= else if $posix_mkdir; then - (umask=$mkdir_umask && + (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 @@ -488,6 +493,13 @@ then rm -f "$dsttmp" else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || @@ -502,9 +514,9 @@ # file should still install successfully. { test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || + $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 diff -Nru bison-3.5.1+dfsg/build-aux/javacomp.sh.in bison-3.8.2+dfsg/build-aux/javacomp.sh.in --- bison-3.5.1+dfsg/build-aux/javacomp.sh.in 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/javacomp.sh.in 2021-03-10 05:41:24.000000000 +0000 @@ -1,7 +1,7 @@ #!/bin/sh # Compile a Java program. -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # Written by Bruno Haible , 2001. # # This program is free software: you can redistribute it and/or modify diff -Nru bison-3.5.1+dfsg/build-aux/javaexec.sh.in bison-3.8.2+dfsg/build-aux/javaexec.sh.in --- bison-3.5.1+dfsg/build-aux/javaexec.sh.in 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/javaexec.sh.in 2021-03-10 05:41:24.000000000 +0000 @@ -1,7 +1,7 @@ #!/bin/sh # Execute a Java program. -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # Written by Bruno Haible , 2001. # # This program is free software: you can redistribute it and/or modify diff -Nru bison-3.5.1+dfsg/build-aux/libtool-reloc bison-3.8.2+dfsg/build-aux/libtool-reloc --- bison-3.5.1+dfsg/build-aux/libtool-reloc 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/libtool-reloc 2021-03-10 05:41:24.000000000 +0000 @@ -1,6 +1,6 @@ #!/bin/sh # libtool-reloc - libtool wrapper with support for relocatable programs -# Copyright (C) 2019-2020 Free Software Foundation, Inc. +# Copyright (C) 2019-2021 Free Software Foundation, Inc. # Written by Bruno Haible , 2019. # # This program is free software: you can redistribute it and/or modify diff -Nru bison-3.5.1+dfsg/build-aux/Linux.valgrind bison-3.8.2+dfsg/build-aux/Linux.valgrind --- bison-3.5.1+dfsg/build-aux/Linux.valgrind 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/Linux.valgrind 2021-06-23 04:48:48.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2015, 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2012-2015, 2018-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -11,7 +11,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # Valgrind suppression file for Bison. diff -Nru bison-3.5.1+dfsg/build-aux/local.mk bison-3.8.2+dfsg/build-aux/local.mk --- bison-3.5.1+dfsg/build-aux/local.mk 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/local.mk 2021-06-23 04:48:48.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2000-2015, 2018-2020 Free Software Foundation, Inc. +## Copyright (C) 2000-2015, 2018-2021 Free Software Foundation, Inc. ## ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -11,7 +11,7 @@ ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License -## along with this program. If not, see . +## along with this program. If not, see . EXTRA_DIST += \ build-aux/Darwin.valgrind \ diff -Nru bison-3.5.1+dfsg/build-aux/mdate-sh bison-3.8.2+dfsg/build-aux/mdate-sh --- bison-3.5.1+dfsg/build-aux/mdate-sh 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/mdate-sh 2021-08-03 05:51:08.000000000 +0000 @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1995-2020 Free Software Foundation, Inc. +# Copyright (C) 1995-2021 Free Software Foundation, Inc. # written by Ulrich Drepper , June 1995 # # This program is free software; you can redistribute it and/or modify diff -Nru bison-3.5.1+dfsg/build-aux/missing bison-3.8.2+dfsg/build-aux/missing --- bison-3.5.1+dfsg/build-aux/missing 2020-01-19 13:16:04.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/missing 2021-09-25 04:54:03.000000000 +0000 @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify diff -Nru bison-3.5.1+dfsg/build-aux/move-if-change bison-3.8.2+dfsg/build-aux/move-if-change --- bison-3.5.1+dfsg/build-aux/move-if-change 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/move-if-change 2021-03-10 05:41:24.000000000 +0000 @@ -8,7 +8,7 @@ # If you change this file with Emacs, please let the write hook # do its job. Otherwise, update this string manually. -# Copyright (C) 2002-2020 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff -Nru bison-3.5.1+dfsg/build-aux/prefix-gnulib-mk bison-3.8.2+dfsg/build-aux/prefix-gnulib-mk --- bison-3.5.1+dfsg/build-aux/prefix-gnulib-mk 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/prefix-gnulib-mk 2021-06-23 05:08:39.000000000 +0000 @@ -3,20 +3,11 @@ # Rewrite a gnulib.mk, adding prefixes to work with automake's subdir-objects. -# Copyright (C) 2012-2020 Free Software Foundation, Inc. +# Copyright (C) 2012-2021 Free Software Foundation, Inc. # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. # # Written by Jim Meyering @@ -31,11 +22,11 @@ # are valid code in both sh and perl. When executed by sh, they re-execute # the script through the perl program found in $PATH. The '-x' option # is essential as well; without it, perl would re-execute the script -# through /bin/sh. When executed by perl, the next two lines are a no-op. +# through /bin/sh. When executed by perl, the next two lines are a no-op. eval 'exec perl -wSx "$0" "$@"' if 0; -my $VERSION = '2012-01-21 17:13'; # UTC +my $VERSION = '2020-04-04 15:07'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook diff -Nru bison-3.5.1+dfsg/build-aux/relocatable.sh.in bison-3.8.2+dfsg/build-aux/relocatable.sh.in --- bison-3.5.1+dfsg/build-aux/relocatable.sh.in 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/relocatable.sh.in 2021-03-10 05:41:24.000000000 +0000 @@ -6,7 +6,7 @@ # package by hand; see doc/relocatable-maint.texi (in Gnulib) for # details. # -# Copyright (C) 2003-2020 Free Software Foundation, Inc. +# Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff -Nru bison-3.5.1+dfsg/build-aux/reloc-ldflags bison-3.8.2+dfsg/build-aux/reloc-ldflags --- bison-3.5.1+dfsg/build-aux/reloc-ldflags 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/reloc-ldflags 2021-03-10 05:41:24.000000000 +0000 @@ -2,7 +2,7 @@ # Output a system dependent linker command for putting a relocatable library # search path into an executable. # -# Copyright 2003-2020 Free Software Foundation, Inc. +# Copyright 2003-2021 Free Software Foundation, Inc. # Written by Bruno Haible , 2003. # # This program is free software: you can redistribute it and/or modify @@ -56,7 +56,7 @@ origin_token= case "$host_os" in linux* | gnu* | kfreebsd* | \ - freebsd* | dragonfly* | \ + freebsd* | dragonfly* | midnightbsd* | \ netbsd* | \ openbsd* | \ solaris* | \ @@ -68,7 +68,9 @@ ;; esac if test -n "$origin_token"; then - rpath= + # We are not on AIX, HP-UX, or IRIX. Therefore the -rpath options are + # cumulative. + rpath_options= save_IFS="$IFS"; IFS=":" for dir in $library_path_value; do IFS="$save_IFS" @@ -89,8 +91,8 @@ idir=`echo "$idir" | sed -e 's,^//*[^/]*,,'` done dir="$origin_token"`echo "$idir" | sed -e 's,//*[^/]*,/..,g'`"$dir" - # Add dir to rpath. - rpath="${rpath}${rpath:+ }$dir" + # Augment rpath_options with dir. + rpath_options="${rpath_options}${rpath_options:+ }-Wl,-rpath,$dir" ;; *) if test -n "$dir"; then @@ -101,15 +103,14 @@ done IFS="$save_IFS" # Output it. - if test -n "$rpath"; then + if test -n "$rpath_options"; then case "$host_os" in # At least some versions of FreeBSD, DragonFly, and OpenBSD need the # linker option "-z origin". See . freebsd* | dragonfly* | openbsd*) - echo "-Wl,-z,origin -Wl,-rpath,$rpath" ;; - *) - echo "-Wl,-rpath,$rpath" ;; + rpath_options="-Wl,-z,origin $rpath_options" ;; esac + echo "$rpath_options" fi else echo "relocation via rpath not supported on this system: $host" 1>&2 diff -Nru bison-3.5.1+dfsg/build-aux/test-driver bison-3.8.2+dfsg/build-aux/test-driver --- bison-3.5.1+dfsg/build-aux/test-driver 2020-01-19 13:16:04.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/test-driver 2021-09-25 04:54:04.000000000 +0000 @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2011-2018 Free Software Foundation, Inc. +# Copyright (C) 2011-2021 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -42,11 +42,13 @@ { cat <$log_file 2>&1 +# Test script is run here. We create the file first, then append to it, +# to ameliorate tests themselves also writing to the log file. Our tests +# don't, but others can (automake bug#35762). +: >"$log_file" +"$@" >>"$log_file" 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then @@ -126,7 +131,7 @@ # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). -echo "$res $test_name (exit status: $estatus)" >>$log_file +echo "$res $test_name (exit status: $estatus)" >>"$log_file" # Report outcome to console. echo "${col}${res}${std}: $test_name" diff -Nru bison-3.5.1+dfsg/build-aux/texinfo.tex bison-3.8.2+dfsg/build-aux/texinfo.tex --- bison-3.5.1+dfsg/build-aux/texinfo.tex 2019-10-29 20:28:54.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/texinfo.tex 2021-06-23 05:08:39.000000000 +0000 @@ -3,9 +3,9 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2019-09-24.13} +\def\texinfoversion{2021-04-25.21} % -% Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc. +% Copyright 1985, 1986, 1988, 1990-2021 Free Software Foundation, Inc. % % This texinfo.tex file is free software: you can redistribute it and/or % modify it under the terms of the GNU General Public License as @@ -33,7 +33,7 @@ % The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. % -% Send bug reports to bug-texinfo@gnu.org. Please include including a +% Send bug reports to bug-texinfo@gnu.org. Please include a % complete document in each bug report with which we can reproduce the % problem. Patches are, of course, greatly appreciated. % @@ -349,36 +349,21 @@ \ifodd\pageno \advance\hoffset by \bindingoffset \else \advance\hoffset by -\bindingoffset\fi % + \checkchapterpage + % % Retrieve the information for the headings from the marks in the page, % and call Plain TeX's \makeheadline and \makefootline, which use the % values in \headline and \footline. % - % This is used to check if we are on the first page of a chapter. - \ifcase1\the\savedtopmark\fi - \let\prevchaptername\thischaptername - \ifcase0\firstmark\fi - \let\curchaptername\thischaptername - % - \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi - % - \ifx\curchaptername\prevchaptername - \let\thischapterheading\thischapter - \else - % \thischapterheading is the same as \thischapter except it is blank - % for the first page of a chapter. This is to prevent the chapter name - % being shown twice. - \def\thischapterheading{}% - \fi - % % Common context changes for both heading and footing. % Do this outside of the \shipout so @code etc. will be expanded in % the headline as they should be, not taken literally (outputting ''code). - \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars} - % - \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}% + \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars} % + \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi + \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}% \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi - \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}% + \global\setbox\footlinebox = \vbox{\commonheadfootline \makefootline}% % {% % Set context for writing to auxiliary files like index files. @@ -423,6 +408,22 @@ \ifr@ggedbottom \kern-\dimen@ \vfil \fi} } +% Check if we are on the first page of a chapter. Used for printing headings. +\newif\ifchapterpage +\def\checkchapterpage{% + % Get the chapter that was current at the end of the last page + \ifcase1\the\savedtopmark\fi + \let\prevchaptername\thischaptername + % + \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi + \let\curchaptername\thischaptername + % + \ifx\curchaptername\prevchaptername + \chapterpagefalse + \else + \chapterpagetrue + \fi +} % Argument parsing @@ -571,9 +572,8 @@ \fi } -% @end foo executes the definition of \Efoo. -% But first, it executes a specialized version of \checkenv -% + +% @end foo calls \checkenv and executes the definition of \Efoo. \parseargdef\end{% \if 1\csname iscond.#1\endcsname \else @@ -1002,6 +1002,14 @@ \global\everypar = {}% } +% leave vertical mode without cancelling any first paragraph indent +\gdef\imageindent{% + \toks0=\everypar + \everypar={}% + \ptexnoindent + \global\everypar=\toks0 +} + % @refill is a no-op. \let\refill=\relax @@ -1010,7 +1018,7 @@ \let\setfilename=\comment % @bye. -\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} +\outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend} \message{pdf,} @@ -1137,6 +1145,45 @@ \fi +% Output page labels information. +% See PDF reference v.1.7 p.594, section 8.3.1. +\ifpdf +\def\pagelabels{% + \def\title{0 << /P (T-) /S /D >>}% + \edef\roman{\the\romancount << /S /r >>}% + \edef\arabic{\the\arabiccount << /S /D >>}% + % + % Page label ranges must be increasing. Remove any duplicates. + % (There is a slight chance of this being wrong if e.g. there is + % a @contents but no @titlepage, etc.) + % + \ifnum\romancount=0 \def\roman{}\fi + \ifnum\arabiccount=0 \def\title{}% + \else + \ifnum\romancount=\arabiccount \def\roman{}\fi + \fi + % + \ifnum\romancount<\arabiccount + \pdfcatalog{/PageLabels << /Nums [\title \roman \arabic ] >> }\relax + \else + \pdfcatalog{/PageLabels << /Nums [\title \arabic \roman ] >> }\relax + \fi +} +\else + \let\pagelabels\relax +\fi + +\newcount\pagecount \pagecount=0 +\newcount\romancount \romancount=0 +\newcount\arabiccount \arabiccount=0 +\ifpdf + \let\ptxadvancepageno\advancepageno + \def\advancepageno{% + \ptxadvancepageno\global\advance\pagecount by 1 + } +\fi + + % PDF uses PostScript string constants for the names of xref targets, % for display in the outlines, and in other places. Thus, we have to % double any backslashes. Otherwise, a name like "\node" will be @@ -1427,7 +1474,13 @@ % subentries, which we calculated on our first read of the .toc above. % % We use the node names as the destinations. + % + % Currently we prefix the section name with the section number + % for chapter and appendix headings only in order to avoid too much + % horizontal space being required in the PDF viewer. \def\numchapentry##1##2##3##4{% + \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\unnchapentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% \def\numsecentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% @@ -1669,9 +1722,13 @@ % Therefore, we read toc only once. % % We use node names as destinations. + % + % Currently we prefix the section name with the section number + % for chapter and appendix headings only in order to avoid too much + % horizontal space being required in the PDF viewer. \def\partentry##1##2##3##4{}% ignore parts in the outlines \def\numchapentry##1##2##3##4{% - \dopdfoutline{##1}{1}{##3}{##4}}% + \dopdfoutline{##2 ##1}{1}{##3}{##4}}% \def\numsecentry##1##2##3##4{% \dopdfoutline{##1}{2}{##3}{##4}}% \def\numsubsecentry##1##2##3##4{% @@ -1683,7 +1740,8 @@ \let\appsecentry\numsecentry% \let\appsubsecentry\numsubsecentry% \let\appsubsubsecentry\numsubsubsecentry% - \let\unnchapentry\numchapentry% + \def\unnchapentry##1##2##3##4{% + \dopdfoutline{##1}{1}{##3}{##4}}% \let\unnsecentry\numsecentry% \let\unnsubsecentry\numsubsecentry% \let\unnsubsubsecentry\numsubsubsecentry% @@ -1812,19 +1870,23 @@ \closein 1 \endgroup % - \def\xetexpdfext{pdf}% - \ifx\xeteximgext\xetexpdfext - \XeTeXpdffile "#1".\xeteximgext "" - \else - \def\xetexpdfext{PDF}% + % Putting an \hbox around the image can prevent an over-long line + % after the image. + \hbox\bgroup + \def\xetexpdfext{pdf}% \ifx\xeteximgext\xetexpdfext \XeTeXpdffile "#1".\xeteximgext "" \else - \XeTeXpicfile "#1".\xeteximgext "" + \def\xetexpdfext{PDF}% + \ifx\xeteximgext\xetexpdfext + \XeTeXpdffile "#1".\xeteximgext "" + \else + \XeTeXpicfile "#1".\xeteximgext "" + \fi \fi - \fi - \ifdim \wd0 >0pt width \xeteximagewidth \fi - \ifdim \wd2 >0pt height \xeteximageheight \fi \relax + \ifdim \wd0 >0pt width \xeteximagewidth \fi + \ifdim \wd2 >0pt height \xeteximageheight \fi \relax + \egroup } \fi @@ -2496,7 +2558,7 @@ \def\it{\fam=\itfam \setfontstyle{it}} \def\sl{\fam=\slfam \setfontstyle{sl}} \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} -\def\tt{\fam=\ttfam \setfontstyle{tt}} +\def\tt{\fam=\ttfam \setfontstyle{tt}}\def\ttstylename{tt} % Texinfo sort of supports the sans serif font style, which plain TeX does not. % So we set up a \sf. @@ -2622,8 +2684,6 @@ \definetextfontsizexi -\message{markup,} - % Check if we are currently using a typewriter font. Since all the % Computer Modern typewriter fonts have zero interword stretch (and % shrink), and it is reasonable to expect all typewriter fonts to have @@ -2631,68 +2691,14 @@ % \def\ifmonospace{\ifdim\fontdimen3\font=0pt } -% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will -% define and register \INITMACRO to be called on markup style changes. -% \INITMACRO can check \currentmarkupstyle for the innermost -% style. - -\let\currentmarkupstyle\empty - -\def\setupmarkupstyle#1{% - \def\currentmarkupstyle{#1}% - \markupstylesetup -} - -\let\markupstylesetup\empty - -\def\defmarkupstylesetup#1{% - \expandafter\def\expandafter\markupstylesetup - \expandafter{\markupstylesetup #1}% - \def#1% -} - -% Markup style setup for left and right quotes. -\defmarkupstylesetup\markupsetuplq{% - \expandafter\let\expandafter \temp - \csname markupsetuplq\currentmarkupstyle\endcsname - \ifx\temp\relax \markupsetuplqdefault \else \temp \fi -} - -\defmarkupstylesetup\markupsetuprq{% - \expandafter\let\expandafter \temp - \csname markupsetuprq\currentmarkupstyle\endcsname - \ifx\temp\relax \markupsetuprqdefault \else \temp \fi -} - { \catcode`\'=\active \catcode`\`=\active -\gdef\markupsetuplqdefault{\let`\lq} -\gdef\markupsetuprqdefault{\let'\rq} - -\gdef\markupsetcodequoteleft{\let`\codequoteleft} -\gdef\markupsetcodequoteright{\let'\codequoteright} +\gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright} +\gdef\setregularquotes{\let`\lq \let'\rq} } -\let\markupsetuplqcode \markupsetcodequoteleft -\let\markupsetuprqcode \markupsetcodequoteright -% -\let\markupsetuplqexample \markupsetcodequoteleft -\let\markupsetuprqexample \markupsetcodequoteright -% -\let\markupsetuplqkbd \markupsetcodequoteleft -\let\markupsetuprqkbd \markupsetcodequoteright -% -\let\markupsetuplqsamp \markupsetcodequoteleft -\let\markupsetuprqsamp \markupsetcodequoteright -% -\let\markupsetuplqverb \markupsetcodequoteleft -\let\markupsetuprqverb \markupsetcodequoteright -% -\let\markupsetuplqverbatim \markupsetcodequoteleft -\let\markupsetuprqverbatim \markupsetcodequoteright - % Allow an option to not use regular directed right quote/apostrophe % (char 0x27), but instead the undirected quote from cmtt (char 0x0d). % The undirected quote is ugly, so don't make it the default, but it @@ -2855,7 +2861,7 @@ } % @samp. -\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} +\def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}} % @indicateurl is \samp, that is, with quotes. \let\indicateurl=\samp @@ -2898,8 +2904,7 @@ \global\let'=\rq \global\let`=\lq % default definitions % \global\def\code{\begingroup - \setupmarkupstyle{code}% - % The following should really be moved into \setupmarkupstyle handlers. + \setcodequotes \catcode\dashChar=\active \catcode\underChar=\active \ifallowcodebreaks \let-\codedash @@ -2987,10 +2992,18 @@ % arg (if given), and not the url (which is then just the link target). \newif\ifurefurlonlylink +% The default \pretolerance setting stops the penalty inserted in +% \urefallowbreak being a discouragement to line breaking. Set it to +% a negative value for this paragraph only. Hopefully this does not +% conflict with redefinitions of \par done elsewhere. +\def\nopretolerance{% +\pretolerance=-1 +\def\par{\endgraf\pretolerance=100 \let\par\endgraf}% +} + % The main macro is \urefbreak, which allows breaking at expected -% places within the url. (There used to be another version, which -% didn't support automatic breaking.) -\def\urefbreak{\begingroup \urefcatcodes \dourefbreak} +% places within the url. +\def\urefbreak{\nopretolerance \begingroup \urefcatcodes \dourefbreak} \let\uref=\urefbreak % \def\dourefbreak#1{\urefbreakfinish #1,,,\finish} @@ -3045,7 +3058,7 @@ \urefcatcodes % \global\def\urefcode{\begingroup - \setupmarkupstyle{code}% + \setcodequotes \urefcatcodes \let&\urefcodeamp \let.\urefcodedot @@ -3101,15 +3114,15 @@ % Allow a ragged right output to aid breaking long URL's. There can % be a break at the \allowbreak with no extra glue (if the existing stretch in -% the line is sufficent), a break at the \penalty100 with extra glue added +% the line is sufficient), a break at the \penalty with extra glue added % at the end of the line, or no break at all here. % Changing the value of the penalty and/or the amount of stretch affects how -% preferrable one choice is over the other. +% preferable one choice is over the other. \def\urefallowbreak{% - \allowbreak - \hskip 0pt plus 4 em\relax - \penalty100 - \hskip 0pt plus -4 em\relax + \penalty0\relax + \hskip 0pt plus 2 em\relax + \penalty1000\relax + \hskip 0pt plus -2 em\relax } \urefbreakstyle after @@ -3166,8 +3179,8 @@ \def\kbdsub#1#2#3\par{% \def\one{#1}\def\three{#3}\def\threex{??}% \ifx\one\xkey\ifx\threex\three \key{#2}% - \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi - \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi + \else{\tclose{\kbdfont\setcodequotes\look}}\fi + \else{\tclose{\kbdfont\setcodequotes\look}}\fi } % definition of @key that produces a lozenge. Doesn't adjust to text size. @@ -3184,7 +3197,7 @@ % monospace, don't change it; that way, we respect @kbdinputstyle. But % if it isn't monospace, then use \tt. % -\def\key#1{{\setupmarkupstyle{key}% +\def\key#1{{\setregularquotes \nohyphenation \ifmonospace\else\tt\fi #1}\null} @@ -3305,6 +3318,29 @@ \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi} \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}% +% provide this command from LaTeX as it is very common +\def\frac#1#2{{{#1}\over{#2}}} + +% @displaymath. +% \globaldefs is needed to recognize the end lines in \tex and +% \end tex. Set \thisenv as @end displaymath is seen before @end tex. +{\obeylines +\globaldefs=1 +\envdef\displaymath{% +\tex% +\def\thisenv{\displaymath}% +\begingroup\let\end\displaymathend% +$$% +} + +\def\displaymathend{$$\endgroup\end}% + +\def\Edisplaymath{% +\def\thisenv{\tex}% +\end tex +}} + + % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. % Ignore unless FMTNAME == tex; then it is like @iftex and @tex, % except specified as a normal braced arg, so no newlines to worry about. @@ -3509,7 +3545,7 @@ % @pounds{} is a sterling sign, which Knuth put in the CM italic font. % -\def\pounds{{\it\$}} +\def\pounds{\ifmonospace{\ecfont\char"BF}\else{\it\$}\fi} % @euro{} comes from a separate font, depending on the current style. % We use the free feym* fonts from the eurosym package by Henrik @@ -3658,11 +3694,19 @@ \fi % Quotes. -\chardef\quotedblleft="5C -\chardef\quotedblright=`\" \chardef\quoteleft=`\` \chardef\quoteright=`\' +% only change font for tt for correct kerning and to avoid using +% \ecfont unless necessary. +\def\quotedblleft{% + \ifmonospace{\ecfont\char"10}\else{\char"5C}\fi +} + +\def\quotedblright{% + \ifmonospace{\ecfont\char"11}\else{\char`\"}\fi +} + \message{page headings,} @@ -3784,12 +3828,19 @@ \newtoks\evenheadline % headline on even pages \newtoks\oddheadline % headline on odd pages +\newtoks\evenchapheadline% headline on even pages with a new chapter +\newtoks\oddchapheadline % headline on odd pages with a new chapter \newtoks\evenfootline % footline on even pages \newtoks\oddfootline % footline on odd pages % Now make \makeheadline and \makefootline in Plain TeX use those variables -\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline - \else \the\evenheadline \fi}} +\headline={{\textfonts\rm + \ifchapterpage + \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi + \else + \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi + \fi}} + \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}\HEADINGShook} \let\HEADINGShook=\relax @@ -3805,12 +3856,14 @@ \def\evenheading{\parsearg\evenheadingxxx} \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} \def\evenheadingyyy #1\|#2\|#3\|#4\finish{% -\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}} + \global\evenchapheadline=\evenheadline} \def\oddheading{\parsearg\oddheadingxxx} \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} \def\oddheadingyyy #1\|#2\|#3\|#4\finish{% -\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}% + \global\oddchapheadline=\oddheadline} \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% @@ -3877,37 +3930,34 @@ \parseargdef\headings{\csname HEADINGS#1\endcsname} \def\headingsoff{% non-global headings elimination - \evenheadline={\hfil}\evenfootline={\hfil}% - \oddheadline={\hfil}\oddfootline={\hfil}% + \evenheadline={\hfil}\evenfootline={\hfil}\evenchapheadline={\hfil}% + \oddheadline={\hfil}\oddfootline={\hfil}\oddchapheadline={\hfil}% } \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting \HEADINGSoff % it's the default % When we turn headings on, set the page number to 1. +\def\pageone{ + \global\pageno=1 + \global\arabiccount = \pagecount +} + % For double-sided printing, put current file name in lower left corner, % chapter name on inside top of right hand pages, document % title on inside top of left hand pages, and page numbers on outside top % edge of all pages. \def\HEADINGSdouble{% -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapterheading\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage +\pageone +\HEADINGSdoublex } \let\contentsalignmacro = \chappager % For single-sided printing, chapter title goes across top left of page, % page number on top right. \def\HEADINGSsingle{% -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapterheading\hfil\folio}} -\global\oddheadline={\line{\thischapterheading\hfil\folio}} -\global\let\contentsalignmacro = \chappager +\pageone +\HEADINGSsinglex } \def\HEADINGSon{\HEADINGSdouble} @@ -3917,7 +3967,9 @@ \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapterheading\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\evenchapheadline={\line{\folio\hfil}} +\global\oddchapheadline={\line{\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } @@ -3925,8 +3977,22 @@ \def\HEADINGSsinglex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapterheading\hfil\folio}} -\global\oddheadline={\line{\thischapterheading\hfil\folio}} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\evenchapheadline={\line{\hfil\folio}} +\global\oddchapheadline={\line{\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} + +% for @setchapternewpage off +\def\HEADINGSsinglechapoff{% +\pageone +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\evenchapheadline=\evenheadline +\global\oddchapheadline=\oddheadline \global\let\contentsalignmacro = \chappager } @@ -4235,82 +4301,8 @@ \doitemize{#1.}\flushcr } -% @alphaenumerate and @capsenumerate are abbreviations for giving an arg -% to @enumerate. -% -\def\alphaenumerate{\enumerate{a}} -\def\capsenumerate{\enumerate{A}} -\def\Ealphaenumerate{\Eenumerate} -\def\Ecapsenumerate{\Eenumerate} - % @multitable macros -% Amy Hendrickson, 8/18/94, 3/6/96 -% -% @multitable ... @end multitable will make as many columns as desired. -% Contents of each column will wrap at width given in preamble. Width -% can be specified either with sample text given in a template line, -% or in percent of \hsize, the current width of text on page. - -% Table can continue over pages but will only break between lines. - -% To make preamble: -% -% Either define widths of columns in terms of percent of \hsize: -% @multitable @columnfractions .25 .3 .45 -% @item ... -% -% Numbers following @columnfractions are the percent of the total -% current hsize to be used for each column. You may use as many -% columns as desired. - - -% Or use a template: -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item ... -% using the widest term desired in each column. - -% Each new table line starts with @item, each subsequent new column -% starts with @tab. Empty columns may be produced by supplying @tab's -% with nothing between them for as many times as empty columns are needed, -% ie, @tab@tab@tab will produce two empty columns. - -% @item, @tab do not need to be on their own lines, but it will not hurt -% if they are. - -% Sample multitable: - -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item first col stuff @tab second col stuff @tab third col -% @item -% first col stuff -% @tab -% second col stuff -% @tab -% third col -% @item first col stuff @tab second col stuff -% @tab Many paragraphs of text may be used in any column. -% -% They will wrap at the width determined by the template. -% @item@tab@tab This will be in third column. -% @end multitable - -% Default dimensions may be reset by user. -% @multitableparskip is vertical space between paragraphs in table. -% @multitableparindent is paragraph indent in table. -% @multitablecolmargin is horizontal space to be left between columns. -% @multitablelinespace is space to leave between table items, baseline -% to baseline. -% 0pt means it depends on current normal line spacing. -% -\newskip\multitableparskip -\newskip\multitableparindent -\newdimen\multitablecolspace -\newskip\multitablelinespace -\multitableparskip=0pt -\multitableparindent=6pt -\multitablecolspace=12pt -\multitablelinespace=0pt % Macros used to set up halign preamble: % @@ -4358,8 +4350,6 @@ \go } -% multitable-only commands. -% % @headitem starts a heading row, which we typeset in bold. Assignments % have to be global since we are inside the implicit group of an % alignment entry. \everycr below resets \everytab so we don't have to @@ -4376,14 +4366,8 @@ % default for tables with no headings. \let\headitemcrhook=\relax % -% A \tab used to include \hskip1sp. But then the space in a template -% line is not enough. That is bad. So let's go back to just `&' until -% we again encounter the problem the 1sp was intended to solve. -% --karl, nathan@acm.org, 20apr99. \def\tab{\checkenv\multitable &\the\everytab}% -% @multitable ... @end multitable definitions: -% \newtoks\everytab % insert after every tab. % \envdef\multitable{% @@ -4398,9 +4382,8 @@ % \tolerance=9500 \hbadness=9500 - \setmultitablespacing - \parskip=\multitableparskip - \parindent=\multitableparindent + \parskip=0pt + \parindent=6pt \overfullrule=0pt \global\colcount=0 % @@ -4430,47 +4413,24 @@ % continue for many paragraphs if desired. \halign\bgroup &% \global\advance\colcount by 1 - \multistrut + \strut \vtop{% - % Use the current \colcount to find the correct column width: + \advance\hsize by -1\leftskip + % Find the correct column width \hsize=\expandafter\csname col\the\colcount\endcsname % - % In order to keep entries from bumping into each other - % we will add a \leftskip of \multitablecolspace to all columns after - % the first one. - % - % If a template has been used, we will add \multitablecolspace - % to the width of each template entry. - % - % If the user has set preamble in terms of percent of \hsize we will - % use that dimension as the width of the column, and the \leftskip - % will keep entries from bumping into each other. Table will start at - % left margin and final column will justify at right margin. - % - % Make sure we don't inherit \rightskip from the outer environment. \rightskip=0pt \ifnum\colcount=1 - % The first column will be indented with the surrounding text. - \advance\hsize by\leftskip + \advance\hsize by\leftskip % Add indent of surrounding text \else - \ifsetpercent \else - % If user has not set preamble in terms of percent of \hsize - % we will advance \hsize by \multitablecolspace. - \advance\hsize by \multitablecolspace - \fi - % In either case we will make \leftskip=\multitablecolspace: - \leftskip=\multitablecolspace + % In order to keep entries from bumping into each other. + \leftskip=12pt + \ifsetpercent \else + % If a template has been used + \advance\hsize by \leftskip + \fi \fi - % Ignoring space at the beginning and end avoids an occasional spurious - % blank line, when TeX decides to break the line at the space before the - % box from the multistrut, so the strut ends up on a line by itself. - % For example: - % @multitable @columnfractions .11 .89 - % @item @code{#} - % @tab Legal holiday which is valid in major parts of the whole country. - % Is automatically provided with highlighting sequences respectively - % marking characters. - \noindent\ignorespaces##\unskip\multistrut + \noindent\ignorespaces##\unskip\strut }\cr } \def\Emultitable{% @@ -4479,31 +4439,6 @@ \global\setpercentfalse } -\def\setmultitablespacing{% - \def\multistrut{\strut}% just use the standard line spacing - % - % Compute \multitablelinespace (if not defined by user) for use in - % \multitableparskip calculation. We used define \multistrut based on - % this, but (ironically) that caused the spacing to be off. - % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. -\ifdim\multitablelinespace=0pt -\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip -\global\advance\multitablelinespace by-\ht0 -\fi -% Test to see if parskip is larger than space between lines of -% table. If not, do nothing. -% If so, set to same dimension as multitablelinespace. -\ifdim\multitableparskip>\multitablelinespace -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller - % than skip between lines in the table. -\fi% -\ifdim\multitableparskip=0pt -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller - % than skip between lines in the table. -\fi} - \message{conditionals,} @@ -4841,7 +4776,7 @@ % like the previous two, but they put @code around the argument. \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx} -\def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}} +\def\docodeindexxxx #1{\docind{\indexname}{#1}} % Used for the aux, toc and index files to prevent expansion of Texinfo @@ -5138,43 +5073,44 @@ \def\ss{ss}% \def\th{th}% % - \def\LaTeX{LaTeX}% - \def\TeX{TeX}% + \let\do\indexnofontsdef + % + \do\LaTeX{LaTeX}% + \do\TeX{TeX}% % - % Assorted special characters. \defglyph gives the control sequence a - % definition that removes the {} that follows its use. - \defglyph\atchar{@}% - \defglyph\arrow{->}% - \defglyph\bullet{bullet}% - \defglyph\comma{,}% - \defglyph\copyright{copyright}% - \defglyph\dots{...}% - \defglyph\enddots{...}% - \defglyph\equiv{==}% - \defglyph\error{error}% - \defglyph\euro{euro}% - \defglyph\expansion{==>}% - \defglyph\geq{>=}% - \defglyph\guillemetleft{<<}% - \defglyph\guillemetright{>>}% - \defglyph\guilsinglleft{<}% - \defglyph\guilsinglright{>}% - \defglyph\leq{<=}% - \defglyph\lbracechar{\{}% - \defglyph\minus{-}% - \defglyph\point{.}% - \defglyph\pounds{pounds}% - \defglyph\print{-|}% - \defglyph\quotedblbase{"}% - \defglyph\quotedblleft{"}% - \defglyph\quotedblright{"}% - \defglyph\quoteleft{`}% - \defglyph\quoteright{'}% - \defglyph\quotesinglbase{,}% - \defglyph\rbracechar{\}}% - \defglyph\registeredsymbol{R}% - \defglyph\result{=>}% - \defglyph\textdegree{o}% + % Assorted special characters. + \do\atchar{@}% + \do\arrow{->}% + \do\bullet{bullet}% + \do\comma{,}% + \do\copyright{copyright}% + \do\dots{...}% + \do\enddots{...}% + \do\equiv{==}% + \do\error{error}% + \do\euro{euro}% + \do\expansion{==>}% + \do\geq{>=}% + \do\guillemetleft{<<}% + \do\guillemetright{>>}% + \do\guilsinglleft{<}% + \do\guilsinglright{>}% + \do\leq{<=}% + \do\lbracechar{\{}% + \do\minus{-}% + \do\point{.}% + \do\pounds{pounds}% + \do\print{-|}% + \do\quotedblbase{"}% + \do\quotedblleft{"}% + \do\quotedblright{"}% + \do\quoteleft{`}% + \do\quoteright{'}% + \do\quotesinglbase{,}% + \do\rbracechar{\}}% + \do\registeredsymbol{R}% + \do\result{=>}% + \do\textdegree{o}% % % We need to get rid of all macros, leaving only the arguments (if present). % Of course this is not nearly correct, but it is the best we can do for now. @@ -5189,7 +5125,10 @@ \macrolist \let\value\indexnofontsvalue } -\def\defglyph#1#2{\def#1##1{#2}} % see above + +% Give the control sequence a definition that removes the {} that follows +% its use, e.g. @AA{} -> AA +\def\indexnofontsdef#1#2{\def#1##1{#2}}% @@ -5208,6 +5147,20 @@ \fi } +% Same as \doind, but for code indices +\def\docind#1#2{% + \iflinks + {% + % + \requireopenindexfile{#1}% + \edef\writeto{\csname#1indfile\endcsname}% + % + \def\indextext{#2}% + \safewhatsit\docindwrite + }% + \fi +} + % Check if an index file has been opened, and if not, open it. \def\requireopenindexfile#1{% \ifnum\csname #1indfile\endcsname=0 @@ -5274,6 +5227,9 @@ % trim spaces. \edef\trimmed{\segment}% \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}% + \ifincodeindex + \edef\trimmed{\noexpand\code{\trimmed}}% + \fi % \xdef\bracedtext{\bracedtext{\trimmed}}% % @@ -5339,7 +5295,12 @@ % Write the entry in \indextext to the index file. % -\def\doindwrite{% + +\newif\ifincodeindex +\def\doindwrite{\incodeindexfalse\doindwritex} +\def\docindwrite{\incodeindextrue\doindwritex} + +\def\doindwritex{% \maybemarginindex % \atdummies @@ -5559,7 +5520,11 @@ \else \begindoublecolumns \catcode`\\=0\relax - \catcode`\@=12\relax + % + % Make @ an escape character to give macros a chance to work. This + % should work because we (hopefully) don't otherwise use @ in index files. + %\catcode`\@=12\relax + \catcode`\@=0\relax \input \jobname.\indexname s \enddoublecolumns \fi @@ -6401,18 +6366,16 @@ \def\CHAPPAGoff{% \global\let\contentsalignmacro = \chappager \global\let\pchapsepmacro=\chapbreak -\global\let\pagealignmacro=\chappager} +\global\def\HEADINGSon{\HEADINGSsinglechapoff}} \def\CHAPPAGon{% \global\let\contentsalignmacro = \chappager \global\let\pchapsepmacro=\chappager -\global\let\pagealignmacro=\chappager \global\def\HEADINGSon{\HEADINGSsingle}} \def\CHAPPAGodd{% \global\let\contentsalignmacro = \chapoddpage \global\let\pchapsepmacro=\chapoddpage -\global\let\pagealignmacro=\chapoddpage \global\def\HEADINGSon{\HEADINGSdouble}} \CHAPPAGon @@ -6777,9 +6740,7 @@ % \def\startcontents#1{% % If @setchapternewpage on, and @headings double, the contents should - % start on an odd page, unlike chapters. Thus, we maintain - % \contentsalignmacro in parallel with \pagealignmacro. - % From: Torbjorn Granlund + % start on an odd page, unlike chapters. \contentsalignmacro \immediate\closeout\tocfile % @@ -6794,6 +6755,9 @@ % % Roman numerals for page numbers. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi + \def\thistitle{}% no title in double-sided headings + % Record where the Roman numerals started. + \ifnum\romancount=0 \global\romancount=\pagecount \fi } % redefined for the two-volume lispref. We always output on @@ -6816,8 +6780,7 @@ \fi \closein 1 \endgroup - \lastnegativepageno = \pageno - \global\pageno = \savepageno + \contentsendroman } % And just the chapters. @@ -6852,10 +6815,20 @@ \vfill \eject \contentsalignmacro % in case @setchapternewpage odd is in effect \endgroup + \contentsendroman +} +\let\shortcontents = \summarycontents + +% Get ready to use Arabic numerals again +\def\contentsendroman{% \lastnegativepageno = \pageno \global\pageno = \savepageno + % + % If \romancount > \arabiccount, the contents are at the end of the + % document. Otherwise, advance where the Arabic numerals start for + % the page numbers. + \ifnum\romancount>\arabiccount\else\global\arabiccount=\pagecount\fi } -\let\shortcontents = \summarycontents % Typeset the label for a chapter or appendix for the short contents. % The arg is, e.g., `A' for an appendix, or `3' for a chapter. @@ -6997,7 +6970,7 @@ % But \@ or @@ will get a plain @ character. \envdef\tex{% - \setupmarkupstyle{tex}% + \setregularquotes \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie @@ -7223,7 +7196,7 @@ % If you want all examples etc. small: @set dispenvsize small. % If you want even small examples the full size: @set dispenvsize nosmall. % This affects the following displayed environments: -% @example, @display, @format, @lisp +% @example, @display, @format, @lisp, @verbatim % \def\smallword{small} \def\nosmallword{nosmall} @@ -7269,9 +7242,9 @@ % \maketwodispenvdef{lisp}{example}{% \nonfillstart - \tt\setupmarkupstyle{example}% + \tt\setcodequotes \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. - \gobble % eat return + \parsearg\gobble } % @display/@smalldisplay: same as @lisp except keep current font. % @@ -7429,7 +7402,7 @@ \def\setupverb{% \tt % easiest (and conventionally used) font for verbatim \def\par{\leavevmode\endgraf}% - \setupmarkupstyle{verb}% + \setcodequotes \tabeightspaces % Respect line breaks, % print special symbols as themselves, and @@ -7444,13 +7417,9 @@ \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount % % We typeset each line of the verbatim in an \hbox, so we can handle -% tabs. The \global is in case the verbatim line starts with an accent, -% or some other command that starts with a begin-group. Otherwise, the -% entire \verbbox would disappear at the corresponding end-group, before -% it is typeset. Meanwhile, we can't have nested verbatim commands -% (can we?), so the \global won't be overwriting itself. +% tabs. \newbox\verbbox -\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup} +\def\starttabbox{\setbox\verbbox=\hbox\bgroup} % \begingroup \catcode`\^^I=\active @@ -7461,7 +7430,8 @@ \divide\dimen\verbbox by\tabw \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw - \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox + \wd\verbbox=\dimen\verbbox + \leavevmode\box\verbbox \starttabbox }% } \endgroup @@ -7471,17 +7441,14 @@ \let\nonarrowing = t% \nonfillstart \tt % easiest (and conventionally used) font for verbatim - % The \leavevmode here is for blank lines. Otherwise, we would - % never \starttabbox and the \egroup would end verbatim mode. - \def\par{\leavevmode\egroup\box\verbbox\endgraf}% + \def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}% \tabexpand - \setupmarkupstyle{verbatim}% + \setcodequotes % Respect line breaks, % print special symbols as themselves, and % make each space count. % Must do in this order: \obeylines \uncatcodespecials \sepspaces - \everypar{\starttabbox}% } % Do the @verb magic: verbatim text is quoted by unique @@ -7516,13 +7483,16 @@ % ignore everything up to the first ^^M, that's the newline at the end % of the @verbatim input line itself. Otherwise we get an extra blank % line in the output. - \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + \xdef\doverbatim#1^^M#2@end verbatim{% + \starttabbox#2\egroup\noexpand\end\gobble verbatim}% % We really want {...\end verbatim} in the body of the macro, but % without the active space; thus we have to use \xdef and \gobble. + % The \egroup ends the \verbbox started at the end of the last line in + % the block. \endgroup % \envdef\verbatim{% - \setupverbatim\doverbatim + \setnormaldispenv\setupverbatim\doverbatim } \let\Everbatim = \afterenvbreak @@ -7540,7 +7510,7 @@ \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% \edef\tmp{\noexpand\input #1 } \expandafter - }\tmp + }\expandafter\starttabbox\tmp\egroup \afterenvbreak }% } @@ -7892,7 +7862,7 @@ % leave the code in, but it's strange for @var to lead to typewriter. % Nowadays we recommend @code, since the difference between a ttsl hyphen % and a tt hyphen is pretty tiny. @code also disables ?` !`. - \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}% + \def\var##1{{\setregularquotes\ttslanted{##1}}}% #1% \sl\hyphenchar\font=45 } @@ -8001,11 +7971,18 @@ } \fi +\let\E=\expandafter + % Used at the time of macro expansion. % Argument is macro body with arguments substituted \def\scanmacro#1{% \newlinechar`\^^M - \def\xeatspaces{\eatspaces}% + % expand the expansion of \eatleadingcr twice to maybe remove a leading + % newline (and \else and \fi tokens), then call \eatspaces on the result. + \def\xeatspaces##1{% + \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1% + }}% + \def\xempty##1{}% % % Process the macro body under the current catcode regime. \scantokens{#1@comment}% @@ -8058,6 +8035,11 @@ \unbrace{\gdef\trim@@@ #1 } #2@{#1} } +{\catcode`\^^M=\other% +\gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}% +% Warning: this won't work for a delimited argument +% or for an empty argument + % Trim a single trailing ^^M off a string. {\catcode`\^^M=\other \catcode`\Q=3% \gdef\eatcr #1{\eatcra #1Q^^MQ}% @@ -8224,6 +8206,7 @@ \let\hash\relax % \hash is redefined to `#' later to get it into definitions \let\xeatspaces\relax + \let\xempty\relax \parsemargdefxxx#1,;,% \ifnum\paramno<10\relax\else \paramno0\relax @@ -8235,9 +8218,11 @@ \else \let\next=\parsemargdefxxx \advance\paramno by 1 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname - {\xeatspaces{\hash\the\paramno}}% + {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}% \edef\paramlist{\paramlist\hash\the\paramno,}% \fi\next} +% the \xempty{} is to give \eatleadingcr an argument in the case of an +% empty macro argument. % \parsemacbody, \parsermacbody % @@ -8826,7 +8811,7 @@ \else \ifhavexrefs % We (should) know the real title if we have the xref values. - \def\printedrefname{\refx{#1-title}{}}% + \def\printedrefname{\refx{#1-title}}% \else % Otherwise just copy the Info node name. \def\printedrefname{\ignorespaces #1}% @@ -8920,7 +8905,7 @@ % If the user specified the print name (third arg) to the ref, % print it instead of our usual "Figure 1.2". \ifdim\wd\printedrefnamebox = 0pt - \refx{#1-snt}{}% + \refx{#1-snt}% \else \printedrefname \fi @@ -8955,34 +8940,30 @@ \else % Reference within this manual. % - % _ (for example) has to be the character _ for the purposes of the - % control sequence corresponding to the node, but it has to expand - % into the usual \leavevmode...\vrule stuff for purposes of - % printing. So we \turnoffactive for the \refx-snt, back on for the - % printing, back off for the \refx-pg. - {\turnoffactive - % Only output a following space if the -snt ref is nonempty; for - % @unnumbered and @anchor, it won't be. - \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% - \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi - }% + % Only output a following space if the -snt ref is nonempty, as the ref + % will be empty for @unnumbered and @anchor. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + % % output the `[mynode]' via the macro below so it can be overridden. \xrefprintnodename\printedrefname % - % But we always want a comma and a space: - ,\space - % - % output the `page 3'. - \turnoffactive \putwordpage\tie\refx{#1-pg}{}% - % Add a , if xref followed by a space - \if\space\noexpand\tokenafterxref ,% - \else\ifx\ \tokenafterxref ,% @TAB - \else\ifx\*\tokenafterxref ,% @* - \else\ifx\ \tokenafterxref ,% @SPACE - \else\ifx\ - \tokenafterxref ,% @NL - \else\ifx\tie\tokenafterxref ,% @tie - \fi\fi\fi\fi\fi\fi + \expandafter\ifx\csname SETtxiomitxrefpg\endcsname\relax + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \putwordpage\tie\refx{#1-pg}% + % Add a , if xref followed by a space + \if\space\noexpand\tokenafterxref ,% + \else\ifx\ \tokenafterxref ,% @TAB + \else\ifx\*\tokenafterxref ,% @* + \else\ifx\ \tokenafterxref ,% @SPACE + \else\ifx\ + \tokenafterxref ,% @NL + \else\ifx\tie\tokenafterxref ,% @tie + \fi\fi\fi\fi\fi\fi + \fi \fi\fi \fi \endlink @@ -9049,13 +9030,12 @@ \fi\fi\fi } -% \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX -% is output afterwards if non-empty. -\def\refx#1#2{% +% \refx{NAME} - reference a cross-reference string named NAME. +\def\refx#1{% \requireauxfile {% \indexnofonts - \otherbackslash + \turnoffactive \def\value##1{##1}% \expandafter\global\expandafter\let\expandafter\thisrefX \csname XR#1\endcsname @@ -9078,7 +9058,6 @@ % It's defined, so just use it. \thisrefX \fi - #2% Output the suffix in any case. } % This is the macro invoked by entries in the aux file. Define a control @@ -9188,10 +9167,10 @@ \catcode`\[=\other \catcode`\]=\other \catcode`\"=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other + \catcode`\_=\active + \catcode`\|=\active + \catcode`\<=\active + \catcode`\>=\active \catcode`\$=\other \catcode`\#=\other \catcode`\&=\other @@ -9412,7 +9391,7 @@ \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup \catcode`\^^M = 5 % in case we're inside an example \normalturnoffactive % allow _ et al. in names - \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro + \makevalueexpandable % If the image is by itself, center it. \ifvmode \imagevmodetrue @@ -9438,7 +9417,7 @@ % On the other hand, if we are in the case of @center @image, we don't % want to start a paragraph, which will create a hsize-width box and % eradicate the centering. - \ifx\centersub\centerV\else \noindent \fi + \ifx\centersub\centerV \else \imageindent \fi % % Output the image. \ifpdf @@ -10712,6 +10691,8 @@ \DeclareUnicodeCharacter{0233}{\=y}% \DeclareUnicodeCharacter{0237}{\dotless{j}}% % + \DeclareUnicodeCharacter{02BC}{'}% + % \DeclareUnicodeCharacter{02DB}{\ogonek{ }}% % % Greek letters upper case @@ -11346,6 +11327,18 @@ \globaldefs = 0 }} +\def\bsixpaper{{\globaldefs = 1 + \afourpaper + \internalpagesizes{140mm}{100mm}% + {-6.35mm}{-12.7mm}% + {\bindingoffset}{14pt}% + {176mm}{125mm}% + \let\SETdispenvsize=\smallword + \lispnarrowing = 0.2in + \globaldefs = 0 +}} + + % @pagesizes TEXTHEIGHT[,TEXTWIDTH] % Perhaps we should allow setting the margins, \topskip, \parskip, % and/or leading, also. Or perhaps we should compute them somehow. @@ -11359,12 +11352,12 @@ \setleading{\textleading}% % \dimen0 = #1\relax - \advance\dimen0 by \voffset - \advance\dimen0 by 1in % reference point for DVI is 1 inch from top of page + \advance\dimen0 by 2.5in % default 1in margin above heading line + % and 1.5in to include heading, footing and + % bottom margin % \dimen2 = \hsize - \advance\dimen2 by \normaloffset - \advance\dimen2 by 1in % reference point is 1 inch from left edge of page + \advance\dimen2 by 2in % default to 1 inch margin on each side % \internalpagesizes{#1}{\hsize}% {\voffset}{\normaloffset}% @@ -11451,7 +11444,7 @@ \let> = \activegtr \let~ = \activetilde \let^ = \activehat - \markupsetuplqdefault \markupsetuprqdefault + \setregularquotes \let\b = \strong \let\i = \smartitalic % in principle, all other definitions in \tex have to be undone too. @@ -11510,8 +11503,7 @@ @let|=@normalverticalbar @let~=@normaltilde @let\=@ttbackslash - @markupsetuplqdefault - @markupsetuprqdefault + @setregularquotes @unsepspaces } } @@ -11604,8 +11596,7 @@ @c Do this last of all since we use ` in the previous @catcode assignments. @catcode`@'=@active @catcode`@`=@active -@markupsetuplqdefault -@markupsetuprqdefault +@setregularquotes @c Local variables: @c eval: (add-hook 'before-save-hook 'time-stamp) @@ -11618,3 +11609,4 @@ @c vim:sw=2: @enablebackslashhack + diff -Nru bison-3.5.1+dfsg/build-aux/update-b4-copyright bison-3.8.2+dfsg/build-aux/update-b4-copyright --- bison-3.5.1+dfsg/build-aux/update-b4-copyright 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/update-b4-copyright 2021-06-23 04:48:48.000000000 +0000 @@ -3,7 +3,7 @@ # Update b4_copyright invocations or b4_copyright_years definitions to # include the current year. -# Copyright (C) 2009-2015, 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2009-2015, 2018-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . use strict; use warnings; diff -Nru bison-3.5.1+dfsg/build-aux/update-copyright bison-3.8.2+dfsg/build-aux/update-copyright --- bison-3.5.1+dfsg/build-aux/update-copyright 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/update-copyright 2021-03-10 05:41:24.000000000 +0000 @@ -3,7 +3,7 @@ # Update an FSF copyright year list to include the current year. -# Copyright (C) 2009-2020 Free Software Foundation, Inc. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -133,11 +133,11 @@ # are valid code in both sh and perl. When executed by sh, they re-execute # the script through the perl program found in $PATH. The '-x' option # is essential as well; without it, perl would re-execute the script -# through /bin/sh. When executed by perl, the next two lines are a no-op. +# through /bin/sh. When executed by perl, the next two lines are a no-op. eval 'exec perl -wSx -0777 -pi "$0" "$@"' if 0; -my $VERSION = '2018-03-07.03:47'; # UTC +my $VERSION = '2020-04-04.15:07'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook diff -Nru bison-3.5.1+dfsg/build-aux/useless-if-before-free bison-3.8.2+dfsg/build-aux/useless-if-before-free --- bison-3.5.1+dfsg/build-aux/useless-if-before-free 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/useless-if-before-free 2021-06-23 05:08:39.000000000 +0000 @@ -4,7 +4,7 @@ # Detect instances of "if (p) free (p);". # Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces. -# Copyright (C) 2008-2020 Free Software Foundation, Inc. +# Copyright (C) 2008-2021 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -32,16 +32,18 @@ # are valid code in both sh and perl. When executed by sh, they re-execute # the script through the perl program found in $PATH. The '-x' option # is essential as well; without it, perl would re-execute the script -# through /bin/sh. When executed by perl, the next two lines are a no-op. +# through /bin/sh. When executed by perl, the next two lines are a no-op. eval 'exec perl -wSx "$0" "$@"' if 0; -my $VERSION = '2018-03-07 03:47'; # UTC +my $VERSION = '2021-04-11 10:11'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook # do its job. Otherwise, update this string manually. +my $copyright_year = '2021'; + use strict; use warnings; use Getopt::Long; @@ -118,7 +120,19 @@ GetOptions ( help => sub { usage 0 }, - version => sub { print "$ME version $VERSION\n"; exit }, + version => + sub + { + print "$ME version $VERSION\n"; + print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n"; + print "License GPLv3+: GNU GPL version 3 or later .\n" + . "This is free software: you are free to change and redistribute it.\n" + . "There is NO WARRANTY, to the extent permitted by law.\n"; + print "\n"; + my $author = "Jim Meyering"; + print "Written by $author.\n"; + exit + }, list => \$list, 'name=s@' => \@name, ) or usage 1; diff -Nru bison-3.5.1+dfsg/build-aux/vc-list-files bison-3.8.2+dfsg/build-aux/vc-list-files --- bison-3.5.1+dfsg/build-aux/vc-list-files 2020-01-10 18:53:25.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/vc-list-files 2021-03-10 05:41:24.000000000 +0000 @@ -4,7 +4,7 @@ # Print a version string. scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2006-2020 Free Software Foundation, Inc. +# Copyright (C) 2006-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff -Nru bison-3.5.1+dfsg/build-aux/ylwrap bison-3.8.2+dfsg/build-aux/ylwrap --- bison-3.5.1+dfsg/build-aux/ylwrap 2020-01-19 13:16:04.000000000 +0000 +++ bison-3.8.2+dfsg/build-aux/ylwrap 2021-09-25 04:54:04.000000000 +0000 @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # Written by Tom Tromey . # diff -Nru bison-3.5.1+dfsg/cfg.mk bison-3.8.2+dfsg/cfg.mk --- bison-3.5.1+dfsg/cfg.mk 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/cfg.mk 2021-09-25 06:02:52.000000000 +0000 @@ -1,5 +1,5 @@ ## Customize maint.mk -*- makefile -*- -## Copyright (C) 2008-2015, 2018-2020 Free Software Foundation, Inc. +## Copyright (C) 2008-2015, 2018-2021 Free Software Foundation, Inc. ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ ## GNU General Public License for more details. ## You should have received a copy of the GNU General Public License -## along with this program. If not, see . +## along with this program. If not, see . # Update version, then recompile so that tests/bison --version be # up-to-date, then compile our parser again with our up-to-date bison. @@ -42,7 +42,7 @@ # Tests not to run as part of "make distcheck". local-checks-to-skip = \ sc_immutable_NEWS \ - sc_prohibit_atoi_atof + sc_indent # The local directory containing the checked-out copy of gnulib used in # this release. Used solely to get a date for the "announcement" target. @@ -51,7 +51,7 @@ bootstrap-tools = autoconf,automake,flex,gettext,gnulib announcement_Cc_ = \ - bug-bison@gnu.org, help-bison@gnu.org, bison-patches@gnu.org, \ + bug-bison@gnu.org, bison-announce@gnu.org, \ coordinator@translationproject.org update-copyright: update-b4-copyright update-package-copyright-year @@ -126,7 +126,7 @@ _space_before_paren_exempt =? \\n\\$$ _space_before_paren_exempt = \ - (^ *\#|(LA)?LR\([01]\)|percent_(code|define)|b4_syncline|m4_(define|init)|symbol) + (^ *\#|(LA)?LR\([01]\)|percent_(code|define)|b4_syncline|m4_(define|init)) # Ensure that there is a space before each open parenthesis in C code. sc_space_before_open_paren: @if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \ @@ -156,16 +156,19 @@ $(call exclude, \ bindtextdomain=^lib/main.c$$ \ cast_of_argument_to_free=^src/muscle-tab.c$$ \ - po_check=(^po/POTFILES.in|.md)$$ \ + error_message_uppercase=etc/bench.pl.in$$ \ + file_system=^doc/Doxyfile.in$$ \ + po_check=^tests|(^po/POTFILES.in|.md)$$ \ preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \ program_name=^lib/main.c$$ \ prohibit_always-defined_macros=^data/skeletons/yacc.c$$ \ prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \ prohibit_always-defined_macros+=?|^tests/regression.at$$ \ + prohibit_atoi_atof=^(doc|etc|examples|tests)/ \ prohibit_doubled_word=^tests/named-refs.at$$ \ prohibit_magic_number_exit=^doc/bison.texi$$ \ prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \ - prohibit_strcmp=^doc/bison\.texi|examples|tests/local\.at$$ \ + prohibit_strcmp=^doc/bison\.texi|examples|tests \ prohibit_tab_based_indentation=install-icc.sh|\.(am|mk)$$|^\.git|tests/input.at|Makefile$$ \ require_config_h=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \ require_config_h_first=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \ diff -Nru bison-3.5.1+dfsg/ChangeLog bison-3.8.2+dfsg/ChangeLog --- bison-3.5.1+dfsg/ChangeLog 2020-01-19 13:35:38.000000000 +0000 +++ bison-3.8.2+dfsg/ChangeLog 2021-09-25 09:10:40.000000000 +0000 @@ -1,3 +1,11991 @@ +2021-09-25 Akim Demaille + + version 3.8.2 + * NEWS: Record release date. + +2021-09-25 Akim Demaille + + tests: Apple clang issues warning on C++11 features + $ cat /tmp/foo.cc + using foo = int; + foo f; + $ clang++ -Wc++11-extensions -c /tmp/foo.cc + /tmp/foo.cc:1:13: warning: alias declarations are a C++11 extension [-Wc++11-extensions] + using foo = int; + ^ + 1 warning generated. + $ clang++ --version + Apple clang version 11.0.0 (clang-1100.0.33.17) + Target: x86_64-apple-darwin18.7.0 + Thread model: posix + InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin + + * tests/local.at (AT_COMPILE_CXX): Make sure -std=c++11 is passed when + running glr2.cc. It may be overridden by another flag in CXXFLAGS + afterwards. + +2021-09-25 Akim Demaille + + avoid using atoi + * cfg.mk: Disable sc_indent as auto indent is too invasive for now. + Enable sc_prohibit_atoi_atof, except where we don't care. + * src/location.c, src/muscle-tab.c: Use strtol instead of atoi. + +2021-09-24 Akim Demaille + + news: update + +2021-09-18 Akim Demaille + + gnulib: update + To get + + commit 7818455627c5e54813ac89924b8b67d0bc869146 + Author: Bruno Haible + Date: Fri Sep 17 22:22:50 2021 +0200 + + threadlib: Avoid crashes in thread-related functions on Cygwin 3.2.0. + + Reported by Brian Inglis via Akim Demaille in + . + + * m4/threadlib.m4 (gl_WEAK_SYMBOLS): Force a "guessing no" result on + Cygwin. + +2021-09-18 Akim Demaille + + c++: use YY_NOEXCEPT where it helps + Suggested by Don Macpherson. + + + * data/skeletons/c++.m4, data/skeletons/glr2.cc, + * data/skeletons/lalr1.cc, data/skeletons/stack.hh: Use YY_NOEXCEPT + where it helps constructors. + +2021-09-13 Akim Demaille + + gnulib: update + +2021-09-13 Akim Demaille + + glr2.cc: semantic_option: use a symbol + * data/skeletons/c++.m4 (basic_symbol): Add assignment operators. + * data/skeletons/glr2.cc (semantic_option): Replace yytoken, yyvalue + and yylocation by yyla. + +2021-09-13 Akim Demaille + + glr2.cc: don't publish move ctor to lalr1.cc + These operators were introduced in "c++: add move assignments to the + symbol type" (fdaedc780af0dd678a4f4fa3175a201a553be20a) for glr2.cc. + + * data/skeletons/c++.m4: Define them for glr2.cc only. + +2021-09-12 Akim Demaille + + glr2.cc: simplify semantic_option + * data/skeletons/glr2.cc (semantic_option): Simplify the rule-based + constructor. This shows that it should be easy to use a symbol_kind, + instead of the kind/value/location triple. + +2021-09-12 Akim Demaille + + glr2.cc: we require C++11 + * data/skeletons/glr2.cc: So no need for C++98 compatibility. + +2021-09-12 Akim Demaille + + glr2.cc: introduse b4_glr2_cc_if + * data/skeletons/bison.m4 (b4_glr2_cc_if): Intro. + * data/skeletons/c++.m4: use. + +2021-09-12 Akim Demaille + + glr2.cc: don't pass %parse-param to destroy + I regret that %destructor and %printer give access to the %parse-param + in lalr1.cc, since that prevents them from being implemented as a + simple destructor and operator<<. Let's not repeat the mistake in + glr2.cc. In addition, fixes a name conflict we have currently in + tests 566 568 570 657: + + calc.cc:1395:85: error: declaration shadows a field of 'calc::parser' [-Werror,-Wshadow] + void glr_state::destroy (char const* yymsg, calc::parser& yyparser, semantic_value *result, int *count, int *nerrs) + ^ + calc.hh:441:21: note: previous declaration is here + semantic_value *result; + ^ + + With this commit, the whole test suite passes for glr2.cc. + + * data/skeletons/glr2.cc (glr_state::destroy): Don't take the user + arguments. + +2021-09-12 Akim Demaille + + glr2.cc: kill trailing white spaces + Fixes several calc tests. + + Tests 566 568 570 657 still fail because of a name clash when using + %parse-param: + + calc.cc:1395:85: error: declaration shadows a field of 'calc::parser' [-Werror,-Wshadow] + void glr_state::destroy (char const* yymsg, calc::parser& yyparser, semantic_value *result, int *count, int *nerrs) + ^ + calc.hh:441:21: note: previous declaration is here + semantic_value *result; + ^ + + * data/skeletons/glr2.cc: Fix indentation/trailing spaces. + +2021-09-12 Akim Demaille + + glr2.cc: check linking conflicts + * tests/headers.at (Several Headers): Link two glr2.cc parsers. + +2021-09-12 Akim Demaille + + glr2.cc: move strong_index_alias into the unnamed namespace + * data/skeletons/glr2.cc: here. + +2021-09-12 Akim Demaille + + glr2.cc: use only symbol_kind_type, not yysymbol_kind_t + * data/skeletons/glr2.cc: here. + And prefer the unnamed namespace to static. + +2021-09-12 Akim Demaille + + glr2.cc: prefer using, and remove useless type aliases + * data/skeletons/glr2.cc: here. + +2021-09-12 Akim Demaille + + glr2.cc: put glr_state_set and glr_stack_item in unnamed namespace + * data/skeletons/glr2.cc: here. + +2021-09-12 Akim Demaille + + glr2.cc: move state_stack into the unnamed namespace + * data/skeletons/glr2.cc: here. + Prefer `using` to `typedef`, this is C++11. + Use the type alias we introduced. + +2021-09-12 Akim Demaille + + glr2.cc: style: clarify control flow + * data/skeletons/glr2.cc (yypreference): Be more functional-style. + +2021-09-12 Akim Demaille + + glr2.cc: move glr_stack and glr_state into the parser class + In order to be able to link several glr2.cc parser together, we cannot + have glr_stack and glr_state be in no namespace. Putting them in the + unnamed namespace is not doable, since we need to fwd declare them in + the parser. Putting them in the specified namespace is not enough + either, since some users would like to be able to put several parsers + in the same name, only differing by the class name. + + * data/skeletons/glr2.cc (glr_state, glr_stack): Move into yy::parser. + +2021-09-12 Akim Demaille + + glr2.cc: put create_state_set_index in unnamed namespace + * data/skeletons/glr2.cc: here. + +2021-09-12 Akim Demaille + + glr2.cc: prefer unnamed namespace to 'static' + * data/skeletons/glr2.cc: here. + +2021-09-12 Akim Demaille + + glr2.cc: put semantic_option into an unnamed namespace + If we link several glr2.cc parsers together, we get linking failures + because of duplicate symbols. + + * data/skeletons/glr2.cc (semantic_option::indexIn) + (semantic_option::next): Remove the useless overloads. + +2021-09-12 Akim Demaille + + glr2.cc: don't publish YY_EXCEPTIONS + We don't need them in the header file. + + * data/skeletons/glr2.cc (YY_EXCEPTIONS): Define only in the + implementation file. + * tests/headers.at (Several Parsers): Also check glr2.cc. + +2021-09-12 Akim Demaille + + c++: demonstrate custom error messages in the examples + Let's use c++/glr to demonstrate custom error messages in C++ (not + just in glr2.cc). + + * examples/c++/glr/c++-types.yy (report_syntax_error): New. + * examples/c++/glr/c++-types.test: Adjust. + * examples/c/bistromathic/parse.y: Comment changes. + * tests/local.at (AT_YYERROR_DEFINE(c++)): Use a nicer way to print + the lookakead's name. + +2021-09-12 Akim Demaille + + glr2.cc: custom error messages + Reported by Tom Shields . + + + * data/skeletons/glr2.cc (context): New. + Use it to generate the error messages. + Add support for custom error messages. + * tests/calc.at: Check support for custom error messages. + +2021-09-12 Akim Demaille + + glr2.cc: start the transition to using symbol_type + Currently glr2.cc uses three variables/struct members to denote the + symbols' kind (or state), value and location. lalr1.cc has two types + for "complete" symbols: symbol_type and stack_symbol_type. Let's use + that model in glr2.cc too. + + For a start use yyla (a symbol_type) to denote the lookahead, instead + of the triple yytoken, yylval and yylloc. This will make easier the + introduction of the "context" subclass, used in parse.error=custom. + + It simplifies the code in several places. For instance from: + + symbol_kind_type yytoken_current = this->yytoken;]b4_variant_if([[ + value_type yylval_current; + ]b4_symbol_variant([this->yytoken], + [yylval_current], [move], [this->yylval])], [[ + value_type yylval_current = this->yylval;]])[]b4_locations_if([ + location_type yylloc_current = this->yylloc;])[ + + to: + + symbol_type yyla_current = std::move (this->yyla); + + * data/skeletons/glr2.cc (yytoken, yylval, yylloc): Replace by... + (yyla): this. + Adjust all dependencies. + (yyloc_default): Remove, unused. + * tests/c++.at, tests/glr-regression.at, tests/types.at: C++11 is + required for glr2.cc. + Adjust to changes in glr2.cc. + +2021-09-12 Akim Demaille + + c++: add move assignments to the symbol type + This will be used in glr2.cc, which requires C++11. + + * data/skeletons/c++.m4 (basic_symbol, by_kind): Add move assignment. + +2021-09-12 Akim Demaille + + c++: avoid using the obsolete names + * data/skeletons/c++.m4: Don't define obsolete identifiers in the case + of glr2.cc. Let's not start with technical debt. + * data/skeletons/glr2.cc, data/skeletons/lalr1.cc, + * data/skeletons/variant.hh: Use token_kind_type, not token_type. + * tests/c++.at, tests/local.at: Use value_type, not semantic_type. + +2021-09-12 Akim Demaille + + regen + +2021-09-11 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2021-09-11 Akim Demaille + + version 3.8.1 + * NEWS: Record release date. + +2021-09-11 Akim Demaille + + portability: don't use strtof + It is not available on HP-UX 11i. + Reported by Larkin Nickle . + + + Gnulib provides no replacement, but anyway we should be using doubles, + since difftime uses doubles. + + * bootstrap.conf: We want portability on stdtod. + * src/counterexample.c: Use double, not float, for time measurements. + +2021-09-11 Akim Demaille + + yacc: declare yyerror/yylex only when POSIXLY_CORRECT + The recent changes to comply with POSIX are breaking Automake's test + suite. + Reported by Kiyoshi Kanazawa. + + + To limit the impact of POSIX changes, bind them to $POSIXLY_CORRECT. + Suggested by Karl Berry. + + + The existing `maintainer-check-posix` Make target checks these + changes. + + * src/getargs.h, src/getargs.c (set_yacc): New. + Use it. + * data/skeletons/bison.m4 (b4_posix_if): New. + * data/skeletons/yacc.c (b4_declare_yyerror_and_yylex): Use it. + * doc/bison.texi, tests/local.at: Adjust. + +2021-09-07 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2021-09-07 Akim Demaille + + version 3.8 + * NEWS: Record release date. + +2021-09-07 Akim Demaille + + news: update + +2021-09-02 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2021-09-02 Akim Demaille + + version 3.7.91 + * NEWS: Record release date. + +2021-09-02 Akim Demaille + + tests: disable "Multistart reports" + For some reason this test fails on Solaris/x86. But multistart is not + part of 3.8, so we can postpone the debugging of this issue. + Reported by Dagobert Michelsen. + + + * tests/report.at (Multistart reports): Comment out. + +2021-08-29 Akim Demaille + + style: c++: formatting changes + * data/skeletons/variant.hh, data/skeletons/glr2.cc: Fix space before + paren issue. + +2021-08-29 Akim Demaille + + style: rename stmtMerge as stmt_merge + Follow the GNU Coding Style. + + * doc/bison.texi, examples/c++/glr/c++-types.yy, + * examples/c/glr/c++-types.y, tests/cxx-type.at: s/stmtMerge/stmt_merge/g. + +2021-08-29 Akim Demaille + + c++: beware of Visual C++ limitations + Contrary to what commit d8cc6b073e2802d871a16dc62418a7eb62ed2216 "c++: + shorten the assertions that check whether tokens are correct" + believed, MS Visual C++'s preprocessor limitation is not on the input + line length, but on the size of the line holding the full C++ + statement. + + Reported by Vince Huffaker + + + * data/skeletons/variant.hh (_b4_symbol_constructor_define): Hide the + assertion from Visual C++. + +2021-08-29 Akim Demaille + + tests: don't postprocess stderr with sed + On Solaris, sed throws away the NUL bytes from the stream, even in C + locale. So instead of postprocessing bison's stderr to neutralize + changes in value of `argv[0]`, use an envvar to actually neutralize + variations of `argv[0]` during tests. + + Reported by Dagobert Michelsen. + + + * src/main.c (main): Change `argv[0]` if BISON_PROGRAM_NAME is + defined. + * tests/bison.in: No longer mess with stderr, just pass + the expected BISON_PROGRAM_NAME value. + +2021-08-19 Akim Demaille + + CI: don't require Autoconf 2.71 + +2021-08-19 Akim Demaille + + examples: don't demonstrate multistart, which is not part of 3.8 + Besides, for mysterious reasons, this fails on some environment. + Reported by Dagobert Michelsen. + + + * examples/c/lexcalc/lexcalc.test, examples/c/lexcalc/parse.y, + * examples/c/lexcalc/scan.l: Revert to a single-start example. + +2021-08-19 Akim Demaille + + tests: grep -E is not portable + Reported by Dagobert Michelsen. + + + * tests/calc.at: Use $EGREP. + +2021-08-19 Akim Demaille + + glr2.cc: require C++11 + Reported by Dagobert Michelsen. + https://lists.gnu.org/r/bug-bison/2021-08/msg00006.html + + * m4/bison-cxx-std.m4 (_BISON_CXXSTD_98_snippet): We don't need + vector::data, it was only for glr2.cc, which is C++11 anyway. + (_BISON_CXXSTD_11_snippet): We need vector::data and std::swap on + arrays. + * m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): We don't need + vector::data. + * tests/local.at (AT_COMPILE_CXX): Skip when glr2.cc and no support + for C++11. + +2021-08-13 Akim Demaille + + readme: add D + +2021-08-13 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2021-08-13 Akim Demaille + + version 3.7.90 + * NEWS: Record release date. + +2021-08-13 Akim Demaille + + build: ignore syntax-check's file_system check on Doxyfile + * cfg.mk: Here. + +2021-08-12 Akim Demaille + + tests: fix incorrect test case + In c2ba260487927a4cdf061fae10fdd1b387ca3d95 ("glr.c: fix signature + when using custom error messages"), I meant to add a test case for C, + not C++. It does not work in C++. + + * tests/calc.at: Run for glr.c, not glr.cc. + +2021-08-12 Akim Demaille + + gnulib: update + +2021-08-12 Akim Demaille + + news: be clear that glr2.cc is C++11 + +2021-08-12 Akim Demaille + + build: modernize to newer Autoconf releases + * configure.ac: here. + +2021-08-12 Akim Demaille + + build: reject C++ compilers that don't support std::vector::data + GCC 4.2 on macOS claims to support C++98, but does not feature it. + + input.cc: In member function 'void state_stack::yycompressStack()': + input.cc:1774: error: 'class std::vector >' has no member named 'data' + + Reported by Christopher Nielsen . + . + + * m4/bison-cxx-std.m4 (_BISON_CXXSTD_98_snippet): Check for it. + * m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): Ditto. + +2021-08-12 Akim Demaille + + build: check for C++ 20 and 2b + C++20 is released. + + * configure.ac, m4/bison-cxx-std.m4, tests/atlocal.in, + * tests/local.at: Replace 2a with 20, and add support for 2b. + +2021-08-12 Akim Demaille + + tests: remove obsolete checks + * tests/atlocal.in: It was an error for tests to depend on gnulib: + they must not, as gnulib would hide portability issues that we want to + catch. So this piece of code is no longer useful, and must not be + useful. + +2021-08-12 Akim Demaille + + tests: be robust to old versions of xlstproc + Reported by Christopher Nielsen . + + + * tests/report.at (AT_CHECK_HTML): New. + Use it. + +2021-08-11 Akim Demaille + + c: fix _Noreturn support detection + Reported by Christopher Nielsen . + and + . + + * data/skeletons/c.m4: Fix typo. + +2021-08-11 Akim Demaille + + lalr1.cc: style changes + * data/skeletons/lalr1.cc: Formatting changes. + Use more `const`, as in glr2.cc. + +2021-08-11 Akim Demaille + + glr.c: fix signature when using custom error messages + Reported by Tom Shields . + + * data/skeletons/glr.c (yypcontext_location): Fix return type. + * tests/calc.at: Check the case pure, location, custom error messages. + +2021-08-11 Akim Demaille + + tests: check symbol/token renumbering + In some extreme situations, with lots of useless tokens, Bison was + numbering them incorrectly, which resulted in a broken grammar. + + commit a774839ca873d1082f79ba3c4eecc1e242a28ce1. + + * tests/regression.at (Useless Tokens): New. + +2021-08-09 Akim Demaille + + style: rename b4_lex as b4_yylex + For consistency with b4_yyerror_formals, etc. + + * data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/d.m4, + * data/skeletons/glr.c, data/skeletons/glr2.cc, + * data/skeletons/java.m4, data/skeletons/lalr1.cc, + * data/skeletons/lalr1.d, data/skeletons/lalr1.java, + * data/skeletons/yacc.c + (b4_lex, b4_lex_formals): Rename as... + (b4_yylex, b4_yylex_formals): these. + +2021-08-09 Akim Demaille + + yacc: comply with recent POSIX updates: declare yyerror and yylex + In POSIX Yacc mode, declare yyerror and yylex unless already #defined, + or if YYERROR_IS_DECLARED/YYLEX_IS_DECLARED are defined (for + consistency with Bison's YYSTYPE_IS_DECLARED/YYLTYPE_IS_DECLARED). + See . + + * data/skeletons/c.m4 (b4_function_declare): Resurect. + (b4_lex_formals): Since we will possibly expose this prototype + in the header, take the prefix into account. + * data/skeletons/yacc.c (b4_declare_yyerror_and_yylex): New. + (b4_shared_declarations): Use it. + + * tests/local.at (AT_YACC_IF): New. + When in Yacc mode, set the `yacc` Autotest keyword. + (AT_YYERROR_DECLARE(c)): Don't declare in Yacc mode, + to avoid clashes (since this signature is static). + (AT_YYERROR_DEFINE(c)): Don't define as static in Yacc mode. + * tests/regression.at (Early token definitions with --yacc): Specify + that we are in Yacc mode. + +2021-08-09 Akim Demaille + + build: enable -Wmismatched-dealloc + * configure.ac (warn_common): Here. + +2021-08-09 Akim Demaille + + gnulib: update + +2021-08-08 Akim Demaille + + bistromathic: beware of portability issues with readline + In some cases readline emits a trailing spaces after the last + suggestion, which results in errors such as: + + ``` + -( - atan cos exp ln number sin sqrt$ + +( - atan cos exp ln number sin sqrt $ + ``` + + Reported by Christopher Nielsen . + + + + * examples/test (run): Add support for -t. + * examples/c/bistromathic/bistromathic.test: Use it. + +2021-08-07 Akim Demaille + + d: prepare to be able to run LAC tests + Unfortunately it seems to be quite difficult to have "LAC: Exploratory + stack" run for D. + + * data/skeletons/lalr1.d: We need File when traces are enabled. + * tests/local.at (AT_YYLEX_DEFINE(d)): New. + * tests/regression.at: Prepare for D, but don't run it, it does not + work. + +2021-08-07 Akim Demaille + + tests: factor iterating over skeletons + * tests/local.at (AT_FOR_EACH_SKEL): New. + Use where appropriate. + * data/skeletons/lalr1.d: Reject -d. + * tests/input.at, tests/scanner.at: Also check D. + +2021-08-07 Akim Demaille + + m4: catch suspicions of unevaluated macros + Check in m4's output if there are sequences such as m4_foo or b4_foo, + which are probably resulting from incorrect m4 processing. + + It actually already is useful: + + - it caught a leaking b4_lac_if leaking from glr.c, where LAC is not + supported, hence b4_lac_if is not defined. + + - it also caught references to location.hh in position.hh when + location.hh does not exist. + + - while making "Code injection" robust to these new warnings (it is + its very purpose to let b4_canary pass unevaluated), I saw that it + did not check lalr1.d, and when adding lalr1.d, it revealed it did + underquote ocurrences of token value types. + + * src/scan-skel.l (macro): New abbreviation. + Use it. + * data/skeletons/glr.c: Don't use b4_lac_if, we don't have it. + * data/skeletons/location.cc: Don't generate position.hh when we don't + generate location.hh. + * data/skeletons/d.m4 (b4_basic_symbol_constructor_define): Fix + underquotation. + * data/skeletons/bison.m4 (b4_canary): New. + * tests/input.at (Code injection): Use it, and check lalr1.d too. + +2021-08-07 Akim Demaille + + style: formatting changes in scan-code.l + * src/scan-code.l: Fix indentation. + +2021-08-07 Akim Demaille + + doc: avoid #define YYDEBUG in C++ + * doc/bison.texi (Enabling Traces): here. + +2021-08-06 Akim Demaille + + tests: extract AT_LOCATION_PRINT_DECLARE and AT_LOCATION_PRINT_DEFINE + * tests/local.at (AT_LOCATION_PRINT_DECLARE) + (AT_LOCATION_PRINT_DEFINE): New. + +2021-08-06 Akim Demaille + + tests: rename AT_YACC_IF as AT_YACC_C_IF + In data/, b4_yacc_if refers to %yacc, not yacc.c. + + * tests/local.at (AT_YACC_IF): Rename as... + (AT_YACC_C_IF): this. + +2021-08-06 Akim Demaille + + doc: more pointers to the examples + * doc/bison.texi (Infix Calc): Here. + +2021-08-06 Akim Demaille + + git: add diff patterns for Autotest and Texinfo + +2021-08-06 Akim Demaille + + CI: fix the GCC 9 build + +2021-08-04 Akim Demaille + + todo: d: push and token ctors are done + +2021-08-04 Akim Demaille + + doc: refer to the examples + * doc/bison.texi: Point to rpcalc, mfcalc, simple.y, calc++, c/glr and + c++/glr. + +2021-08-04 Akim Demaille + + examples: modernize the example Makefiles + * examples/c++/Makefile, examples/c++/calc++/Makefile, + * examples/c++/glr/Makefile, examples/c/bistromathic/Makefile, + * examples/c/calc/Makefile, examples/c/glr/Makefile, + * examples/c/lexcalc/Makefile, examples/c/mfcalc/Makefile, + * examples/c/pushcalc/Makefile, examples/c/reccalc/Makefile, + * examples/c/rpcalc/Makefile, examples/d/calc/Makefile, + * examples/d/simple/Makefile, examples/java/calc/Makefile, + * examples/java/simple/Makefile: + Use --html to generate *.html directly. + No longer demonstrate --xml. + No longer show rules for xml to html. + Use --header, not --defines. + Use --graph without specifying the output file now that we + generate *.gv by default. + +2021-08-04 Akim Demaille + + doc: glr: document typed mergers + See . + + * doc/bison.texi (Merging GLR Parses): document typed mergers. + And avoid #define YYSTYPE. + +2021-08-04 Akim Demaille + + style: tests: rebox comments + * tests/glr-regression.at: here. + +2021-08-04 Akim Demaille + + news: update + In particular, announce lalr1.d. + +2021-08-03 Akim Demaille + + doc: fix spello + * doc/bison.texi (Multiple start-symbols): here. + +2021-08-03 Akim Demaille + + scan: fix typo in UTF-8 escape + We had: + + ``` + -mbchar ...|\xF0[\x\90-\xBF]([\x80-\xBF]{2})|... + +mbchar ...|\xF0[\x90-\xBF]([\x80-\xBF]{2})|... + ``` + + so a precise sequence that matches the incorrect regex can let NUL + bytes pass through, which triggers an assertion violation downstream. + It is a pity that Flex does not report an error for such input. + + Reported by Ahcheong Lee . + + + * src/scan-gram.l (mbchar): Fix the bad regex. + * tests/input.at (Invalid inputs): Check that case. + +2021-08-03 Akim Demaille + + todo: POSIX yacc and prototypes + +2021-08-03 Akim Demaille + + doc: update Doxygen template file + * doc/Doxyfile.in: here. + +2021-08-03 Akim Demaille + + doc: a bit of editing + * doc/bison.texi: Use @samp{...}, not "..." for pieces of code. + Use @samp{...}, not @command{...} for command lines. + Promote %header/--header over %defines/--defines. + Spellcheck. + +2021-08-03 Akim Demaille + + gnulib: update + +2021-08-01 Alyssa Ross + + getargs: don't translate first line of --version + + + * src/getargs.c (version): here. + +2021-08-01 Akim Demaille + + all: fix confusion between token ctor and symbol ctor + The symbol constructors are genuine constructors. Token constructors + are plain functions that construct tokens. + +2021-07-25 Akim Demaille + + d: minor clean up + * doc/bison.texi: Use @samp, not "...", around pieces of code. + * examples/d/calc/calc.y: Don't promote %union. + +2021-06-23 Akim Demaille + + gnulib: update + +2021-06-06 Adela Vais + + d: demonstrate the token constructors + * examples/d/calc/calc.y: Use the token constructors in the 'calc' example. + +2021-04-11 Adela Vais + + d: update documentation + * doc/bison.texi: Various fixes. + (D Push Parser Interface, D Complete Symbols): New sections. + +2021-04-11 Adela Vais + + d: demonstrate the push parser + * examples/d/calc/calc.y: Use a parser of type 'push' in the calc + example. + +2021-04-11 Adela Vais + + d: add push parser support + Support the push-pull directive with the options pull, push and both. + Pull remains the default option. + + * data/skeletons/d.m4: Add user aliases for the push parser's return + values: PUSH_MORE, ABORT, ACCEPT. + * data/skeletons/lalr1.d: Add push parser support. + * tests/calc.at: Test it. + +2021-03-26 Adela Vais + + d: add token constructors support + The user can return from yylex() by calling the Symbol method of the + same name as the TokenKind reported, and adding the parameters for + value and location if necessary. These methods generate compile-time + errors if the parameters are not correlated. Token constructors work + with both %union and api.value.type union. + + * data/skeletons/d.m4: Here. + * tests/calc.at: Test it. + +2021-03-26 Akim Demaille + + d: add api.value.type union support + The union of the values is handled by the backend. + In D, unions can hold classes, structs, etc., so this is more similar + to the C++ api.value.type variant. + + * data/skeletons/d.m4, data/skeletons/lalr1.d: Here. + * tests/calc.at, tests/local.at: Test it. + +2021-03-26 Adela Vais + + d: rewrite Symbol's constructors in M4 + The D code was becoming too complex. + M4 is easier to maintain in the long run. + + * data/skeletons/d.m4: Here. + +2021-03-26 Akim Demaille + + gnulib: update + +2021-03-10 Akim Demaille + + files: please syntax-check + * src/files.c (string_free): syntax-check does not want us to cast + arguments to free. + +2021-03-10 Akim Demaille + + Merge 3.7.6 into master + * maint: + maint: post-release administrivia + version 3.7.6 + yacc: fix push parser + tables: fix again the handling of useless tokens + +2021-03-08 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2021-03-08 Akim Demaille + + version 3.7.6 + * NEWS: Record release date. + +2021-03-07 Akim Demaille + + doc: don't mention YY_LOCATION_PRINT + * doc/bison.texi (Syntax Error Reporting Function): Don't refer to + YY_LOCATION_PRINT, it is a private internal detail. + +2021-03-07 Akim Demaille + + yacc: fix push parser + When a pstate is used for multiple successive parses, some state may + leak from one run into the following one. That was introduced in + 330552ea499ca474f65967160e9d4e50265f9631 "yacc.c: push: don't clear + the parser state when accepting/rejecting". + + Reported by Ryan + https://lists.gnu.org/r/bug-bison/2021-03/msg00000.html + + * data/skeletons/yacc.c (yypush_parse): We reusing a pstate from a + previous run, do behave as if it were the first run. + * tests/push.at (Pstate reuse): Check this. + +2021-03-07 Akim Demaille + + tables: fix again the handling of useless tokens + The right-shift added in c22902e360e0fbbe9fd5657dcf107e03166da309 + ("tables: fix handling for useless tokens") is incorrect. In + particular, we need to reset the "new" bits. + + Reported by Balázs Scheidler. + https://github.com/akimd/bison/issues/74 + + * src/tables.c (pos_set_set): Fix the right-shift. + +2021-02-26 Akim Demaille + + html: fix memory leak + * src/print-xml.c (print_html): Free allocated memory. + +2021-02-26 Akim Demaille + + output: cache the mapped file names + Don't repeatedly call malloc/free for each call to map_file_name. + + * bootstrap.conf: We need hash-map. + * src/files.h, src/files.c (map_file_name): The caller must not free + the result. + Adjust callers. + (mapped_dir_prefix, spec_mapped_header_file): Remove. + * src/files.c + (map_file_name): Rename as... + (map_file_name_alloc): this. + (mapped_files, map_file_name, string_equals, string_hash, string_free): + New. + +2021-02-26 Joshua Watt + + output: use mapped file name for symbols + Applies the file name mapping before exporting it as a symbol. This + allows the symbols to correctly respect the --file-prefix-map command + line option. + +2021-02-26 Akim Demaille + + style: formatting changes + * src/files.c, src/files.h: Save horizontal space. + Prefer `res` for returned values. + Put the doc into the header. + +2021-02-26 Akim Demaille + + gnulib: update + +2021-02-25 Joshua Watt + + doc: fix documented function name + * data/README.md: Fix the name of a referenced function to match the + name in code. + +2021-02-25 Akim Demaille + + regen + +2021-02-09 Akim Demaille + + doc: printing locations + Document YYLOCATION_PRINT. + + * doc/bison.texi (Printing Locations): New node. + +2021-02-09 Akim Demaille + + examples: improve some function prototypes + * examples/c/bistromathic/parse.y, examples/c/glr/c++-types.y, + * examples/c/lexcalc/parse.y: Use const where appropriate. + Avoid `yy` prefixes where it does not make sense. + Avoid the `p` prefix for pointers. + +2021-02-09 Akim Demaille + + examples: use YYLOCATION_PRINT + * examples/c/bistromathic/parse.y, examples/c/glr/c++-types.y, + * examples/c/lexcalc/parse.y: Don't use the private internal detail + `YY_LOCATION_PRINT`, use `YYLOCATION_PRINT`. + +2021-02-09 Akim Demaille + + c: rename YY_LOCATION_PRINT as YYLOCATION_PRINT and make it public + It is very helpful to be able to look at the locations in the debug + traces, let's provide the users with (i) a means to do that for their + location types, and (ii) a public macro to print locations when debug + traces are enabled. + + * data/skeletons/c.m4 (b4_yy_location_print_define): Rename as... + (b4_yylocation_print_define): this. + Define YYLOCATION_PRINT instead of YY_LOCATION_PRINT. + Ensure backward compatibility for those who might have defined/used + YY_LOCATION_PRINT in spite the warnings. + Adjust dependencies. + * data/skeletons/glr2.cc: We don't use YYLOCATION_PRINT here. + +2021-02-09 Akim Demaille + + examples: do not rely on YY_LOCATION_PRINT + * examples/c/bistromathic/parse.y (location_print): New. + Use it. + +2021-02-02 Akim Demaille + + c: stop defining YY_LOCATION_PRINT when locations are not enabled + * data/skeletons/c.m4 (b4_yy_location_print_define): here. + +2021-02-02 Akim Demaille + + graph: output foo.gv by default, instead of *.dot + That change was started in Bison 3.4. The announcement for 3.7 stated + that in Bison 3.8 we would use *.gv by default. + + * src/files.c (compute_output_file_names): spec_graph_file defaults + too *.gv. + * doc/bison.texi, examples/c++/calc++/local.mk, tests/output.at: + Adjust. + +2021-02-01 Akim Demaille + + tests: adjust to the removal of YYPRINT + * tests/regression.at: here. + +2021-02-01 Akim Demaille + + yacc: remove support for YYPRINT + Its removal was annonced several times in NEWS (for Bison 3.5, 3.6, 3.7). + + * data/skeletons/c.m4, data/skeletons/yacc.c: Remove support for YYPRINT. + * NEWS: Fix the mess introduced by the merge. + Document the removal of YYPRINT. + * doc/bison.texi (The YYPRINT Macro): Remove. + +2021-02-01 Akim Demaille + + c++: issue a compile-time warning when #define YYSTYPE is used + Using #define YYSTYPE has always been strongly discouraged in C++. + Macros are dangerous and can result in subtle bugs. + https://lists.gnu.org/r/bug-bison/2020-12/msg00007.html + + Maybe some people are currently using #define YYSTYPE. Instead of + dropping support right now, first issue a warning. Bison can "see" if + YYDEBUG is defined (it could even be on the command line), only the + compiler knows. Unfortunately `#warning` is non-portable, and + actually GCC even dies on it when `-pedantic` is enabled. So we need + to use `#pragma message`. We must make it conditional as some + compilers might not support it, but it doesn't matter if only _some_ + compilers emit the warning: it should be enough to catch the attention + of the developers. + + * data/skeletons/c++.m4: Issue a warning when the user defined + YYSTYPE. + * tests/actions.at: Don't #define YYSTYPE. + * tests/headers.at (Several parsers): Ignore the YYSTYPE in the + warning. + +2021-02-01 Akim Demaille + + c++: make it clear that #define YYSTYPE is not supported + We have been accepting this for years, but it is deprecated: people + are expecting to define api.value.type instead. + + * doc/bison.texi: Make it clear that YYSTYPE and YYLTYPE are for C + only. + +2021-02-01 Akim Demaille + + c++: stop referring to YYSTYPE in yylex + * data/skeletons/glr2.cc, data/skeletons/lalr1.cc (b4_lex): Don't + refer to YYSTYPE, but to value_type. + Note that this is "symbolic" in the sense that these values are never + used by b4_function_call. + +2021-02-01 Akim Demaille + + CI: try GCC 11 and Clang 11 + +2021-02-01 Akim Demaille + + gnulib: update + +2021-01-31 Akim Demaille + + glr2.cc: no longer be part of b4_glr_cc_if + We are fully independant of glr.c/glr.cc, we no longer need to pretend + we are glr.cc. + + * data/skeletons/bison.m4: here. + +2021-01-31 Akim Demaille + + m4: provide macros for api.value.type=union + * data/skeletons/bison.m4 (b4_union_if): New. + Remove support for "%define variant", which was deprecated long ago. + * tests/local.at (AT_UNION_IF): New. + +2021-01-30 Akim Demaille + + traces: display the Bison version + * src/main.c (main): When traces are enabled, display the Bison + version. + * tests/conflicts.at, tests/report.at, tests/sets.at: + Use AT_PACKAGE_VERSION (for package.m4) instead of post-processing the + output. + +2021-01-30 Akim Demaille + + tests: run the main test suite on "make check" + Automake appears to not recognize "check-local" when it is not a + isolated target. Fixes 77a8b84fc8bbe39dc231a1f657fd56a50fac5855. + + * tests/local.mk (check-local): Make it visible to Automake. + +2021-01-30 Adela Vais + + d: tests: various style fixes + * tests/calc.at, tests/scanner.at: Here. + (yylex): Report values directly, without storing them to the union + first. + +2021-01-30 Paul Eggert + + Update URLs to prefer https: to http: + Also, fix a few http: URLs that were no longer working. + +2021-01-29 Paul Eggert + + Update URLs to prefer https: to http: + Also, fix a few http: URLs that were no longer working. + +2021-01-27 Akim Demaille + + tests: provide check-examples and check-tests + * examples/local.mk (check-examples): New. + * tests/local.mk (check-tests): New. + * README-hacking.md: Document them. + +2021-01-27 Akim Demaille + + bistromathic: use gettext for all the messages + * examples/c/bistromathic/parse.y: Add missing calls to _. + +2021-01-24 Adela Vais + + d: tests: avoid mixing output from reportSyntaxError and getExpectedTokens + Function reportSyntaxError buffers and prints the message at the end. + + * tests/local.at: Here. + +2021-01-24 Akim Demaille + + glr2.cc: fix destructor support + Currently glr2.cc does not use 'symbol's everywhere, in various places + it also uses yykind, yyval and yyloc "by hand". So we need two + different calls for user-defined constructors: once for ~symbol, + another for yy_destroy_. Both need to call the user destructors with + different calling conventions. + + * data/skeletons/glr2.cc (b4_symbol_action): Rename as... + (b4_symbol_action_for_yyval): this. + (b4_symbol_action): New, taken from lalr1.cc. + (yy_destroy_, yy_symbol_value_print_): Use b4_symbol_action_for_yyval. + +2021-01-24 Akim Demaille + + glr2.cc: beware of types with angle brackets + For C++98, avoid "yyval.as>". + + * data/skeletons/glr2.cc (b4_call_merger): Add spaces within "<...>". + +2021-01-24 Akim Demaille + + package: fix details after merge with 3.7.5 + * TODO, cfg.mk: Update. + * src/parse-gram.c, src/parse-gram.h: Regen. + +2021-01-24 Akim Demaille + + Merge tag 'v3.7.5' + Three new commits: + + commit 8358090292e21c61a583da542bad9099ad65f355 + Author: Paul Eggert + Date: Wed Jan 20 18:30:16 2021 -0800 + + c: port to HP-UX 11.23 + + commit 2c294c132528ede23d8ae4959783a67e9ff05ac5 + Author: Vincent Imbimbo + Date: Sat Jan 23 13:25:18 2021 -0500 + + cex: fix state-item pruning + + commit c22902e360e0fbbe9fd5657dcf107e03166da309 + Author: Akim Demaille + Date: Sat Jan 23 18:40:15 2021 +0100 + + tables: fix handling for useless tokens + +2021-01-24 Akim Demaille + + doc: fix typo + Reported by Kaz Kylheku. + https://lists.gnu.org/r/bison-patches/2020-11/msg00019.html + + * doc/bison.texi (Versioning): here. + +2021-01-24 Kaz Kylheku + + doc: document best deployment practices. + * doc/bison.texi (Versioning): New node about practices + regarding dealing with multiple versions of Bison. + +2021-01-24 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2021-01-24 Akim Demaille + + version 3.7.5 + * NEWS: Record release date. + +2021-01-24 Akim Demaille + + tables: fix handling for useless tokens + In some rare conditions, the generated parser can be wrong when there + are useless tokens. + + Reported by Balázs Scheidler. + https://github.com/akimd/bison/issues/72 + + Balázs managed to prove that the bug was introduced in + + commit af1c6f973a60a51c609903713ff8f7fce0887025 + Author: Theophile Ranquet + Date: Tue Nov 13 10:38:49 2012 +0000 + + tables: use bitsets for a performance boost + + Suggested by Yuri at + . + + The improvement is marginal for most grammars, but notable for large + grammars (e.g., PosgreSQL's postgre.y), and very large for the + sample.y grammar submitted by Yuri in + http://lists.gnu.org/archive/html/bison-patches/2012-01/msg00012.html. + Measured with --trace=time -fsyntax-only. + + parser action tables postgre.y sample.y + Before 0,129 (44%) 37,095 (99%) + After 0,117 (42%) 5,046 (93%) + + * src/tables.c (pos): Replace this set of integer coded as an unsorted + array of integers with... + (pos_set): this bitset. + + which was implemented long ago, but that I installed only recently + (March 2019), first published in v3.3.90. + + That patch introduces a bitset to represent a set of integers. It + managed negative integers by using a (fixed) base (the smallest + integer to represent). It avoided negative accesses into the bitset + by ignoring integers smaller than the base, under the asumption that + these cases correspond to useless tokens that are ignored anyway. + While it turns out to be true for all the test cases in the test suite + (!), Balázs' use case demonstrates that it is not always the case. + + So we need to be able to accept negative integers that are smaller + than the current base. + + "Amusingly" enough, the aforementioned patch was visibly unsure about + itself: + + /* Store PLACE into POS_SET. PLACE might not belong to the set + of possible values for instance with useless tokens. It + would be more satisfying to eliminate the need for this + 'if'. */ + + This commit needs several improvements in the future: + - support from bitset for bit assignment and shifts + - amortized resizing of pos_set + - test cases + + * src/tables.c (pos_set_base, pos_set_dump, pos_set_set, pos_set_test): + New. + Use them instead of using bitset_set and bitset_test directly. + +2021-01-24 Vincent Imbimbo + + cex: fix state-item pruning + There were several bugs in pruning that would leave the state-item + graph in an inconsistent state which could cause crashes later on: + + - Pruning now happens in one pass instead of two. + + - Disabled state-items no longer prune the state-items they transition + to if that state-item has other states that transition to it. + + - State-items that transition to disabled state-items are always + pruned even if they have productions. + + Reported by Michal Bartkowiak + https://lists.gnu.org/r/bug-bison/2021-01/msg00000.html + and Zartaj Majeed + https://github.com/akimd/bison/issues/71 + + * src/state-item.c (prune_forward, prune_backward): Fuse into... + (prune_state_item): this. + Adjust callers. + +2021-01-23 Akim Demaille + + package: pacify syntax-check + * cfg.mk: Currently we cannot update gnulib because of portability + issues with ancient versions of clang + (https://lists.gnu.org/r/bug-gnulib/2021-01/msg00241.html). So skip + the check about copyright date for gnulib. + +2021-01-23 Akim Demaille + + news: update + +2021-01-23 Akim Demaille + + package: bump copyrights to 2021 + Run 'make update-copyright'. + +2021-01-23 Akim Demaille + + %merge: associate it to its first definition, not the latest + Currently each time we meet %merge we record this location as the + defining location (and symbol). Instead, record the first definition. + + In the generated code we go from + + yy0->A = merge (*yy0, *yy1); + + to + + yy0->S = merge (*yy0, *yy1); + + where S was indeed the first symbol, and in the diagnostics we go from + + glr-regr18.y:30.18-24: error: result type clash on merge function 'merge': != + 30 | sym2: sym3 %merge { $$ = $1; } ; + | ^~~~~~~ + glr-regr18.y:29.18-24: note: previous declaration + 29 | sym1: sym2 %merge { $$ = $1; } ; + | ^~~~~~~ + glr-regr18.y:31.13-19: error: result type clash on merge function 'merge': != + 31 | sym3: %merge { $$ = 0; } ; + | ^~~~~~~ + glr-regr18.y:30.18-24: note: previous declaration + 30 | sym2: sym3 %merge { $$ = $1; } ; + | ^~~~~~~ + + to + + glr-regr18.y:30.18-24: error: result type clash on merge function 'merge': != + 30 | sym2: sym3 %merge { $$ = $1; } ; + | ^~~~~~~ + glr-regr18.y:29.18-24: note: previous declaration + 29 | sym1: sym2 %merge { $$ = $1; } ; + | ^~~~~~~ + glr-regr18.y:31.13-19: error: result type clash on merge function 'merge': != + 31 | sym3: %merge { $$ = 0; } ; + | ^~~~~~~ + glr-regr18.y:29.18-24: note: previous declaration + 29 | sym1: sym2 %merge { $$ = $1; } ; + | ^~~~~~~ + + where both duplicates are reported against definition 1, rather than + using definition 1 as a reference when diagnosing about definition 2, + and then 2 as a reference for 3. + + * src/reader.c (record_merge_function_type): Keep the first definition. + * tests/glr-regression.at: Adjust. + +2021-01-23 Akim Demaille + + %merge: fix compatibility with api.value.type=union + Reported by Jot Dot. + https://lists.gnu.org/r/help-bison/2020-12/msg00014.html + + * data/skeletons/glr.c, data/skeletons/glr2.cc (b4_call_merger): Use + the symbol's slot, not its type. + * examples/c/glr/c++-types.y: Use explicit per-symbol typing together + with api.value.type=union. + (yylex): Use yytoken_kind_t. + +2021-01-23 Akim Demaille + + %merge: delegate the generation of calls to mergers to m4 + Don't generate C code from bison, leave that to the skeletons. + + * src/output.c (merger_output): Emit invocations to b4_call_merger. + * data/skeletons/glr.c (b4_call_merger): New. + +2021-01-23 Akim Demaille + + %merge: let mergers record a typing-symbol, rather than a type + Symbols are richer than types, and in M4 it is my simpler (and more + common) to deal with symbols rather than types. So let's associate + mergers to a symbol rather than a type name. + + * src/reader.h (merger_list): Replace the 'type' member by a symbol + member. + * src/reader.c (record_merge_function_type): Take a symbol as + argument, rather than a type name. + * src/output.c (merger_output): Adjust. + +2021-01-23 Akim Demaille + + %merge: clearer tests on diagnostics + * tests/glr-regression.at: Use caret errors. + +2021-01-23 Akim Demaille + + skeletons: introduce "slot"s for symbols + Extracted from d9cf99b6a5cb0345e91dfb90fe6d6473024ea97a, in the master + branch. + + * data/skeletons/bison.m4 (b4_symbol_slot): New, with safer semantics + than type and type_tag. + +2021-01-23 Akim Demaille + + style: YYUSE is private, make it YY_USE + This macro is not exposed to users, make start it with 'YY_'. + + * data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/glr.c, + * data/skeletons/glr.cc, data/skeletons/lalr1.cc, + * src/parse-gram.c, tests/actions.at, tests/c++.at, tests/headers.at, + * tests/local.at (YYUSE): Rename as... + (YY_USE): this. + +2021-01-23 Akim Demaille + + package: codespell + * src/parse-gram.y: Fix spelling. + +2021-01-23 Akim Demaille + + cex: fix traces: fix display of disabled items + The display of disabled state items is incorrect. The item is + stuttered, and lacks on end-of-line. + + From + + State 7: + 1 exp: exp • "⊕" exp + -> 1 exp: exp "⊕" • exp + <- 1 exp: • exp "⊕" exp + + 2 exp: exp • "+" exp 2 exp: exp • "+" exp DISABLED + 2 exp: exp "+" exp • + <- 2 exp: exp "+" • exp + + 3 exp: exp • "+" exp 3 exp: exp • "+" exp DISABLED + 3 exp: exp "+" exp • + <- 3 exp: exp "+" • exp + + to + + State 7: + 1 exp: exp • "⊕" exp + -> 1 exp: exp "⊕" • exp + <- 1 exp: • exp "⊕" exp + + 2 exp: exp • "+" exp DISABLED + + 2 exp: exp "+" exp • + <- 2 exp: exp "+" • exp + + 3 exp: exp • "+" exp DISABLED + + 3 exp: exp "+" exp • + <- 3 exp: exp "+" • exp + + * src/state-item.c (state_items_report): Don't issue disabled items + twice, and issue two '\n' at their end. + * tests/conflicts.at: Check it. + +2021-01-23 Akim Demaille + + cex: fix traces: add missing end-of-lines + In 430ca0fc632f5e8072fe468b8a99c640985f6926, I completely forgot that + `puts` adds a `\n`. + + * src/lssi.c, src/state-item.c: Restore missing end-of-lines in the + output. + +2021-01-23 Akim Demaille + + cex: add support for $TIME_LIMIT + * src/counterexample.c (TIME_LIMIT): Replace with... + (time_limit): this. + (counterexample_init): Check $TIME_LIMIT. + * src/scan-gram.l: Reorder includes. + +2021-01-23 Akim Demaille + + cex: send traces to stderr, not stdout + When comparing traces from different machines, the mixture of + stdout/stderr in the output are making things uselessly difficult. + + * src/lssi.c, src/state-item.c: Output debug traces on stderr. + +2021-01-23 Akim Demaille + + c++: I'm tired of Flex's warnings + * doc/bison.texi: Disable another warning I'm tired to see. + New releases would be most welcome. + +2021-01-23 Akim Demaille + + glr.cc: don't "leak" yyparse + When using glr.cc, the C function yyparse is an internal detail that + should not be exposed. Users might call it by accident (I did). + + * data/skeletons/glr.c (yyparse): When used for glr.cc, rename as yy_parse_impl. + * data/skeletons/glr.cc: Adjust. + +2021-01-23 Akim Demaille + + tables: avoid warnings and save bits + The yydefgoto table uses -1 as an invalid for an impossible case (we + never use yydefgoto[0], since it corresponds to the reduction to + $accept, which never happens). Since yydefgoto is a table of state + numbers, this -1 forces a signed type uselessly, which (1) might + trigger compiler warnings when storing a value from yydefgoto into a + state number (nonnegative), and (2) wastes bits which might result in + using a int16 where a uint8 suffices. + + Reported by Jot Dot . + https://lists.gnu.org/r/bug-bison/2020-11/msg00027.html + + * src/tables.c (default_goto): Use 0 rather than -1 as invalid value. + * tests/regression.at: Adjust. + +2021-01-23 Akim Demaille + + c++: use noexcept where appropriate + Reported by Don Macpherson. + https://github.com/akimd/bison/issues/63 + https://github.com/akimd/bison/issues/64 + + * data/skeletons/c++.m4, data/skeletons/lalr1.cc: here. + +2021-01-23 Martin Rehak + + examples: avoid "unbound variable" errors + When the shell option `nounset` is set, we may get "unbound variable" + errors. + https://lists.gnu.org/r/bug-bison/2020-11/msg00013.html + + * examples/test (diff_opts): Be sure to initialize it. + +2021-01-23 Akim Demaille + + autoconf: update + +2021-01-23 Akim Demaille + + c: adjust _Noreturn to pedantic clang + Reported by Joe Nelson . + https://lists.gnu.org/r/help-bison/2021-01/msg00004.html + Fixed by Paul Eggert in gnulib. + https://lists.gnu.org/r/bug-gnulib/2021-01/msg00156.html + + * data/skeletons/c.m4 (b4_attribute_define): Adjust _Noreturn to + pedantic clang. + +2021-01-21 Paul Eggert + + c: port to HP-UX 11.23 + Problem reported by Albert Chin in: + https://lists.gnu.org/r/bug-bison/2021-01/msg00029.html + * data/skeletons/c.m4 (b4_c99_int_type_define): + Work around HP-UX bug. + +2021-01-17 Akim Demaille + + d: examples: reduce scopes + * data/skeletons/lalr1.d (YYLocation.step): New. + * examples/d/calc/calc.y (Lexer): Reduce scopes to avoid uninitialized + varibles. + Factor the handling of locations. + We don't need lenChars. + +2021-01-17 Adela Vais + + d: examples: calc: remove Value from Lexer + The Symbol constructor does not use it, so it is easier to not use + Value at all. + + * examples/d/calc/calc.y: Here. + +2021-01-17 Adela Vais + + d: examples: calc: use of std.conv.parse for location + From Dlang v2.095.0 onwards, std.conv.parse reports the number of + consumed characters. + + * examples/d/calc/calc.y: Here. + +2021-01-17 Adela Vais + + d: examples: simple: fix style + * examples/d/simple/calc.y: Formatting changes. + +2021-01-17 Akim Demaille + + CI: run D tests + * .travis.yml: here. + +2021-01-16 Akim Demaille + + package: codespell + * data/skeletons/glr2.cc, src/parse-gram.y: Fix spelling. + +2021-01-16 Akim Demaille + + package: fixes + * examples/c++/glr/local.mk, examples/c/glr/local.mk (CLEANFILES): + Complete to fix distcheck. + * src/output.c (merger_output): Obfuscate to pacify syntax-check's + sc_space_before_open_paren. + +2021-01-16 Akim Demaille + + regen + +2021-01-16 Akim Demaille + + package: bump copyrights to 2021 + Run 'make update-copyright'. + +2021-01-16 Akim Demaille + + gnulib: update + * src/output.c, src/print-xml.c: Adjust. + +2021-01-16 Akim Demaille + + autoconf: update + +2021-01-16 Akim Demaille + + cex: fix traces + The display of disabled state items is incorrect. The item is + stuttered, and lacks on end-of-line. + + From + + State 7: + 1 exp: exp • "⊕" exp + -> 1 exp: exp "⊕" • exp + <- 1 exp: • exp "⊕" exp + + 2 exp: exp • "+" exp 2 exp: exp • "+" exp DISABLED + 2 exp: exp "+" exp • + <- 2 exp: exp "+" • exp + + 3 exp: exp • "+" exp 3 exp: exp • "+" exp DISABLED + 3 exp: exp "+" exp • + <- 3 exp: exp "+" • exp + + to + + State 7: + 1 exp: exp • "⊕" exp + -> 1 exp: exp "⊕" • exp + <- 1 exp: • exp "⊕" exp + + 2 exp: exp • "+" exp DISABLED + + 2 exp: exp "+" exp • + <- 2 exp: exp "+" • exp + + 3 exp: exp • "+" exp DISABLED + + 3 exp: exp "+" exp • + <- 3 exp: exp "+" • exp + + * src/state-item.c (state_items_report): Don't issue disabled items + twice, and issue two '\n' at their end. + * tests/conflicts.at: Check it. + +2021-01-16 Akim Demaille + + cex: fix traces + In 430ca0fc632f5e8072fe468b8a99c640985f6926, I completely forgot that + `puts` adds a `\n`. + + * src/lssi.c, src/state-item.c: Restore missing end-of-lines in the + output. + +2021-01-16 Akim Demaille + + c: add support for YYNOMEM + Suggested by Joe Nelson . + https://lists.gnu.org/r/help-bison/2020-12/msg00020.html + + * data/skeletons/glr.c, data/skeletons/yacc.c (YYNOMEM): New. + Use it. + (yyexhaustedlab): Rename as... + (yynomemlab): this. + * tests/calc.at: Check it. + * doc/bison.texi: Document it. + Fix incorrect statements about non-existing constants for YYERROR etc. + +2021-01-16 Akim Demaille + + doc: spell check + Gettext uses "catalog", not "catalogue". + + * doc/bison.texi, examples/c/README.md, + * examples/c/bistromathic/Makefile, + * examples/c/bistromathic/README.md, + * examples/c/bistromathic/parse.y: + Spell check. + +2021-01-16 Akim Demaille + + yacc.c, glr.c: style: rename yyreturn and yyreturnlab + * data/skeletons/glr.c, data/skeletons/yacc.c: here. + +2021-01-16 Akim Demaille + + glr.c: style: formatting changes + * data/skeletons/glr.c (YYCHK1): here. + +2021-01-16 Akim Demaille + + tests: check YYACCEPT and YYABORT + There are some tests that cover them, but nothing for all the + skeletons. Let's do that in the calculator tests. + + * tests/calc.at: Check YYACCEPT and YYABORT. + +2021-01-16 Akim Demaille + + glr2.cc: don't prepare for subclassing + I am not aware of people subclassing the parser class, and I fail to + see how this could be useful. Rather than leaving a badly baked + feature (as in glr.cc currently), let's not support it at all, until + someone comes and explains why and how it would be useful. + + * data/skeletons/glr2.cc (parser): We need no virtual function members. + +2021-01-16 Akim Demaille + + glr2.cc: formatting changes + * data/skeletons/glr2.cc: here. + +2021-01-16 Akim Demaille + + glr2.cc: move strong_index_alias into implementation file + * data/skeletons/glr2.cc: here. + Fix coding style issues. + +2021-01-16 Akim Demaille + + glr2.cc: remove some useless qualifications + * data/skeletons/glr2.cc: Rely on the type-aliases provided by + glr_stack. + +2021-01-16 Akim Demaille + + glr2.cc: more free functions about the automaton into glr_stack + * data/skeletons/glr2.cc (yypact_value_is_default) + (yytable_value_is_error, yyisShiftAction, yyisErrorAction) + (yyisDefaultedState, yydefaultAction): + Move into... + (glr_stack): here. + Fix naming conventions. + +2021-01-16 Akim Demaille + + glr2.cc: move free-functions into glr_stack + * data/skeletons/glr2.cc (yypreference, yyLRgotoState): Move into... + (glr_stack): here. + +2021-01-16 Akim Demaille + + glr2.cc: make yygetToken a member of glr_stack + It's on purpose that I keep the `this->` now. We'll see later if we + want to remove them. + + * data/skeletons/glr2.cc (yygetToken): Move into... + (glr_stack::yyget_token): this. + (b4_lex): Adjust. + +2021-01-16 Akim Demaille + + glr2.cc: move parser::parse into glr_stack + Currently we have two classes that actually should be fused together: + parser and glr_stack. Both carry part of the parsing: (i) parser + contains `parse`, which is the top-level of the parsing process, it + uses yygetToken, etc., and (ii) glr_stack takes care of all the + details (dealing with the stack), and also calls yygetToken. + + However if we fuse them together, we would get a large parser class, + in the header file. So it is probably better to split this large + class using the pimpl idiom. But then it appears that glr_stack is + very close from being the impl of parser. + + Let's improve this. + + For a start... + + * data/skeletons/glr2.cc (parser::parse): Move to... + (glr_stack::parse): here. + (parser::parse): Use it. + +2021-01-14 Akim Demaille + + cex: add support for $TIME_LIMIT + * src/counterexample.c (TIME_LIMIT): Replace with... + (time_limit): this. + (counterexample_init): Check $TIME_LIMIT. + * src/scan-gram.l: Reorder includes. + +2021-01-13 Akim Demaille + + c: adjust _Noreturn to pedantic clang + Reported by Joe Nelson . + https://lists.gnu.org/r/help-bison/2021-01/msg00004.html + Fixed by Paul Eggert in gnulib. + https://lists.gnu.org/r/bug-gnulib/2021-01/msg00156.html + + * data/skeletons/c.m4 (b4_attribute_define): Adjust _Noreturn to + pedantic clang. + +2021-01-13 Akim Demaille + + cex: send traces to stderr, not stdout + When comparing traces from different machines, the mixture of + stdout/stderr in the output are making things uselessly difficult. + + * src/lssi.c, src/state-item.c: Output debug traces on stderr. + +2021-01-10 Akim Demaille + + glr2.cc: remove remains from glr.cc + * data/skeletons/glr2.cc: We no longer play dirty tricks with + parse-params, remove the now useless dance around them. + We now have genuine objects for locations, leave the initial action + alone. + +2021-01-10 Akim Demaille + + glr2.cc: add support for api.token.constructor + * data/skeletons/glr2.cc: Add support for api.token.constructor. + * examples/c++/glr/c++-types.yy: Use it. + * examples/c++/glr/c++-types.test: Adjust expectations for error + messages. + +2021-01-10 Akim Demaille + + glr2.cc: introduce the yytranslate_ member function + * data/skeletons/c++.m4 (b4_yytranslate_define): Use static_cast + rather than the YY_CAST macro. + Avoids the need to define YY_CAST in the header. + * data/skeletons/glr2.cc: Fix calls to b4_shared_declarations: pass + the type of file we are in. + Don't define YYTRANSLATE. + (parser::yytranslate_): New, as in lalr1.cc. + Adjust to use it. + + * tests/glr-regression.at: Adjust. + +2021-01-10 Akim Demaille + + glr2.cc: tests: simplify + * tests/glr-regression.at: Remove useless qualification for tokens. + +2021-01-10 Akim Demaille + + glr2.cc: rely on symbol kinds rather than token kinds + Instead of tracking the lookahead with yychar, use yytoken. This is + consistent with lalr1.cc, saves us from calls to YYTRANSLATE (except + when calling yylex), and makes it easier to migrate to using + symbol_type. + + * data/skeletons/glr2.cc: Replace all uses of `int yychar` with + `symbol_kind_type yytoken`. + (yygetToken): Don't take/return the lookahead's token-kind and + symbol-kind, just work directly on yystack's `yytoken` member. + + * tests/glr-regression.at (AT_PRINT_LOOKAHEAD_DECLARE) + (AT_PRINT_LOOKAHEAD_DEFINE): New. + Adjust to the fact that we have yytoken, not yychar, in glr2.cc. + +2021-01-10 Akim Demaille + + glr2.cc: example: style changes + * examples/c++/glr/c++-types.yy: We need C++ 11 (we use shared_ptr). + +2021-01-10 Akim Demaille + + glr2.cc: use references to print symbols + * data/skeletons/glr2.cc (b4_symbol_action): New, so that we use + `yyval` and `yyloc` rather than the `yyvaluep` and `yylocationp` + pointers. + (yy_symbol_value_print_, yy_symbol_print_, yy_destroy_): Use + references rather than pointers. + Drop support for the undocumented, obsolete, `yyoutput` variable. + Adjust callers. + (glr_state::destroy): Don't use yy_symbol_print_ when we don't have a + symbol. Rather, write dedicated code. + +2021-01-10 Akim Demaille + + glr2.cc: fix memory leak + * data/skeletons/glr2.cc (glr_stack_item::setState): Free the previous + state before installing the new one. + +2021-01-10 Akim Demaille + + glr: examples: fix locations + The locations are actually false: they should include the location of + the semicolon (we print statements), but they don't. + + * examples/c++/glr/c++-types.test, examples/c++/glr/c++-types.yy, + * examples/c/glr/c++-types.test, examples/c/glr/c++-types.y, + * tests/cxx-type.at: + Fix locations and adjust expectations. + +2021-01-10 Akim Demaille + + glr: tests: more macros + This will be useful to support changes in glr2.cc. + + tests/glr-regression.at + (Incorrect lookahead during deterministic GLR) + (Incorrect lookahead during nondeterministc GLR): + Introduce and use PRINT_LOOKAHEAD. + +2021-01-10 Akim Demaille + + glr: tests: formatting changes + * tests/glr-regression.at: here. + Use %empty where applicable. + +2021-01-10 Akim Demaille + + tests: fix definition for parser class name + * tests/local.at (AT_PARSER_CLASS): Fix it. + And use it. + +2021-01-10 Akim Demaille + + CI: disable the installation of dmd + Currently all the builds fail: + + $ mkdir -p ~/dlang && wget https://dlang.org/install.sh -O ~/dlang/install.sh + --2021-01-10 06:05:39-- https://dlang.org/install.sh + Resolving dlang.org (dlang.org)... 162.217.114.56, 2607:fc50:1:ff02::5:0 + Connecting to dlang.org (dlang.org)|162.217.114.56|:443... connected. + ERROR: cannot verify dlang.org's certificate, issued by ‘CN=R3,O=Let's Encrypt,C=US’: + Unable to locally verify the issuer's authority. + To connect to dlang.org insecurely, use `--no-check-certificate'. + + * .travis.yml: Disable dmd. + +2021-01-07 Akim Demaille + + tests: remove some redundant tests + * tests/calc.at: Cut the CI some slack. + +2021-01-07 Adela Vais + + d: create getter for the number of errors from the parser + * data/skeletons/lalr1.d: Here. + +2021-01-07 Adela Vais + + d: remove support for parse.error verbose + Without the history, D should not support this option. Before the + removal, 'detailed' and 'verbose' options generated the same code. + + * data/skeletons/lalr1.d: Here. + * doc/bison.texi: Adapt tests to use 'detailed' instead of 'verbose'. + * tests/calc.at: Document it. + +2021-01-07 Akim Demaille + + d: add support for %printer + Currently we display the addresses of the semantic values. Instead, + print the values. + + Add support for YY_USE across languages. + + * data/skeletons/c.m4, data/skeletons/d.m4 (b4_use): New. + * data/skeletons/bison.m4 (b4_symbol_actions): Use b4_use to be + portable to D. + + Add support for %printer, and use it. + + * data/skeletons/d.m4: Instead of duplicating what's already in + c-like.m4, include it. + (b4_symbol_action): New. + Differs from the one in bison.m4 in that it uses yyval/yyloc instead + of *yyvaluep and *yylocationp. + + * data/skeletons/lalr1.d (yy_symbol_print): Avoid calls to formatting, + just call write directly. + Use the %printer. + * examples/d/calc/calc.y: Specify a printer. + Enable traces when $YYDEBUG is set. + * tests/calc.at: Fix the use of %printer with D. + +2021-01-06 Adela Vais + + d: remove unnecessary imports + * data/skeletons/lalr1.d: Here. + +2021-01-06 Adela Vais + + d: remove yytnamerr usage + It is a backwards-compatible feature for the other parsers. + D should not support this option. + + * data/skeletons/d.m4: Here. + +2021-01-06 Adela Vais + + d: add internationalisation support + The D parser implements this feature similarly to the C parser, + by using Gettext. Functions gettext() and dgettext() are + imported using extern(C). The internationalisation uses yysymbol_name + to report the name of the SymbolKinds. + + * data/skeletons/d.m4 (SymbolKind.toString.yytranslatable, + SymbolKind.toString.yysymbol_name: New), data/skeletons/lalr1.d: Here. + * doc/bison.texi: Document it. + * tests/calc.at: Test it. + +2021-01-05 Akim Demaille + + glr2.cc: add support for variants + (Bison) Variants are extremely picky, which makes them both + annoying (lots of micro-details must be taken care of) and + precious (all the micro-details must be taken care of, in particular + object lifetime). + + So (i) each time a semantic value is stored, it must be stored in a + place that exists, and (ii) each time a semantic value is discarded, + its place must have been emptied. + + Example of (i) + + - new (&yys.value ()) value_type (s->value ()); + + {]b4_variant_if([[ + + new (&yys.value ()) value_type (); + + ]b4_symbol_variant([yy_accessing_symbol (s->yylrState)], + + [yys.value ()], [copy], [s->value ()])], [[ + + new (&yys.value ()) value_type (s->value ());]])[ + + } + + Example of (ii) + + yyparser.yy_destroy_ ("Error: discarding", + - yytoken, &yylval]b4_locations_if([, &yylloc])[); + + yytoken, &yylval]b4_locations_if([, &yylloc])[);]b4_variant_if([[ + + // Value type destructor. + + ]b4_symbol_variant([[YYTRANSLATE (this->yychar)]], [[yylval]], [[template destroy]])])[ + this->yychar = ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(empty, id)[; + + However, in some places we must not be "pure". In particular: + + glr_stack_item (const glr_stack_item& other) YY_NOEXCEPT YY_NOTHROW + : is_state_ (other.is_state_) + { + std::memcpy (raw_, other.raw_, union_size); + } + + still must use memcpy, because the constructor would change pred, and + it must not. This constructor is used only when resizing the stack, + in which case pred (which is relative) must not be "adjusted". + + The result works, but is messy. Its verbosity comes from at least two + factors: + + - we don't have support for complete symbols (binding kind, value and + location), and we should at least try to have it. That simplified + lalr1.cc a lot. + + - I have not tried to be smart and use 'move' when possible. As a + consequence many places have 'copy' and then 'destroy'. That kind + of clean up can be done once everything appears to be solid. + + * data/skeletons/glr2.cc: Be more rigorous in object lifetime. + In particular, don't forget to discard the lookahead when we're done + with it. + Call variant routines where needed. + Deal with plenty of details. + (b4_call_merger): Add support for variants. + Use references in mergers, rather than pointers. + + * examples/c++/glr/c++-types.yy: Exercise variants. + +2021-01-05 Akim Demaille + + glr: strengthen the tests + On some experimentation I was running, the test suite was passing, yet + the example crashed when run in verbose mode. Let's add this case to + the test suite. + + * tests/cxx-type.at: Run all these tests in verbose mode too. + +2021-01-03 Akim Demaille + + c++: I'm tired of Flex's warnings + * doc/bison.texi: Disable another warning I'm tired to see. + New releases would be most welcome. + +2021-01-03 Akim Demaille + + glr: example: flush the output + * examples/c/glr/c++-types.y: Flush stdout so that the logs (on + stderr) and the effective output (on stdout) mix correctly. + While at it, be a bit more const-correct. + +2021-01-03 Akim Demaille + + style: YYUSE is private, make it YY_USE + This macro is not exposed to users, make start it with 'YY_'. + + * data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/glr.c, + * data/skeletons/glr.cc, data/skeletons/glr2.cc, data/skeletons/lalr1.cc, + * src/parse-gram.c, tests/actions.at, tests/c++.at, tests/headers.at, + * tests/local.at (YYUSE): Rename as... + (YY_USE): this. + +2021-01-03 Akim Demaille + + glr.c: example: use a printer + * examples/c++/glr/c++-types.yy: Here. + +2021-01-03 Akim Demaille + + glr: consistently use the same wording in traces + * data/skeletons/glr.c, data/skeletons/glr2.cc (yyglrReduce): Traces + refer to "state 42", not to "state #42". + +2021-01-02 Akim Demaille + + glr2.cc: also equip semantic_option with self check + * data/skeletons/glr2.cc (semantic_option): Add MAGIC_, magic_ and + check_ members. + Use it. + +2021-01-02 Akim Demaille + + glr2.cc: log the execution of deferred actions + See "glr.c: log the execution of deferred actions". + + * data/skeletons/glr2.cc (yyuserAction): Take yyk as a new argument. + Rename argument yyn as yyrule for clarity. + Log before and after the user action. + Adjust callers to not call YY_REDUCE_PRINT and YY_SYMBOL_PRINT. + +2021-01-02 Akim Demaille + + glr2.cc: minor clean up + * data/skeletons/glr2.cc (YYUNDEFTOK): Now useless. + Formatting/coding style changes. + +2021-01-02 Akim Demaille + + glr.c: log the execution of deferred actions + Currently deferred reductions are not "verbose" at all: only immediate + reductions are displayed in the YYDEBUG traces. I don't understand + why. Besides it seems actually simpler the install the reduction + traces right around the user action inside yyuserAction rather that + around calls to yyuserAction. + + This only trouble is that yyuserAction does not know the stack number + it works on, so we have to pass it. And pass -1 when we are actually + running on a temporary stack. + + The glr example, on "T(x) + y;" as input, adds these logs, which + allow to see when the `` is built: + + Stack 0 Entering state 26 + Reduced stack 0 by rule 7 (line 108); action deferred. Now in state 7. + Stack 0 Entering state 7 + Reading a token + Next token is token '+' (1.6: ) + Stack 1 Entering state 27 + Reduced stack 1 by rule 13 (line 123); action deferred. Now in state 12. + Stack 1 Entering state 12 + Next token is token '+' (1.6: ) + Stack 1 dies. + Removing dead stacks. + On stack 0, shifting token '+' (1.6: ) + Stack 0 now in state #14 + +Reducing stack -1 by rule 6 (line 107): + + $1 = token identifier (1.3: x) + +-> $$ = nterm expr (1.3: x) + +Reducing stack -1 by rule 7 (line 108): + + $1 = token typename (1.0: T) + + $2 = token '(' (1.2: ) + + $3 = nterm expr (1.3: x) + + $4 = token ')' (1.4: ) + +-> $$ = nterm expr (1.0-3: (x,T)) + Returning to deterministic operation. + + * data/skeletons/glr.c (yyuserAction): Take yyk as a new argument. + Rename argument yyn as yyrule for clarity. + Log before and after the user action. + Adjust callers to not call YY_REDUCE_PRINT and YY_SYMBOL_PRINT. + +2021-01-02 Akim Demaille + + glr.c: reorder routines + The next commit wants to use YY_REDUCE_PRINT above its current + definition. Move it higher. + + * data/skeletons/glr.c (yylhsNonterm, YY_REDUCE_PRINT): Make available + earlier. + +2021-01-02 Akim Demaille + + glr.c: example: use the exact same display as in the C++ example + * examples/c/glr/c++-types.y: Add a space after the commas. + * examples/c/glr/c++-types.test: Adjust expectations. + +2021-01-02 Akim Demaille + + glr.c: example: several improvements + * examples/c/glr/c++-types.y (node_print): New. + Use YY_LOCATION_PRINT instead of duplicating it. + And actually use it in the action instead of badly duplicating it. + (main): Add proper option support. + * examples/c/glr/c++-types.test: Adjust expectations on locations. + * examples/c++/glr/c++-types.yy: Fix bad iteration. + +2020-12-31 Akim Demaille + + glr2.cc: the example requires Bison 3.8 + This will save us from generating the position.hh file. + + * src/parse-gram.y: Claim we are 3.8. + * examples/c++/glr/c++-types.yy: Require 3.8. + +2020-12-31 Akim Demaille + + %merge: associate it to its first definition, not the latest + Currently each time we meet %merge we record this location as the + defining location (and symbol). Instead, record the first definition. + + In the generated code we go from + + yy0->A = merge (*yy0, *yy1); + + to + + yy0->S = merge (*yy0, *yy1); + + where S was indeed the first symbol, and in the diagnostics we go from + + glr-regr18.y:30.18-24: error: result type clash on merge function 'merge': != + 30 | sym2: sym3 %merge { $$ = $1; } ; + | ^~~~~~~ + glr-regr18.y:29.18-24: note: previous declaration + 29 | sym1: sym2 %merge { $$ = $1; } ; + | ^~~~~~~ + glr-regr18.y:31.13-19: error: result type clash on merge function 'merge': != + 31 | sym3: %merge { $$ = 0; } ; + | ^~~~~~~ + glr-regr18.y:30.18-24: note: previous declaration + 30 | sym2: sym3 %merge { $$ = $1; } ; + | ^~~~~~~ + + to + + glr-regr18.y:30.18-24: error: result type clash on merge function 'merge': != + 30 | sym2: sym3 %merge { $$ = $1; } ; + | ^~~~~~~ + glr-regr18.y:29.18-24: note: previous declaration + 29 | sym1: sym2 %merge { $$ = $1; } ; + | ^~~~~~~ + glr-regr18.y:31.13-19: error: result type clash on merge function 'merge': != + 31 | sym3: %merge { $$ = 0; } ; + | ^~~~~~~ + glr-regr18.y:29.18-24: note: previous declaration + 29 | sym1: sym2 %merge { $$ = $1; } ; + | ^~~~~~~ + + where both duplicates are reported against definition 1, rather than + using definition 1 as a reference when diagnosing about definition 2, + and then 2 as a reference for 3. + + * src/reader.c (record_merge_function_type): Keep the first definition. + * tests/glr-regression.at: Adjust. + +2020-12-31 Akim Demaille + + %merge: test support for api.value.type=union + * tests/glr-regression.at: here. + +2020-12-31 Akim Demaille + + %merge: fix compatibility with api.value.type=union + Reported by Jot Dot. + https://lists.gnu.org/r/help-bison/2020-12/msg00014.html + + * data/skeletons/glr.c, data/skeletons/glr2.cc (b4_call_merger): Use + the symbol's slot, not its type. + * examples/c/glr/c++-types.y: Use explicit per-symbol typing together + with api.value.type=union. + (yylex): Use yytoken_kind_t. + +2020-12-31 Akim Demaille + + %merge: delegate the generation of calls to mergers to m4 + Don't generate C code from bison, leave that to the skeletons. + + * src/output.c (merger_output): Emit invocations to b4_call_merger. + * data/skeletons/glr.c, data/skeletons/glr2.cc (b4_call_merger): New. + +2020-12-31 Akim Demaille + + %merge: let mergers record a typing-symbol, rather than a type + Symbols are richer than types, and in M4 it is my simpler (and more + common) to deal with symbols rather than types. So let's associate + mergers to a symbol rather than a type name. + + * src/reader.h (merger_list): Replace the 'type' member by a symbol + member. + * src/reader.c (record_merge_function_type): Take a symbol as + argument, rather than a type name. + * src/output.c (merger_output): Adjust. + +2020-12-31 Akim Demaille + + %merge: clearer tests on diagnostics + * tests/glr-regression.at: Use caret errors. + +2020-12-28 Akim Demaille + + glr2.cc: style: quoting changes + * data/skeletons/glr2.cc: Use stricter quoting rules. + +2020-12-28 Akim Demaille + + lalr1.cc: style: quoting changes + * data/skeletons/lalr1.cc: here. + +2020-12-27 Akim Demaille + + glr2.cc: use references to the stack rather than pointers + Now that the lookahead macros (that used yystackp) are out of the way, + there is no reason to continue using a pointer. + + * data/skeletons/glr2.cc: Use yystack, a reference, rather that + yystackp, a pointer. + Fix tons of const-correctness issues. + +2020-12-27 Akim Demaille + + glr2.cc: simplify names + Now that we no longer play dangerous games with macros, we can give + the lookahead's token kind its proper name. The content of yychar + _is_ raw (as opposed to yytoken), there's no reason to pleonasmicate + it (and thus to neologize). + + * data/skeletons/glr2.cc (glr_stack::yyrawchar): Rename as... + (glr_stack::yychar): this. + +2020-12-27 Akim Demaille + + glr2.cc: get rid of the macros wrapping the lookahead + In glr.c, the macros yychar, yylval and yylloc allow to deal with + api.pure: sometimes they point to global variables (impure), sometimes + they point to the member variables (pure). + + There's no room for globals in glr2.cc. Besides, they map yychar to + yyrawchar, yylval to yyval, etc. which obfuscates what is actually + going on. + + * data/skeletons/glr2.cc (glr_stack::yyval, glr_stack::yyloc): Rename + as... + (glr_stack::yylval, glr_stack::yylloc): these, for clarity. + (yynerrs, yychar, yylval, yylloc, yystackp): Remove these macros. + (b4_yygetToken_call): Remove. + +2020-12-26 Akim Demaille + + glr2.cc: reorganize the skeleton + Restore a more natural order: first define the macros and then use + them. Currently, some macros were defined between the moment the + header is issued, and then the implementation file. As a result, it + was possible for the header and the implementation to not use the same + versions of the macros. + + * data/skeletons/glr2.cc: Define the macros first, then use them. + * data/skeletons/lalr1.cc: Minor comment and quoting changes. + +2020-12-26 Akim Demaille + + glr2.cc: example: simplify + * examples/c++/glr/c++-types.yy: Formatting changes. + Remove unused support for '@'. + * examples/c/glr/c++-types.y: Ditto. + +2020-12-26 Akim Demaille + + glr2.cc: make yyreportTree a member function of semantic_option + * data/skeletons/glr2.cc (yy_accessing_symbol, yylhsNonterm): Define + ealier. + (state_stack::yyreportTree): Move to... + (semantic_option::yyreportTree): here. + Adjust dependencies. + +2020-12-26 Akim Demaille + + glr2.cc: pass references to yyreportAmbiguity + * data/skeletons/glr2.cc (yyreportAmbiguity): Use references. + +2020-12-26 Akim Demaille + + style: use yyval only, not yysval + * data/skeletons/glr.c, data/skeletons/glr2.cc: Use yyval, as in + the other skeletons. + +2020-12-26 Akim Demaille + + glr2.cc: pass location by const ref to yyglrShift + * data/skeletons/glr2.cc (glr_state.yyglrShift): Take the location by + const&. + Remove useless `inline`. + +2020-12-26 Akim Demaille + + style: rename semanticVal as value + * data/skeletons/README-D.txt: Remove, now useless and obsolete. + * data/skeletons/glr2.cc, examples/d/calc/calc.y, + * tests/calc.at, tests/d.at, tests/scanner.at (semanticVal): Replace + with... + (value): this. + +2020-12-26 Akim Demaille + + glr2.cc: remove dead comments + * data/skeletons/glr2.cc: We no longer wrap glr.c here. + +2020-12-26 Akim Demaille + + glr2.cc: use YYCDEBUG, not YY_DEBUG_STREAM + * data/skeletons/glr2.cc (YY_DEBUG_STREAM): Rename as... + (YYCDEBUG): this, as in lalr1.cc. + +2020-12-26 Akim Demaille + + glr2.cc: formatting changes + * data/skeletons/glr2.cc: here. + Remove useless `inline`. + +2020-12-26 Akim Demaille + + glr2.cc: don't use YYSTYPE/YYLTYPE at all + * data/skeletons/glr2.cc: Define value_type and location_type where + needed, and use them only. + (yyuserMerge): Make it a member function of the glr_state class. + +2020-12-26 Akim Demaille + + tests: don't require YYSTYPE/YYLTYPE to be defined in C++ + * tests/glr-regression.at: Use AT_YYSTYPE/AT_YYLTYPE to generate + yy::parser::value_type and yy::parser::location_type in C++. + +2020-12-26 Akim Demaille + + c++: rename semantic_type as value_type + We always refer to the triplet "kind, value, location". All of them + are nouns, and we support api.value.type and api.location.type. On + this regard, "semantic_type" was a poor choice. Make it "value_type". + + The test suite was not updated to use value_type, on purpose, to + enforce backward compatibility. + + * data/skeletons/c++.m4, data/skeletons/glr.cc, data/skeletons/glr2.cc, + * data/skeletons/variant.hh, doc/bison.texi: Define value_type rather + than semantic_type. + Add a backward compatibility typedef. + * examples/c++/glr/c++-types.yy: Migrate. + +2020-12-26 Akim Demaille + + doc: more about sanitizers + * README-hacking.md: here. + +2020-12-26 Akim Demaille + + glr2.cc: simplify + * data/skeletons/glr2.cc (glr_state_set::yyremoveDeletes): Use + vector::resize rather than vector::erase. + (glr_state::copyFrom): Merge into... + (glr_state::operator=): here. + Valentin wanted each assignment to be explicit, hence copyFrom rather + that operator=. But in 0a82316e54fead8c3f1cf41d2213c868ab88f508 + (glr2.cc: example: use objects (not pointers) to represent the AST), + in order to get real objects to be processed correctly, we had to + introduce the assignment operator. Afterward, we also introduced a + full implementation of the copy-ctor, independent of copyFrom. As a + result, today the only invocation of copyFrom is from the assignment + operator. Simplify this. + +2020-12-26 Akim Demaille + + glr2.cc: fix warnings about uninitialized locations + With GCC10, the CI shows tons of warnings such as + (327. actions.at:374: testing Initial location: glr2.cc): + + input.cc: In member function 'YYRESULTTAG glr_stack::yyglrReduce(state_set_index, rule_num, bool)': + input.cc:1357:11: error: '.glr_state::yyloc' may be used uninitialized in this function [-Werror=maybe-uninitialized] + 1357 | yyloc = other.yyloc; + | ~~~~~~^~~~~~~~~~~~~ + + This is because we don't have the constructors for locations. But we + should have them! That's only because of glr.cc that ctors were not + enabled by default. In glr2.cc, they should. + + That fixes all the warnings when Bison's locations are used. However, + when user-defined locations without constructor are used, we still + have: + + 550. calc.at:1409: testing Calculator glr2.cc %locations api.location.type={Span} ... + calc.cc: In member function 'YYRESULTTAG glr_stack::yyglrReduce(state_set_index, rule_num, bool)': + calc.cc:1261:11: error: '.glr_state::yyloc' may be used uninitialized in this function [-Werror=maybe-uninitialized] + 1261 | yyloc = other.yyloc; + | ~~~~~~^~~~~~~~~~~~~ + + To address this case, we need glr_state to explicily initialize its + yyloc member. + + * data/skeletons/glr2.cc: Use genuine objects, with ctors, for position + and location. + (glr_state): Explicitly initialize yyloc in the constructors. + +2020-12-25 Akim Demaille + + glr2.cc: provide glr_state with a genuine copy-constructor + The copy constructor was (lazily) implemented by a call to copyFrom. + Unfortunately copyFrom reads yyresolved from the destination (and + source), and in the case of the copy-ctor this is random garbagge, + which UBSAN catches: + + glr-regr2a.cc:1072:10: runtime error: load of value 7, which is not a valid value for type 'bool' + + Rather than defining yyresolved before calling copyFrom, let's just + provide a genuine cpy-ctor for glr_state. + + * data/skeletons/glr2.cc (glr_state::glr_state): Implement properly. + +2020-12-25 Akim Demaille + + glr2.cc: beware of self-assignment + In yycompressStack: + + while (yyr != YY_NULLPTR) + { + nextFreeItem->check_ (); + yyr->check_(); + nextFreeItem->setState(*yyr); + glr_state& nextFreeState = nextFreeItem->getState(); + yyr = yyr->pred(); + nextFreeState.setPred(&(nextFreeItem - 1)->getState()); + setFirstTop(&nextFreeState); + ++nextFreeItem; + } + + it is possible that nextFreeItem and yyr are actually the same state. + In which case `nextFreeItem->setState(*yyr)` does really bad things. + + * data/skeletons/glr2.cc (glr_stack_item::setState): Beware of + self-assignment. + +2020-12-25 Akim Demaille + + glr: comment changes + * data/skeletons/glr.c: A bit more doc. + (yypstates): Rename yyst (only occurrence) to yys (commonly used for + yyGLRState). + * data/skeletons/glr2.cc: Ditto. + Prefer '\n' to "\n". + +2020-12-21 Adela Vais + + d: remove unnecessary methods from the Lexer interface + The complete symbol approach in yylex removes the need for the methods + semanticVal, startPos and endPos, which were used when the values were + reported separately. + + * data/skeletons/lalr1.d: Here. + * doc/bison.texi: Remove sections about the three methods. + * examples/d/calc/calc.y, examples/d/simple/calc.y: Remove the unused methods. + * tests/calc.at, tests/d.at, tests/scanner.at: Test it. + +2020-12-21 Adela Vais + + d: use Location and Position aliases in the backend + * data/skeletons/lalr1.d: Here. + +2020-12-21 Adela Vais + + d: remove unnecessary comparison from YYParser.parse() + * data/skeletons/lalr1.d: Here. + +2020-12-21 Akim Demaille + + style: address syntax-check diagnostics + * examples/c/glr/c++-types.y: Formatting changes. + * po/POTFILES.in: Add missing files. + * src/reader.c: Remove useless include. + * tests/calc.at: Avoid magic values for exit. + Obfuscate calls to error. + +2020-12-21 Adela Vais + + d: create alias Position for YYPosition + * data/skeletons/d.m4 (b4_public_types_declare): Here. + * data/skeletons/lalr1.d: Adjust. + * doc/bison.texi: Document it. + * examples/d/calc/calc.y: Use it. + * tests/calc.at: Test it. + +2020-12-21 Adela Vais + + d: create alias Value for YYSemanticType + * data/skeletons/d.m4: Here. + * data/skeletons/lalr1.d, examples/d/calc/calc.y, examples/d/simple/calc.y: Adjust. + * tests/calc.at, tests/d.at, tests/scanner.at: Test it. + +2020-12-21 Adela Vais + + d: create alias Location for YYLocation + * data/skeletons/d.m4: Here. + * doc/bison.texi: Document it. + * examples/d/calc/calc.y: Adjust. + * tests/calc.at: Test it. + +2020-12-21 Adela Vais + + d: remove yychar from YYParse.parse() + The yychar variable was keeping the external form of the token (the + TokenKind). As the D parser translates the token to its internal + form (the SymbolKind) inside the struct Symbol, there is no need for + yychar anymore. + + * data/examples/lalr1.d (yychar): Remove. + Use only yytoken. + +2020-12-21 Adela Vais + + d: reduce verbosity for returning the location from yylex() + * examples/d/calc/calc.y (start, end): Replace by this... + (location): new member variable in the Lexer class. + Use it. + * tests/calc.at: Use the defined location variable. + +2020-12-21 Adela Vais + + d: m4 style consistency fix + * data/skeletons/lalr1.d: Here. + +2020-12-21 Adela Vais + + d: create alias Symbol for YYParse.Symbol + * data/skeletons/lalr1.d: Here. + * doc/bison.texi: Document it. + * examples/d/calc/calc.y, examples/d/simple/calc.y: Adjust. + * tests/calc.at, tests/d.at, tests/scanner.at: Test it. + +2020-12-21 Adela Vais + + d: change name of YYParser.Symbol's semanticValue() to value() + Member value was renamed to value_ to avoid the name clash. + + * data/skeletons/d.m4: Change member names. + * data/skeletons/lalr1.d: Adjust. + +2020-12-20 Akim Demaille + + glr2.cc: formatting changes + * data/skeletons/glr2.cc (glr_state): here. + (glr_state::MAGIC): Make it easier to recognize in decimal. + +2020-12-20 Akim Demaille + + glr2.cc: call the destructor in a way that complies with clang + examples/c++/glr/c++-types.cc:721:24: error: + expected the class name after '~' to name a destructor + yysval.YYSTYPE::~semantic_type (); + ^ + + Using a local typedef, for some reaon, result in clang complaining + about a useless local typedef. Since anyway we don't want to keep on + using YYSTYPE and YYLTYPE, it is time to introduce proper typedefs to + reach these guys. And to be slightly in advance of the other + skeletons: use value_type, not semantic_type. This is much more + consistent with our use of the (kind, value, location) triplet. + + * data/skeletons/glr2.cc (glr_state::value_type) + (glr_state::location_type): New. + (glr_state::~glr_state): Use value_type to name the dtor. + +2020-12-20 Akim Demaille + + glr2.cc: example: use objects (not pointers) to represent the AST + Currently we are using pointers. The whole point of + glr2.cc (vs. glr.cc) is precisely to allow genuine C++ objects to be + semantic values. Let's make that work. + + * data/skeletons/glr2.cc (glr_state::glr_state): Be sure to initialize + yysval. + (glr_state): Add copy-ctor, assignment and dtor. + (glr_state::copyFrom): Be sure to initialize the destination if it was + not. + (glr_state::~glr_state): Destroy the semantic value. + * examples/c++/glr/ast.hh: Rewrite so that we use genuine objects, + rather than a traditional OOP hierarchy that requires to deal with + pointers. + With help from Bruno Belanyi . + * examples/c++/glr/c++-types.yy: Remove memory management. + Use true objects. + (main): Don't reach yydebug directly. + + * examples/c++/glr/local.mk: We need C++11. + +2020-12-20 Akim Demaille + + glr2.cc: more checks + * data/skeletons/glr2.cc: Clarify use of magic numbers. + (glr_stack_item::getState): Check the returned state. + +2020-12-20 Akim Demaille + + glr2.cc: fix GLR stack expansion + When expanding the GLR stack, none of the pointers were updated to + reflect the new location of the displaced objects. + + This fixes + + 748: Incorrect lookahead during nondeterministic GLR: glr2.cc + + * data/skeletons/glr2.cc (yyexpandGLRStack): Update the split point + and the stack tops. + (reduceToOneStack): Factor a bit. + +2020-12-20 Akim Demaille + + glr2.cc: factor the computation of the accessing symbol + * data/skeletons/glr2.cc (yy_accessing_symbol): New, as in glr.c. + Use it. + +2020-12-20 Akim Demaille + + glr2.cc: fix calling conventions for yyexpandGLRStackIfNeeded + This test fails: + + 748: Incorrect lookahead during nondeterministic GLR: glr2.cc + + It consumes lots of stack space, so at some point we need to expand + it. Because of Boolean logic mistakes, we then claim + memory-exhausted (first error). Hence we jump to cleaning the + stack (popall_), calling all the destructors, and at some point we + crash with heap-use-after-free (second error). + + This commit fixes the first error. Unfortunately, even though we now + do expand the stack, we crash again with (another) + heap-use-after-free, not addressed here. + + Eventually, we should make sure popall_() properly works. + + * data/skeletons/glr2.cc (yyexpandGLRStackIfNeeded): Return true iff + success (i.e., memory not exhausted). + +2020-12-20 Akim Demaille + + glr2.cc: example: use streams and accept arguments + From a debugger, it is easier to pass a file name than working on + stdin. + + * examples/c++/glr/c++-types.yy: Reduce scopes. + Avoid YYSTYPE/YYLTYPE: use the C++ types. + (input, process): New. + (main): Use them. + +2020-12-20 Akim Demaille + + glr: formatting changes + * data/skeletons/glr.c: Formatting changes. + * data/skeletons/glr2.cc: Ditto. + (glr_state_set::INITIAL_NUMBER_STATES): Remove, unused (and useless: + let std::vector deal with that). + +2020-12-20 Akim Demaille + + skeletons: better comments for some tables + And also, remove the incorrect indentation of these comments: + + - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ + +/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ + static const yytype_int8 yyr2[] = + { + 0, 2, 4, 0, 2, 1, 1, 1, 3, 2, + + I don't remember why this indentation was added (in + 0991e29b75f192570b6fac1ba23657ab4f3509ee), but it seems wrong, + at least for yacc.c. I suspect this was done with lalr1.cc (where + this is embeded in the class definition, so it should be indented), + but today lalr1.cc uses other routines to output these comments. + + * data/skeletons/bison.m4 (b4_integral_parser_tables_map): Improve the + wording of the comments of some tables. + * data/skeletons/c.m4 (b4_integral_parser_table_define): Remove + indentation. + +2020-12-19 Akim Demaille + + glr2.cc: fix glr_stack_item::setState + A glr_stack_item has "raw" memory to store either a glr_state or a + semantic_option. glr_stack_item::setState stores a state using a copy + assignment. However, this is more like a construction: we are + starting from "raw" memory, so use the placement new operator instead. + While it probably makes no difference when parse.assert is disabled, + it does make one when it is: the constructor properly initialize the + magic number, the assignment does not. So without these changes, the + next commit (which stores genuine objects in semantic values) fails + tests 712 and 730 because of incorrect magic numbers. + + * data/skeletons/glr2.cc (glr_stack_item::setState): Build the state, + don't just copy it. + +2020-12-19 Akim Demaille + + glr2.cc: more self checks + * data/skeletons/glr2.cc: here. + +2020-12-19 Akim Demaille + + glr2.cc: style: s/Type/Kind/g + * data/skeletons/glr2.cc (YY_SYMBOL_PRINT): Use Kind, not Type. + As in the other skeletons. + +2020-12-19 Akim Demaille + + glr2.cc: example: style: add missing copyright headers + * examples/c++/glr/ast.hh, examples/c++/glr/c++-types.yy: here. + * examples/c++/glr/local.mk: Fix distribution of ast.hh. + +2020-12-19 Akim Demaille + + glr2.cc: example: address Clang warnings + ast.hh:24:7: error: 'Node' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit [-Werror,-Wweak-vtables] + class Node + ^ + ast.hh:57:7: error: 'Nterm' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit [-Werror,-Wweak-vtables] + class Nterm : public Node + ^ + ast.hh:102:7: error: 'Term' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit [-Werror,-Wweak-vtables] + class Term : public Node + ^ + + * examples/c++/glr/ast.hh: Define the destructors out of the class + definition. + This does not change anything, it is still in the header, but that + does pacify clang. + +2020-12-16 Akim Demaille + + glr: tests: add support for the YYDEBUG envvar + When debugging these parsers, we really need debug traces. + Enable them, and bind them to $YYDEBUG. + + * tests/glr-regression.at: Support the YYDEBUG envvar. + As a consequence, now that syntactic ambiguities are reported, adjust + the expected output. + (No users destructors if stack 0 deleted): Don't return 0 on memory + exhaustion, really return the parser's status, and adust expectations. + +2020-12-14 Akim Demaille + + glr.c: comment changes + * data/skeletons/glr.c (yycompressStack): Reduce scope, and import some + nice comments from glr2.cc. + +2020-12-14 Akim Demaille + + glr2.cc: make the example more C++ + Currently the example really looks like C. Instead of a union of + structs to implement the AST, use a hierarchy. It would be nice to + feature a C++17 version with std variants. + + * examples/c++/glr/c++-types.yy (Node, free_node, new_nterm) + (new_term): Move into... + * examples/c++/glr/ast.hh: here, a proper C++ hierarchy. + +2020-12-14 Akim Demaille + + glr2.cc: make yyparse a member function + Amusingly enough, glr2.cc still had its core function, yyparse, being + a free function instead of a member function. + + * data/skeletons/glr2.cc (yyparse): Remove this free function called + from yyparser::parse. Inline its body into... + (yyparser::parse): this member function. + This requires moving a bit the yychar, etc. macros. + Access to token can be simplified (the + b4_namespace_ref::b4_parser_class prefix is no longer needed). + +2020-12-14 Akim Demaille + + glr2.cc: being pure is not an option + Remove the useless conditional b4_pure_if: the skeleton is, of course, + pure (no global variables). Make glr2.cc intrinsically pure. + + * data/skeletons/glr2.cc (b4_pure_if): Remove definition and uses. + (b4_lex): New. + Stolen from lalr1.cc to avoid needing to use the one from c.m4. + +2020-12-14 Akim Demaille + + glr2.cc: fix yycompressStack + Currently, yycompressStack expects the free items to be states only. + That's not the case. + + Fixes 712 and 730 pass. 748 still fails, but later and + differently (heap-use-after-free). + + * data/skeletons/glr2.cc (glr_stack_item::setState): New. + (glr_stack_item::yycompressStack): Use it. + * tests/glr-regression.at: Adjust. + +2020-12-14 Akim Demaille + + glr2.cc: fix pointer arithmethics + A glr_state keeps tracks of its predecessor using an offset relative + to itself (i.e., pointer subtraction). Unfortunately we sometimes + have to compute offsets for pointers that live in different + containers, in particular in yyfillin. In that case there is no + reason for the distance between the two objects to be a multiple of + the object size (0x40 on my machine), and the resulting ptrdiff_t may + be "wrong", i.e., it does allow to recover one from the other. We + cannot use "typed" pointer arithmetics here, the Euclidean division + has it wrong. So use "plain" char* pointers. + + Fixes 718 (Duplicate representation of merged trees: glr2.cc) and + examples/c++/glr/c++-types. + + Still XFAIL: + + 712: Improper handling of embedded actions and dollar(-N) in GLR parsers: glr2.cc + 730: Incorrectly initialized location for empty right-hand side in GLR: glr2.cc + 748: Incorrect lookahead during nondeterministic GLR: glr2.cc + + * data/skeletons/glr2.cc (glr_state::as_pointer_): New. + (glr_state::pred): Use it. + * examples/c++/glr/c++-types.test: The test passes. + * tests/glr-regression.at (Duplicate representation of merged trees: + glr2.cc): Passes. + +2020-12-14 Akim Demaille + + glr2.cc: style fixes + * data/skeletons/glr2.cc: Formatting changes. + +2020-12-13 Akim Demaille + + glr2.cc: add sanity check in glr_state + The use of YY_IGNORE_NULL_DEREFERENCE_BEGIN/END in `check_` is to + please GCC 10: + + glr-regr8.cc: In member function 'YYRESULTTAG glr_stack::yyresolveValue(glr_state&)': + glr-regr8.cc:1433:21: error: potential null pointer dereference [-Werror=null-dereference] + 1433 | YYASSERT (this->magic_ == MAGIC); + | ~~~~~~^~~~~~ + glr-regr8.cc:905:40: note: in definition of macro 'YYASSERT' + 905 | # define YYASSERT(Condition) ((void) ((Condition) || (abort (), 0))) + | ^~~~~~~~~ + + * data/skeletons/glr2.cc (glr_state::check_): New. + Use it in the member functions. + +2020-12-13 Akim Demaille + + glr2.cc: add sanity checks in glr_stack_item + We obviously have broken pointer arithmetics that hands us + glr_stack_items that are not glr_stack_items. Have a simple check for + this, to have earlier failures. + + * data/skeletons/glr2.cc (glr_stack_item::check_): New. + Use it. + (glr_stack_item::contents): Avoid the useless struct. + Fix minor stylistic issues. + +2020-12-06 Akim Demaille + + glr2.cc: run the glr-regression tests + When installed on master as of 2020-12-05 (on top of "glr2.cc: fix + when the stack is not expandable", almost all the GLR regression tests + fail (with a SEGV): + + 709: Badly Collapsed GLR States: glr2.cc FAILED (glr-regression.at:130) + 712: Improper handling of embedded actions and dollar(-N) in GLR parsers: glr2.cc FAILED (glr-regression.at:275) + 715: Improper merging of GLR delayed action sets: glr2.cc FAILED (glr-regression.at:404) + 718: Duplicate representation of merged trees: glr2.cc FAILED (glr-regression.at:502) + 721: User destructor for unresolved GLR semantic value: glr2.cc FAILED (glr-regression.at:566) + 724: User destructor after an error during a split parse: glr2.cc FAILED (glr-regression.at:624) + 727: Duplicated user destructor for lookahead: glr2.cc FAILED (glr-regression.at:724) + 730: Incorrectly initialized location for empty right-hand side in GLR: glr2.cc FAILED (glr-regression.at:823) + 733: No users destructors if stack 0 deleted: glr2.cc FAILED (glr-regression.at:911) + 736: Corrupted semantic options if user action cuts parse: glr2.cc FAILED (glr-regression.at:974) + 739: Undesirable destructors if user action cuts parse: glr2.cc FAILED (glr-regression.at:1042) + 742: Leaked semantic values if user action cuts parse: glr2.cc FAILED (glr-regression.at:1173) + 748: Incorrect lookahead during nondeterministic GLR: glr2.cc FAILED (glr-regression.at:1546) + 751: Leaked semantic values when reporting ambiguity: glr2.cc FAILED (glr-regression.at:1639) + 754: Leaked lookahead after nondeterministic parse syntax error: glr2.cc FAILED (glr-regression.at:1710) + 757: Uninitialized location when reporting ambiguity: glr2.cc FAILED (glr-regression.at:1794) + 766: Predicates: glr2.cc FAILED (glr-regression.at:2045) + + These pass: + + 745: Incorrect lookahead during deterministic GLR: glr2.cc ok + 760: Missed %merge type warnings when LHS type is declared later: glr2.cc ok + 763: Ambiguity reports: glr2.cc ok + + With Valentin Tolmer's "glr2.cc: Fix memory corruption bug" commit, + these test fail "gracefully": + + 712: Improper handling of embedded actions and dollar(-N) in GLR parsers: glr2.cc FAILED (glr-regression.at:268) + 730: Incorrectly initialized location for empty right-hand side in GLR: glr2.cc FAILED (glr-regression.at:816) + 748: Incorrect lookahead during nondeterministic GLR: glr2.cc FAILED (glr-regression.at:1539) + + And these do not end: + + 709: Badly Collapsed GLR States: glr2.cc FAILED (glr-regression.at:123) + 715: Improper merging of GLR delayed action sets: glr2.cc FAILED (glr-regression.at:397) + 718: Duplicate representation of merged trees: glr2.cc FAILED (glr-regression.at:495) + 751: Leaked semantic values when reporting ambiguity: glr2.cc FAILED (glr-regression.at:1632) + + With "tests: glr2.cc: run the glr-regression tests", none loop, and + 709, 715, and 751 pass. Only 718 still fails. + + * tests/glr-regression.at: Run all the tests with glr2.cc. + * tests/local.at (AT_GLR2_CC_IF): New. + +2020-12-06 Akim Demaille + + glr2.cc: use the same format for traces as glr.c + * data/skeletons/glr2.cc: here. + This allows to share the same expected output. + +2020-12-06 Akim Demaille + + glr2.cc: add support for parse.assert + * data/skeletons/glr2.cc: Fake support of parse.assert, so that the + tests can use it without failing. + +2020-12-06 Akim Demaille + + glr2.cc: fix yyresolveValue + When "tests: glr2.cc: run the glr-regression tests" tests are run, + before this commit the following tests used to loop endlessly: + + 709: Badly Collapsed GLR States: glr2.cc FAILED (glr-regression.at:123) + 715: Improper merging of GLR delayed action sets: glr2.cc FAILED (glr-regression.at:397) + 718: Duplicate representation of merged trees: glr2.cc FAILED (glr-regression.at:495) + 751: Leaked semantic values when reporting ambiguity: glr2.cc FAILED (glr-regression.at:1632) + + After this commit, no test loops and 709, 715, and 751 pass. Only 718 + still fails. + + * data/skeletons/glr2.cc (yyresolveValue): Add missing incrementation + of the iteration variable. + +2020-12-06 Valentin Tolmer + + glr2.cc: misc cleanups + * data/skeletons/glr2.cc: Use 'const' on variables and applicable + member functions. + Improve comments. + Use references where applicable. + Enforce names_like_this, notLikeThis. + Reduce scopes. + +2020-12-06 Valentin Tolmer + + glr2.cc: fix memory corruption bug + * data/skeletons/glr2.cc (yyremoveDeletes): Remove double-increment in + the loop. + (glr_state::copyFrom): Handle gracefully when other is resolved. + +2020-12-06 Akim Demaille + + glr2.cc: turn some pointers into references + * data/skeletons/glr2.cc: Prefer references to pointers. + Add a few more const. + +2020-12-06 Valentin Tolmer + + glr2.cc: use 'const' for some constant local variables + * data/skeletons/glr2.cc: here. + +2020-12-06 Akim Demaille + + glr2.cc: fix when the stack is not expandable + * data/skeletons/glr2.cc (yyexpandGLRStackIfNeeded): Fix the + implementation when !YYSTACKEXPANDABLE. + +2020-12-06 Akim Demaille + + glr.c: fix line numbers in logs + * data/skeletons/glr.c (yyglrReduce): Fix line numbers. + * tests/glr-regression.at: Fix expectations. + +2020-12-05 Akim Demaille + + tests: glr: run the glr regression tests with glr.cc + * tests/glr-regression.at: Adjust the tests to be more independent of + the language, and run them with glr.cc. + Some tests relied on yychar, yylval and yylloc being global variables: + pass arguments instead. + +2020-12-05 Akim Demaille + + tests: glr: prepare for more languages + * tests/glr-regression.at: Wrap each test in an AT_TEST. + Call it with glr.c. + +2020-12-05 Akim Demaille + + tests: glr: use AT_FULL_COMPILE + * tests/glr-regression.at: Instead of using AT_BISON_CHECK and + AT_COMPILE, use AT_FULL_COMPILE. This is shorter, and makes it easier + to add support for other programming languages. + +2020-12-05 Akim Demaille + + tests: glr: prefer directives to warnings + * tests/glr-regression.at: Use %expect and %expect-rr in the grammar + files, rather than accepting diagnostics. + This will make it easier to support other programming languages. + +2020-12-05 Akim Demaille + + tests: factor the access to token kinds + * tests/local.at (AT_BISON_OPTION_PUSHDEFS): Define AT_TOKEN. + (AT_BISON_OPTION_POPDEFS): Undefine it. + * tests/actions.at, tests/c++.at, tests/calc.at: Use AT_TOKEN. + +2020-12-05 Akim Demaille + + tests: formatting changes + * tests/local.at: here. + +2020-12-05 Akim Demaille + + glr.cc: don't "leak" yyparse + When using glr.cc, the C function yyparse is an internal detail that + should not be exposed. Users might call it by accident (I did). + + * data/skeletons/glr.c (yyparse): When used for glr.cc, rename as yy_parse_impl. + * data/skeletons/glr.cc: Adjust. + +2020-12-03 Akim Demaille + + portability: beware of GCC 4.6 + src/reader.c: In function 'grammar_start_symbols_add': + src/reader.c:67:24: error: declaration of 'dup' shadows a global declaration [-Werror=shadow] + + * src/reader.c (grammar_start_symbols_add): Rename dup as dupl. + +2020-12-03 Akim Demaille + + tables: avoid warnings and save bits + The yydefgoto table uses -1 as an invalid for an impossible case (we + never use yydefgoto[0], since it corresponds to the reduction to + $accept, which never happens). Since yydefgoto is a table of state + numbers, this -1 forces a signed type uselessly, which (1) might + trigger compiler warnings when storing a value from yydefgoto into a + state number (nonnegative), and (2) wastes bits which might result in + using a int16 where a uint8 suffices. + + Reported by Jot Dot . + https://lists.gnu.org/r/bug-bison/2020-11/msg00027.html + + * src/tables.c (default_goto): Use 0 rather than -1 as invalid value. + * tests/regression.at: Adjust. + +2020-12-03 Akim Demaille + + c++: use noexcept where appropriate + Reported by Don Macpherson. + https://github.com/akimd/bison/issues/63 + https://github.com/akimd/bison/issues/64 + + * data/skeletons/c++.m4, data/skeletons/lalr1.cc: here. + +2020-11-30 Akim Demaille + + gnulib: update + +2020-11-30 Akim Demaille + + multistart: check duplicates + * src/symlist.h, src/symlist.c (symbol_list_find_symbol) + (symbol_list_last): New. + (symbol_list_append): Use symbol_list_last. + * src/reader.c (grammar_start_symbols_add): Check and discard duplicates. + * tests/input.at (Duplicate %start symbol): New. + * tests/reduce.at (Bad start symbols): Add the multistart keyword. + +2020-11-22 Akim Demaille + + style: change the format of a debugging function + * src/symlist.c (symbol_list_syms_print): Use braces to make traces + easier to read. + +2020-11-22 Akim Demaille + + style: rename grammar_start_symbols_set as grammar_start_symbols_add + * src/reader.h, src/reader.c (grammar_start_symbols_set): Rename as... + (grammar_start_symbols_add): this. + Adjust dependencies. + +2020-11-22 Akim Demaille + + TODO: update + +2020-11-21 Akim Demaille + + multistart: also use the api.prefix in the implementation + We were declaring foo_parse_expr but implementing yyparse_expr. + + * data/skeletons/yacc.c (_b4_define_sub_yyparse): Use api.prefix for + the parse function name. + +2020-11-20 Akim Demaille + + doc: using stow to set up a bison herd + * README-hacking.md (Stow): New. + +2020-11-20 Adela Vais + + d: change YYLocation's type from class to struct + This avoids heap allocation and gives minimal costs for the + creation and destruction of the YYParser.Symbol struct if + the location tracking is active. + + Suggested by H. S. Teoh. + + * data/skeletons/lalr1.d: Here. + * doc/bison.texi: Document it. + * examples/d/calc/calc.y: Adjust. + * tests/calc.at: Test it. + +2020-11-20 Adela Vais + + d: change the return value of yylex from TokenKind to YYParser.Symbol + The complete symbol approach was deemed to be the right approach for Dlang. + Now, the user can return from yylex() an instance of YYParser.Symbol structure, + which binds together the TokenKind, the semantic value and the location. Before, + the last two were reported separately to the parser. + Only the user API is changed, Bisons's internal structure is kept the same. + + * data/skeletons/d.m4 (struct YYParser.Symbol): New. + * data/skeletons/lalr1.d: Change the return value. + * doc/bison.texi: Document it. + * examples/d/calc/calc.y, examples/d/simple/calc.y: Demonstrate it. + * tests/calc.at, tests/scanner.at: Test it. + +2020-11-20 Martin Rehak + + examples: avoid "unbound variable" errors + When the shell option `nounset` is set, we may get "unbound variable" + errors. + https://lists.gnu.org/r/bug-bison/2020-11/msg00013.html + + * examples/test (diff_opts): Be sure to initialize it. + +2020-11-20 Akim Demaille + + gnulib: update + * Makefile.am (gitsort): New. + Use it. + +2020-11-18 Adela Vais + + d: add support for lookahead correction + When using lookahead correction, the method YYParser.Context.getExpectedTokens + is not annotated with const, because the method calls yylacCheck, which is not + const. Also, because of yylacStack and yylacEstablished, yylacCheck needs to + be called from the context of the parser class, which is sent as parameter to + the Context's constructor. + + * data/skeletons/lalr1.d (yylacCheck, yylacEstablish, yylacDiscard, + yylacStack, yylacEstablished): New. + (Context): Use it. + * doc/bison.texi: Document it. + * tests/calc.at: Check it. + +2020-11-18 Adela Vais + + d: change the name of the custom error message function to reportSyntaxError + Changed from syntax_error to reportSyntaxError to be similar to the Java parser. + + * data/skeletons/lalr1.d: Change the function name. + * doc/bison.texi: Document it. + * tests/local.at: Adjust. + +2020-11-14 Akim Demaille + + Merge branch 'maint' + * upstream/maint: + maint: post-release administrivia + version 3.7.4 + +2020-11-14 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-11-14 Akim Demaille + + version 3.7.4 + * NEWS: Record release date. + +2020-11-13 Akim Demaille + + style: prefer b4_symbol(empty, ...) to b4_symbol(-2, ...) + * data/skeletons/c.m4: here. + +2020-11-13 Akim Demaille + + Merge branch 'maint' + * maint: + c++: shorten the assertions that check whether tokens are correct + c++: don't glue functions together + lalr1.cc: YY_ASSERT should use api.prefix + c++: don't use YY_ASSERT at all if parse.assert is disabled + c++: style: follow the Bison m4 quoting pattern + yacc.c: provide the Bison version as an integral macro + regen + style: make conversion of version string to int public + %require: accept version numbers with three parts ("3.7.4") + yacc.c: fix #definition of YYEMPTY + gnulib: update + doc: fix incorrect section title + doc: minor grammar fixes in counterexamples section + +2020-11-13 Akim Demaille + + c++: shorten the assertions that check whether tokens are correct + Before: + + YY_ASSERT (tok == token::YYEOF || tok == token::YYerror || tok == token::YYUNDEF || tok == 120 || tok == 49 || tok == 50 || tok == 51 || tok == 52 || tok == 53 || tok == 54 || tok == 55 || tok == 56 || tok == 57 || tok == 97 || tok == 98); + + After: + + YY_ASSERT (tok == token::YYEOF + || (token::YYerror <= tok && tok <= token::YYUNDEF) + || tok == 120 + || (49 <= tok && tok <= 57) + || (97 <= tok && tok <= 98)); + + Clauses are now also wrapped on several lines. This is nicer to read + and diff, but also avoids pushing Visual C++ to its arbitrary + limits (640K and lines of 16380 bytes ought to be enough for anybody, + otherwise make an C2026 error). + + The useless parens are there for the dummy warnings about + precedence (in the future, will we also have to put parens in + `1+2*3`?). + + * data/skeletons/variant.hh (_b4_filter_tokens, b4_tok_in, b4_tok_in): + New. + (_b4_token_constructor_define): Use them. + +2020-11-13 Akim Demaille + + c++: don't glue functions together + * data/skeletons/bison.m4 (b4_type_foreach): Accept a separator. + * data/skeletons/c++.m4: Use it. + And fix an incorrect comment. + +2020-11-13 Akim Demaille + + lalr1.cc: YY_ASSERT should use api.prefix + Working on the previous commit I realized that YY_ASSERT was used in + the generated headers, so must follow api.prefix to avoid clashes when + multiple C++ parser with variants are used. + + Actually many more macros should obey api.prefix (YY_CPLUSPLUS, + YY_COPY, etc.). There was no complaint so far, so it's not urgent + enough for 3.7.4, but it should be addressed in 3.8. + + * data/skeletons/variant.hh (b4_assert): New. + Use it. + * tests/local.at (AT_YYLEX_RETURN): Fix. + * tests/headers.at: Make sure variant-based C++ parsers are checked + too. + This test did find that YY_ASSERT escaped renaming (before the fix in + this commit). + +2020-11-13 Akim Demaille + + c++: don't use YY_ASSERT at all if parse.assert is disabled + In some extreme situations (about 800 tokens), we generate a + single-line assertion long enough for Visual C++ to discard the end of + the line, thus falling into parse ends for the missing `);`. On a + shorter example: + + YY_ASSERT (tok == token::TOK_YYEOF || tok == token::TOK_YYerror || tok == token::TOK_YYUNDEF || tok == token::TOK_ASSIGN || tok == token::TOK_MINUS || tok == token::TOK_PLUS || tok == token::TOK_STAR || tok == token::TOK_SLASH || tok == token::TOK_LPAREN || tok == token::TOK_RPAREN); + + Whether NDEBUG is used or not is irrelevant, the parser dies anyway. + + Reported by Jot Dot . + https://lists.gnu.org/r/bug-bison/2020-11/msg00002.html + + We should avoid emitting lines so long. + + We probably should also use a range-based assertion (with extraneous + parens to pacify fascist compilers): + + YY_ASSERT ((token::TOK_YYEOF <= tok && tok <= token::TOK_YYUNDEF) + || (token::TOK_ASSIGN <= tok && ...) + + But anyway, we should simply not emit this assertion at all when not + asked for. + + * data/skeletons/variant.hh: Do not define, nor use, YY_ASSERT when it + is not enabled. + +2020-11-13 Akim Demaille + + c++: style: follow the Bison m4 quoting pattern + * data/skeletons/variant.hh: here. + +2020-11-11 Akim Demaille + + todo: more + +2020-11-11 Akim Demaille + + yacc.c: provide the Bison version as an integral macro + Suggested by Balazs Scheidler. + https://github.com/akimd/bison/issues/55 + + * src/muscle-tab.c (muscle_init): Move/rename `b4_version` to/as... + * src/output.c (prepare): `b4_version_string`. + Also define `b4_version`. + * data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/d.m4, + * data/skeletons/java.m4: Adjust. + * doc/bison.texi: Document it. + +2020-11-11 Akim Demaille + + regen + +2020-11-11 Akim Demaille + + style: make conversion of version string to int public + * src/parse-gram.y (str_to_version): Rename as/move to... + * src/strversion.h, src/strversion.c (strversion_to_int): these new + files. + +2020-11-11 Akim Demaille + + %require: accept version numbers with three parts ("3.7.4") + * src/parse-gram.y (str_to_version): Support three parts. + * data/skeletons/location.cc, data/skeletons/stack.hh: + Adjust. + +2020-11-11 Todd C. Miller + + yacc.c: fix #definition of YYEMPTY + When generating a C parser, YYEMPTY is present in enum yytokentype but + there is no corresponding #define like there is for the other values. + There is a special case for YYEMPTY in b4_token_enums but no + corresponding case in b4_token_defines. + + * data/skeletons/c.m4 (b4_token_defines): Do define YYEMPTY. + +2020-11-10 Akim Demaille + + gnulib: update + +2020-11-10 Akim Demaille + + style: enforce java coding style + * tests/scanner.at: here. + +2020-11-10 Akim Demaille + + ielr: fix incorrect function call + * src/ielr.c: s/rule_is_accepting/rule_is_initial/. + +2020-11-10 Akim Demaille + + ielr: more comments and logs + * src/ielr.c: More comments. + (state_list_print): New. + +2020-11-10 Akim Demaille + + multistart: fix IELR computations + IELR needs to rule out the successors of the kernel items of the + initial state (`$accept: input • $end`). In the case of multistart, + this condition must be expressed differently: the mere item index does + not suffice. + + * src/ielr.c (ielr_item_has_lookahead, ielr_compute_lookaheads): Don't + rely on the item index to check whether is_successor_of_initial_item. + It is certainly more costly than just checking the item index, but (i) + we need to compute the rule anyway, so it's not very much more costly, + and (ii) in ielr_item_has_lookahead, this situation is actually + impossible, so an optimizing compiler reading the assertions should + actually avoid this computation. + +2020-11-10 Akim Demaille + + ielr: make some conditions about items easier to understand + Checking that an item index is > 1 means ruling out `$accept: • input + $end` and `$accept: input • $end`. But actually only the latter is + possible there, i.e., we're checking whether this item is about a + successor of a (kernel) item of the initial state ($accept: input • + $end). + + * src/ielr.c (is_successor_of_initial_item): Use a variable to name + this condition. + +2020-11-10 Akim Demaille + + multistart: introduce and use rule_is_initial + * src/gram.h (rule_is_initial): New. + * src/graphviz.c, src/print-xml.c, src/print.c, src/lalr.c: Use it. + Some of these occurrences were incorrect (checking whether this is + rule 0), and not behaving properly in the case of multistart. + +2020-11-08 Akim Demaille + + style: comment and formatting changes, and fixes + * examples/c/lexcalc/parse.y: Fix option handling. + * src/gram.h: Clarify comments. + * src/ielr.c: Fix indentation. + * src/print.c, src/state.h: More comments. + +2020-11-08 Akim Demaille + + lalr: add assertions + * src/lalr.c: Remove incorrect comment (subsumed anyway by the + (correct) one in the header. + (set_goto_map): More debug traces. + (map_goto): Add an assertion. + +2020-11-07 Akim Demaille + + glr2.cc: remove scaffolding for glr.c + * data/skeletons/glr2.cc (b4_glr_cc_setup, b4_glr_cc_cleanup): Remove. + +2020-11-07 Akim Demaille + + d: remove dead comment + * data/skeletons/lalr1.d (reportSyntaxError): here. + +2020-11-07 Adela Vais + + d: add the custom error message feature + Parser.Context class returns a const YYLocation, so Lexer's method + yyerror() needs to receive the location as a const parameter. + + Internal error reporting flow is changed to be similar to that of + the other skeletons. Before, case YYERRLAB was calling yyerror() + with the result of yysyntax_error() as the string parameter. As the + custom error message lets the user decide if they want to use + yyerror() or not, this flow needed to be changed. Now, case YYERRLAB + calls yyreportSyntaxError(), that builds the error message using + yysyntaxErrorArguments(). Then yyreportSyntaxError() passes the + error message to the user defined syntax_error() in case of a custom + message, or to yyerror() otherwise. + + In the tests in tests/calc.at, the order of the tokens needs to be + changed in order of precedence, so that the D program outputs the + expected tokens in the same order as the other parsers. + + * data/skeletons/lalr1.d: Add the custom error message feature. + * doc/bison.texi: Document it. + * examples/d/calc/calc.y: Adjust. + * tests/calc.at, tests/local.at: Test it. + +2020-11-07 Adela Vais + + d: examples: fix coding style + * examples/d/calc/calc.y, examples/d/simple/calc.y: Fix whitespace issues + and remove the @property attribute. + +2020-11-07 Akim Demaille + + style: avoid explicit symbol numbers + This should have been part of commit "symbols: stop dealing with YYEMPTY + as b4_symbol(-2, ...)" (cd40ec9526df27d0e3e1c2d41e82a3e6a47254d1). + Give names to all the special symbols: "eof", "error" and "undef". + + * data/skeletons/bison.m4 (b4_symbol): Let `b4_symbol(eof, ...)` mean + `b4_symbol(0, ...)`, `b4_symbol(error, ...)` mean `b4_symbol(1, ...)`, + and , `b4_symbol(undef, ...)` mean `b4_symbol(2, ...)`.. + + * data/skeletons/c.m4, data/skeletons/glr.c, data/skeletons/glr.cc, + * data/skeletons/glr2.cc, data/skeletons/lalr1.cc, + * data/skeletons/lalr1.d, data/skeletons/lalr1.java, + * data/skeletons/yacc.c: + Prefer symbols to numbers. + +2020-11-07 Adela Vais + + d: fix Context class + All methods are now declared as const. Method getExpectedTokens() has now the + functionality of reporting only the number of expected tokens. + + * data/skeletons/lalr1.d: Fix Context class. + +2020-11-07 Akim Demaille + + doc: fix typo + Reported by Kaz Kylheku. + https://lists.gnu.org/r/bison-patches/2020-11/msg00019.html + + * doc/bison.texi (Versioning): here. + +2020-11-07 Adela Vais + + d: doc: add D Action Features section + * doc/bison.texi (D Action Features section): New. + +2020-11-07 Adela Vais + + d: add yyerrok + In D's case, yyerrok() is a private method of the Parser class. + It can be called directly as `yyerrok()` from the grammar rules section. + + * data/skeletons/lalr1.d: Add yyerrok(). + * examples/d/calc/calc.y, examples/d/simple/calc.y: Demonstrate yyerrok(). + * tests/calc.at: Update D tests to use yyerrok(). + +2020-11-06 Akim Demaille + + java: lac: a stronger test for the exploratory stack + * tests/local.at (AT_YYLEX_DEFINE(java)): Fix overquoting issue. + Style changes. + * tests/regression.at (LAC: Exploratory stack): Run for lalr1.java too. + +2020-11-05 Kaz Kylheku + + doc: document best deployment practices. + * doc/bison.texi (Versioning): New node about practices + regarding dealing with multiple versions of Bison. + +2020-11-04 Akim Demaille + + java: lac: more tests, and some doc + * doc/bison.texi: C++ and Java support LAC. + * tests/input.at (LAC: Errors for %define): Generalize the test, and + apply it to Java. + +2020-11-03 Akim Demaille + + java: avoid Integer(String), use parseInt + examples/java/calc/Calc.java:1531: warning: [deprecation] Integer(String) in Integer has been deprecated + yylval = new Integer(st.sval); + ^ + + * examples/java/calc/Calc.y, examples/java/simple/Calc.y, + * tests/calc.at, tests/scanner.at: Use Integer.parseInt. + +2020-11-03 Akim Demaille + + java: prefer ArrayList to Vector + Vector is synchronized, which is completely useless in our case (and + not even relevant when concurrency matters). No seasoned Java + programmer would use it. + Reported by Uxio Prego. + + * data/skeletons/lalr1.java: Replace Vector with ArrayList. + Unfortunately its API is not as rich, and lacks lastElement and + setSize. + +2020-11-03 Akim Demaille + + java: lac: check it + * tests/calc.at: Add tests for LAC in pull and push parsers. + Skip LAC: line from the logs. + * tests/local.at (reportSyntaxError): Output the error message in a + single call, to avoid having the error message on stderr be + interrupted by the debug traces of LAC in getExpectedTokens. + +2020-11-03 Akim Demaille + + java: add support for lookahead correction + Shamelessly stolen from Adrian Vogelsgesang's implementation in + lalr1.cc. + + * data/skeletons/lalr1.java (yycdebugNnl, yyLacCheck, yyLacEstablish) + (yyLacDiscard, yylacStack, yylacEstablished): New. + (Context): Use it. + * examples/java/calc/Calc.y: Enable LAC. + +2020-11-03 Akim Demaille + + style: java: more style fixes + * data/skeletons/lalr1.java, tests/java.at: Avoid space before paren. + And use braces as is customary in the Java. + +2020-11-03 Akim Demaille + + style: comment changes in the skeletons + * data/skeletons/lalr1.cc: Prepare for Java's LAC. + * data/skeletons/lalr1.java: Style fixes. + +2020-11-01 Akim Demaille + + doc: fix incorrect section title + Reported by Gaurav Singh . + https://lists.gnu.org/r/bug-bison/2020-11/msg00000.html + + * doc/bison.texi (Rpcalc Expr): Rename as... + (Rpcalc Exp): this, as the nterm is named 'exp'. + +2020-11-01 Akim Demaille + + doc: fix incorrect section title + Reported by Gaurav Singh . + https://lists.gnu.org/r/bug-bison/2020-11/msg00000.html + + * doc/bison.texi (Rpcalc Expr): Rename as... + (Rpcalc Exp): this, as the nterm is named 'exp'. + +2020-10-28 Nick Gasson + + doc: minor grammar fixes in counterexamples section + * doc/bison.texi: Minor fixes in counterexamples section. + +2020-10-28 Nick Gasson + + doc: minor grammar fixes in counterexamples section + * doc/bison.texi: Minor fixes in counterexamples section. + +2020-10-27 Adela Vais + + d: create the Parser.Context class + This will provide the user an interface for creating custom error messages. + + * data/skeletons/lalr1.d: Add the Context class. + * doc/bison.texi: Document it. + +2020-10-14 Akim Demaille + + Merge branch 'maint' + * upstream/maint: + doc: fix typo + maint: post-release administrivia + version 3.7.3 + build: don't link bison against libreadline + gnulib: update + glr.cc: fix: use symbol_name + build: fix a concurrent build issue in examples + +2020-10-14 Akim Demaille + + doc: fix typo + * README: here. + +2020-10-13 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-10-13 Akim Demaille + + version 3.7.3 + * NEWS: Record release date. + +2020-10-13 Akim Demaille + + build: don't link bison against libreadline + Reported by Paul Smith . + https://lists.gnu.org/r/bug-bison/2020-10/msg00001.html + + * src/local.mk (src_bison_LDADD): here. + +2020-10-13 Akim Demaille + + gnulib: update + +2020-10-07 Akim Demaille + + doc: D comes before Java in alphabetical order + * doc/bison.texi: Keep languages sorted. + +2020-10-07 Akim Demaille + + report: put the dot after %empty in items + When printing items, it is clearer to put the dot after %emtpy rather + than before: + + 0 $accept: . unit "end of file" + 1 unit: . assignments exp + - 2 assignments: . %empty + + 2 assignments: %empty . + 3 | . assignments assignment + + Also, use the Unicode characters if they are supported. + + * src/gram.c (item_print): Put the dot after %emtpy. + * tests/conflicts.at, tests/reduce.at, tests/report.at: Adjust. + +2020-10-03 Adela Vais + + d: change api.token.raw default value to true + Generate consecutive values for enum TokenKind, as D's yylex() + returns TokenKind and collisions can't happen. + + * data/skeletons/d.m4: Change default value. + * tests/scanner.at, tests/d.at: Check it. + +2020-10-03 Akim Demaille + + m4: have b4_percent_define_if_define apply default values lazily + Currently `b4_percent_define_ifdef([foo])` assigns a default value to + `foo` when invoked. As a consequence, skeletons such as lalr1.d + cannot specify their specific default values: `foo` was defined in + bison.m4. + + Instead, provide `foo` with a default value when `b4_foo_if` is + invoked. + + I could not measure a runtime difference between both cases. + + * data/skeletons/bison.m4 (_b4_percent_define_define): New. + Helps getting rid of spurious indentation that resulted in spurious + white space in the output. + (b4_percent_define_if_define): Move the definition to... + (_b4_percent_define_if_define): when the defined macros is called. + +2020-10-02 Adela Vais + + d: don't trigger GC in void toString + * data/skeletons/d.m4 (b4_declare_symbol_enum): Here. + +2020-10-02 Adela Vais + + d: document support + * doc/bison.texi: Various fixes. + (D Parsers): New section. + +2020-10-02 Adela Vais + + d: remove the default prefix for SymbolKind's enum elements + This is not needed in D, since the kinds are "scoped". + + * data/skeletons/d.m4: Remove the default prefix. + * doc/bison.text: Document it. + +2020-10-02 Adela Vais + + d: remove the @property attribute from interface Lexer + D best practices is to not use it. + + * data/skeletons/lalr1.d: Remove attribute. + +2020-09-29 Akim Demaille + + symbols: stop dealing with YYEMPTY as b4_symbol(-2, ...) + * data/skeletons/bison.m4 (b4_symbol): Redirect `b4_symbol(empty, + ...)` to `b4_symbol(-2, ...)`. + Change all uses of the latter to the former. + +2020-09-29 Akim Demaille + + tests: remove useless prefix for EOF in D + * tests/calc.at (CALC_EOF): Rename as... + (EOF): this. + Since there is no risk of a clash with #define EOF here... + +2020-09-28 Adela Vais + + d: support api.symbol.prefix and api.token.prefix + The D skeleton was not properly supporting them. + + * data/skeletons/d.m4, data/skeletons/lalr1.d: Fix it. + * tests/calc.at: Check it. + +2020-09-28 Akim Demaille + + multistart: start more thorough testing + * tests/local.at (AT_MULTISTART_IF): New. + * tests/calc.at: Adjust to check multiple start symbols. + * data/skeletons/yacc.c (yy_parse_impl): Fix. + +2020-09-27 Akim Demaille + + tests: style: reorder the calculator test macros + * tests/local.at (AT_TOKEN_TRANSLATE_IF): New, moved from... + * tests/calc.at: here. + Instead of sorting per feature (main, yylex, calc.y) and then by + language, do the converse, so that C bits are together, etc. + +2020-09-27 Akim Demaille + + tests: shorten the generated file + * tests/synclines.at (_AT_SYNCLINES_COMPILE): Pull the comments out. + +2020-09-27 Akim Demaille + + gnulib: update + +2020-09-27 Akim Demaille + + multistart: also give access to yynerrs + This is something that has always bothered me: with pure parsers (and + they all should be) the user does not have an (easy) access to yynerrs + at the end of the parse. In the case of error recovery, that's the + only direct means to know if there were errors. The usual approach + being having the user maintain a counter incremented each time yyerror + is called. + + So here, also capture yynerrs in the return value of the start-symbol + parsing functions. + + * data/skeletons/yacc.c (yy_parse_impl_t): New. + (yy_parse_impl): Use it. + (b4_accept): Fill it. + * examples/c/lexcalc/parse.y, examples/c/lexcalc/scan.l: No longer + pass nerrs as lex- and parse-param, just use the resulting yynerrs. + bistromathic and reccalc both demonstrate %param. + +2020-09-27 Akim Demaille + + yacc.c: also count calls to YYERROR in yynerrs + * data/skeletons/yacc.c: here. + +2020-09-27 Akim Demaille + + multistart: allow tokens as start symbols + After all, why not? + + * src/reader.c (switching_token): Use symbol_id_get. + (check_start_symbols): Require that the start symbol is a token only + if it's the only one. + * examples/c/lexcalc/parse.y: Let NUM be a start symbol. + +2020-09-27 Akim Demaille + + multistart: use b4_accept instead of action post-processing + For each start symbol, generate a parsing function with a richer + return value than the usual of yyparse. Reserve a place for the + returned semantic value, in order to avoid having to pass a pointer as + argument to "return" that value. This also makes the call to the + parsing function independent of whether a given start-symbol is typed. + + For instance, if the grammar file contains: + + %type expression + %start input expression + + (so "input" is valueless) we get + + typedef struct + { + int yystatus; + } yyparse_input_t; + + yyparse_input_t yyparse_input (void); + + typedef struct + { + int yyvalue; + int yystatus; + } yyparse_expression_t; + + yyparse_expression_t yyparse_expression (void); + + This commit also changes the implementation of the parser termination: + when there are multiple start symbols, it is the initial rules that + explicitly YYACCEPT. They do that after having exported the + start-symbol's value (if it is typed): + + switch (yyn) + { + case 1: /* $accept: YY_EXPRESSION expression $end */ + { ((*yyvalue).TOK_expression) = (yyvsp[-1].TOK_expression); YYACCEPT; } + break; + + case 2: /* $accept: YY_INPUT input $end */ + { YYACCEPT; } + break; + + I have tried several ways to deal with termination, and this is the + one that appears the best one to me. It is also the most natural. + + * src/scan-code.h, src/scan-code.l (obstack_for_actions): New. + * src/reader.c (grammar_rule_check_and_complete): Generate the actions + of the rules for each start symbol. + + * data/skeletons/bison.m4 (b4_symbol_slot): New, with safer semantics + than type and type_tag. + * data/skeletons/yacc.c (b4_accept): New. + Generates the body of the action of the start rules. + (_b4_declare_sub_yyparse): For each start symbol define a dedicated + return type for its parsing function. + Adjust the declaration of its parsing function. + (_b4_define_sub_yyparse): Adjust the definition of the function. + + * examples/c/lexcalc/parse.y: Check the case of valueless symbols. + * examples/c/lexcalc/lexcalc.test: Check start symbols. + +2020-09-27 Akim Demaille + + multistart: adjust reader checks for generated rules + So far we were not checking the generated rule 0 at all. Now there + can be several of them. Instead of not checking at all, let's be more + selective on the check to run on them. + + * src/reader.c (grammar_rule_check_and_complete): Don't check for + value usage for generated rules, it is ok to have a valued start + symbol, in which case it is ok for the generated rule ("accept: start + $end {}") to not use $1. + (packgram): Call grammar_rule_check_and_complete for all the rules. + +2020-09-27 Akim Demaille + + todo: more + +2020-09-27 Akim Demaille + + multistart: toy with it in lexcalc + * examples/c/lexcalc/parse.y: Define several start symbols. + * examples/c/lexcalc/lexcalc.test: Check support. + +2020-09-27 Akim Demaille + + multistart: equip yacc.c + * data/skeletons/yacc.c: Add support for multiple start symbols. + +2020-09-27 Akim Demaille + + multistart: pass the list of start symbols to the backend + * src/output.c (start_symbols_output): New. + (muscles_output): Use it. + +2020-09-27 Akim Demaille + + multistart: also check the HTML report + We don't actually have checks for HTML, so let's do it for multistart. + + * tests/report.at: here. + +2020-09-27 Akim Demaille + + multistart: adjust computation of initial core and adjust reports + Currently the core of the initial state is limited to the single rule + on $accept. + + * src/lr0.c (generate_states): There may now be several rules on + $accept. + + * src/graphviz.c (conclude_red): Recognize "final" transitions by the + fact that we reduce to "$accept". + * src/print.c (print_reduction): Likewise. + * src/print-xml.c (print_reduction): Likewise. + +2020-09-27 Akim Demaille + + regen + +2020-09-27 Akim Demaille + + multistart: turn start symbols into rules on $accept + Now that the parser can read several start symbols, let's process + them, and create the corresponding rules. + + * src/parse-gram.y (grammar_declaration): Accept a list of start symbols. + * src/reader.h, src/reader.c (grammar_start_symbol_set): Rename as... + (grammar_start_symbols_set): this. + + * src/reader.h, src/reader.c (start_flag): Replace with... + (start_symbols): this. + * src/reader.c (grammar_start_symbols_set): Build a list of start + symbols. + (switching_token, create_start_rules): New. + (check_and_convert_grammar): Use them to turn the list of start + symbols into a set of rules. + * src/reduce.c (nonterminals_reduce): Don't complain about $accept, + it's an internal detail. + (reduce_grammar): Complain about all the start symbols that don't + derive sentences. + + * src/symtab.c (startsymbol, startsymbol_loc): Remove, replaced by + start_symbols. + symbols_pack): Move the check about the start symbols + to... + * src/symlist.c (check_start_symbols): here. + Adjust to multiple start symbols. + * tests/reduce.at (Empty Language): Generalize into... + (Bad start symbols): this. + +2020-09-27 Akim Demaille + + regen + +2020-09-27 Akim Demaille + + parser: expose a list of symbols + * src/parse-gram.y (%type): Also use current_class. + (symbol_decl.1): Rename as... + (symbols.1): this. + +2020-09-27 Akim Demaille + + reader: get ready to create several initial rules + * src/reader.c (create_start_rule): New. + Use it. + +2020-09-27 Akim Demaille + + gram: more debugging information + * src/gram.c (ritem_print): Show indices in ritem. + +2020-09-27 Akim Demaille + + glr.cc: fix: use symbol_name + * data/skeletons/glr.cc: here. + +2020-09-26 Akim Demaille + + glr2.cc: add an example + Currently this example crashes on input such as "T (x) + y;". + The same example with glr.c works properly. + + * examples/c++/glr/Makefile, examples/c++/glr/README.md, + * examples/c++/glr/c++-types.test, examples/c++/glr/c++-types.yy, + * examples/c++/glr/local.mk, examples/c++/local.mk: New. + Based on examples/c/glr/c++-types.y. + +2020-09-26 Akim Demaille + + glr.cc: fix: use symbol_name + * data/skeletons/glr.cc: here. + +2020-09-26 Adela Vais + + d: change the return value of yylex from int to TokenKind + * data/skeletons/lalr1.d: Change the return value. + * examples/d/calc/calc.y, examples/d/simple/calc.y: Adjust. + * tests/scanner.at: Adjust. + * tests/calc.at (_AT_DATA_CALC_Y(d)): New, extracted from... + (_AT_DATA_CALC_Y(c)): here. + The two grammars have been sufficiently different to be separated. + Still trying to be them together results in a maintenance burden. For + the same reason, instead of specifying the results for D and for the + rest, compute the expected results with D from the regular case. + +2020-09-24 Adela Vais + + d: support api.parser.extends and api.parser.implements + The D skeleton was not properly supporting them. + + * data/skeletons/d.m4: Fix it. + * tests/d.at: Check it. + * tests/local.mk, tests/testsuite.at: Adjust. + +2020-09-21 Akim Demaille + + glr2.cc: also run all the calculator tests + This revealed issues with yy_symbol_print and yy_reduce_print. + These changes, in turn, reactivated GCC10 warnings: + + 559. calc.at:1258: testing Calculator glr2.cc %locations %header parse.error=verbose %debug api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} ... + tests/calc.at:1258: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y + tests/calc.at:1258: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS + stderr: + calc.cc: In function 'void glr_stack::yyresolveLocations(glr_state*, int)': + calc.cc:2623:46: error: potential null pointer dereference [-Werror=null-dereference] + 2623 | yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + calc.cc:2623:46: error: potential null pointer dereference [-Werror=null-dereference] + 2623 | yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + calc.cc:2623:46: error: potential null pointer dereference [-Werror=null-dereference] + 2623 | yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + calc.cc:1177:10: error: potential null pointer dereference [-Werror=null-dereference] + 1177 | return yypred ? &(asItem (this) - yypred)->getState () : YY_NULLPTR; + | ^~~~~~ + calc.cc:2623:46: error: potential null pointer dereference [-Werror=null-dereference] + 2623 | yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + calc.cc:2623:46: error: potential null pointer dereference [-Werror=null-dereference] + 2623 | yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + calc.cc: In member function 'YYRESULTTAG glr_stack::yyresolveValue(glr_state*)': + calc.cc:2623:46: error: potential null pointer dereference [-Werror=null-dereference] + 2623 | yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + + * tests/calc.at (AT_CHECK_CALC_GLR_CC): Also check glr2.cc. + * data/skeletons/glr2.cc: Don't pass the user arguments to + yy_symbol_print and yy_reduce_print, since they have it in the parser + object. + (b4_user_formals_no_comma, b4_pure_args, b4_lpure_args) + (b4_locuser_formals, b4_locuser_args): Remove, useless. + (YY_IGNORE_NULL_DEREFERENCE_BEGIN): Enable for GCC >= 10 too. + +2020-09-20 Akim Demaille + + tests: check the location of the right-hand side symbols + The D skeleton was not properly supporting @1 etc. + Reported by Adela Vais. + https://lists.gnu.org/r/bison-patches/2020-09/msg00049.html + + * data/skeletons/d.m4 (b4_rhs_location): Fix it. + * tests/calc.at: Check the support of @n for all the skeletons. + +2020-09-20 Akim Demaille + + style: formatting changes + * src/scan-code.l: here. + +2020-09-20 Akim Demaille + + style: introduce parse_positional_ref + * src/scan-code.l: here. + +2020-09-20 Akim Demaille + + style: clarify the way state kernels (aka cores) are built + Use state_list_append in a more natural way. + + * src/lr0.c (generate_states): Here. + +2020-09-20 Akim Demaille + + style: reorder and comment + * src/reader.h: here. + +2020-09-19 Akim Demaille + + examples: add a demonstration of GLR parsers in C + Based on the test case 668 (cxx-type.at:437) "GLR: Merge conflicting + parses, pure, locations". + + * examples/c/glr/Makefile, examples/c/glr/README.md, + * examples/c/glr/c++-types.test, examples/c/glr/c++-types.y, + * examples/c/glr/local.mk: New. + +2020-09-19 Akim Demaille + + glr: support api.header.include + * data/skeletons/glr.c: here. + +2020-09-19 Akim Demaille + + add support for --html + * bootstrap.conf: We need the "execute" module. + * src/files.h, src/files.c (spec_html_file, html_flag): New. + * src/getargs.h, src/getargs.c (--html): New. + * src/print-xml.h, src/print-xml.c (print_html): New. + * src/main.c: Use them. + * tests/output.at, tests/report.at: Check --html. + +2020-09-19 Akim Demaille + + regen + +2020-09-19 Akim Demaille + + deprecate %defines in favor of %header + This is consistent with --defines being deprecated in favor of + --header. The directive %defines is also too similar to %define. + And %header matches nicely with api.header.name. + + * src/scan-gram.l (%defines): Deprecate to %header. + (%header): Scan it. + * src/parse-gram.y (PERCENT_DEFINES): Replace with... + (PERCENT_HEADER): this. + * data/skeletons/lalr1.java + * doc/bison.texi + * tests/actions.at, tests/c++.at, tests/calc.at, tests/conflicts.at, + * tests/input.at, tests/java.at, tests/local.at, tests/output.at, + * tests/synclines.at, tests/types.at: + Convert most tests to check %header instead of %defines. + +2020-09-19 Akim Demaille + + options: rename --defines as --header + The name "defines" is incorrect, the generated file contains far more + than just #defines. + + * src/getargs.h, src/getargs.c (-H, --header): New option. + With optional argument, just like --defines, --xml, etc. + (defines_flag): Rename as... + (header_flag): this. + Adjust dependencies. + * data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/glr.c, + * data/skeletons/glr.cc, data/skeletons/glr2.cc, data/skeletons/lalr1.cc, + * data/skeletons/yacc.c: + Adjust. + * examples, doc/bison.texi: Adjust. + * tests/headers.at, tests/local.at, tests/output.at: Convert most + tests from using --defines to using --header. + +2020-09-17 Akim Demaille + + CI: beware of time limits + * .travis.yml (GCC 8): Run only the part 1 of the tests. + +2020-09-17 Valentin Tolmer + + glr2.cc: replace refs to parser::symbol_kind_type with yysymbol_kind_t + * data/skeletons/glr2.cc: here. + +2020-09-17 Valentin Tolmer + + glr2.cc: fix container out-of-bounds access + Clang 10 with ASAN enabled reported errors in glr2.cc. + + * data/skeletons/glr2.cc: here. + +2020-09-15 Akim Demaille + + glr2.cc: disable GCC 4.6 warning + 231. conflicts.at:1096: testing Syntax error in consistent error state: glr2.cc ... + tests/conflicts.at:1096: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS + input.cc: In member function 'YYRESULTTAG glr_stack::yyresolveValue(glr_state*)': + input.cc:2674:36: error: 'yysval' may be used uninitialized in this function [-Werror=uninitialized] + + Do not initialize the variable: this way ASAN can really make sure we + do set it to a proper value. + If we initialize it, ASAN would report nothing. + + * data/skeletons/c.m4 (YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN): Disable + GCC 4.6's -Wuninitialized. + * data/skeletons/glr2.cc: Disable the warning locally. + +2020-09-14 Akim Demaille + + glr2.cc: fix warning with GCC 4.7 and 4.8 + 231. conflicts.at:1096: testing Syntax error in consistent error state: glr2.cc ... + tests/conflicts.at:1096: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS + input.cc: In function 'int yyparse(yy::parser&)': + input.cc:3147:41: error: 'yyarg' may be used uninitialized in this function [-Werror=maybe-uninitialized] + return yytnamerr_ (yytname_[yysymbol]); + ^ + input.cc:2058:34: note: 'yyarg' was declared here + yy::parser::symbol_kind_type yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + ^ + + * data/skeletons/glr2.cc (yyreportSyntaxError): Initialize yyarg. + +2020-09-14 Akim Demaille + + glr2.cc: simplify symbol kinds + We emit code like + + if (yytoken != yy::parser::symbol_kind::symbol_kind::S_YYEMPTY) + + * data/skeletons/glr2.cc: Use b4_symbol correctly. + +2020-09-14 Akim Demaille + + glr2.cc: fix warning about local variable vs. member + Fix a warning triggered in GCC (at least from 4.6 to 4.9): + + input.cc: In constructor 'glr_stack_item::glr_stack_item(bool)': + input.cc:1371:5: error: declaration of 'is_state' shadows a member of 'this' [-Werror=shadow] + : is_state_(is_state) + ^ + + * data/skeletons/glr2.cc (glr_stack_item): Alpha-convert. + +2020-09-13 Akim Demaille + + c++: variants: minor simplification + Do as Valentin Tolmer did in glr2.cc. + + * data/skeletons/variant.hh: The union does not need to be named. + +2020-09-13 Akim Demaille + + glr2.cc: avoid type-punning issues + On the CI, tests fail with GCC 4.6 to GCC 6 as follows: + + tests/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"\\\"\".cc \"\\\"\".y + tests/synclines.at:440: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o \"\\\"\" \"\\\"\".cc $LIBS + stderr: + "\"".cc: In member function 'glr_state& glr_stack_item::getState()': + "\"".cc:1404:47: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + return *reinterpret_cast(&raw_); + ^ + "\"".cc: In member function 'const glr_state& glr_stack_item::getState() const': + "\"".cc:1408:53: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + return *reinterpret_cast(&raw_); + ^ + "\"".cc: In member function 'semantic_option& glr_stack_item::getOption()': + "\"".cc:1413:53: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + return *reinterpret_cast(&raw_); + ^ + "\"".cc: In member function 'const semantic_option& glr_stack_item::getOption() const': + "\"".cc:1417:59: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + return *reinterpret_cast(&raw_); + ^ + + See also be6fa942acae21a4a025bac5e339451be6ad136d. + + * data/skeletons/glr2.cc (glr_stack_item): Use a temporary void* + variable to avoid type-punning issues with reinterpret_cast. + +2020-09-13 Akim Demaille + + glr.cc, glr2.cc: don't publish compiler pragmas + Currently the compiler attributes are defined in + b4_shared_declarations (that can in the header if it exists, otherwise + in the implementation file). This is not needed, only the + implementation file needs them. + + Besides, glr2.cc was also defining these macros in the implementation + file, so we had two definitions. + + * data/skeletons/glr.cc, data/skeletons/glr2.cc: Define the compiler + attribute macros only in the implementation files. + * tests/regression.at (Lex and parse params): Generate a header, to + make it easy to check that the header is self-sufficient. + +2020-09-13 Akim Demaille + + glr2.cc: disable incorrect warnings from GCC6 to 9 + For instance with GCC8: + + 616. regression.at:1560: testing Lex and parse params: glr2.cc ... + tests/regression.at:1560: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y + tests/regression.at:1560: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS + stderr: + input.cc: In member function 'YYRESULTTAG glr_stack::yyresolveValue(glr_state*)': + input.cc:1796:10: error: potential null pointer dereference [-Werror=null-dereference] + return yypred ? &(asItem(this) - yypred)->getState() : YY_NULLPTR; + ^~~~~~ + input.cc:1796:10: error: potential null pointer dereference [-Werror=null-dereference] + return yypred ? &(asItem(this) - yypred)->getState() : YY_NULLPTR; + ^~~~~~ + cc1plus: all warnings being treated as errors + + It complains that the implicit this in yypred might be null. It fears + it because of loops such as + + for (glr_state* yys = firstTopState(); + yys != yystateStack.yysplitPoint; + yys = yys->pred()) + yyn += 1; + + that could possibly set yys to null, since yys->pred might return + null. However, the warning is incorrect, since in C++ `this` cannot + be null. GCC 10 no longer emits this warning. + + GCC 7 also complains many times about glr_stack::yyresolveLocations + when NDEBUG is enabled (when it is not, YYASSERT (yyoption != + YY_NULLPTR) is probably enough to pacify GCC): + + 616. regression.at:1560: testing Lex and parse params: glr2.cc ... + tests/regression.at:1560: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y + tests/regression.at:1560: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS + stderr: + input.cc: In member function 'void glr_stack::yyresolveLocations(glr_state*, int)': + input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] + yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] + yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] + yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + input.cc: In member function 'YYRESULTTAG glr_stack::yyresolveValue(glr_state*)': + input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] + yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] + yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] + yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] + yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] + yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] + yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ + + * data/skeletons/glr2.cc (YY_IGNORE_NULL_DEREFERENCE_BEGIN) + (YY_IGNORE_NULL_DEREFERENCE_BEGIN): New. + (glr_state::pred, glr_stack::yyresolveLocations): Use them. + +2020-09-12 Adela Vais + + d: make enum SymbolKind idiomatic D + Taking into account comments from H. S. Teoh. + https://lists.gnu.org/r/bison-patches/2020-09/msg00021.html + + * data/skeletons/d.m4, data/skeletons/lalr1.d (SymbolKind): Wrap the + enum in a structure that contains its string representation. + +2020-09-12 Akim Demaille + + glr2.cc: address warnings with G++ 4.8 + input.cc: In constructor 'glr_stack_item::glr_stack_item(bool)': + input.cc:1423:5: error: declaration of 'isState' shadows a member of 'this' [-Werror=shadow] + : isState_(isState) { + ^ + test.cc:1165:45: error: declaration of 'begin' shadows a member of 'this' [-Werror=shadow] + test.cc:1167:45: error: declaration of 'end' shadows a member of 'this' [-Werror=shadow] + + * data/skeletons/glr2.cc (isState): Rename as... + (is_state): this. + Formatting changes. + (reduceToOneStack): Rename variables to avoid name clashes. + +2020-09-12 Akim Demaille + + glr2.cc: get rid of the C indirection for yy_symbol_print + * data/skeletons/glr2.cc (yy_symbol_print): Remove. + Just use yyparser.yy_symbol_print_ directly. + +2020-09-12 Akim Demaille + + glr2.cc: formatting changes + * data/skeletons/glr2.cc: here. + +2020-09-12 Akim Demaille + + glr2.cc: fix GCC10 warning + For instance on test 433: "glr2.cc api.value.type={double}" + + tests/types.at:138: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o test test.cc $LIBS + stderr: + In file included from /opt/local/include/gcc10/c++/bits/stl_tempbuf.h:60, + from /opt/local/include/gcc10/c++/bits/stl_algo.h:62, + from /opt/local/include/gcc10/c++/algorithm:62, + from test.cc:82: + /opt/local/include/gcc10/c++/bits/stl_construct.h: In instantiation of 'constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = glr_stack_item; _Args = {glr_stack_item}; decltype (::new(void*(0)) _Tp) = glr_stack_item*]': + /opt/local/include/gcc10/c++/bits/alloc_traits.h:514:21: required from 'static constexpr void std::allocator_traits >::construct(std::allocator_traits >::allocator_type&, _Up*, _Args&& ...) [with _Up = glr_stack_item; _Args = {glr_stack_item}; _Tp = glr_stack_item; std::allocator_traits >::allocator_type = std::allocator]' + /opt/local/include/gcc10/c++/bits/vector.tcc:115:30: required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {glr_stack_item}; _Tp = glr_stack_item; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::reference = glr_stack_item&]' + /opt/local/include/gcc10/c++/bits/stl_vector.h:1204:21: required from 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = glr_stack_item; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::value_type = glr_stack_item]' + test.cc:1949:48: required from here + /opt/local/include/gcc10/c++/bits/stl_construct.h:95:14: error: noexcept-expression evaluates to 'false' because of a call to 'glr_stack_item::glr_stack_item(const glr_stack_item&)' [-Werror=noexcept] + 95 | noexcept(noexcept(::new((void*)0) _Tp(std::declval<_Args>()...))) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + test.cc:1436:3: note: but 'glr_stack_item::glr_stack_item(const glr_stack_item&)' does not throw; perhaps it should be declared 'noexcept' + 1436 | glr_stack_item(const glr_stack_item& other) + | ^~~~~~~~~~~~~~ + cc1plus: all warnings being treated as errors + stdout: + tests/types.at:138: exit code was 1, expected 0 + 433. types.at:138: 433. glr2.cc api.value.type={double} (types.at:138): FAILED (types.at:138) + + * data/skeletons/glr2.cc (glr_stack_item): Use YY_NOEXCEPT/YY_NOTHROW. + +2020-09-12 Valentin Tolmer + + glr2.cc: coding style changes + * data/skeletons/glr2.cc: Change some CamlCase to snake_case, and + remove some yy prefixes for classes inside the namespace. + +2020-09-12 Valentin Tolmer + + glr2.cc: move StrongIndexAlias into the namespace + * data/skeletons/glr2.cc: here. + +2020-09-12 Valentin Tolmer + + glr2.cc: remove usage of PTRDIFF_MAX + * data/skeletons/glr2.cc: Use std::ptrdiff_t and numeric_limits. + +2020-09-12 Valentin Tolmer + + glr2.cc: remove C-style casts + * data/skeletons/glr2.cc: here. + +2020-09-12 Valentin Tolmer + + glr2.cc: add copy constructor to yyGLRStackItem + This silences the clang warning -Wdeprecated-copy. + + * data/skeletons/glr2.cc: here. + +2020-09-07 Akim Demaille + + examples: d: remove unused token + * examples/d/calc/calc.y, examples/d/simple/calc.y: Remove "=". + +2020-09-06 Akim Demaille + + Merge branch 'maint' (i.e., Bison 3.7.2) + * upstream/maint: + maint: post-release administrivia + version 3.7.2 + build: disable syntax-check warning + gnulib: update + build: fix incorrect dependencies + doc: updates + gnulib: update + tests: beware of sed portability issues + +2020-09-06 Akim Demaille + + build: fix a concurrent build issue in examples + Reported by Thomas Deutschmann . + https://lists.gnu.org/r/bug-bison/2020-09/msg00010.html + + * examples/c/lexcalc/local.mk: scan.o depends on parse.[ch]. + +2020-09-05 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-09-05 Akim Demaille + + version 3.7.2 + * NEWS: Record release date. + +2020-09-05 Akim Demaille + + build: disable syntax-check warning + error_message_uppercase + etc/bench.pl.in-419-static int yylex (@{[is_pure (@directive) ? "YYSTYPE *yylvalp" : "void"]}); + + * cfg.mk: here. + +2020-09-05 Akim Demaille + + gnulib: update + +2020-09-05 Akim Demaille + + build: fix incorrect dependencies + Commit af000bab111768a04021bf5ffa4bbe91d44e231c ("doc: work around + Texinfo 6.7 bug"), published in 3.4.91, added a dependency on the + "all" target. + + This is a super bad idea, since "make all" will run this + target *before* "all", which builds bison. It turns out that this new + dependency actually needed bison to be built. So all the regular + process (i) build $(BUILT_SOURCES) and then (ii) build bison, was + wrecked since some of the $(BUILT_SOURCES) depended on bison... + + It was "easy" to see in the logs of "make V=1" because we were + building bison files (such as src/files.o) *before* displaying the + banner for "all-recursive". With this fix, we finally get again the + proper sequence: + + rm -f examples/c/reccalc/scan.stamp examples/c/reccalc/scan.stamp.tmp + /opt/local/libexec/gnubin/mkdir -p examples/c/reccalc + touch examples/c/reccalc/scan.stamp.tmp + flex -oexamples/c/reccalc/scan.c --header=examples/c/reccalc/scan.h ./examples/c/reccalc/scan.l + mv examples/c/reccalc/scan.stamp.tmp examples/c/reccalc/scan.stamp + rm -f lib/fcntl.h-t lib/fcntl.h && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + ... + } > lib/fcntl.h-t && \ + mv lib/fcntl.h-t lib/fcntl.h + ... + mv -f lib/alloca.h-t lib/alloca.h + make all-recursive + + Reported by Mingli Yu . + https://github.com/akimd/bison/issues/31 + https://lists.gnu.org/r/bison-patches/2020-05/msg00055.html + + Reported by Claudio Calvelli . + https://lists.gnu.org/r/bug-bison/2020-09/msg00001.html + https://bugs.gentoo.org/716516 + + * doc/local.mk (all): Rename as... + (all-local): this. + So that we don't compete with BUILT_SOURCES. + +2020-09-05 Akim Demaille + + doc: simplify the extraction of example snippets + * doc/bison.texi: Use qualified paths. + * examples/extexi: Comment changes. + +2020-09-05 Akim Demaille + + glr2.cc: style changes + * data/skeletons/glr2.cc: Remove stray comment. + +2020-09-05 Akim Demaille + + glr2.cc: get rid of the yyerror scaffolding + The yyerror stand-alone function was used to bounce from glr.c's call + to yyerror to glr.cc's parser.error. Now that glr.c is out of the + way, just directly use parser.error. + + * data/skeletons/glr2.cc (yyerror): Remove. + Adjust callers. + (b4_yyerror_args, b4_lyyerror_args, b4_pure_formals): Remove. + Now unused. + +2020-09-04 Valentin Tolmer + + glr2.cc: avoid warnings about printf and shadowing + * data/skeletons/glr2.cc: Migrate from using printf to std::cerr & co. + Since the yyGLRStack has the user params, no need to pass them around. + +2020-09-03 Adela Vais + + examples: d: demonstrate location tracking + * examples/d/calc/calc.y: Track locations. + * examples/d/calc/calc.test: Check locations. + +2020-09-03 Adela Vais + + examples: d: duplicate the example as "simple" and "calc" + * examples/d/Makefile, examples/d/calc.d, examples/d/calc.test, + examples/d/calc/local.mk: Move into... + * examples/d/calc, examples/d/simple: these new directories. + +2020-09-02 Akim Demaille + + doc: updates + * NEWS, TODO: here. + +2020-09-02 Adela Vais + + examples: d: fix the handling of unary + + It was interpreting "+exp" as "-exp". + + * examples/d/calc.y: Fix. + * examples/d/calc.test: Check it. + +2020-09-02 Akim Demaille + + cex: always show ε/%empty in counterexamples + On a case such as + %% + exp + : empty "a" + | "a" empty + + empty + : %empty + + we used to display + + warning: shift/reduce conflict on token "a" [-Wcounterexamples] + Example: • "a" + Shift derivation + exp + ↳ 2: • "a" empty + ↳ 2: ε + Example: • "a" + Reduce derivation + exp + ↳ 1: empty "a" + ↳ 3: • + + where the shift derivation shows an item "2: empty → ε", with an + explicit "ε", but the reduce derivation shows "3: empty → •", without + "ε". + + For consistency, let's always show ε/%empty in rules with an empty + rhs: + + Reduce derivation + exp + ↳ 1: empty "a" + ↳ 3: ε • + + * src/derivation.c (derivation_width, derivation_print_tree_impl): + Always show ε/%empty in counterexamples. + * tests/diagnostics.at: Check that case. + * tests/conflicts.at, tests/counterexample.at: Adjust. + +2020-08-30 Akim Demaille + + glr2.cc: avoid warnings about long long + * data/skeletons/glr2.cc: Disable the warning before triggering it. + +2020-08-30 Akim Demaille + + cex: display the rule numbers + From + + Example: "if" expr "then" "if" expr "then" stmt • "else" stmt + Shift derivation + if_stmt + ↳ "if" expr "then" stmt + ↳ if_stmt + ↳ "if" expr "then" stmt • "else" stmt + Reduce derivation + if_stmt + ↳ "if" expr "then" stmt "else" stmt + ↳ if_stmt + ↳ "if" expr "then" stmt • + + to + + Example: "if" expr "then" "if" expr "then" stmt • "else" stmt + Shift derivation + if_stmt + ↳ 3: "if" expr "then" stmt + ↳ 2: if_stmt + ↳ 4: "if" expr "then" stmt • "else" stmt + Example: "if" expr "then" "if" expr "then" stmt • "else" stmt + Reduce derivation + if_stmt + ↳ 4: "if" expr "then" stmt "else" stmt + ↳ 2: if_stmt + ↳ 3: "if" expr "then" stmt • + + * src/state-item.h, src/state-item.c (state_item_rule): New. + * src/derivation.h, src/derivation.c (struct derivation): Add a rule + member. + Adjust dependencies. + * src/counterexample.c, src/parse-simulation.c: Pass the rule to + derivation_new. + * src/derivation.c (fprintf_if): New. + (derivation_width, derivation_print_tree_impl): Take the rule number + into account. + + * tests/conflicts.at, tests/counterexample.at, tests/diagnostics.at, + * tests/report.at: Adjust. + + * doc/bison.texi: Adjust. + +2020-08-30 Akim Demaille + + gnulib: update + +2020-08-30 Akim Demaille + + tests: beware of sed portability issues + Reported by David Laxer . + https://lists.gnu.org/r/bug-bison/2020-08/msg00027.html + + * tests/output.at: Don't use + with sed. + While at it, fix a quotation problem hidden by the use of '#'. + +2020-08-30 Akim Demaille + + gnulib: update + +2020-08-30 Akim Demaille + + tests: beware of sed portability issues + Reported by David Laxer . + https://lists.gnu.org/r/bug-bison/2020-08/msg00027.html + + * tests/output.at: Don't use + with sed. + While at it, fix a quotation problem hidden by the use of '#'. + +2020-08-30 Akim Demaille + + glr2.cc: fix a few warnings + * data/skeletons/glr2.cc: Fix some documentation. + Be consistent between class/struct. + (yydoAction, yyresolveAction): Avoid passing yyparser where useless. + +2020-08-30 Valentin Tolmer + + glr2.cc: fork glr.cc to a c++ version + This is a fork of glr.cc to be c++-first instead of a wrapper around + glr.c. + + * data/skeletons/glr2.cc: New. + * data/skeletons/bison.m4, data/skeletons/c++.m4: Adjust. + * data/skeletons/c.m4 (b4_user_args_no_comma): New. + * src/reader.c (grammar_rule_check_and_complete): glr2.cc is C++. + * tests/actions.at, tests/c++.at, tests/calc.at, tests/conflicts.at, + * tests/input.at, tests/local.at, tests/regression.at, tests/scanner.at, + * tests/synclines.at, tests/types.at: Also check glr2.cc. + +2020-08-30 Akim Demaille + + c: always use YYMALLOC/YYFREE + Reported by Kovalex . + https://lists.gnu.org/r/bug-bison/2020-08/msg00015.html + + * data/skeletons/yacc.c: Don't make direct calls to malloc/free. + * tests/calc.at: Check it. + +2020-08-30 Akim Demaille + + build: beware of POSIX mode + Reported by Dennis Clarke. + https://lists.gnu.org/r/bug-bison/2020-08/msg00013.html + + * examples/d/local.mk, examples/java/calc/local.mk, + * examples/java/simple/local.mk: Pass bison's options before its + argument, in case we're in POSIX mode. + +2020-08-30 Akim Demaille + + doc: history of api.prefix + Reported by Matthew Fernandez . + https://lists.gnu.org/r/help-bison/2020-08/msg00015.html + + * doc/bison.texi (api.prefix): We move to {} in 3.0. + +2020-08-11 Akim Demaille + + CI: intel moved the script for ICC + * .travis.yml: Adjust. + +2020-08-08 Akim Demaille + + fix: unterminated \-escape + An assertion failed when the last character is a '\' and we're in a + character or a string. + Reported by Agency for Defense Development. + https://lists.gnu.org/r/bug-bison/2020-08/msg00009.html + + * src/scan-gram.l: Catch unterminated escapes. + * tests/input.at (Unexpected end of file): New. + +2020-08-07 Akim Demaille + + fix: crash when redefining the EOF token + Reported by Agency for Defense Development. + https://lists.gnu.org/r/bug-bison/2020-08/msg00008.html + + On an empty such as + + %token FOO + BAR + FOO 0 + %% + input: %empty + + we crash because when we find FOO 0, we decrement ntokens (since FOO + was discovered to be EOF, which is already known to be a token, so we + increment ntokens for it, and need to cancel this). This "works well" + when EOF is properly defined in one go, but here it is first defined + and later only assign token code 0. In the meanwhile BAR was given + the token number that we just decremented. + + To fix this, assign symbol numbers after parsing, not during parsing, + so that we also saw all the explicit token codes. To maintain the + current numbers (I'd like to keep no difference in the output, not + just equivalence), we need to make sure the symbols are numbered in + the same order: that of appearance in the source file. So we need the + locations to be correct, which was almost the case, except for nterms + that appeared several times as LHS (i.e., several times as "foo: + ..."). Fixing the use of location_of_lhs sufficed (it appears it was + intended for this use, but its implementation was unfinished: it was + always set to "false" only). + + * src/symtab.c (symbol_location_as_lhs_set): Update location_of_lhs. + (symbol_code_set): Remove broken hack that decremented ntokens. + (symbol_class_set, dummy_symbol_get): Don't set number, ntokens and + nnterms. + (symbol_check_defined): Do it. + (symbols): Don't count nsyms here. + Actually, don't count nsyms at all: let it be done in... + * src/reader.c (check_and_convert_grammar): here. Define nsyms from + ntokens and nnterms after parsing. + * tests/input.at (EOF redeclared): New. + + * examples/c/bistromathic/bistromathic.test: Adjust the traces: in + "%nterm exp %% input: ...", exp used to be numbered before + input. + +2020-08-07 Akim Demaille + + style: fix missing space before paren + * cfg.mk (_space_before_paren_exempt): Be less laxist. + * src/output.c, src/reader.c: Fix space before paren issues. + Pacify the warnings where applicable. + +2020-08-07 Akim Demaille + + style: fix comments and more debug trace + * src/location.c, src/symtab.h, src/symtab.c: here. + +2020-08-07 Akim Demaille + + style: more uses of const + * src/symtab.c: here. + +2020-08-07 Akim Demaille + + bench: fix support for pure parser + * etc/bench.pl.in (is_pure): New. + (generate_grammar_calc): Use code provides where needed. + Use is_pure to call yylex properly. + Coding style fixes. + +2020-08-03 Akim Demaille + + portability: multiple typedefs + Older versions of GCC (4.1.2 here) don't like repeated typedefs. + + CC src/bison-parse-simulation.o + src/parse-simulation.c:61: error: redefinition of typedef 'parse_state' + src/parse-simulation.h:74: error: previous declaration of 'parse_state' was here + make: *** [Makefile:7876: src/bison-parse-simulation.o] Error 1 + + Reported by Nelson H. F. Beebe. + + * src/parse-simulation.c (parse_state): Don't typedef, + parse-simulation.h did it already. + +2020-08-02 Akim Demaille + + style: revert "avoid warnings with GCC 4.6" + This reverts commit d0bec3175ff5cf6582ffbf584b73ea6aaea838d0 (which + should have read "We have a clash...", not "With have a clash..."). + Now that `max()` was renamed `max_int()`, we can use `max` again, as + elsewhere in the code. + + * src/counterexample.c (visited_hasher): Alpha reconversion. + +2020-08-02 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-08-02 Akim Demaille + + version 3.7.1 + * NEWS: Record release date. + +2020-08-02 Akim Demaille + + portability: we use termios.h and sys/ioctl.h + Reported by Maarten De Braekeleer. + https://lists.gnu.org/r/bison-patches/2020-07/msg00079.html + + * bootstrap.conf (gnulib_modules): Add termios and sys_ioctl. + +2020-08-02 Maarten De Braekeleer + + portability: rename accept to acceptsymbol because of MSVC + MSVC already defines this symbol. + + * src/symtab.h, src/symtab.c (accept): Rename as... + (acceptsymbol): this. + Adjust dependencies. + +2020-08-02 Akim Demaille + + regen + +2020-08-02 Maarten De Braekeleer + + portability: use CHAR_LITERAL instead of CHAR because MSVC defines CHAR + * src/parse-gram.y, src/scan-gram.l: here. + +2020-08-02 Maarten De Braekeleer + + portability: use INT_LITERAL instead of INT because MSVC defines INT + It is defined as a typedef, not a macro. + https://lists.gnu.org/r/bison-patches/2020-08/msg00001.html + + * src/parse-gram.y, src/scan-gram.l: here. + +2020-08-02 Akim Demaille + + portability: beware of max () with MSVC + Reported by Maarten De Braekeleer. + https://lists.gnu.org/r/bison-patches/2020-07/msg00080.html + + We don't want to use gnulib's min and max macros, since we use + function calls in min/max arguments. + + * src/location.c (max_int, min_int): Move to... + * src/system.h: here. + * src/counterexample.c, src/derivation.c: Use max_int instead of max. + +2020-08-02 Akim Demaille + + libtextstyle: be sure to have ostream_printf and hyperlink support + Older versions of libtextstyle do not support them, rule them out. + + Reported by Lars Wendler + https://lists.gnu.org/r/bug-bison/2020-07/msg00030.html + + and by Arnold Robbins + https://lists.gnu.org/r/bug-bison/2020-07/msg00041.html and + https://lists.gnu.org/mailman/private/gawk-devel/2020-July/003988.html + + and by Nelson H. F. Beebe + https://lists.gnu.org/mailman/private/gawk-devel/2020-July/003993.html + + With support from Bruno Haible in gnulib + https://lists.gnu.org/r/bug-gnulib/2020-08/msg00000.html + thread starting at + https://lists.gnu.org/r/bug-gnulib/2020-07/msg00148.html + + * configure.ac: Require libtextstyle 0.20.5. + * gnulib: Update. + +2020-08-01 Akim Demaille + + CI: comment changes + +2020-08-01 Akim Demaille + + regen + +2020-08-01 Akim Demaille + + diagnostics: better location for type redeclarations + From + + foo.y:1.7-11: error: %type redeclaration for bar + 1 | %type bar bar + | ^~~~~ + foo.y:1.7-11: note: previous declaration + 1 | %type bar bar + | ^~~~~ + + to + + foo.y:1.17-19: error: %type redeclaration for bar + 1 | %type bar bar + | ^~~ + foo.y:1.13-15: note: previous declaration + 1 | %type bar bar + | ^~~ + + * src/symlist.h, src/symlist.c (symbol_list_type_set): There's no need + for the tag's location, use that of the symbol. + * src/parse-gram.y: Adjust. + * tests/input.at: Adjust. + +2020-07-30 Akim Demaille + + todo: updates for D + +2020-07-29 Akim Demaille + + cex: style: comment changes + * src/parse-simulation.c: here. + +2020-07-29 Akim Demaille + + cex: style: prefer "res" for the returned value + * src/derivation.c (derivation_new): here. + +2020-07-29 Akim Demaille + + cex: style: prefer FOO_print to print_FOO + * src/state-item.h, src/state-item.c (print_state_item): Rename as... + (state_item_print): this. + * src/counterexample.c (print_counterexample): Rename as... + (counterexample_print): this. + +2020-07-28 Akim Demaille + + scanner: don't crash on strings containing a NUL byte + We crash if the input contains a string containing a NUL byte. + Reported by Suhwan Song. + https://lists.gnu.org/r/bug-bison/2020-07/msg00051.html + + * src/flex-scanner.h (STRING_FREE): Avoid accidental use of + last_string. + * src/scan-gram.l: Don't call STRING_FREE without calling + STRING_FINISH first. + * tests/input.at (Invalid inputs): Check that case. + +2020-07-28 Akim Demaille + + doc: refer to cex from sections dealing with conflicts + The documentation about -Wcex should be put forward. + + * doc/bison.texi: Refer to -Wcex from the sections about conflicts. + +2020-07-28 Akim Demaille + + doc: factor ifnottex/iftex examples + * doc/bison.texi: Factor the common bits out of ifnottex/iftex. + +2020-07-28 Akim Demaille + + doc: fix colors + The original Texinfo macros introducing colors were made for + diagnostics, which are printed in bold. So by copy-paste accident the + styles we introduced for counterexamples were also in bold. They + should not. + + * doc/bison.texi: Separate the styling of diagnostics from the styling + for counterexamples. + Don't use bold in the latter case. + +2020-07-28 Akim Demaille + + doc: fixes + * doc/bison.texi: Fix spello. + Fix missing colors, and factor. + +2020-07-23 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-07-23 Akim Demaille + + version 3.7 + * NEWS: Record release date. + +2020-07-23 Akim Demaille + + style: avoid warnings with GCC 4.6 + With have a clash with the "max" function. + + src/counterexample.c: In function 'visited_hasher': + src/counterexample.c:720:48: error: declaration of 'max' shadows a global declaration [-Werror=shadow] + src/counterexample.c:116:12: error: shadowed declaration is here [-Werror=shadow] + + * src/counterexample.c (visited_hasher): Alpha conversion. + +2020-07-23 Akim Demaille + + doc: fix definition of -Wall + * doc/bison.texi (Diagnostics): here. + +2020-07-23 Akim Demaille + + gnulib: update + * bootstrap.conf: We need stpncpy. + +2020-07-23 Akim Demaille + + tests: fixes + Fix 6b78e50cef3c2cd8e6f4e7938be987e8769f8eef, "cex: make "rerun with + '-Wcex'" a note instead of a warning" + + * tests/conflicts.at (-W versus %expect and %expect-rr): Fix + expectations. + +2020-07-22 Akim Demaille + + cex: update NEWS for 3.7 + * NEWS: Update to the current style of cex display. + +2020-07-22 Akim Demaille + + doc: catch up with the current display of cex + Unfortunately I found no way to use the ↳ glyph in Texinfo, so I used + @arrow{} instead, which has a different width, so we have to have all + the examples doubled, once for TeX, another for the rest of the world. + + * doc/bison.texi: Use the current display in the examples. + * doc/calc.y, doc/ids.y, doc/if-then-else.y, doc/sequence.y: New. + +2020-07-21 Akim Demaille + + cex: make "rerun with '-Wcex'" a note instead of a warning + Currently the suggestion to rerun is a -Wother warning: + + warning: 2 shift/reduce conflicts [-Wconflicts-sr] + warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] + + Instead, let's attach it as a subnote of the diagnostic (in the + current case, -Wconflicts-sr): + + warning: 2 shift/reduce conflicts [-Wconflicts-sr] + note: rerun with option '-Wcounterexamples' to generate conflict counterexamples + + * src/conflicts.c (conflicts_print): Do that. + Adjust the test suite. + +2020-07-20 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-07-20 Akim Demaille + + version 3.6.93 + * NEWS: Record release date. + +2020-07-20 Akim Demaille + + cex: label all the derivations by their initial action + From + + input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples] + Example: A b . + First derivation + a + `-> A b . + Second derivation + a + `-> A b + `-> b . + + to + + input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples] + Example: A b . + First reduce derivation + a + `-> A b . + Second reduce derivation + a + `-> A b + `-> b . + + * src/counterexample.c (print_counterexample): here. + Compute the width of the labels to properly align the values. + * tests/conflicts.at, tests/counterexample.at, tests/diagnostics.at, + * tests/report.at: Adjust. + +2020-07-20 Akim Demaille + + cex: improve readability of the subsections + Now that the derivation is no longer printed on one line, aligning the + example and the derivation is no longer useful. It can actually be + harmful, as it makes the overall structure less clear. + + * src/derivation.h, src/derivation.c (derivation_print_leaves): Remove + the `prefix` argument. + * src/counterexample.c (print_counterexample): Put the example next to + its label. + * tests/conflicts.at, tests/counterexample.at, tests/diagnostics.at, + * tests/report.at: Adjust. + +2020-07-20 Akim Demaille + + cex: don't issue an empty line between counterexamples + Now that we use complain, the "sections" are clearer. + + * src/counterexample.c (print_counterexample): Use the empty line only + in reports. + * tests/counterexample.at, tests/diagnostics.at, tests/report.at: Adjust. + +2020-07-20 Akim Demaille + + cex: use usual routines for diagnostics about S/R conflicts + See previous commit. We go from + + input.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr] + Shift/reduce conflict on token "⊕": + Example exp "+" exp • "⊕" exp + Shift derivation + exp + ↳ exp "+" exp + ↳ exp • "⊕" exp + + to + + input.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr] + input.y: warning: shift/reduce conflict on token "⊕" [-Wcounterexamples] + Example exp "+" exp • "⊕" exp + Shift derivation + exp + ↳ exp "+" exp + ↳ exp • "⊕" exp + + with an hyperlink on -Wcounterexamples. + + * src/counterexample.c (counterexample_report_shift_reduce): + Use complain. + * tests/counterexample.at, tests/diagnostics.at, tests/report.at: + Adjust. + +2020-07-20 Akim Demaille + + cex: use usual routines for diagnostics about R/R conflicts + This is more consistent, and brings benefits: users know that these + diagnostics are attached to -Wcounterexamples, and they can also click + on the hyperlink if permitted by their terminal. + + We go from + + warning: 1 reduce/reduce conflict [-Wconflicts-rr] + Reduce/reduce conflict on token $end: + Example A b . + First derivation a -> [ A b . ] + Second derivation a -> [ A b -> [ b . ] ] + + to + + warning: 1 reduce/reduce conflict [-Wconflicts-rr] + input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples] + Example A b . + First derivation a -> [ A b . ] + Second derivation a -> [ A b -> [ b . ] ] + + with an hyperlink on -Wcounterexamples. + + * src/counterexample.c (counterexample_report_reduce_reduce): + Use complain. + * tests/counterexample.at, tests/diagnostics.at, tests/report.at: + Adjust. + +2020-07-19 Akim Demaille + + diagnostics: use hyperlinks to point to the only documentation + * src/complain.c (begin_hyperlink, end_hyperlink): New. + (warnings_print_categories): Use them. + * tests/local.at (AT_SET_ENV): Disable hyperlinks in the tests, they + contain random id's, and brackets (which is not so nice for M4). + +2020-07-19 Akim Demaille + + doc: add anchors for warnings + Unfortunately Texinfo somewhat mangles anchors such as `-Werror` into + `g_t_002dWerror`, so let's not include the dash. + + * doc/bison.texi (Diagnostics): here. + +2020-07-19 Akim Demaille + + glyphs: fix types + The code was written on top of buffers of `char[26]`, and then was + changed to use `char *`, yet was still using `sizeof buf`, which + became `sizeof (char *)` instead of `sizeof (char[26])`. + + Reported by Dagobert Michelsen. + https://lists.gnu.org/r/bug-bison/2020-07/msg00023.html + + * src/glyphs.h, src/glyphs.c: Get rid of uses of `char *`, use only + glyph_buffer_t. + +2020-07-19 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-07-19 Akim Demaille + + version 3.6.92 + * NEWS: Record release date. + +2020-07-19 Akim Demaille + + style: avoid strncpy + syntax-check seems to dislike strncpy. The GNU Coreutils replaced + their uses of strncpy with stpncpy. + + strlcpy is not an option. + http://sources.redhat.com/ml/libc-alpha/2002-01/msg00159.html + http://sources.redhat.com/ml/libc-alpha/2002-01/msg00011.html + http://lists.gnu.org/archive/html/bug-gnulib/2004-09/msg00181.html + + * src/glyphs.c: Use stpncpy. + +2020-07-18 Akim Demaille + + cex: display derivations as trees + Sometimes, understanding the derivations is difficult, because they + are serialized to fit in one line. For instance, the example taken + from the NEWS file: + + %token ID + %% + s: a ID + a: expr + expr: expr ID ',' | "expr" + + gave + + First example expr • ID ',' ID $end + Shift derivation $accept → [ s → [ a → [ expr → [ expr • ID ',' ] ] ID ] $end ] + Second example expr • ID $end + Reduce derivation $accept → [ s → [ a → [ expr • ] ID ] $end ] + + Printing as trees, it gives: + + First example expr • ID ',' ID $end + Shift derivation + $accept + ↳ s $end + ↳ a ID + ↳ expr + ↳ expr • ID ',' + Second example expr • ID $end + Reduce derivation + $accept + ↳ s $end + ↳ a ID + ↳ expr • + + * src/glyphs.h, src/glyphs.c (down_arrow, empty, derivation_separator): + New. + * src/derivation.c (derivation_print, derivation_print_impl): Rename + as... + (derivation_print_flat, derivation_print_flat_impl): These. + (fputs_if, derivation_depth, derivation_width, derivation_print_tree) + (derivation_print_tree_impl, derivation_print): New. + * src/counterexample.c (print_counterexample): Adjust. + * tests/conflicts.at, tests/counterexample.at, tests/diagnostics.at, + * tests/report.at: Adjust. + +2020-07-16 Akim Demaille + + cex: use the glyphs + * src/derivation.c: here. + * src/gram.h, src/gram.c (print_arrow, print_dot, print_fallback): + Remove. + +2020-07-16 Akim Demaille + + cex: factor the handling of graphical symbols + * src/glyphs.h, src/glyphs.c: New. + +2020-07-15 Akim Demaille + + cex: style changes + * src/counterexample.c: here. + +2020-07-15 Akim Demaille + + cex: simplify tests + * tests/counterexample.at (AT_BISON_CHECK_CEX): Handle the keyword. + Simplify the signature. + +2020-07-15 Akim Demaille + + cex: more colors + Provided by Daniela Becker. + + * data/bison-default.css: More colors. + +2020-07-14 Akim Demaille + + style: comments changes + * src/print.c: here. + +2020-07-14 Akim Demaille + + doc: update GLR sections + Reported by Christian Schoenebeck. + + * doc/bison.texi (GLR Parsers): Minor fixes. + (Compiler Requirements for GLR): Remove, quite useless today. + +2020-07-14 Akim Demaille + + cex: display shifts before reductions + When reporting counterexamples for s/r conflicts, put the shift first. + This is more natural, and displays the default resolution first, which + is also what happens for r/r conflicts where the smallest rule number + is displayed first, and "wins". + + * src/counterexample.c (counterexample): Add a shift_reduce member. + (new_counterexample): Adjust. + Swap the derivations when this is a s/r conflict. + (print_counterexample): For s/r conflicts, prefer "Shift derivation" + and "Reduce derivation" rather than "First/Second derivation". + + * tests/conflicts.at, tests/counterexample.at, tests/report.at: Adjust. + * NEWS, doc/bison.texi: Ditto. + +2020-07-14 Akim Demaille + + style: s/lookahead_tokens/lookaheads/g + Currently we use both names. Let's stick to the short one. + + * src/AnnotationList.c, src/conflicts.c, src/counterexample.c, + * src/getargs.c, src/getargs.h, src/graphviz.c, src/ielr.c, + * src/lalr.c, src/print-graph.c, src/print-xml.c, src/print.c, + * src/state-item.c, src/state.c, src/state.h, src/tables.c: + s/lookahead_token/lookahead/gi. + +2020-07-14 Akim Demaille + + cex: factor memory allocation + * src/counterexample.c (counterexample_report_state): Allocate once + per conflicted state, instead of once per r/r conflict. + +2020-07-14 Akim Demaille + + cex: use state_item_number consistently + * src/counterexample.c, src/state-item.c: here. + (counterexample_report_state): While at it, prefer c2 to j/k, to match + c1. + +2020-07-14 Akim Demaille + + cex: more consistent memory allocation/copy + * src/counterexample.c, src/parse-simulation.c: It is more usual in + Bison to use sizeof on expressions than on types, especially for + allocation. + Let the compiler do it's job instead of calling memcpy ourselves. + +2020-07-14 Akim Demaille + + cex: minor renaming + * src/counterexample.c (has_common_prefix): Rename as... + (have_common_prefix): this. + +2020-07-14 Akim Demaille + + cex: use better type names + There are too many gl_list_t in there, it's hard to understand what is + going on. Introduce and use more precise types. I sure can be wrong + in some places, it's hard to tell without proper tool support. + + * src/counterexample.c, src/lssi.c, src/lssi.h, src/parse-simulation.c, + * src/parse-simulation.h, src/state-item.c, src/state-item.h + (si_bfs_node_list, search_state_list, ssb_list, lssi_list) + (state_item_list): New. + +2020-07-14 Akim Demaille + + cex: minor style changes + * src/counterexample.h, src/derivation.h, src/derivation.c: + More comments. + Use `out` for FILE*, as elsewhere. + +2020-07-14 Akim Demaille + + tests: beware of version numbers from git describe + * tests/report.at: Be robust to version numbers such as + 3.6.4.133-fbac-dirty. + +2020-07-14 Akim Demaille + + tests: fix expectations + Broken in ee86ea88399ed02243fbceb2704c9ea322a12bf9. + + * tests/diagnostics.at: here. + +2020-07-12 Akim Demaille + + doc: makeinfo wants @arrow{}, not @arrow + * doc/bison.texi: here. + +2020-07-11 Akim Demaille + + gnulib: update + +2020-07-11 Akim Demaille + + cex: prefer → to ::= + It does not make a lot of sense to use ::= in our counterexamples, + that's not something that belongs to the Bison "vocabulary". Using + the colon makes sense, but it's too discreet. Let's use the arrow, + which we already use in some reports (HTML and Dot). + + * src/gram.h (print_dot_fallback): Generalize into... + (print_fallback): this. + (print_arrow): New. + * src/derivation.c: Use it. + + * NEWS, tests/conflicts.at, tests/counterexample.at, + * tests/diagnostics.at, tests/report.at: Adjust. + * doc/bison.texi: Ditto. + Unfortunately the literal `→` is output as `↦`. So we need to use + @arrow. + +2020-07-11 Akim Demaille + + style: cex: prefer the array notation + Prefer `&foos[i]` to `foos + i` when `foos` is an array. IMHO, it + makes the semantics clearer. + + * src/counterexample.c, src/lssi.c, src/parse-simulation.c, + * src/state-item.c: With arrays, prefer the array notation rather than + the pointer one. + +2020-07-11 Akim Demaille + + style: cex: remove variables that don't make it simpler to read + * src/counterexample.c: With arrays, prefer the array notation rather + than the pointer one. + +2020-07-11 Akim Demaille + + bistromathic: demonstrate caret-diagnostics + * examples/c/bistromathic/parse.y (user_context): We need the current + line. + (yyreport_syntax_error): Quote the guilty line, with squiggles. + * examples/c/bistromathic/bistromathic.test: Adjust. + +2020-07-11 Akim Demaille + + bistromathic: do not display parse errors on completion + Currently autocompletion on a line with errors leaks the error + messages. It can be useful to let the user know, but GNU Readline + does not provide us with an nice way to display the error. So we + actually break into the current line of the user. + + So instead, do not show these errors. + + * examples/c/bistromathic/parse.y (user_context): New. + Use %param to pass it to the parser and scanner. + Keep quiet when in computing autocompletion. + +2020-07-11 Akim Demaille + + bistromathic: don't stupidly reset the location for each token + That quite defeats the whole point of locations... But anyway, we + should not see these messages at all. + + * examples/c/bistromathic/parse.y (expected_tokens): Fix (useless) + location tracking. + +2020-07-11 Akim Demaille + + bistromathic: promote yytoken_kind_t + * examples/c/bistromathic/parse.y: Use yytoken_kind_t rather than int. + +2020-07-11 Akim Demaille + + html: capitalize titles + * data/xslt/xml2xhtml.xsl: Use "State 0", not "state 0". + As we do in text reports. + +2020-07-11 Akim Demaille + + html: don't define several times the same anchors + Currently when we output useless rules, they appear before the + grammar, but using the same invocation. As a result, the anchor is + defined twice, and the wrong one, being first, is honored. + + * data/xslt/xml2xhtml.xsl (rule): Take a new 'anchor' parameter to + decide whether being an anchor, or a target. + Let it be true when output the grammar. + * tests/report.at: Adjust. + +2020-07-11 Akim Demaille + + html: simplify + * data/xslt/xml2xhtml.xsl: Merge two identical when-clauses. + +2020-07-11 Akim Demaille + + reports: let html reports catch up with --report and --graph + * data/xslt/xml2xhtml.xsl: Show the symbol types. + * tests/report.at: Adjust. + +2020-07-11 Akim Demaille + + reports: let xml reports catch up with --report and --graph + The text and Dot reports are expected to be identical when generated + directly (--report, --graph) or indirectly (via XML). The xml + testsuite had not be run for ages, let it catch up a bit. + + * src/print-xml.c: Pass the type of the symbols. + * data/xslt/xml2text.xsl + Catch up with the new layout. + Display the symbol types. + Use '•', not '.' + * tests/local.at: Smash '•' to '.' when matching against the direct + text report. + * tests/report.at: Adjust XML expectations. + +2020-07-11 Akim Demaille + + reports: update html ouput + * data/xslt/xml2xhtml.xsl: Improve indentation. + Use ul/li rather that pre. + +2020-07-11 Akim Demaille + + tests: check html + * tests/report.at: here. + +2020-07-11 Akim Demaille + + style: factor complex expressions + * src/print-xml.c, src/print.c: Introduce a variable pointing to the + current symbol. + +2020-07-11 Akim Demaille + + maint: make it easier to update expectations + * tests/local.mk (update-tests): New. + +2020-07-09 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-07-09 Akim Demaille + + version 3.6.91 + * NEWS: Record release date. + +2020-07-09 Akim Demaille + + news: update + +2020-07-09 Akim Demaille + + gnulib: update + +2020-07-08 Akim Demaille + + examples: add license headers + Prompted by Rici Lake. + https://stackoverflow.com/questions/62658368/#comment110853985_62661621 + Discussed with Paul Eggert. + + * doc/bison.texi, examples/c/bistromathic/parse.y, + * examples/c/lexcalc/parse.y, examples/c/lexcalc/scan.l, + * examples/c/pushcalc/calc.y, examples/c/reccalc/parse.y, + * examples/c/reccalc/scan.l, examples/d/calc.y, + * examples/java/calc/Calc.y, examples/java/simple/Calc.y: + Install the GPL3+ header. + +2020-07-05 Akim Demaille + + style: update comments + * src/reader.c: action_obstack was removed in 2002... + * src/parse-gram.y: Better names. + * src/scan-code.h: More comments. + +2020-07-05 Akim Demaille + + style: update comments in the skeletons + * data/skeletons/c++.m4, data/skeletons/glr.c, data/skeletons/lalr1.d, + * data/skeletons/lalr1.java, data/skeletons/yacc.c: + Be more accurate about yychar and yytoken. + Don't name local variables as if they were members. + +2020-07-05 Akim Demaille + + doc: more details about symbols in m4 + * data/README.md: here. + * README-hacking.md (Vocabulary): More. + +2020-07-05 Akim Demaille + + regen + +2020-07-05 Akim Demaille + + examples: include the generated header + * examples/c/bistromathic/parse.y, examples/c/lexcalc/parse.y, + * examples/c/reccalc/parse.y: here. + Add some comments. + + * src/parse-gram.y (api_version): Pull out of handle_require. + Bump to 3.7. + +2020-07-04 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-07-04 Akim Demaille + + version 3.6.90 + * NEWS: Record release date. + +2020-07-04 Akim Demaille + + news: update + +2020-07-04 Akim Demaille + + package: fix syntax-check errors + * examples/c/bistromathic/bistromathic.test, po/POTFILES.in: here. + +2020-07-04 Akim Demaille + + gnulib: update + +2020-07-04 Akim Demaille + + cex: give more details about -Wcex and -rcex + * data/bison-default.css: Cobalt does not seem to be supported. + * doc/bison.texi (Counterexamples): A new section. + (Understanding): Show the counterexamples as it shows in the report: + with its items. + (Bison Options): Document -Wcex and -rcex. + +2020-07-03 Akim Demaille + + news: update + +2020-07-03 Akim Demaille + + dot: also use a dot in the output + * src/print-graph.c (print_core): Use a dot instead of a point. + * doc/figs/example-reduce.gv, doc/figs/example-reduce.txt, + * doc/figs/example-shift.gv, doc/figs/example-shift.txt, + * doc/figs/example.gv: Update. + * tests/output.at, tests/report.at: Adjust. + +2020-07-02 Akim Demaille + + doc: improve a sentence + * doc/bison.texi: here. + +2020-07-01 Akim Demaille + + news: formatting changes + +2020-07-01 Akim Demaille + + news, todo: update + +2020-06-30 Akim Demaille + + doc: clarify that the pcontext interface is *.c only + Reported by Rici Lake. + https://lists.gnu.org/r/bug-bison/2020-06/msg00054.html + + * doc/bison.texi (Syntax Error Reporting Function): Make it clear that + this is not exported. + Remove C++ details that landed in the C doc. + +2020-06-30 Akim Demaille + + doc: use color in the cex examples + * doc/bison.texi: here. + And use smallexample when it no longer fits in PDF. + +2020-06-30 Akim Demaille + + doc: repair the references to the Bibliography + In commit c80cdf2db2b302db4137fabd4ae11e578fa51fca ("doc: simplify + uses of @ref", Jan 27 2020, released in Bison 3.6), I broke the + references to the Bibliography. For instance: + + For a more detailed exposition of the mysterious behavior in LALR parsers + -and the benefits of IELR, @pxref{Bibliography,,Denny 2008 March}, and + -@ref{Bibliography,,Denny 2010 November}. + +and the benefits of IELR, @pxref{Bibliography}, and + +@ref{Bibliography}. + + which results in "see Bibliography" twice, instead of the more precise + reference. + + * doc/bison.texi (@pcite, @tcite): New. + Use them instead of @ref to Bibliography. + Cite only the first author (that's what we did for the other entries). + +2020-06-30 Vincent Imbimbo + + doc: cex documentation + * NEWS, doc/bison.texi: Add documentation for conflict counterexample + generation. + +2020-06-30 Akim Demaille + + doc: update Doxygen template file + * doc/Doxyfile.in: here. + +2020-06-29 Akim Demaille + + yacc.c: push: don't clear the parser state when accepting/rejecting + Currently when a push parser finishes its parsing (i.e., it did not + return YYPUSH_MORE), it also clears its state. It is therefore + impossible to see if it had parse errors. + + In the context of autocompletion, because error recovery might have + fired, the parser is actually already in a different state. For + instance on `(1 + + ` in the bistromathic, because there's a + `exp: "(" error ")"` recovery rule, `1 + +` tokens have already been + popped, replaced by `error`, and autocompletions think we are ready + for the closing ")". So here, we would like to see if there was a + syntax error, yet `yynerrs` was cleared. + + In the case of a successful parse, we still have a problem: if error + recovery succeeded, we won't know it, since, again, `yynerrs` is + clearer. + + It seems much more natural to leave the parser state available for + analysis when there is a failure. + + To reuse the parser, we should either: + + 1. provide an explicit means to reinitialize a parser state for future + parses. + + 2. automatically reset the parser state when it is used in a new + parse. + + Option 2 requires to check whether we need to reinitialize the parser + each time we call `yypush_parse`, i.e., each time we give a new token. + This seems expensive compared to Option 1, but benchmarks revealed no + difference. Option 1 is incompatible with the documentation + ("After `yypush_parse` returns a status other than `YYPUSH_MORE`, the + parser instance `yyps` may be reused for a new parse."). + + So Option 2 wins, reusing the private `yynew` member to record that a + parse was finished, and therefore that the state must reset in the + next call to `yypull_parse`. + + While at it, this implementation now reuses the previously enlarged + stacks from one parse to another. + + * data/skeletons/yacc.c (yypstate_new): Set up the stacks in their + initial configurations (setting their bottom to the stack array), and + use yypstate_clear to reset them (moving their top to their bottom). + (yypstate_delete): Adjust. + (yypush_parse): At the beginning, clear yypstate if needed, and at the + end, record when yypstate needs to be clearer. + + * examples/c/bistromathic/parse.y (expected_tokens): Do not propose + autocompletion when there are parse errors. + * examples/c/bistromathic/bistromathic.test: Check that case. + +2020-06-29 Akim Demaille + + bistromathic: don't display undefined locations + Currently, completion when there is a syntax error shows broken + locations. + + * examples/c/bistromathic/parse.y (expected_tokens): Initialize the + location. + * examples/c/bistromathic/bistromathic.test: Check that. + +2020-06-29 Akim Demaille + + yacc.c: simplify initialization of push parsers + The previous commit ("yacc.c: declare and initialize and the same + time") made b4_initialize_parser_state_variables useless. + + * data/skeletons/yacc.c (b4_initialize_parser_state_variables): Inline + into... + (yypstate_clear): here. + +2020-06-29 Akim Demaille + + regen + +2020-06-29 Akim Demaille + + yacc.c: declare and initialize and the same time + In order to factor the code of push and pull parsers, the declaration + of the parser's state variable was common (being local variable in + pull parsers, and struct members in push parsers). This result in + rather poor style in pull parser, with first variable declarations, + and then their initializations. + + The initialization is about to differ between push and pull parsers, + so it is no longer worth keeping both cases together. + + * data/skeletons/yacc.c (b4_declare_parser_state_variables): Accept an + argument, and when it is set, initialize the variables. + Adjust dependencies. + +2020-06-29 Akim Demaille + + yacc.c: style changes in push mode + * data/skeletons/yacc.c: here. + +2020-06-29 Akim Demaille + + yacc.c: simplify yypull_parse + Currently yypull_parse takes a yypstate* as argument, and accepts it + to be NULL. This does not seem to make a lot of sense: rather it is + its callers that should do that. + + I believe this is historical: yypull_parse was introduced + first (c3d503425f8014b432601a33b3398446d63b5963), with yyparse being a + macro. So yyparse could hardly deal with memory allocation properly. + In 7172e23e8ffb95b8cafee24c4f36c46ca709507f that yyparse was turned + into a genuine function. At that point, it should have allocated its + own yypstate*, which would have left yypull_parse deal with only one + single non-null ypstate* argument. + + Fortunately, it is nowhere documented that it is valid to pass NULL to + yypull_parse. It is now forbidden. + + * data/skeletons/yacc.c (yypull_parse): Don't allocate a yypstate. + Needs a location to issue the error message. + (yyparse): Allocate the yypstate. + +2020-06-29 Akim Demaille + + doc: tidy the text files + * etc/README: Rename/reformat as... + * etc/README.md: this. + And ship it. + +2020-06-29 Akim Demaille + + bench: simplify the `rand` target + * etc/bench.pl.in: There is no need to recompile the bench cases + themselves. + +2020-06-29 Akim Demaille + + bench: make it easy to edit the generated files + * etc/bench.pl.in (&compile): Generate rules that compile the + generated files independently of the source files. + +2020-06-29 Akim Demaille + + tests: don't use $VERBOSE + It is used by the test suite itself, which results in this test + failing. + + * tests/c++.at: Use $DEBUG, not $VERBOSE. + +2020-06-28 Akim Demaille + + doc: overhaul of the readmes + * README-hacking.md (Working from the Repository): Make it first to + make it easier to find the instructions to build from the repo. + (Implementation Notes): New. + * README: Provide more links. + +2020-06-28 Akim Demaille + + java: rename package as api.package + * data/skeletons/lalr1.java: here. + * doc/bison.texi: Update. + * src/muscle-tab.c: Ensure backward compat. + * tests/java.at: Check it. + +2020-06-28 Akim Demaille + + style: shift/reduce, not shift-reduce + * src/reader.c: here. + +2020-06-27 Akim Demaille + + style: rename endtoken as eoftoken + * src/symtab.h, src/symtab.c (endtoken): Rename as... + (eoftoken): this. + Adjust dependencies. + +2020-06-27 Akim Demaille + + news: fixes + Reported by Jacob L. Mandelson. + + * NEWS: here. + +2020-06-27 Akim Demaille + + style: use 'nonterminal' consistently + * doc/bison.texi: Formatting changes. + * src/gram.h, src/gram.c (nvars): Rename as... + (nnterms): this. + Adjust dependencies. + (section): New. Use it. + Replace "non terminal" and "non-terminal" by "nonterminal". + +2020-06-27 Akim Demaille + + doc: parse.assert in C++ requires RTTI + * doc/bison.texi (%define Summary): Say it. + +2020-06-27 Akim Demaille + + c++: by default, use const std::string for file names + Reported by Martin Blais and Yuriy Solodkyy. + https://lists.gnu.org/r/help-bison/2020-05/msg00011.html + https://lists.gnu.org/r/bug-bison/2020-06/msg00038.html + + While at it, modernize filename_type as api.filename.type and document + it properly. + + * data/skeletons/c++.m4 (filename_type): Rename as... + (api.filename.type): this. + Default to const std::string. + * data/skeletons/location.cc (position, location): Expose the + filename_type type. + Use api.filename.type. + * doc/bison.texi (%define Summary): Document api.filename.type. + (C++ Location Values): Document position::filename_type. + * src/muscle-tab.c (muscle_percent_variable_update): Ensure backward + compatibility. + * tests/c++.at: Check that using const file names is ok. + tests/input.at: Check backward compat. + +2020-06-27 Akim Demaille + + ielr: fix crash on memory management + Reported by Dwight Guth. + https://lists.gnu.org/r/bug-bison/2020-06/msg00037.html + + * src/AnnotationList.c (AnnotationList__computePredecessorAnnotations): + Beware that SBITSET__FOR_EACH nests _two_ for-loops, so "break" does + not actually break out of it. + That was the only occurrence in the code. + * src/Sbitset.h (SBITSET__FOR_EACH): Warn passersby. + +2020-06-25 Akim Demaille + + style: factor the access to a rule from its items + * src/counterexample.c (item_rule): Move to... + * src/counterexample.h: here. + * src/AnnotationList.c, src/counterexample.c, src/ielr.c: Use it. + +2020-06-25 Akim Demaille + + style: clean up nullable + * src/nullable.c: Reduce scopes. + Prefer `r` to `rules_ruleno`, which is truly an ugly name. + +2020-06-25 Akim Demaille + + style: clean up ielr + * src/AnnotationList.c, src/ielr.c: Fix include order. + Prefer `res` to `result`. + Reduce scopes. + Be free of the oldish 76 cols limitation when it clutters too much the + code. + Denest when possible (we're starving for horizontal width). + +2020-06-23 Akim Demaille + + don't use strlen to compute visual width + * src/output.c (prepare_symbol_names): Use mbswidth. + +2020-06-23 Akim Demaille + + doc: use dot/'•' rather than point/'.' + AFAICT, "dotted rule" is a more frequent synonym of "item" than + "pointed rule". So let's migrate to using "dot" only. + + * doc/bison.texi: Use dot/'•' rather than point/'.'. + + * src/print-xml.c (print_core): Use dot rather than point. This is + not backward compatible, but AFAICT, we don't have actual user of the + XML output (but ourselves). So... + * data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl, + * data/xslt/xml2xhtml.xsl, tests/report.at: ... adjust. + +2020-06-23 Akim Demaille + + cex: display all the S/R conflicts, not just one per (state, rule) + Before this commit, on + + %% + exp + : "if" exp "then" exp + | "if" exp "then" exp "else" exp + | exp "+" exp + | "num" + + we used to not display the third counterexample below: + + Shift/reduce conflict on token "+": + Example exp "+" exp . "+" exp + First derivation exp ::=[ exp ::=[ exp "+" exp . ] "+" exp ] + Second derivation exp ::=[ exp "+" exp ::=[ exp . "+" exp ] ] + + Shift/reduce conflict on token "else": + Example "if" exp "then" "if" exp "then" exp . "else" exp + First derivation exp ::=[ "if" exp "then" exp ::=[ "if" exp "then" exp . ] "else" exp ] + Second derivation exp ::=[ "if" exp "then" exp ::=[ "if" exp "then" exp . "else" exp ] ] + + Shift/reduce conflict on token "+": + Example "if" exp "then" exp . "+" exp + First derivation exp ::=[ exp ::=[ "if" exp "then" exp . ] "+" exp ] + Second derivation exp ::=[ "if" exp "then" exp ::=[ exp . "+" exp ] ] + + Shift/reduce conflict on token "+": + Example "if" exp "then" exp "else" exp . "+" exp + First derivation exp ::=[ exp ::=[ "if" exp "then" exp "else" exp . ] "+" exp ] + Second derivation exp ::=[ "if" exp "then" exp "else" exp ::=[ exp . "+" exp ] ] + + * src/counterexample.c (counterexample_report_state): Don't stop of + the first conflicts. + * tests/conflicts.at, tests/counterexample.at, tests/diagnostics.at, + * tests/report.at: Adjust. + +2020-06-22 Akim Demaille + + cex: don't display twice unifying examples if there is no color + It makes no sense, and is actually confusing, to display twice the + same example with no visible difference. + + * src/complain.h, src/complain.c (is_styled): New. + * src/counterexample.c (print_counterexample): Display the unified + example a second time only if it makes a difference. + * tests/conflicts.at, tests/counterexample.at, tests/report.at: Adjust. + * tests/diagnostics.at: Make sure we do display the unifying examples + twice when colors are enabled. And check those colors. + +2020-06-22 Vincent Imbimbo + + cex: fix reporting of null nonterminals + I implemented this to print A ::= [ ], but A ::= [ %empty ] might be + clearer. + + * src/parse-simulation.c (nullable_closure): Don't generate null + nonterminal derivations as leaves. + * src/derivation.c (derivation_print_impl): Don't print seperator + spaces for null nonterminal. + * tests/counterexample.at: Update test results. + +2020-06-22 Akim Demaille + + cex: use the bullet in HTML + * data/xslt/xml2xhtml.xsl: here. + +2020-06-19 Akim Demaille + + cex: style changes + * src/counterexample.c: Simplify a bit. + * src/parse-simulation.c, src/parse-simulation.h: Enforce coding style. + +2020-06-16 Akim Demaille + + c++: get rid of global_tokens_and_yystype + This was a hack to make it easier for people to migrate from yacc.c to + lalr1.cc and from glr.c to glr.cc: when set, YYSTYPE and YYLTYPE were + `#defined`. It was never documented (just mentioned in NEWS for Bison + 2.2, 2006-05-19), but was used to simplify the test suite. Stop that: + adjust the test suite to the skeletons, not the converse. + + In C++ use yy::parser::semantic_type, yy::parser::location_type, and + yy::parser::token::MY_TOKEN, instead of YYSTYPE, YYLTYPE and MY_TOKEN. + + * data/skeletons/glr.cc, data/skeletons/lalr1.cc: Remove its support. + * tests/actions.at, tests/c++.at, tests/calc.at: Adjust. + +2020-06-16 Akim Demaille + + cex: don't assume the terminal supports "•" + Use of print_unicode_char suggested by Bruno Haible. + https://lists.gnu.org/r/bug-gettext/2020-06/msg00012.html + + * src/gram.h (print_dot_fallback, print_dot): New. + * src/gram.c, src/derivation.c: Use it. + * tests/counterexample.at, tests/report.at: Adjust the test suite. + * .travis.yml, README-hacking.md: Adjust. + +2020-06-16 Akim Demaille + + cex: also include in the report on --report=counterexamples + And let --report=all include the counterexamples. + + * src/getargs.h, src/getargs.c (report_cex): New. + * src/main.c: Compute counterexamples when -rcex is specified. + * src/print.c: Include the counterexamples when -rcex is specified. + + * tests/conflicts.at, tests/existing.at, tests/local.at: Adjust. + +2020-06-16 Akim Demaille + + cex: also include the counterexamples in the report + The report is the best place to show the details about + counterexamples, since we have the state right under the nose. + + For instance: + + State 7 + + 1 exp: exp . "⊕" exp + 2 | exp . "+" exp + 2 | exp "+" exp . [$end, "+", "⊕"] + 3 | exp . "+" exp + 3 | exp "+" exp . [$end, "+", "⊕"] + + "⊕" shift, and go to state 6 + + $end reduce using rule 2 (exp) + $end [reduce using rule 3 (exp)] + "+" reduce using rule 2 (exp) + "+" [reduce using rule 3 (exp)] + "⊕" [reduce using rule 2 (exp)] + "⊕" [reduce using rule 3 (exp)] + $default reduce using rule 2 (exp) + + Conflict between rule 2 and token "+" resolved as reduce (%left "+"). + + Shift/reduce conflict on token "⊕": + 2 exp: exp "+" exp . + 1 exp: exp . "⊕" exp + Example exp "+" exp • "⊕" exp + First derivation exp ::=[ exp ::=[ exp "+" exp • ] "⊕" exp ] + Example exp "+" exp • "⊕" exp + Second derivation exp ::=[ exp "+" exp ::=[ exp • "⊕" exp ] ] + + Reduce/reduce conflict on tokens $end, "+", "⊕": + 2 exp: exp "+" exp . + 3 exp: exp "+" exp . + Example exp "+" exp • + First derivation exp ::=[ exp "+" exp • ] + Example exp "+" exp • + Second derivation exp ::=[ exp "+" exp • ] + + Shift/reduce conflict on token "⊕": + 3 exp: exp "+" exp . + 1 exp: exp . "⊕" exp + Example exp "+" exp • "⊕" exp + First derivation exp ::=[ exp ::=[ exp "+" exp • ] "⊕" exp ] + Example exp "+" exp • "⊕" exp + Second derivation exp ::=[ exp "+" exp ::=[ exp • "⊕" exp ] ] + + * src/conflicts.h, src/conflicts.c (has_conflicts): New. + * src/counterexample.h, src/counterexample.c (print_counterexample): + Add a `prefix` argument. + (counterexample_report_shift_reduce) + (counterexample_report_reduce_reduce): Show the items when there's a + prefix. + * src/state-item.h, src/state-item.c (print_state_item): + Add a `prefix` argument. + * src/derivation.h, src/derivation.c (derivation_print) + (derivation_print_leaves): Add a prefix argument. + * src/print.c (print_state): When -Wcex is enabled, show the + conflicts. + * tests/report.at: Adjust. + +2020-06-16 Akim Demaille + + cex: indent the diagnostics to highlight the structure + Instead of + + Shift/reduce conflict on token D: + Example A a • D + First derivation s ::=[ A a a ::=[ b ::=[ c ::=[ • ] ] ] d ::=[ D ] ] + Example A a • D + Second derivation s ::=[ A a d ::=[ • D ] ] + + display + + Shift/reduce conflict on token D: + Example A a • D + First derivation s ::=[ A a a ::=[ b ::=[ c ::=[ • ] ] ] d ::=[ D ] ] + Example A a • D + Second derivation s ::=[ A a d ::=[ • D ] ] + + * src/counterexample.c (print_counterexample): Indent. + * tests/counterexample.at: Adjust. + +2020-06-16 Akim Demaille + + cex: don't report the items + Showing the items (with the state numbers) is really something we + should restrict to the report. + + * src/counterexample.c (counterexample_report_shift_reduce) + (counterexample_report_reduce_reduce): Don't show the pointed rules, + we will do that in the report. + * tests/counterexample.at: Adjust. + +2020-06-16 Akim Demaille + + cex: make sure traces go to stderr + * src/parse-simulation.h, src/parse-simulation.c (print_parse_state): + here. + +2020-06-16 Akim Demaille + + cex: add an argument to the reporting functions to specify the stream + * src/conflicts.c (find_state_item_number, report_state_counterexamples): + Move to... + * src/counterexample.h, src/counterexample.c (find_state_item_number) + (counterexample_report_state): this. + Add support for `out` as an argument. + (counterexample_report_reduce_reduce, counterexample_report_shift_reduce): + Accept an `out` argument, and be static. + +2020-06-16 Akim Demaille + + style: more uses of const + * src/print.c, src/state.h, src/state.c: here. + +2020-06-16 Akim Demaille + + Merge 'maint' + * upstream/maint: + maint: post-release administrivia + version 3.6.4 + glr.cc: don't leak glr.c/glr.cc scaffolding to the user + + Some fixes were needed to adjust to recent changes in glr.cc and + glr.c. + + * data/skeletons/glr.cc: Stop messing with the user's epilogue to + insert glr.cc code. We need that code to be inserted _before_ the + user's epilogue, not after. So define b4_glr_cc_pre_epilogue. + * data/skeletons/glr.c: Use it. + +2020-06-15 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-06-15 Akim Demaille + + version 3.6.4 + * NEWS: Record release date. + +2020-06-15 Akim Demaille + + glr.cc: don't leak glr.c/glr.cc scaffolding to the user + Until we have a decent reimplementation of glr.cc, we have to use + tricks to shoehorn C++ symbols to the C engine of glr.c. Some of them + are done via #define. Unfortunately in Bison 3.6 some of these we + done in the header file, which broke valid user code. + + Reported by Egor Pugin. + https://lists.gnu.org/r/bug-bison/2020-06/msg00003.html + + * data/skeletons/glr.cc: Stop playing tricks with b4_pre_epilogue. + (b4_glr_cc_setup, b4_glr_cc_cleanup): New. + Much cleaner way to instal glr.cc's scaffolding around glr.c. + * data/skeletons/glr.c: Adjust to use them. + +2020-06-13 Akim Demaille + + reports: the column width differs from the byte count + From + + "number" shift, and go to state 1 + "Ñùṃéℝô" shift, and go to state 2 + + to + + "number" shift, and go to state 1 + "Ñùṃéℝô" shift, and go to state 2 + + * src/print.c: Use mbswidth, not strlen, to compute visual columns. + * tests/report.at: Adjust. + +2020-06-13 Akim Demaille + + reports: don't escape the labels + Currently we use "quotearg" to escape the strings output in Dot. As a + result, if the user's locale is C for instance, all the non-ASCII are + escaped. Unfortunately graphviz does not interpret this style of + escaping. + + For instance: + + 5 -> 2 [style=solid label="\"\303\221\303\271\341\271\203\303\251\342\204\235\303\264\""] + + was displayed as a sequence of numbers. We now output: + + 5 -> 2 [style=solid label="\"Ñùṃéℝô\""] + + independently of the user's locale. + + * src/system.h (obstack_backslash): New. + * src/graphviz.h, src/graphviz.c (escape): Remove, use + obstack_backslash instead. + * src/print-graph.c: Likewise. + * tests/report.at: Adjust. + +2020-06-13 Akim Demaille + + regen + +2020-06-13 Akim Demaille + + parser: keep string aliases as the user wrote it + Currently our scanner decodes all the escapes in the strings, and we + later reescape the strings when we emit them. + + This is troublesome, as we do not respect the user input. For + instance, when the user writes in UTF-8, we destroy her string when we + write it back. And this shows everywhere: in the reports we show the + escaped string instead of the actual alias: + + 0 $accept: . exp $end + 1 exp: . exp "\342\212\225" exp + 2 | . exp "+" exp + 3 | . exp "+" exp + 4 | . "number" + 5 | . "\303\221\303\271\341\271\203\303\251\342\204\235\303\264" + + "number" shift, and go to state 1 + "\303\221\303\271\341\271\203\303\251\342\204\235\303\264" shift, and go to state 2 + + This commit preserves the user's exact spelling of the string aliases, + instead of interpreting the escapes and then reescaping. The report + now shows: + + 0 $accept: . exp $end + 1 exp: . exp "⊕" exp + 2 | . exp "+" exp + 3 | . exp "+" exp + 4 | . "number" + 5 | . "Ñùṃéℝô" + + "number" shift, and go to state 1 + "Ñùṃéℝô" shift, and go to state 2 + + Likewise, the XML (and therefore HTML) outputs are fixed. + + * src/scan-gram.l (STRING, TSTRING): Do not interpret the escapes in + the resulting string. + * src/parse-gram.y (unquote, parser_init, parser_free, unquote_free) + (handle_defines, handle_language, obstack_for_unquote): New. + Use them to unquote where needed. + * tests/regression.at, tests/report.at: Update. + +2020-06-13 Akim Demaille + + tests: check reports with conflicts and UTF-8 + This is to record the current state of the report, which escapes the + UTF-8 characters (as parse.error="verbose" does), but shouldn't (as + parse.error="detailed" does). + + * tests/report.at: here. + +2020-06-13 Akim Demaille + + style: factor common bits about string scanning + * src/scan-gram.l: here. + +2020-06-13 Akim Demaille + + style: introduce & use STRING_1GROW + * src/flex-scanner.h (STRING_1GROW): New. + * src/scan-gram.l, src/scan-skel.l: Use it. + +2020-06-13 Akim Demaille + + style: reduce scopes + * src/scan-gram.l (STRING_GROW_ESCAPE): Move the static_assert about + type sizes here. + +2020-06-13 Akim Demaille + + style: prefer 'FOO ()' to 'FOO' for function-like macros + * src/flex-scanner.h (STRING_GROW, STRING_FINISH, STRING_FREE): + Make them function-like macros. + Adjust dependencies. + +2020-06-11 Akim Demaille + + regen + +2020-06-10 Akim Demaille + + cex: suggest -Wcounterexamples when there are unexpected conflicts + Suggesting -Wcounterexamples when there are conflicts is probably not + what the user wants. If she knows her conflicts and has set + %expect/%expect-rr appropriately, we shouldn't warn. + + The commit also swaps the counterexamples and the report of conflicts, + into, IMHO, a more natural order: from + + Shift/reduce conflict on token B: + 1: 3 a: A . + 1: 8 y: A . B + Example A • B C + First derivation s ::=[ a ::=[ A • ] x ::=[ B C ] ] + Example A • B C + Second derivation s ::=[ y ::=[ A • B ] c ::=[ C ] ] + + input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] + input.y:4.4: warning: rule useless in parser due to conflicts [-Wother] + + to + + input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] + Shift/reduce conflict on token B: + 1: 3 a: A . + 1: 8 y: A . B + Example A • B C + First derivation s ::=[ a ::=[ A • ] x ::=[ B C ] ] + Example A • B C + Second derivation s ::=[ y ::=[ A • B ] c ::=[ C ] ] + + input.y:4.4: warning: rule useless in parser due to conflicts [-Wother] + + * src/conflicts.c (rule_conflicts_print): Rename as... + (report_rule_expectation_mismatches): this. + Move the handling of report_counterexamples to... + (conflicts_print): Here. + Display this warning when applicable. + +2020-06-10 Akim Demaille + + cex: rename -Wcounterexample as -Wcounterexamples, and support -Wcex + Plural vs. singular is always a problem... + + But we already have conflicts-sr and conflicts-rr, so counterexamples + makes more sense than counterexample. Besides, -Wcounterexample will + still be accepted as an unambiguous prefix of -Wcounterexamples. + + Add -Wcex as a convenient alias. + + While at it, use only "counterexample", never "counter example". + + * src/complain.h, src/complain.c + (Wcounterexample, warning_counterexample): Rename as... + (Wcounterexamples, warning_counterexamples): these. + (argmatch_warning_docs): Rename -Wcounterexample as -Wcounterexamples. + (argmatch_warning_args): Likewise. + Add support for -Wcex. + Adjust dependencies. + +2020-06-09 Akim Demaille + + api.header.include: document it, and fix its default value + While defining api.header.include worked as expected, its default + value was incorrectly defined. As a result, by default, the generated + parsers still duplicated the content of the generated header instead + of including it. + + * data/skeletons/yacc.c (api.header.include): Fix its default value. + * tests/output.at: Check it. + * doc/bison.texi (%define Summary): Document api.header.include. + While at it, move the definition of api.namespace at the proper + place. + +2020-06-07 Akim Demaille + + cex: color the counterexamples + Use colors to show the counterexamples and the derivations in color, + to highlight their structure. Align the outputs, and add i18n + support. Reduce width by using a one-space separator instead of + two-space. + + From + + Example A • B C + First derivation s ::=[ a ::=[ A • ] x ::=[ B C ] ] + Second derivation s ::=[ y ::=[ A • B ] c ::=[ C ] ] + + to + + Example A • B C + First derivation s ::=[ a ::=[ A • ] x ::=[ B C ] ] + Example A • B C + Second derivation s ::=[ y ::=[ A • B ] c ::=[ C ] ] + + with colors. + + * data/bison-default.css (cex-dot, cex-0, cex-1, cex-2, cex-3, cex-4) + (cex-5, cex-6, cex-7, cex-step, cex-leaf): New. + * src/derivation.c (derivation_print_styled_impl): New. + (derivation_print, derivation_print_leaves): Use it. + * src/counterexample.c: Reformat the output. + * tests/counterexample.at: Adjust. + +2020-06-07 Akim Demaille + + cex: enforce case for tokens/nonterminals + It's unfortunate that the traditions between formal language theory + and Yacc differs, but here, tokens should be upper case, and + nonterminals should be lower case. + + * tests/counterexample.at: Comply with this. + +2020-06-07 Akim Demaille + + cex: reformat the s/r and r/r reports + In Bison we refer to "shift/reduce" conflicts, not "shift-reduce" (in + Bison 3.6.3 186 occurrences vs 15). Enforce consistency on this. + + Instead of "spending" a second line for each conflict to report the + lookaheads, put that on the same line as the type of conflict. Also, + prefer "token" to "symbol". Maybe we should even prefer "lookahead". + While at it, enable internationalization, with plurals where + appropriate. + + As a consequence, instead of + + Shift-Reduce Conflict: + 6: 3 b: . %empty + 6: 6 d: c . A + On Symbol: A + + display + + Shift/reduce conflict on token A: + 6: 3 b: . %empty + 6: 6 d: c . A + + * NEWS, doc/bison.texi, src/conflicts.c: Spell it "shift/reduce", not + "shift-reduce". + * src/counterexample.c (counterexample_report_shift_reduce) + (counterexample_report_reduce_reduce): Reformat and internationalize + output. + * tests/counterexample.at: Adjust expectations. + +2020-06-07 Akim Demaille + + style: fix syntax-check issues + * src/counterexample.c, src/files.c, src/files.h, src/lssi.c, + * src/state-item.c: here. + +2020-06-07 Akim Demaille + + all: show the rules in comments before the user actions + For instance, in the case of Bison's own parser: + + - case 40: + + case 40: /* grammar_declaration: "%code" "identifier" "{...}" */ + { + muscle_percent_code_grow ((yyvsp[-1].ID), (yylsp[-1]), + translate_code_braceless ((yyvsp[0].BRACED_CODE), (yylsp[0])), + (yylsp[0])); + code_scanner_last_string_free (); + } + break; + + * data/skeletons/c.m4: Modified. + * data/skeletons/d.m4: Modified. + * data/skeletons/java.m4: Modified. + * src/output.c (output_escaped): New. + (quoted_output): Use it, and rename as... + (output_quoted): this. + Adjust dependencies. + (rule_output): New. + (user_actions_output): Use it. + * data/skeletons/c.m4, data/skeletons/d.m4, data/skeletons/java.m4 + (b4_case): Add support for $3, an optional comment. + +2020-06-06 Akim Demaille + + CI: use GCC10 on ppc too + We were still using GCC9, because GCC10 was failing. + + * .travis.yml (PPC64le): Use GCC10. + While at it, use -O2 instead of -O3: it's certainly nicer for the + CPUs, and allows to test different sets of compiler flags (we use -O3 + in several other configurations). + +2020-06-06 Akim Demaille + + examples: fix missing includes + * examples/c/bistromathic/parse.y: Use abort rather than assert so + that the "unused result" warning is silenced even with -DNDEBUG. + +2020-06-03 Akim Demaille + + warnings: fix -Wmissing-prototypes issues + * src/counterexample.c, src/lssi.c, src/parse-simulation.c, + * src/state-item.c: + Here. + +2020-06-03 Akim Demaille + + Merge maint into HEAD + * upstream/maint: + maint: post-release administrivia + version 3.6.3 + build: check -Wmissing-prototypes + tests: show logs + c++: fix printing of state number on streams + +2020-06-03 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-06-03 Akim Demaille + + version 3.6.3 + * NEWS: Record release date. + +2020-06-01 Akim Demaille + + build: check -Wstrict-aliasing + * configure.ac (warn_common): Add -Wstrict-aliasing. + +2020-06-01 Akim Demaille + + doc: using asan + * README-hacking.md: here. + +2020-06-01 Akim Demaille + + style: fix includes + * src/fixits.c: Follow our usual pattern. + * src/scan-code.l, src/scan-gram.l, src/scan-skel.l: Prefer "" to + include src/ headers. + * README-hacking.md: Document the pattern. + +2020-06-01 Akim Demaille + + lists: fix various issues with the use of gnulib's list + First, we should avoid code such as + + gl_list_iterator_t it = gl_list_iterator (deriv->children); + derivation *child = NULL; + while (gl_list_iterator_next (&it, (const void **) &child, NULL)) + { + derivation_print (child, f); + + because of -Wstrict-aliasing (whose job is to catch type-punning + issues). See https://lists.gnu.org/r/bug-bison/2020-05/msg00039.html. + + Rather we need + + gl_list_iterator_t it = gl_list_iterator (deriv->children); + const void **p = NULL; + while (gl_list_iterator_next (&it, &p, NULL)) + { + derivation *child = (derivation *) p; + derivation_print (child, f); + + Second, list iterators actually have destructors. Even though they + are noop in the case of linked-lists, we should use them. + + Let's address both issues with typed wrappers (such as + derivation_list_next) that take care of both issues, and besides allow + to scope the iterators within the loop: + + derivation *child; + for (gl_list_iterator_t it = gl_list_iterator (deriv->children); + derivation_list_next (&it, &child); + ) + { + derivation_print (child, f); + + * src/derivation.h, src/derivation.c (derivation_list_next): New. + Use it where appropriate. + * src/counterexample.c (search_state_list_next): New. + Use it where appropriate. + * src/parse-simulation.h, src/parse-simulation.c + * src/state-item.h (state_item_list_next): New. + Use it where appropriate. + +2020-06-01 Akim Demaille + + build: check -Wmissing-prototypes + pstate_clear is lacking a prototype. + Reported by Ryan + https://lists.gnu.org/r/bug-bison/2020-05/msg00101.html + + Besides, none of the C examples were compiled with the warning flags. + + * configure.ac (warn_c): Add -Wmissing-prototypes. + * data/skeletons/yacc.c (pstate_clear): Make it static. + * examples/local.mk (TEST_CFLAGS): New. + * examples/c/bistromathic/local.mk, examples/c/calc/local.mk, + * examples/c/lexcalc/local.mk, examples/c/mfcalc/local.mk, + * examples/c/pushcalc/local.mk, examples/c/reccalc/local.mk, + * examples/c/rpcalc/local.mk: + Use it. + + GCC's warn_unused_result is not silenced by a cast to void, so we have + to "use" scanf's result. + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509 + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425 + + Flex generated code produces too many warnings, including things such + as, with ICC: + + examples/c/lexcalc/scan.c(1088): error #1682: implicit conversion + of a 64-bit integral type to a smaller integral type (potential portability problem) + 2259 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + 2260 ^ + 2261 + 2262 + + I am tired of trying to fix Flex's output. The project does not seem + maintained. We ought to avoid it. So, for the time being, don't try + to enable warnings with Flex. + + * examples/c/bistromathic/parse.y, examples/c/reccalc/scan.l: Fix + warnings. + * doc/bison.texi: Discard scanf's return value to defeat + -Werror=unused-result. + +2020-05-31 Akim Demaille + + gnulib: update + +2020-05-25 Akim Demaille + + style: make item_index a truly different type from item_number + See previous commit. + + * src/gram.h (item_index): Make it unsigned. + Fix remaiming issues. + +2020-05-25 Vincent Imbimbo + + style: decouple different uses of item_number + item_number is used for elements of ritem as well as indices into + ritem which is fairly confusing. Introduce item_index to represent + indices into ritem. + + * src/gram.h (item_index): Introduce it for ritem indices. + * src/closure.h, src/closure.c, src/ielr.c, src/lr0.c, + * src/print-graph.c, src/state.h, src/state.h: + Replace uses of item_number with item_index where appropriate. + +2020-05-24 Joshua Watt + + bison: add command line option to map file prefixes + Teaches bison about a new command line option, --file-prefix-map OLD=NEW + (based on the -ffile-prefix-map option from GCC) which causes it to + replace and file path of OLD in the text of the output file with NEW, + mainly for header guards and comments. The primary use of this is to + make builds reproducible with different input paths, and in particular + the debugging information produced when the source code is compiled. For + example, a distro may know that the bison source code will be located at + "/usr/src/bison" and thus can generate bison files that are reproducible + with the following command: + + bison --output=/build/bison/parse.c -d --file-prefix-map=/build/bison/=/usr/src/bison/ parse.y + + Importantly, this will change the header guards and #line directives + from: + + #ifndef YY_BUILD_BISON_PARSE_H + #line 100 "/build/bison/parse.h" + + to + + #ifndef YY_USR_SRC_BISON_PARSE_H + #line 100 "/usr/src/bison/parse.h" + + which is reproducible. + + See https://lists.gnu.org/r/bison-patches/2020-05/msg00016.html + + * src/files.h, src/files.c (spec_mapped_header_file) + (mapped_dir_prefix, map_file_name, add_prefix_map): New. + * src/getargs.c (-M, --file-prefix-map): New option. + * src/output.c (prepare): Define b4_mapped_dir_prefix and + b4_spec_header_file. + * src/scan-skel.l (@ofile@): Output the mapped file name. + * data/skeletons/glr.c, data/skeletons/glr.cc, + * data/skeletons/lalr1.cc, data/skeletons/location.cc, + * data/skeletons/yacc.c: + Adjust. + * doc/bison.texi: Document. + * tests/input.at, tests/output.at: Check. + +2020-05-24 Akim Demaille + + tests: fix expectations + Should have been part of 1ec93ca2a2b4718b5d94871475520a2688b4c5c8. + + * tests/counterexample.at: here. + +2020-05-23 Akim Demaille + + cex: clean the display of conflicted symbols + Instead of `On Symbols: {b,c,}`, display `On Symbols: b, c`. + + * src/counterexample.c (counterexample_report_reduce_reduce): We don't + need braces. + Use commas as a separator, not a terminator. + * tests/counterexample.at: Adjust. + +2020-05-23 Akim Demaille + + tests: show logs + * examples/c/bistromathic/bistromathic.test, examples/test: here. + +2020-05-23 Akim Demaille + + c++: fix printing of state number on streams + Avoid this kind of display: + + LAC: checking lookahead identifier: R4 R3 G^B S5 + + * data/skeletons/lalr1.cc: Convert state_t to int before printing it. + +2020-05-23 Akim Demaille + + c++: fix printing of state number on streams + Avoid this kind of display: + + LAC: checking lookahead identifier: R4 R3 G^B S5 + + * data/skeletons/lalr1.cc: Convert state_t to int before printing it. + +2020-05-23 Vincent Imbimbo + + cex: fix pruning crash + Fixes a crash on Cim's grammar. + https://lists.gnu.org/r/bison-patches/2020-05/msg00107.html + + * src/state-item.c (prune_disabled_paths): Prune forward and backwards + paths in seperate passes. + (prune_forward, prune_backward): New. + (disable_state_item): Change function argument from state_item_number + to state_item. + (state_items_report): Add disabling to graph print-out. + * src/conflicts.c (find_state_item_number, + report_state_counterexamples): Add SI_DISABLED checks. + +2020-05-23 Akim Demaille + + regen + +2020-05-23 Akim Demaille + + kinds: use the symbol kinds where applicable + Instead of generating switch statements with numbers, let's use the + symbol kinds. Not only is this more readable, it also makes reading + diff easier, as a change in symbol numbers won't have such a large + effect on the implementation of symbol actions. + + * data/skeletons/bison.m4 (_b4_symbol_case): Use the symbol kind + rather than its number. + +2020-05-23 Akim Demaille + + kinds: also define the possibly qualified symbol kinds + * data/skeletons/bison.m4 (b4_symbol_kind): Rename as... + (b4_symbol_kind_base): this. + (b4_symbol_kind): New, for fully qualified kind name. + * data/skeletons/lalr1.cc (b4_symbol_kind): New. + Adjust to use b4_symbol_kind where appropriate. + * src/parse-gram.h, src/parse-gram.c: regen. + +2020-05-23 Akim Demaille + + m4: simplify useless quotation + * data/skeletons/bison.m4: The result of b4_symbol is "quoted" + already, no need for m4_expand. + +2020-05-23 Akim Demaille + + m4: use m4_shift2 etc. + * data/skeletons/bison.m4 (m4_shift4): New. + Use them where applicable. + +2020-05-23 Akim Demaille + + tests: show logs + * examples/c/bistromathic/bistromathic.test, examples/test: here. + +2020-05-23 Akim Demaille + + style: spell fixes + * Makefile.am (codespell): New. + * doc/bison.texi: Fixes. + Use @option for options. + * src/lssi.c, src/lssi.h, src/parse-simulation.h, src/state-item.c: + Fix spellos. + +2020-05-23 Akim Demaille + + style: rename user_token_number as code + This should have been done in 3.6, but I wanted to avoid introducing + conflicts into Vincent's work on counterexamples. It turns out it's + completely orthogonal. + + * data/README.md, data/skeletons/bison.m4, data/skeletons/c++.m4, + * data/skeletons/c.m4, data/skeletons/glr.c, data/skeletons/java.m4, + * data/skeletons/lalr1.d, data/skeletons/lalr1.java, + * data/skeletons/variant.hh, data/skeletons/yacc.c, src/conflicts.c, + * src/derives.c, src/gram.c, src/gram.h, src/output.c, + * src/parse-gram.c, src/parse-gram.y, src/print-xml.c, src/print.c, + * src/reader.c, src/symtab.c, src/symtab.h, tests/input.at, + * tests/types.at: + s/user_token_number/code/g. + Plus minor changes. + +2020-05-22 Akim Demaille + + Merge maint into master + * upstream/maint: + fix generated comments + traces: provide a means to get short m4 traces + traces: show the full m4 invocation + +2020-05-22 Vincent Imbimbo + + cex: replace state-item data structures + * src/state-item.h: Add trans, prods, and revs edges to state-item + struct. + (si_trans, si_revs, si_prods_lookup): Remove. + * src/state-item.c, src/lssi.c, src/parse-simulation.c, + * src/counterexample.c: Update state-item API usage accordingly. + +2020-05-22 Vincent Imbimbo + + cex: fix bad reference counting + * src/counterexample.c (si_bfs_free): Fix reference_count + decrementing. + +2020-05-22 Vincent Imbimbo + + cex: fix miscellaneous leaks + * src/counterexample.c (unifying_counterexample): Always free + stage3result when it exists. + * src/conflicts.c (report_state_counterexamples): free leaked bitset. + * src/state-item.c (prune_disabled_paths): free leaked queue. + +2020-05-22 Vincent Imbimbo + + cex: fix counterexample leak + * src/counterexample.c (free_counterexample): New. + Free counterexamples after printing. + +2020-05-22 Vincent Imbimbo + + cex: fix lssi leaks + * src/lssi.c (shortest_path_from_start): Free the root of + shortest_path_from_start search. + Free eligible bitset. + +2020-05-22 Vincent Imbimbo + + cex: fix parse state leaks + * src/parse_simulation.c: Fix bug in parse_state_free. + Free new_root when simulate_reduction generates zero states. + + * src/parse-simulation.c, src/parse-simulation.h + (parse_state_list, parse_state_list_append): New. + * src/parse-simulation.c, src/parse-simulation.h, + * src/counterexample.c: Replace all uses of lists of parse states and + appends to parse_state_lists with the new API. + +2020-05-22 Vincent Imbimbo + + cex: derivation reference counting + * src/derivation.h, src/derivation.c: Make derivation struct opaque. + Add derivation_list type for clarity. + (derivation_list_new): New. + (derivation_list_append): New. + (derivation_list_prepend): New. + (derivation_new_leaf): New constructor for derivations with no + children. + * src/counterexample.c, src/parse-simulation.c, + * src/parse-simulation.h: Replace uses of gl_list_t containing + derivations with derivation_list and its API. + Replace calls of dervation_new using null children with + derivation_new_leaf. + * src/parse-simulation.c: replace ps_chunk and its API with typed + versions si_chunk and deriv_chunk. + * src/parse-simlation.h, src/parse-simulation.c: Remove + parse_state_retain_deriv in favor of derivation reference counting. + * src/counterexample.c: Remove search_state_retain_deriv. + +2020-05-22 Akim Demaille + + cex: style changes in parse-simulation + * src/parse-simulation.c: Formatting changes. + (parse_state_list_new): New. + Use it. + +2020-05-22 Akim Demaille + + cex: style: prefer res for returned value + * src/lssi.c, src/parse-simulation.c: here. + +2020-05-22 Akim Demaille + + cex: fix memory leaks when there are conflicts + * src/counterexample.c (production_step, reduction_step): Release + memory of temporary objects. + +2020-05-22 Akim Demaille + + cex: be sure to always reclaim memory put in hashes + One call to hash_initialize did not provide a function to free memory. + + * src/state-item.c (hash_pair_table_create): New. + Use it. + +2020-05-22 Akim Demaille + + cex: properly reclaim hash's allocated memory + * src/state-item.c: Use hash_free where appropriate. + +2020-05-22 Akim Demaille + + cex: avoid gratuitous heap allocations + There's no need to go for the heap when using gnulib's hash module. + + * src/state-item.c (hash_pair_lookup, hash_pair_remove, + state_sym_lookup): Use the heap Luke. + That removes a leak from hash_pair_lookup. + (init_prods): Use hash_pair_insert instead of duplicating it. + +2020-05-22 Vincent Imbimbo + + cex: fix leaks + * src/state-item.c: Various functions were using heap allocated locals + and not freeing them. + +2020-05-22 Akim Demaille + + style: use hash_xinsert + * gnulib: Update to get hash_xinsert. + Use it where appropriate. + +2020-05-22 Akim Demaille + + cex: style changes in state-item + * src/state-item.h, src/state-item.c (state_item): Make the state + const. + (state_item_set): Make it clearer that it works in the state_items + global array. + +2020-05-22 Akim Demaille + + cex: stylistic changes + * src/counterexample.c: Use 'res' as a variable name for returned + value, as elsewhere. + Avoid uninitialized variables, especially pointers. + Avoid assignment where possible. + +2020-05-22 Akim Demaille + + cex: avoid uninitialized variables + * src/counterexample.c (item_rule_bounds): Split into... + (item_rule_start, item_rule_end): these. + Adjust dependencies. + * src/conflicts.c (find_state_item_number): New. + Use it to avoid uninitialized variables. + +2020-05-22 Akim Demaille + + cex: isolate missing API from gl_list + * src/counterexample.c (list_get_end): New. + Use it. + Reduce scopes. + +2020-05-22 Akim Demaille + + cex: tests: be robust to variations in time limit reports + The CI has "failures" such as (253, "Null nonterminals"): + + @@ -21,7 +21,7 @@ + 3: 3 b: . %empty + 3: 4 c: . %empty + On Symbols: {A,} + -time limit exceeded: 6.000000 + +time limit exceeded: 11.000000 + First Example c • c A A $end + First derivation $accept ::=[ a ::=[ c d ::=[ a ::=[ b ::=[ • ] d ::=[ c A A ] ] ] ] $end ] + Second Example c • A $end + + * tests/counterexample.at (AT_BISON_CHECK_CEX): New. + Use it to neutralize differences in timeout values. + +2020-05-22 Vincent Imbimbo + + cex: fix stack overflow + * src/parse-simulation.c: Replace reference counting with + parse_state_retain everywhere. + (free_parse_state): Make this function iterative instead of + recursive. Long parse_state chains were causing stack exhaustion. + + * tests/counterexample.at: Fix expectations. + +2020-05-22 Vincent Imbimbo + + cex: fix crash from zombie result + Fixes the SEGV in test 247 (counterexample.at:195): "S/R after first + token". + + * src/counterexample.c: here. + * tests/counterexample.at: Fix expectations. + +2020-05-22 Akim Demaille + + cex: fixes, and enable tests + * src/counterexample.c, src/derivation.c: + Do not output diagnostics on stdout, that's the job of stderr, and the + testsuite heavily depend on this. + Do not leave trailing spaces in the output. + * tests/counterexample.at: Use AT_KEYWORDS. + Specify the expected outputs. + * tests/local.mk: Add counterexample.at. + +2020-05-22 Akim Demaille + + cex: fix a crash + * src/state-item.c (init_state_items): If the rule has no reductions + at all, don't read at all in its list of reduced rules. + +2020-05-22 Vincent Imbimbo + + cex: add tests + * tests/counterexample.at: New. + +2020-05-22 Vincent Imbimbo + + cex: bind counterexample generation + * src/complain.h, src/complain.c: Add support for -Wcounterexample. + * src/conflicts.c (report_counterexamples): New. + (rule_conflicts_print): Use it when -Wcounterexample is given. + * src/getargs.h, src/getargs.c: Add support for --trace=cex. + * src/main.c (main): Init and deinit counterexample generation. + +2020-05-22 Vincent Imbimbo + + cex: introduce counterexample search + * src/counterexample.h, src/counterexample.c: New. + +2020-05-22 Vincent Imbimbo + + cex: introduce the parse simulator + * src/derivation.h, src/derivation.c, + * src/parse-simulation.h, src/parse-simulation.c: New. + +2020-05-22 Vincent Imbimbo + + cex: add support for state-item pair graph generation + * src/lssi.h, src/lssi.c, src/state-item.h, src/state-item.c: New. + +2020-05-22 Akim Demaille + + cex: add gnulib dependencies + * bootstrap.conf (gnulib_modules): Add linked-list. + +2020-05-21 Akim Demaille + + fix generated comments + In Bison 3.6.2, the comments with brackets lose their brackets, for + improper m4 quotation. + + * data/skeletons/bison.m4 (b4_gsub): New. + * data/skeletons/c-like.m4 (_b4_comment): Use it. + * tests/m4.at: Check b4_gsub. + +2020-05-21 Akim Demaille + + traces: provide a means to get short m4 traces + Let --trace=m4-early dump all the logs from the start (as --trace=m4 + used to do), and have --trace=m4 now start traces only when actually + working of the user's grammar. + + Can make a big difference in the case of small inputs. E.g. + + $ bison -S tests/testsuite.dir/001/input.m4 tests/testsuite.dir/001/input.y --trace=m4 |& wc + 3952 19446 251068 + $ bison -S tests/testsuite.dir/001/input.m4 tests/testsuite.dir/001/input.y --trace=m4-early |& wc + 19491 131904 1830495 + + * data/skeletons/traceon.m4: New. + * src/getargs.h, src/getargs.c: Introduce --trace=m4-early. + * src/output.c (output_skeleton): Adjust for --trace=m4 and --trace=m4-early. + +2020-05-21 Akim Demaille + + traces: show the full m4 invocation + Unfortunately the effect of -dV is still position independent. + + * src/output.c (output_skeleton): here. + +2020-05-20 Thomas Petazzoni + + src: make path to m4 relocatable + Commit a4ede8f85b0c9a254fcb01e5888cee1983095669 ("package: make bison + a relocatable package") made Bison relocatable, but in fact it still + contains one absolute reference: the M4 variable, which points to the + M4 program. Let's fix that by using relocate(), see if an M4 binary is + available at the relocated location, and otherwise fallback to the + original M4 location. + + See https://lists.gnu.org/r/bison-patches/2020-05/msg00078.html, + and https://lists.gnu.org/r/bison-patches/2020-05/msg00087.html. + + * src/files.h, src/files.c (m4path): New. + * src/output.c: Use it. + +2020-05-17 Akim Demaille + + CI: fix PPC recipe + +2020-05-17 Akim Demaille + + Merge branch 'maint' + * upstream/maint: + maint: post-release administrivia + version 3.6.2 + tests: improve update-test + CI: add GCC 10 and Clang 10 + fix: do not emit nested comments + todo: update + examples: use markdown hyperlinks + tests: don't use == to compare const char *... + gnulib: update + +2020-05-17 Akim Demaille + + c: more fixes for _Noreturn + The previous fix was insufficient. + + tests/types.at:366: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o test test.cc $LIBS + ++ ccache clang++-mp-9.0 -Qunused-arguments -ggdb -Wall -Wextra -Wcast-align -Wchar-subscripts -fparse-all-comments -Wdocumentation -Wformat -Wimplicit-fallthrough -Wnull-dereference -Wno-sign-compare -Wno-tautological-constant-out-of-range-compare -Wpointer-arith -Wshadow -Wwrite-strings -Wextra-semi -Wold-style-cast -Wundefined-func-template -Wweak-vtables -Wunreachable-code -Wundef -pedantic -Wconversion -Wdeprecated -Wsign-compare -Wsign-conversion -Wtautological-constant-out-of-range-compare -fno-color-diagnostics -Wno-keyword-macro -Werror -std=c++98 -I/Users/akim/src/gnu/bison/tests -isystem /opt/gostai/include -isystem /opt/local/include -L/opt/gostai/lib -L/opt/local/lib -o test test.cc /Users/akim/src/gnu/bison/_build/c9d/lib/libbison.a -lintl -Wl,-framework -Wl,CoreFoundation + stderr: + test.cc:955:1: error: _Noreturn functions are a C11-specific feature [-Werror,-Wc11-extensions] + _Noreturn static void + ^ + test.cc:963:1: error: _Noreturn functions are a C11-specific feature [-Werror,-Wc11-extensions] + _Noreturn static void + ^ + 2 errors generated. + + * data/skeletons/c.m4 (b4_attribute_define): Do not use _Noreturn at + all in C++, clang or not. + +2020-05-17 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-05-17 Akim Demaille + + version 3.6.2 + * NEWS: Record release date. + +2020-05-17 Akim Demaille + + tests: improve update-test + * build-aux/update-test: When given a directory, use the testsuite.log + which it contains. + Do not accept empty "from"s, as substituting the empty string with + something is rarely a good idea. + +2020-05-17 Akim Demaille + + CI: add GCC 10 and Clang 10 + * .travis.yml: Here. + * tests/input.at, tests/regression.at: Beware of clang's -Wdocumentation. + +2020-05-17 Akim Demaille + + fix: do not emit nested comments + With input such as + + %token yVL_CLOCK "/*verilator sc_clock*/" + + we generate + + yVL_CLOCK = 610, /* "/*verilator sc_clock*/" */ + + which is invalid since the comment will actually be closed on the + first "*/". Let's turn "*/" into "*\/" to avoid this. But GCC will + also warn about "/*" inside a comment, so let's "escape" it too. + + Reported by Huang Rui. + https://github.com/akimd/bison/issues/38 + + * data/skeletons/c-like.m4 (_b4_comment): Escape comment delimiters in + comments. + * tests/input.at (Torturing the Scanner): Check thes cases. + * tests/m4.at: New. + +2020-05-16 Akim Demaille + + c: restore definition of _Noreturn as [[noreturn]] in C++ + c.m4 contains a definition of _Noreturn which is modeled after + gnulib's lib/_Noreturn.h. The latter was recently + changed (b61bf2f0e8bdc1e522ae8e97d57d5625163b42ea) to not using + [[noreturn]] at all, because the uses of _Noreturn in gnulib are + sometimes incompatible with the rules of [[noreturn]]. + + As a result glr.cc started to use _Noreturn in C++, which clang + refuses (all the glr.cc tests currently fail with Clang++). + + * data/skeletons/c.m4 (b4_attribute_define): Restore the definition of + _Noreturn as [[noreturn]] in modern C++. + The generated code uses _Noreturn in places where [[noreturn]] is + valid. + +2020-05-16 Akim Demaille + + examples: don't promote unchecked function calls + * etc/bench.pl.in, examples/c/bistromathic/parse.y, + * examples/c/calc/calc.y, examples/c/pushcalc/calc.y: Check scanf's + return value. + * doc/bison.texi: Likewise, but only for the second example, to avoid + cluttering the very simple case. + +2020-05-16 Akim Demaille + + gnulib: update + +2020-05-15 Akim Demaille + + todo: update + +2020-05-14 Akim Demaille + + examples: use markdown hyperlinks + * examples/c++/README.md, examples/c++/calc++/README.md, + * examples/c/README.md: here. + +2020-05-14 Akim Demaille + + tests: don't use == to compare const char *... + Reported by Dagobert Michelsen. + https://lists.gnu.org/r/bug-bison/2020-05/msg00091.html + + * tests/c++.at: here. + +2020-05-14 Akim Demaille + + gnulib: update + +2020-05-13 Akim Demaille + + tests: improve update-test + * build-aux/update-test: When given a directory, use the testsuite.log + which it contains. + Do not accept empty "from"s, as substituting the empty string with + something is rarely a good idea. + +2020-05-10 Akim Demaille + + Merge branch maint + * maint: + news: update + maint: post-release administrivia + version 3.6.1 + c++: style: reorder generated code + c++: provide yy::parser::symbol_type::name + c++: make parser::symbol_name public + examples: beware of ~/.inputrc + build: also provide lzip compressed tarballs + style: minor fixes + yacc.c: restore ansi-c compatibility + +2020-05-10 Akim Demaille + + news: update + +2020-05-10 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-05-10 Akim Demaille + + version 3.6.1 + * NEWS: Record release date. + +2020-05-10 Akim Demaille + + bench: add support to randomize the order of execution + It's amazing how much the order matters. To a point that many of + these benches are meaningless. For instance (some of the benches + where run with `make -C benches/latest rand + BENCHFLAGS=--benchmark_min_time=3`): + + compiler: g++ -std=c++11 -O2 + 0. %define nofinal + 1. + -------------------------------------------------- + Benchmark Time CPU Iterations + -------------------------------------------------- + BM_y0 1543 ns 1541 ns 441660 + BM_y1 1521 ns 1520 ns 456535 + -------------------------------------------------- + BM_y0 1531 ns 1530 ns 440584 + BM_y1 1512 ns 1511 ns 457591 + -------------------------------------------------- + BM_y0 1539 ns 1538 ns 2749330 + BM_y1 1516 ns 1515 ns 2771500 + -------------------------------------------------- + BM_y0 1571 ns 1570 ns 2600782 + BM_y1 1542 ns 1541 ns 2708349 + -------------------------------------------------- + BM_y0 1530 ns 1529 ns 2670363 + BM_y1 1519 ns 1518 ns 2764096 + + -------------------------------------------------- + Benchmark Time CPU Iterations + -------------------------------------------------- + BM_y1 1529 ns 1528 ns 451937 + BM_y0 1508 ns 1507 ns 453944 + -------------------------------------------------- + BM_y1 1525 ns 1524 ns 2750684 + BM_y0 1516 ns 1515 ns 2794034 + -------------------------------------------------- + BM_y1 1526 ns 1525 ns 2749620 + BM_y0 1515 ns 1514 ns 2808112 + -------------------------------------------------- + BM_y1 1524 ns 1523 ns 4475844 + BM_y0 1502 ns 1501 ns 4611665 + + * etc/bench.pl.in: here. + +2020-05-10 Akim Demaille + + bench: use a Makefile + This makes it much easier to toy with the benchs. + + * etc/bench.pl.in: Generate a Makefile instead of directly compiling + the files. + +2020-05-10 Akim Demaille + + examples: use markdown hyperlinks + * examples/c++/README.md, examples/c++/calc++/README.md, + * examples/c/README.md: here. + +2020-05-10 Akim Demaille + + don't use stdnoreturn + Reported by Paul Eggert. + + * src/getargs.c: We don't need it anyway, since we use _Noreturn. + * data/skeletons/c.m4: While at it, update the definition of _Noreturn + stolen from gnulib. + +2020-05-10 Akim Demaille + + c++: style: reorder generated code + The implementation of yy::parser::symbol_name is emitted even before + the implementation of yy::parser::parser. This makes little sense. + + * data/skeletons/lalr1.cc (symbol_name): Move its implementation in + the same place as in the class definition: after "error" and before + "context". + +2020-05-10 Akim Demaille + + c++: provide yy::parser::symbol_type::name + * data/skeletons/c++.m4 (yy::parser::basic_symbol::name): New. + * data/skeletons/lalr1.cc (yy_print_): Use it. + * doc/bison.texi: Document. + * tests/c++.at: Check. + +2020-05-10 Akim Demaille + + c++: make parser::symbol_name public + Reported by Martin Blais . + https://lists.gnu.org/r/help-bison/2020-05/msg00005.html + + * data/skeletons/lalr1.cc (symbol_name): Make it public. + Add a private hidden hook to enable testing of private parts. + * tests/local.at (AT_DATA_GRAMMAR_PROLOGUE): Help Emacs find the right + language mode. + * tests/c++.at (C++ Variant-based Symbols Unit Tests): Check that we + can read symbol_name. + +2020-05-10 Akim Demaille + + examples: beware of ~/.inputrc + * examples/c/bistromathic/bistromathic.test: here. + +2020-05-10 Akim Demaille + + build: also provide lzip compressed tarballs + Suggested by Matias Fonzo . + + * cfg.mk: Post announcements to bison-announce. + * configure.ac: Build lzip packages. + * .travis.yml: Build only xz, we don't care about the other formats + here. + +2020-05-10 Akim Demaille + + style: minor fixes + * examples/c/README.md: here. + +2020-05-09 Akim Demaille + + yacc.c: restore ansi-c compatibility + Reported by neok-m4700. + https://github.com/akimd/bison/issues/37 + + * data/skeletons/yacc.c: Don't use // comments. + +2020-05-09 Akim Demaille + + bench: use *.cc for C++ + Using *.c is simpler, but triggers annoying warnings with Clang++. + + * etc/bench.pl.in: Please the dictator. + +2020-05-09 Akim Demaille + + style: minor fixes + * examples/c/README.md: here. + +2020-05-09 Akim Demaille + + gnulib: update + +2020-05-08 Akim Demaille + + gnulib: update, and use the attribute module + * gnulib: Update. + * bootstrap.conf: Use attribute. + * src/system.h: Remove macros for attributes. + Adjust dependencies. + * src/scan-gram.l (DEPRECATED): Rename as... + (DEPRECATED_DIRECTIVE): this, to avoid the clash with the DEPRECATED macro. + +2020-05-08 Akim Demaille + + build: also provide lzip compressed tarballs + Suggested by Matias Fonzo . + + * cfg.mk: Post announcements to bison-announce. + * configure.ac: Build lzip packages. + * .travis.yml: Build only xz, we don't care about the other formats + here. + +2020-05-08 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-05-08 Akim Demaille + + version 3.6 + * NEWS: Record release date. + +2020-05-08 Akim Demaille + + examples: beware of portability issue on Windows + Reported by Jannick. + https://lists.gnu.org/r/bug-bison/2020-05/msg00040.html + https://lists.gnu.org/r/bug-bison/2020-05/msg00066.html + + * examples/test (diff_opts): Use --strip-trailing-cr if supported, to + avoid \n vs. \r\n issues. + * examples/c/bistromathic/bistromathic.test: When on MSYS, don't try + to check autocompletion. + +2020-05-08 Akim Demaille + + regen + +2020-05-08 Akim Demaille + + doc: fix the generation of the man page + When there is no bison.1 at all, the procedure fails. + + * doc/local.mk (bison.1): Be robust to cold starts. + +2020-05-08 Akim Demaille + + news: prepare for 3.6 + +2020-05-08 Akim Demaille + + doc: complete the table of symbols + * doc/bison.texi: Add YYEMPTY, YYEOF and YYUNDEF. + +2020-05-07 Akim Demaille + + doc: clarify the glossary item about kinds + * doc/bison.texi (Glossary): here. + +2020-05-06 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-05-06 Akim Demaille + + version 3.5.94 + * NEWS: Record release date. + +2020-05-06 Akim Demaille + + doc: document yypstate_expected_tokens + * doc/bison.texi (Push Parser Interface): Here. + +2020-05-06 Akim Demaille + + doc: restructure the push parser documentation + I don't think it's fair to have yypstate_new, yypstate_delete, + yypush_parse and yypull_parse to have their own section, on par with + yyparse and yylex. Let them be in a single section about push + parsers. And show new/delete first. + + * doc/bison.texi (Push Parser Interface): New. + Fuse the aforementioned sections into it. + +2020-05-06 Akim Demaille + + all: fix the interface of yyexpected_tokens + The user gives yyexpected_tokens a limit: the max number of tokens she + wants to hear about. That's because an error message that reports a + bazillion of possible tokens is useless. + + In that case yyexpected_tokens returned 0, so the user would not know + if there are too many expected tokens or none (yes, that's possible). + + There are several ways to tell the user in which situation she's in: + + - return some E2MANY, a negative value. Then it makes the pattern + + int argsize = yypcontext_expected_tokens (ctx, arg, ARGS_MAX); + if (argsize < 0) + return argsize; + + no longer valid, as for E2MANY (i) the user must generate the error + message anyway, and (ii) she should not return E2MANY + + - return ARGS_MAX + 1. Then it makes it dangerous for the user, as + she has to iterate update `min (ARGS_MAX, argsize)`. + + Returning 0 is definitely simpler and safer for the user, as it tells + her "this is not an error, just generate your message without a list + of expecting tokens". So let's still return 0, but set arg[0] to the + empty token when the list is really empty. + + * data/skeletons/glr.c, data/skeletons/lalr1.cc, data/skeletons/lalr1.java + * data/skeletons/yacc.c (yyexpected_tokens): Put the empty symbol + first if there are no possible tokens at all. + * examples/c/bistromathic/parse.y: Demonstrate how to use that. + +2020-05-05 Akim Demaille + + examples: fix handling of syntax errors + The shell grammar does not allow empty statements in then/else part of + an if, but examples/test failed to catch the syntax errors from the + script it ran. So exited with success anyway. + + You would expect 'set -e' to suffice, but with bash 3.2 actually it + does not. As a matter of fact, I could find a way to have this behave + properly: + + $ cat test.sh + set -e + cleanup () + { + status=$? + echo "cleanup: $status" + exit $status + } + trap cleanup 0 1 2 13 15 + . $1 + s=$? + echo "test.sh: $s" + exit $s + + $ cat bistro.test + if true; then + fi + + $ /bin/sh ./test.sh ./bistro.test + ./bistro.test: line 2: syntax error near unexpected token `fi' + cleanup: 0 + $ echo $? + 0 + + Remove the set -e (or the trap), and tada, it works... So we have to + deal with the error by hand. + + * examples/test ($exit): Replace with... + ($status): this. + Preserve the exit status of the test case. + * examples/c/bistromathic/bistromathic.test: Fix syntax error. + +2020-05-04 Akim Demaille + + doc: beware of timestamp issues on Haiku + On Haiku, help2man is fired on a freshly extracted tarball. + Reported by Bruno Haible. + https://lists.gnu.org/r/bug-bison/2020-05/msg00055.html + + * doc/local.mk (bison.1): Be robust to a missing help2man. + +2020-05-04 Akim Demaille + + tests: beware of wchar_t portability issues on AIX + https://lists.gnu.org/r/bug-bison/2020-05/msg00050.html + Reported by Bruno Haible. + + * tests/diagnostics.at: here. + +2020-05-04 Akim Demaille + + glr.c: beware of portability issues with PTRDIFF_MAX + For instance test 386, "glr.cc api.value.type={double}": + + types.at:366: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o test test.cc $LIBS + stderr: + test.cc: In function 'ptrdiff_t yysplitStack(yyGLRStack*, ptrdiff_t)': + test.cc:490:4: error: 'PTRDIFF_MAX' was not declared in this scope + (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : YY_CAST (ptrdiff_t, SIZE_MAX)) + ^ + test.cc:1805:37: note: in expansion of macro 'YYSIZEMAX' + ptrdiff_t half_max_capacity = YYSIZEMAX / 2 / state_size; + ^~~~~~~~~ + test.cc:490:4: note: suggested alternative: '__PTRDIFF_MAX__' + (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : YY_CAST (ptrdiff_t, SIZE_MAX)) + ^ + test.cc:1805:37: note: in expansion of macro 'YYSIZEMAX' + ptrdiff_t half_max_capacity = YYSIZEMAX / 2 / state_size; + ^~~~~~~~~ + + The failing tests are using glr.cc only, which I don't understand, the + problem is rather in glr.c, so I would expect glr.c tests to also fail. + + Reported by Bruno Haible. + https://lists.gnu.org/archive/html/bug-bison/2020-05/msg00053.html + + * data/skeletons/yacc.c: Move the block that defines + YYPTRDIFF_T/YYPTRDIFF_MAXIMUM, YYSIZE_T/YYSIZE_MAXIMUM, and + YYSIZEOF to... + * data/skeletons/c.m4 (b4_sizes_types_define): Here. + (b4_c99_int_type): Also take care of the #undefinition of short. + * data/skeletons/yacc.c, data/skeletons/glr.c: Use + b4_sizes_types_define. + * data/skeletons/glr.c: Adjust to use YYPTRDIFF_T/YYPTRDIFF_MAXIMUM, + YYSIZE_T/YYSIZE_MAXIMUM. + +2020-05-04 Akim Demaille + + todo: update + +2020-05-04 Akim Demaille + + examples: beware of strnlen portability issues + One function missing on Solaris 10 Sparc: + + CCLD examples/c/bistromathic/bistromathic + Undefined first referenced + symbol in file + strnlen examples/c/bistromathic/bistromathic-parse.o + ld: fatal: symbol referencing errors. No output written to examples/c/bistromathic/bistromathic + + Reported by Dagobert Michelsen. + https://lists.gnu.org/r/bug-bison/2020-05/msg00048.html + + * examples/c/bistromathic/parse.y (xstrndup): Don't use strnlen. + xstrndup is assembled from gnulib's xstrndup, strndup and strnlen... + +2020-05-04 Akim Demaille + + examples: beware of portability issues with sh's trap + On AIX 7.2, when invoking "exit 77", we actually exit with 127. The + "cleanup" function, called via trap, received an incorrect exit + status, something described in Autoconf's doc. + Reported by Bruno Haible. + https://lists.gnu.org/archive/html/bug-bison/2020-05/msg00029.html + https://lists.gnu.org/archive/html/bug-bison/2020-05/msg00047.html + + * examples/test (skip): New. + * examples/c/bistromathic/bistromathic.test, + * examples/c/reccalc/reccalc.test: Use it, to ensure $? is set to 77 + when the trap is called. + +2020-05-04 Akim Demaille + + tests: beware of portability issues with diff -u + AIX 7.1 supports diff -u, but its output does not match the expected + one. + Reported by Bruno Haible. + https://lists.gnu.org/r/bug-bison/2020-05/msg00049.html + + * tests/atlocal.in (DIFF_U_WORKS): New. + * tests/local.at (AT_DIFF_U_CHECK): New. + * tests/existing.at (_AT_TEST_EXISTING_GRAMMAR): Use AT_DIFF_U_CHECK. + +2020-05-03 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-05-03 Akim Demaille + + version 3.5.93 + * NEWS: Record release date. + +2020-05-03 Akim Demaille + + news: update for 3.5.93 + +2020-05-03 Akim Demaille + + gnulib: update + +2020-05-03 Akim Demaille + + tests: really skip tricky multichar test on Cygwin + In Autotest, anything outside AT_SETUP/AT_CLEANUP is discarded. + + * tests/diagnostics.at (AT_TEST): Accept a skip-if test. + Use it to skip on cygwin. + +2020-05-03 Akim Demaille + + bistromathic: beware of portability issues of readline on AIX + Readline may emit escape sequences before the prompt. + Reported by Bruno Haible. + https://lists.gnu.org/r/platform-testers/2020-05/msg00001.html. + + * examples/c/bistromathic/bistromathic.test: Trust readline _only_ if + we get what we expect on some reference computation. + +2020-05-03 Akim Demaille + + examples: beware of portability issues with cmp + As someone wrote nearly 20 years ago in Autoconf's documentation, + don't use cmp to compare text files, but diff. + https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=abad4f0576a7dc361e5385e19c7681449103cdb1 + Reported by Jannick. + + * examples/test: Use diff, not cmp. + +2020-05-03 Akim Demaille + + build: fix warnings (shown on IRIX) + Appearing on IRIX with gcc -mabi=n32. + Reported by Bruno Haible. + https://lists.gnu.org/r/bug-bison/2020-05/msg00039.html + + * examples/c++/variant-11.yy, examples/c/bistromathic/parse.y: Don't + give chars to isdigit, cast them to unsigned char before. + * src/complain.c: Use c_isdigit. + * src/fixits.c (fixits_run): Avoid casts. + * src/lalr.c (goto_print): Use %zu for a size_t. + +2020-05-03 Akim Demaille + + c++: be compatible with the pre-3.6 way to get a symbol's kind + Reported by Pramod Kumbhar. + https://lists.gnu.org/r/bug-bison/2020-05/msg00025.html + + * data/skeletons/c++.m4: here. + +2020-05-03 Akim Demaille + + bistromathic: beware of portability issues with strndup + Reported by Dagobert Michelsen. + https://lists.gnu.org/r/bug-bison/2020-05/msg00026.html + + * examples/c/bistromathic/parse.y (xstrndup): New. + Use it. + +2020-05-03 Akim Demaille + + flex: fix incorrect use of Automake conditional + AM_CONDITIONAL does _not_ define a shell variable... + Reported privately by Denis Excoffier. + + * configure.ac (LEX_CXX_WORKS): Fix its definition. + +2020-05-03 Bruno Haible + + package: fix a link error on IRIX + https://lists.gnu.org/r/bug-bison/2020-05/msg00035.html + + * src/local.mk (src_bison_LDADD): Mention libbison.a before, not after, the + system libraries. + +2020-05-03 Akim Demaille + + bistromathic: beware of portability of readline + Don't try to build bistromathic if we don't have readline. + Reported by Bruno Haible. + https://lists.gnu.org/r/bug-bison/2020-05/msg00028.html + + * configure.ac (ENABLE_BISTROMATHIC): New. + * examples/c/bistromathic/local.mk: Use it. + * examples/c/bistromathic/bistromathic.test: Exit 77 for skip. + +2020-05-03 Akim Demaille + + tests: beware of portability issues of sh + "foo || bar" does not invoke bar on AIX 7.2 when foo does not exist. + It just dies. + Reported by Bruno Haible. + https://lists.gnu.org/r/bug-bison/2020-05/msg00029.html + + * examples/c/reccalc/reccalc.test: Check for seq in a subshell. + +2020-05-03 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-05-03 Akim Demaille + + version 3.5.92 + * NEWS: Record release date. + +2020-05-03 Akim Demaille + + news: update for 3.5.92 + +2020-05-03 Akim Demaille + + gnulib: update + +2020-05-03 Akim Demaille + + java: demonstrate push parsers + * data/skeletons/lalr1.java (Location): Make it a static class. + (Lexer.yylex, Lexer.getLVal, Lexer.getStartPos, Lexer.getEndPos): + These are not needed in push parsers. + * examples/java/calc/Calc.y: Demonstrate push parsers in the Java. + * doc/bison.texi: Push parsers have been supported for a long time, + remove incorrect statements stating the opposite. + +2020-05-03 Akim Demaille + + doc: clarify what a location is + Reported by Arthur Schwarz + https://lists.gnu.org/r/help-bison/2013-12/msg00009.html + + * doc/bison.texi (Location Type): here. + +2020-05-03 Akim Demaille + + tests: beware of mbswidth portability issues + Shy away from these issues on Cygwin. + Reported Denis Excoffier. + https://lists.gnu.org/r/bug-bison/2020-05/msg00003.html + + * tests/diagnostics.at (Tabulations and multibyte characters): Split + in two. + +2020-05-03 Akim Demaille + + examples: beware of intl portability issues + Reported by Horst von Brand. + https://lists.gnu.org/r/bug-bison/2020-04/msg00033.html + + * examples/c/bistromathic/Makefile: libintl might not be needed, but + libm probably is. + * examples/c/bistromathic/parse.y: Include locale.h. + +2020-05-03 Akim Demaille + + examples: beware of portability issues with readline + On OpenBSD 6.5, the prompt is repeated, but not the actual command + line... Don't try to cope with that. + Reported by Bruno Haible. + https://lists.gnu.org/r/bug-bison/2020-05/msg00015.html + + * examples/c/bistromathic/bistromathic.test: Skip when readline behave + this way. + +2020-05-03 Akim Demaille + + examples: beware of the portability of flex --header-file + The option --header was introduced in version 2.5.6. + The option --header-file was introduced in version 2.6.4. + Reported by Bruno Haible. + https://lists.gnu.org/r/bug-bison/2020-05/msg00013.html + + So use --header, and do bother with versions that don't support it. + + * m4/flex.m4: Check whether flex supports --header. + * configure.ac (FLEX_WORKS, FLEX_CXX_WORKS): Set to false if it doesn't. + * * examples/c/reccalc/local.mk, examples/c/reccalc/Makefile: + Use --header rather than --header-file. + +2020-05-03 Akim Demaille + + c++: provide backward compatibility on by_type + To write unit tests for their scanners, some users depended on + symbol_type::token(): + + Lexer lex("12345"); + symbol_type t = lex.nextToken(); + assert(t.token() == token::INTLIT); + assert(t.value.as() == 12345); + + But symbol_type::token() was removed in Bison 3.5 because it relied on + a conversion table. So users had to find other patterns, such as + + assert(t.type_get() == by_type(token::INTLIT).type_get()); + + which relies on several private implementation details. + + As part of transitioning from "token type" to "token kind", and making + this a public and documented interface, "by_type" was renamed + "by_kind" and "type_get()" was renamed as "kind()". The latter had + backward compatibility mechanisms, not the former. + + In Bison 3.6 none of this should be used, but rather + + assert(t.kind() == symbol_kind::S_INTLIT); + + Reported by Pramod Kumbhar. + https://lists.gnu.org/r/bug-bison/2020-05/msg00012.html + + * data/skeletons/c++.m4 (by_type): Make it an alias to by_kind. + +2020-05-02 Akim Demaille + + yacc.c: improve formatting of the generated code + * data/skeletons/yacc.c (yy_reduce_print): here. + +2020-05-02 Akim Demaille + + doc: java supports push parsers since 3.0 (2013-07-25) + * doc/bison.texi: Clarify this. + +2020-05-02 Akim Demaille + + java: fix coding style + I don't plan to fix everything in one go. But this was in the way of + the next commit. + + * data/skeletons/lalr1.java: Avoid space before parens. + * tests/java.at: Adjust. + +2020-05-02 Akim Demaille + + style: comment changes + * tests/java.at: here. + +2020-05-02 Akim Demaille + + todo: more + +2020-05-02 Akim Demaille + + style: more documentation about errs + Suggested by Angelo Borsotti. + https://lists.gnu.org/r/bug-bison/2014-02/msg00003.html + + * src/state.h: here. + +2020-05-01 Akim Demaille + + doc: document the exit status + Suggested by Alexandre Duret-Lutz. + https://lists.gnu.org/r/bug-bison/2013-09/msg00015.html + + * doc/bison.texi (Invocation): Here. + +2020-05-01 Akim Demaille + + java: add missing i18n requests + * data/skeletons/lalr1.java (reportSyntaxError): Here. + +2020-05-01 Akim Demaille + + java: style: fix coding style of yyerror/reportSyntaxError + * data/skeletons/lalr1.java: here. + +2020-05-01 Akim Demaille + + java: avoid useless work + * data/skeletons/lalr1.java (yySymbolPrint): Avoid the computation of + the argument if useless. + While at it, fix Java coding style. + +2020-05-01 Akim Demaille + + java: comment changes + * data/skeletons/lalr1.java, examples/java/calc/Calc.y: here. + +2020-05-01 Akim Demaille + + news: make it more consistent + * NEWS: Use the same pattern for titles. + +2020-05-01 Akim Demaille + + c++: use modern idioms to make classes non-copyable + Reported by Don Macpherson. + https://lists.gnu.org/r/bug-bison/2019-05/msg00015.html + https://github.com/akimd/bison/issues/36 + + * data/skeletons/lalr1.cc, data/skeletons/stack.hh, + * data/skeletons/variant.hh: Delete the copy-ctor and the copy operator. + +2020-04-30 Akim Demaille + + yacc.c: avoid the use of a temporary + * data/skeletons/yacc.c: Use YYLLOC_DEFAULT directly with the final + destination. + +2020-04-29 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-04-29 Akim Demaille + + version 3.5.91 + * NEWS: Record release date. + +2020-04-29 Akim Demaille + + build: fix syntax-check issues + * cfg.mk: We do want to gettextize the examples. + * po/POTFILES.in: Adjust. + +2020-04-29 Akim Demaille + + gnulib: update + +2020-04-29 Akim Demaille + + doc: document YYEOF, YYUNDEF and YYerror + * doc/bison.texi (Special Tokens): New. + * examples/c/bistromathic/parse.y: Formatting changes. + +2020-04-29 Akim Demaille + + package: fix distcheck + Bison emits strings to translate in the generated code, for builtin + tokens. So they appear only in generated parsers, which are not + shipped, so they are not in the src tree, so we cannot use them in our + POTFILE. + + Except src/parse-gram.c, which is in the source tree. And even in the + git repo. But to avoid useless diffs in the repo, we do not keep the + src/parse-gram.c _with_ the #lines. This is done in a dist-hook which + regenerates src/parse-gram.c when we run "make dist". + + Unfortunately, then, update-po traverses the whole tree and sees that + the location of the strings to translate in src/parse-gram.c have + changed, so the bison.pot is to be updated. And that is not possible + in the "make dist" which is run within "make distcheck" + (not the one preparing the dist for distcheck, the one run by + distcheck to check that a distributed tarball can build a tarball) + because then the src tree is read-only. + + So let's not put src/parse-gram.c in the POTFILE, and expose these + strings to gettextize by hand. + + * src/i18n-strings.c: New. + * po/POTFILES.in: Add it, and remove src/parse-gram.c. + +2020-04-29 Akim Demaille + + style: avoid gettextize warnings + * src/scan-gram.l, src/scan-skel.l: Help it see the start and end of + "character literals". + +2020-04-29 Akim Demaille + + tests: beware of portability of readline + * examples/test: here. + +2020-04-28 Akim Demaille + + yacc.c: install backward compatibility for YYERRCODE + Some people have been using that symbol. Some even have #defined it + themselves. + https://lists.gnu.org/r/bison-patches/2020-04/msg00138.html + + Let's provide backward compatibility, having it point to YYUNDEF, so + that an error message is generated. + + * data/skeletons/yacc.c (YYERRCODE): New, at the exact same location + it was defined before. + +2020-04-28 Akim Demaille + + style: c++: s/type/kind/ where appropriate + These are internal details. `type_get ()` is still there to ensure + backward compatibility, `kind ()` being the modern way. + + * data/skeletons/c++.m4 (by_type, by_type::type): Rename as... + (by_kind, by_kind::kind_): this. + Adjust dependencies. + +2020-04-28 Akim Demaille + + java: clean up the definition of token kinds + From + + public interface Lexer { + /* Token kinds. */ + /** Token number, to be returned by the scanner. */ + static final int YYEOF = 0; + /** Token number, to be returned by the scanner. */ + static final int YYERRCODE = 256; + /** Token number, to be returned by the scanner. */ + static final int YYUNDEF = 257; + /** Token number, to be returned by the scanner. */ + static final int BANG = 258; + ... + /** Deprecated, use b4_symbol(0, id) instead. */ + public static final int EOF = YYEOF; + + to + + public interface Lexer { + /* Token kinds. */ + /** Token "end of file", to be returned by the scanner. */ + static final int YYEOF = 0; + /** Token error, to be returned by the scanner. */ + static final int YYerror = 256; + /** Token "invalid token", to be returned by the scanner. */ + static final int YYUNDEF = 257; + /** Token "!", to be returned by the scanner. */ + static final int BANG = 258; + ... + /** Deprecated, use YYEOF instead. */ + public static final int EOF = YYEOF; + + * data/skeletons/java.m4 (b4_token_enum): Display the symbol's tag in + comment. + * data/skeletons/lalr1.java: Address overquotation issue. + * examples/java/calc/Calc.y, examples/java/simple/Calc.y: Use YYEOF, + not EOF. + +2020-04-28 Akim Demaille + + error: rename the error token from YYERRCODE to YYerror + See https://lists.gnu.org/r/bison-patches/2020-04/msg00162.html. + + * data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/glr.cc, + * data/skeletons/lalr1.java, doc/bison.texi, + * examples/c/bistromathic/parse.y, src/scan-gram.l, src/symtab.c + (YYERRCODE): Rename as... + (YYerror): this. + Adjust dependencies. + +2020-04-27 Akim Demaille + + dogfooding: use YYERRCODE in our scanner + * src/scan-gram.l: Use it. + * tests/input.at: Adjust. + +2020-04-27 Akim Demaille + + scanner: avoid spurious errors about empty character literals + On an invalid character literal such as "'\777'" we used to produce + two errors: + + input.y:2.9-12: error: invalid number after \-escape: 777 + input.y:2.8-13: error: empty character literal + + Get rid of the second one. + + * src/scan-gram.l (STRING_GROW_ESCAPE): New. + * tests/input.at: Adjust. + +2020-04-27 Akim Demaille + + scanner: bad character literals are errors + * src/scan-gram.l: These are errors, not warnings. + * tests/input.at: Adjust. + +2020-04-27 Akim Demaille + + regen + +2020-04-26 Akim Demaille + + todo: update + +2020-04-26 Akim Demaille + + all: don't emit an error message when the scanner returns YYERRCODE + I'm quite pleased to see that the tricky case of glr.c was already + prepared by the changes to support syntax_error exceptions. Better + yet, it is actually syntax_error that becomes a special case of the + general pattern: make yytoken be YYERRCODE. + + * data/skeletons/glr.c (YYFAULTYTOK): Remove the now useless (Basil) + Faulty token. + Instead, use the error token. + * data/skeletons/lalr1.d, data/skeletons/lalr1.java: When computing + the action, first check the case of the error token. + + * tests/calc.at: Check cases for the error token symbols before and + after it. + +2020-04-26 Akim Demaille + + c: don't emit an error message when the scanner returns YYERRCODE + * data/skeletons/yacc.c (yyparse): When the scanner returns YYERRCODE, + go directly to error recovery (yyerrlab1). + However, don't keep the error token as lookahead, that token is too + special. + * data/skeletons/lalr1.cc: Likewise. + + * examples/c/bistromathic/parse.y (yylex): Use that feature to report + nicely invalid characters. + * examples/c/bistromathic/bistromathic.test: Check that. + * examples/test: Neutralize gratuitous differences such as rule + position. + + * tests/calc.at: Check that case in C only. + The other case seem to be working, but that's an illusion that the + next commit will address (in fact, they can enter endless loops, and + report the error several times anyway). + +2020-04-26 Akim Demaille + + examples: bistromathic: demonstrate error recovery + * examples/c/bistromathic/parse.y: here. + * examples/c/bistromathic/bistromathic.test: Check it. + Included a stupid case where the error is actually ignored. + +2020-04-26 Akim Demaille + + examples: bistromathic: when quitting, close the current line + When the user ctrl-d the line, we left the cursor not at col 0. + Let's fix that. + This revealed a few short-comings in the testing framework. + + * examples/test (run): Also display the diffs. + And support -n. + * examples/c/bistromathic/bistromathic.test + * examples/c/bistromathic/parse.y + +2020-04-26 Akim Demaille + + examples: bistromathic: comment changes + * examples/c/bistromathic/parse.y: here. + +2020-04-26 Akim Demaille + + doc: hacking tricks + * README-hacking.md: Here. + +2020-04-26 Akim Demaille + + c++: make valid to print the empty symbol + * data/skeletons/lalr1.cc (yy_print_): here. + +2020-04-26 Akim Demaille + + c++: always define symbol_name + * data/skeletons/lalr1.cc (symbol_name): Always define it, even when + it's actually yytname which is used. + +2020-04-26 Akim Demaille + + c++: fix a few style issues + * data/skeletons/lalr1.cc (yystack_print_, yy_reduce_print_): Add + missing const. + (yystack_print_): Rename as... + (yy_stack_print_): this. + * data/skeletons/glr.cc (yy_symbol_value_print_, yy_symbol_print_): + Add missing const. + +2020-04-26 Akim Demaille + + all: prefer YYERRCODE to YYERROR + We will not keep YYERRCODE anyway, it causes backward compatibility + issues. So as a first step, let all the skeletons use that name, + until we have a better one. + + * data/skeletons/bison.m4, data/skeletons/glr.c, + * data/skeletons/glr.cc, data/skeletons/lalr1.cc, + * data/skeletons/lalr1.d, data/skeletons/lalr1.java, + * data/skeletons/yacc.c, doc/bison.texi, tests/headers.at, + * tests/input.at: + here. + +2020-04-26 Akim Demaille + + style: glr.c: clarify + * data/skeletons/glr.c: Make the code a bit clearer. + +2020-04-26 Akim Demaille + + style: prefer b4_has_translations_if + * data/skeletons/glr.c, data/skeletons/yacc.c: here. + +2020-04-26 Akim Demaille + + style: glr.c: fix indentation issue + * data/skeletons/glr.c (yyparse): here. + +2020-04-26 Akim Demaille + + style: fix a few remaining 'type' instead of 'kind' + * data/skeletons/glr.c, data/skeletons/yacc.c (YY_SYMBOL_PRINT): + Here. + +2020-04-26 Akim Demaille + + skeletons: make the warning about implementation details clearer + * data/skeletons/bison.m4 (b4_disclaimer): Here. + * data/skeletons/lalr1.d, data/skeletons/lalr1.java: Use it. + +2020-04-25 Akim Demaille + + style: c: fix a few minor issues about indentation of cpp directives + * README-hacking.md: More about cpp. + * data/skeletons/c.m4, data/skeletons/yacc.c: Style changes. + +2020-04-25 Akim Demaille + + bench: store in benches/012 rather than in benches/12 + * etc/bench.pl.in ($basedir): New. + Format $count with a least three digits. + +2020-04-25 Akim Demaille + + bench: minor improvements + * etc/bench.pl.in: Don't force parse.error=detailed + Use a simpler way to display the pseudo %bison directive. + (&bench_with_gbenchmark): Give details about the compiler. + +2020-04-25 Akim Demaille + + style: clarify #endif + We could try to avoid the weird "#if 1", but then the indentation of + the inner #if would be wrong. Let' keep it this way. + + * data/skeletons/yacc.c: here. + Also, avoid sticking the comment to the directive. + +2020-04-25 Akim Demaille + + style: minor fixes + * data/skeletons/bison.m4, doc/bison.texi: Spell check. + * examples/c/bistromathic/parse.y (N_): Remove, now useless. + +2020-04-24 Akim Demaille + + examples: bistromathic: shorten token description + * examples/c/bistromathic/parse.y: "number" is enough. + * doc/bison.texi: Likewise. + +2020-04-24 Akim Demaille + + examples: bistromathic: demonstrate internationalization + Currently it was only using stubs. Let's actually translate the + strings using gettext. + + * examples/c/bistromathic/local.mk: Define LOCALEDIR, BISON_LOCALEDIR + and link with libintl. + * examples/c/bistromathic/parse.y: Use them. + Remove useless includes. + Take ENABLE_NLS into account. + (error_format_string): New. + (yyreport_syntax_error): Rewrite to rely on a format string, which is + more appropriate for internationalization. + * examples/c/bistromathic/Makefile: We no longer use Flex. + We need readline and intl. + + * doc/bison.texi: Point to bistromathic for a better option for + internationalization. + * po/POTFILES.in: Add bistromathic. + +2020-04-24 Akim Demaille + + todo: update for YYERRCODE + +2020-04-24 Akim Demaille + + regen + +2020-04-24 Akim Demaille + + diagnostics: fix a typo + * src/complain.c: here. + +2020-04-20 Akim Demaille + + c, c++: provide a default definition for N_ + In C/C++, N_ is a no-op. Define it if the user didn't. + Suggested by Frank Heckenbach. + https://lists.gnu.org/r/bug-bison/2020-04/msg00010.html + + * src/output.c (prepare_symbol_names): Rename has_translations as + has_translations_flag. + * data/skeletons/bison.m4 (b4_has_translations_if): New. + * data/skeletons/java.m4 (b4_trans): Use it. + + * data/skeletons/glr.c, data/skeletons/lalr1.cc, data/skeletons/yacc.c + (N_): Provide a default definition. + +2020-04-19 Akim Demaille + + i18n: also look in src/parse-gram.c + Some strings appears in the generated file only, e.g., translation of + "end of file". So don't forget to go and see there. + +2020-04-19 Akim Demaille + + style: fix comments + * data/skeletons/glr.c, data/skeletons/lalr1.cc, + * data/skeletons/yacc.c: here. + +2020-04-19 Akim Demaille + + tokens: clean up the translation of special symbols + * src/output.c (prepare_symbol_names): Don't play tricks with the + symbols, it's quite too late. + (has_translations): Move to... + * src/symtab.c: here. + (symbols_pack): Use it to enable translation for special symbols. + +2020-04-19 Akim Demaille + + news: fix typo + Reported by Frank Heckenbach. + +2020-04-19 Akim Demaille + + tests: beware of portability issues with wc + On macOS, wc -l always prepends the result with a tab, even when fed + by stdin. But anyway, we should have used `grep -c -v`, which appears + to be portable according to Autoconf's "Limitations of Usual Tools" + section. + Reported by Denis Excoffier. + https://lists.gnu.org/r/bug-bison/2020-04/msg00009.html + + * tests/calc.at (_AT_CHECK_CALC): Use grep's -c instead. + +2020-04-18 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-04-18 Akim Demaille + + version 3.5.90 + * NEWS: Record release date. + +2020-04-18 Akim Demaille + + examples: beware of readline on macOS + macOS' version of readline does not repeat stdin on stdout in + non-interactive mode, contrary to the current version of GNU readline. + + * examples/test: Add support for strip_prompt. + * examples/c/bistromathic/bistromathic.test (strip_prompt): Set it + when needed. + Early exit when needed. + +2020-04-18 Akim Demaille + + c++: give public access to the symbol kind + symbol_type::token () was removed: it returned the token kind of a + symbol. To do that, one needs to convert from the symbol kind to the + token kind, which requires a table. + + This broke some users' unit tests for scanners, see + https://lists.gnu.org/r/bug-bison/2020-01/msg00001.html + https://lists.gnu.org/r/bug-bison/2020-03/msg00020.html + https://lists.gnu.org/r/help-bison/2020-04/msg00005.html + + Instead of making this possible again, let's check the symbol's kind + instead. So give proper access to a symbol's kind. + + That feature existed, undocumented, as 'type_get()'. Let's rename + this as 'kind()'. + + * data/skeletons/c++.m4, data/skeletons/glr.cc, + * data/skeletons/lalr1.cc (type_get): Rename as... + (kind): This. + (type_get): Install a backward compatibility alias. + * doc/bison.texi (Complete Symbols): Document symbol_type and + symbol_type::kind. + +2020-04-17 Akim Demaille + + doc: token_kind_type in C++ + * data/skeletons/c++.m4: Define the old names in terms on the new + ones, instead of the converse. + * doc/bison.texi (C++ Parser Interface): Be more extensive about + token_kind_type. + +2020-04-16 Akim Demaille + + doc: updates for 3.6 + * doc/bison.texi: More s/token type/token kind/. + * NEWS: Update. + +2020-04-16 Akim Demaille + + skeletons: use symbol(-2, kind) + Not all the symbols have a fixed symbol code. UNDEF's one is fixed: + -2. + + * data/skeletons/glr.c, data/skeletons/lalr1.cc, data/skeletons/lalr1.d, + * data/skeletons/yacc.c: here. + +2020-04-16 Akim Demaille + + style: comments changes about error handling + * data/skeletons/glr.c, data/skeletons/lalr1.cc, data/skeletons/lalr1.d, + * data/skeletons/lalr1.java, data/skeletons/yacc.c: here. + * data/skeletons/lalr1.cc: Reduce scope. + +2020-04-14 Akim Demaille + + examples: bistro: don't be lazy with switch + * examples/c/bistromathic/parse.y (yylex): Use the switch to + discriminate all the cases. + +2020-04-13 Akim Demaille + + doc: spell check + * doc/bison.texi, NEWS, README-hacking.md: here. + And elsewhere. + +2020-04-13 Akim Demaille + + gnulib: update + +2020-04-13 Akim Demaille + + doc: more about the coding style + * README-hacking.md: here. + (Troubleshooting): New. + +2020-04-13 Akim Demaille + + java: promote YYEOF rather that Lexer.EOF + * doc/bison.texi: here. + * data/skeletons/lalr1.java: Use YYEOF. + +2020-04-13 Akim Demaille + + java: fix names + * data/skeletons/lalr1.java (yySymbolPrint): There are no pointers + here, remove the `p` suffix. + Use the appropriate type for locations. + +2020-04-13 Akim Demaille + + doc: java: SymbolKind, etc. + Why didn't I think about this before??? symbolName should be a method + of SymbolKind. + + * data/skeletons/lalr1.java (YYParser::yysymbolName): Move as... + * data/skeletons/java.m4 (SymbolKind::getName): this. + Make the table a static final table, not a local variable. + Adjust dependencies. + * doc/bison.texi (Java Parser Interface): Document i18n. + (Java Parser Context Interface): Document SymbolKind. + * examples/java/calc/Calc.y, tests/local.at: Adjust. + +2020-04-13 Akim Demaille + + style: java: get closer to the Java style + * examples/java/calc/Calc.y, examples/java/simple/Calc.y: here. + +2020-04-13 Akim Demaille + + doc: c++: document parser::context + * doc/bison.texi (C++ Parser Context): New. + + * data/skeletons/lalr1.cc (parser::yysymbol_name): Rename as... + (parser::symbol_name): this. + (A Complete C++ Example): Promote LAC, now that we have it. + Promote parse.error detailed over verbose. + * examples/c++/calc++/calc++.test, tests/local.at: Adjust. + +2020-04-13 Akim Demaille + + doc: promote YYEOF + * NEWS (Deep overhaul of the symbol and token kinds): New. + * doc/bison.texi: Promote YYEOF over "0" in scanners. + (Token Decl): No longer show YYEOF here, it now works by default. + (Token I18n): More details about YYEOF here. + (Calc++): Just use YYEOF. + +2020-04-13 Akim Demaille + + d: put YYEMPTY in the TokenKind + * data/skeletons/d.m4, data/skeletons/lalr1.d (b4_token_enums): Rename + YYTokenType as TokenKind. + Define YYEMPTY. + * examples/d/calc.y, tests/calc.at, tests/scanner.at: Adjust. + +2020-04-13 Akim Demaille + + regen + +2020-04-13 Akim Demaille + + c, c++: also define YYEMPTY in yytoken_kind_t + I have been hesitating a lot before doing it ---after all the user + must not use this kind, so what's the point of showing it in + yytoken_kind_t. And eventually I chose to play it safe with the + typing system and make it possible to use yytoken_kind_t for all the + tokens, even the "empty token". + + * data/skeletons/c.m4: Give an id and a tag to YYEMPTY. + (b4_token_enums): Define YYEMPTY. + * data/skeletons/c++.m4 (b4_token_enums): Define YYEMPTY. + * data/skeletons/glr.c, data/skeletons/glr.cc, data/skeletons/yacc.c: + (YYEMPTY): Remove. + Use b4_symbol(-2, id) instead. + +2020-04-12 Akim Demaille + + doc: use "code", not "number", for token (and symbol) kinds + "Number" is too much about arithmethics. "Code" conveys better the + "enum" nature of token kinds. And of symbol kinds. + + * doc/bison.texi: Here. + +2020-04-12 Akim Demaille + + doc: promote yytoken_kind_t, not yytokentype + * data/skeletons/c.m4 (yytoken_kind_t): New. + * data/skeletons/c++.m4, data/skeletons/lalr1.cc (yysymbol_kind_type): + New. + * examples/c/lexcalc/parse.y, examples/c/reccalc/parse.y, + * tests/regression.at: + Use them. + * doc/bison.texi: Replace "enum yytokentype" by "yytoken_kind_t". + (api.token.raw): Explain that it forces "yytoken_kind_t" to coincide + with "yysymbol_kind_t". + (Calling Convention): Mention YYEOF. + (Table of Symbols): Add entries for "yytoken_kind_t" and + "yysymbol_kind_t". + (Glossary): Add entries for "Kind", "Token kind" and "Symbol kind". + +2020-04-12 Akim Demaille + + doc: document yypcontext_t, and api.symbol.prefix + * doc/bison.texi (%define Summary): Document api.symbol.prefix. + (Syntax Error Reporting Function): Document yypcontext_t, + yypcontext_location, yypcontext_token, yypcontext_expected_tokens, and + yysymbol_kind_t. + +2020-04-12 Akim Demaille + + c: rename yyexpected_tokens as yypcontext_expected_tokens + The user should think of yypcontext fields as accessible only via + yypcontext_* functions. So let's rename yyexpected_tokens to reflect + that. + + Let's _not_ rename yyreport_syntax_error, as the user may define this + function, and is not allowed to access directly the fields of + yypcontext_t: she *must* use the "accessors". This is comparable to + the case of C++/Java where the user defines + parser::report_syntax_error, not parser::context::report_syntax_error. + + * data/skeletons/glr.c, data/skeletons/yacc.c (yyexpected_tokens): + Rename as... + (yypcontext_expected_tokens): this. + Adjust dependencies. + +2020-04-12 Akim Demaille + + skeletons: clarify the tag of special tokens + From + + GRAM_EOF = 0, /* $end */ + GRAM_ERRCODE = 1, /* error */ + GRAM_UNDEF = 2, /* $undefined */ + + to + + GRAM_EOF = 0, /* "end of file" */ + GRAM_ERRCODE = 1, /* error */ + GRAM_UNDEF = 2, /* "invalid token" */ + + * src/output.c (symbol_tag): New. + Use it to pass the token names and the symbol tags to the skeletons. + + * tests/input.at: Adjust. + +2020-04-12 Akim Demaille + + skeletons: use "invalid token" instead of "$undefined" + * src/output.c (prepare_symbol_names): Also handle undeftoken. + * tests/actions.at, tests/calc.at, tests/regression.at: Adjust. + +2020-04-12 Akim Demaille + + skeletons: make the eof token translatable if i18n is enabled + * src/output.c (has_translations): New. + (prepare_symbol_names): Translate endtoken if the user already + translated tokens. + + * examples/c/bistromathic/parse.y, src/parse-gram.y: Simplify. + +2020-04-12 Akim Demaille + + skeletons: use "end of file" instead of "$end" + The name "$end" is nice in the report, in particular it avoids that + pointed-rules (aka items) be too long. It also helps keeping them + "standard". + + But it is bad in error messages, we should report "end of file" (or + maybe "end of input", this is debatable). So, unless the user already + defined the alias for the error token herself, make it "end of file". + It should even be translated if the user already translated some + tokens, so that there is now no strong reason to redefine the $end + token. + + * src/output.c (prepare_symbol_names): Issue "end of file" instead of + "$end". + + * data/skeletons/lalr1.java (yytnamerr_): Remove the renaming hack. + + * build-aux/update-test: Accept files with names containing a "+", + such as c++.at. + * tests/actions.at, tests/c++.at, tests/conflicts.at, + * tests/glr-regression.at, tests/regression.at, tests/skeletons.at: + Adjust. + +2020-04-12 Akim Demaille + + diagnostics: replace "user token number" by "token code" + Yet, don't change the structure identifier to avoid introducing + conflicts in Vincent Imbimbo's PR (which, amusingly enough, is about + conflicts). + + * src/symtab.c: here. + * tests/diagnostics.at, tests/input.at: Adjust. + +2020-04-12 Akim Demaille + + c++: remove the yy prefix from some functions + yy::parser features a parse() function, not a yyparse() one. + + * data/skeletons/lalr1.cc (yyreport_syntax_error) + (context::yyexpected_tokens): Rename as... + (report_syntax_error, context::expected_tokens): these. + +2020-04-12 Akim Demaille + + tokens: properly define the YYEOF token kind + Currently EOF is handled in an adhoc way, with a #define YYEOF 0 in + the implementation file. As a result, the user has to define her own + EOF token if she wants to use it, which is a pity. + + Give the $end token a visible kind name, YYEOF. Except that in C, + where enums are not scoped, we would have collisions between all the + definitions of YYEOFs in the header files, so in C, make it + EOF. + + * data/skeletons/c.m4 (YYEOF): Override its name to avoid collisions. + Unless the user already gave it a different name. + * data/skeletons/glr.c (YYEOF): Remove. + Use ]b4_symbol(0, [id])[ instead. + Add support for "pre_epilogue", for glr.cc. + * data/skeletons/glr.cc: Remove dead code (never emitted #undefs). + * data/skeletons/yacc.c + * src/parse-gram.c + * src/reader.c + * src/symtab.c + * tests/actions.at + * tests/input.at + +2020-04-12 Akim Demaille + + tokens: define the "$undefined" token kind + * data/skeletons/bison.m4 (b4_symbol_token_kind): Give a definition to + $undefined. + (b4_token_visible_if): $undefined has an id. + * src/output.c (prepare_symbol_definitions): Stop lying: $undefined + _is_ a token. + * tests/input.at: Adjust. + +2020-04-12 Akim Demaille + + tokens: properly define the "error" token kind + There are people out there that do use YYERRCODE (the token kind of + the error token). See for instance + https://github.com/borbolla-automation/SPC_Machines/blob/3812012bb782bfdfe7b325950a35cd337925fcad/unixODBC-2.3.2/Drivers/nn/yylex.c. + + Currently, YYERRCODE is defined by yacc.c in an adhoc way as a #define + in the *.c file only. It belongs with the other token kinds. + + YYERRCODE is not a nice name, it does not fit in our naming scheme. + YYERROR would be more logical, but it collides with the YYERROR macro. + Shall we keep the same name in all the skeletons? Besides, to avoid + collisions in C, we need to apply the api prefix: YYERRCODE is + actually ERRCODE. This is not needed in the other languages. + + * data/skeletons/bison.m4 (b4_symbol_token_kind): New. + Map the error token to "YYERRCODE". + * data/skeletons/yacc.c (YYERRCODE): Don't define it, it's handled by... + * src/output.c (prepare_symbol_definitions): this. + * tests/input.at (Redefining the error token): Check it. + +2020-04-12 Akim Demaille + + tokens: style: minor fixes + * data/skeletons/bison.m4 (b4_symbol_kind): Dispatch on the UNDEF + token number rather than its name. + * data/skeletons/c++.m4, data/skeletons/c.m4, data/skeletons/java.m4: + Comment changes. + +2020-04-12 Akim Demaille + + glr.cc: remove dead code + * data/skeletons/glr.cc: here. + +2020-04-12 Akim Demaille + + c++: fix generated headers + A forthcoming commit (tokens: properly define the "error" token kind) + revealed a problem in the C++ generated headers: they are not + self-contained. With this file: + + %language "c++" + %define api.value.type variant + + %code { + static int yylex (yy::parser::semantic_type *lvalp); + } + + %token X + + %% + + exp: + X { printf ("x\n"); } + ; + + %% + + void + yy::parser::error (const std::string& m) + { + std::cerr << m << '\n'; + } + + static + int yylex (yy::parser::semantic_type *lvalp) + { + static int const input[] = {yy::parser::token::X, 0}; + static int toknum = 0; + return input[toknum++]; + } + + int + main (int argc, char const* argv[]) + { + yy::parser p; + return p.parse (); + } + + the generated header fails to compile cleanly (foo.cc just #includes + the generated header): + + $ clang++-mp-9.0 -c -Wundefined-func-template foo.cc + In file included from foo.cc:1: + bar.tab.hh:550:12: warning: instantiation of function 'yy::parser::basic_symbol::basic_symbol' required here, but no definition is available + [-Wundefined-func-template] + struct symbol_type : basic_symbol + ^ + bar.tab.hh:436:7: note: forward declaration of template entity is here + basic_symbol (basic_symbol&& that); + ^ + bar.tab.hh:550:12: note: add an explicit instantiation declaration to suppress this warning if 'yy::parser::basic_symbol::basic_symbol' is explicitly instantiated + in another translation unit + struct symbol_type : basic_symbol + ^ + 1 warning generated. + + * data/skeletons/c++.m4 (b4_public_types_define): Move the + implementation of the basic_symbol move-ctor to... + (b4_public_types_define): here, its declaration. + * tests/headers.at (Sane headers): Use a declared token so that the + corresponding token constructor is declared. Which triggers the + aforementioned issue. + +2020-04-10 Akim Demaille + + style: rename YYNOMEM as YYENOMEM + This is clearer. + + * data/skeletons/glr.c, data/skeletons/yacc.c (YYNOMEM): Rename as... + (YYENOMEM): here. + +2020-04-10 Akim Demaille + + todo: update + +2020-04-10 Akim Demaille + + c++: improvements on symbol kinds + Instead of + + /// (Internal) symbol kind. + enum symbol_kind_type + { + YYNTOKENS = 5, ///< Number of tokens. + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, // END_OF_FILE + YYSYMBOL_YYERROR = 1, // error + YYSYMBOL_YYUNDEF = 2, // $undefined + YYSYMBOL_TEXT = 3, // TEXT + YYSYMBOL_NUMBER = 4, // NUMBER + YYSYMBOL_YYACCEPT = 5, // $accept + YYSYMBOL_result = 6, // result + YYSYMBOL_list = 7, // list + YYSYMBOL_item = 8 // item + }; + + generate + + /// Symbol kinds. + struct symbol_kind + { + enum symbol_kind_type + { + YYNTOKENS = 5, ///< Number of tokens. + S_YYEMPTY = -2, + S_YYEOF = 0, // END_OF_FILE + S_YYERROR = 1, // error + S_YYUNDEF = 2, // $undefined + S_TEXT = 3, // TEXT + S_NUMBER = 4, // NUMBER + S_YYACCEPT = 5, // $accept + S_result = 6, // result + S_list = 7, // list + S_item = 8 // item + }; + }; + + * data/skeletons/c++.m4 (api.symbol.prefix): Define to S_. + Adjust all the uses. + (b4_public_types_declare): Nest the enum inside 'struct symbol_kind'. + * data/skeletons/glr.cc, data/skeletons/lalr1.cc, + * tests/headers.at, tests/local.at: Adjust. + +2020-04-10 Akim Demaille + + d: improvements on symbol kinds + public enum SymbolKind + { + S_YYEMPTY = -2, /* No symbol. */ + S_YYEOF = 0, /* $end */ + S_YYERROR = 1, /* error */ + S_YYUNDEF = 2, /* $undefined */ + S_EQ = 3, /* "=" */ + + * data/skeletons/d.m4 (api.symbol.prefix): Default to S_. + Output the symbol kind definitions with a comment. + +2020-04-10 Akim Demaille + + symbols: minor fixes + * data/skeletons/bison.m4 (b4_symbol_kind): Series of _ are useless, + one is enough. + * data/skeletons/c.m4 (b4_token_enum): Fix overquoting. + +2020-04-07 Akim Demaille + + skeletons: introduce api.symbol.prefix + * data/skeletons/bison.m4 (b4_symbol_prefix): New. + (b4_symbol_kind): Use it. + * data/skeletons/c++.m4, data/skeletons/c.m4, data/skeletons/d.m4 + * data/skeletons/java.m4 (api.symbol.prefix): Provide a default value. + + * data/skeletons/glr.c, data/skeletons/glr.cc, data/skeletons/lalr1.cc, + * data/skeletons/lalr1.d, data/skeletons/lalr1.java, data/skeletons/yacc.c: + Adjust: use b4_symbol_prefix instead of YYSYMBOL_. + +2020-04-07 Akim Demaille + + java: also emit documenting comments for symbol kinds + * data/skeletons/java.m4 (b4_symbol_enum): here. + And stop defined YYSYMBOL_YYEMPTY, we no longer use it. + +2020-04-06 Akim Demaille + + todo: update + * TODO (YYERRCODE): Remove, handled by YYSYMBOL_ERROR. + +2020-04-06 Akim Demaille + + skeletons: beware not to use yyarg when it's null + Reported by Adrian Vogelsgesang. + + * data/skeletons/glr.c, data/skeletons/lalr1.cc, + * data/skeletons/lalr1.java, data/skeletons/yacc.c: Here. + +2020-04-06 Akim Demaille + + java: document new features + * data/skeletons/lalr1.java: More comments. + (Context.EMPTY): Remove. + * doc/bison.texi (Java Parser Context Interface): New. + +2020-04-06 Akim Demaille + + java: prefer null to YYSYMBOL_YYEMPTY + That's one nice benefit from using enums. + + * data/skeletons/lalr1.java (YYSYMBOL_YYEMPTY): No longer define it. + Use 'null' instead. + * examples/java/calc/Calc.y, tests/local.at: Adjust. + +2020-04-06 Akim Demaille + + java: rename Lexer.yyreportSyntaxError as reportSyntaxError + * data/skeletons/lalr1.java: here. + * examples/java/calc/Calc.y, tests/local.at: Adjust. + +2020-04-06 Akim Demaille + + java: use getExpectedTokens, not yyexpectedTokens + * data/skeletons/lalr1.java, examples/java/calc/Calc.y, tests/local.at: + here. + +2020-04-06 Akim Demaille + + java: style: fix coding style + * data/skeletons/java.m4: Indent by two. + * data/skeletons/lalr1.java (yynnts_): Remove. + (yyfinal_, yyntokens_, yylast_, yyempty_): Rename as... + (YYFINAL_, YYNTOKENS_, YYLAST_, YYEMPTY_): these, they are constants. + +2020-04-06 Akim Demaille + + c: make the symbol kind definition nicer to read + From + + enum yysymbol_kind_t + { + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, + YYSYMBOL_YYERROR = 1, + YYSYMBOL_YYUNDEF = 2, + + to + + enum yysymbol_kind_t + { + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYERROR = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* $undefined */ + + * data/skeletons/bison.m4 (b4_last_symbol): New. + (b4_symbol_enum, b4_symbol_enums): Reformat the output. + * data/skeletons/c.m4 + +2020-04-06 Akim Demaille + + c: make the token kind definition nicer to read + From + + enum gram_tokentype + { + GRAM_EOF = 0, + STRING = 3, + TSTRING = 4, + PERCENT_TOKEN = 5, + + To + + enum gram_tokentype + { + GRAM_EOF = 0, /* "end of file" */ + STRING = 3, /* "string" */ + TSTRING = 4, /* "translatable string" */ + PERCENT_TOKEN = 5, /* "%token" */ + + * data/skeletons/bison.m4 (b4_last_enum_token): New. + * data/skeletons/c.m4 (b4_token_enum, b4_token_enums): Show the + corresponding symbol. + +2020-04-06 Akim Demaille + + c: make the generated YYSTYPE nicer to read + From + + union GRAM_STYPE + { + /* precedence_declarator */ + assoc precedence_declarator; + /* "string" */ + char* STRING; + /* "translatable string" */ + char* TSTRING; + /* "{...}" */ + char* BRACED_CODE; + /* "%?{...}" */ + + to + + union GRAM_STYPE + { + assoc precedence_declarator; /* precedence_declarator */ + char* STRING; /* "string" */ + char* TSTRING; /* "translatable string" */ + char* BRACED_CODE; /* "{...}" */ + + * data/skeletons/c.m4 (b4_symbol_type_register): Use m4_format to + align the comments. + * src/parse-gram.h: Regen. + +2020-04-05 Akim Demaille + + regen + +2020-04-05 Akim Demaille + + bison: use consistently "token kind", not "token type" + * src/output.c, src/reader.c, src/scan-gram.l, src/tables.c: here. + +2020-04-05 Akim Demaille + + skeletons: use consistently "kind" instead of "type" in the code + * data/skeletons/bison.m4, data/skeletons/c++.m4, data/skeletons/c.m4, + * data/skeletons/glr.cc, data/skeletons/lalr1.cc, + * data/skeletons/lalr1.d, data/skeletons/lalr1.java: + Refer to the "kind" of a symbol, not its "type", where appropriate. + +2020-04-05 Akim Demaille + + doc: refer to the token kind rather than the token type + * doc/bison.texi: Replace occurrences of "token type" with "token + kind". + Stop referring to the "macro definitions" of the token kinds, just + name them "definitions". + +2020-04-05 Akim Demaille + + m4: we don't need undef_token_number + It's replaced by YYSYMBOL_YYUNDEF. + +2020-04-05 Akim Demaille + + m4: rename b4_symbol_sid as b4_symbol_kind + * data/skeletons/bison.m4, data/skeletons/c++.m4, data/skeletons/c.m4, + * data/skeletons/d.m4, data/skeletons/java.m4 + (b4_symbol_sid): Rename as... + (b4_symbol_kind): this. + Adjust dependencies. + * data/README.md: Document the kind. + +2020-04-05 Akim Demaille + + d, java: rename SymbolType as SymbolKind + See https://lists.gnu.org/r/bison-patches/2020-04/msg00031.html. + + * data/skeletons/d.m4, data/skeletons/lalr1.d, + * data/skeletons/java.m4, data/skeletons/lalr1.java + (SymbolType): Rename as... + (SymbolKind): this. + Adjust dependencies. + +2020-04-05 Akim Demaille + + c, c++: rename yysymbol_type_t as yysymbol_kind_t + See https://lists.gnu.org/r/bison-patches/2020-04/msg00031.html + + * data/skeletons/c.m4, data/skeletons/glr.c, data/skeletons/yacc.c + (yysymbol_type_t): Rename as... + (yysymbol_kind_t): this. + Adjust dependencies. + * data/skeletons/c++.m4, data/skeletons/glr.cc, data/skeletons/lalr1.cc + (symbol_type_type): Rename as... + (symbol_kind_type): this. + Adjust dependencies. + +2020-04-05 Akim Demaille + + doc: remove obsolete release instructions + * README-hacking.md: here. + +2020-04-05 Akim Demaille + + Merge branch 'maint' + * maint: + maint: post-release administrivia + version 3.5.4 + examples: reccalc: really compile cleanly in C99 + news: announce that Bison 3.6 drops YYERROR_VERBOSE + news: update for 3.5.4 + style: fix spellos + typo: succesful -> successful + package: improve the readme + java: check and fix support for api.token.raw + java: style: prefer 'int[] foo' to 'int foo[]' + build: fix syntax-check issues + tests: recheck: work properly when the test suite was interrupted + doc: c++: promote api.token.raw + build: fix compatibility with old compilers + examples: reccalc: compile cleanly in C99 + +2020-04-05 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-04-05 Akim Demaille + + version 3.5.4 + * NEWS: Record release date. + +2020-04-05 Akim Demaille + + news: update the yyreport_syntax_error example + * examples/c/bistromathic/parse.y, tests/local.at + (yyreport_syntax_error): Fix use of YYSYMBOL_YYEMPTY. + * NEWS: Update. + +2020-04-05 Akim Demaille + + todo: update + +2020-04-05 Akim Demaille + + style: rename yysyntax_error_arguments as yy_syntax_error_arguments + It's a private implementation detail. + + * NEWS, data/skeletons/glr.c, data/skeletons/lalr1.cc, + * data/skeletons/yacc.c, doc/bison.texi: here. + +2020-04-05 Akim Demaille + + examples: reccalc: really compile cleanly in C99 + The previous fix does not suffice, and actually managed to make things + worse by defining yyscan_t twice in parse.y... + + Reported by kencu. + https://trac.macports.org/ticket/59927#comment:29 + + * examples/c/reccalc/parse.y (yyscan_t): Define it with the same + guards as used by Flex. + +2020-04-04 Akim Demaille + + c: rename yyparse_context_t as yypcontext_t + The first name is too long. We already have `yypstate`, so + `yypcontext` is ok. We are also migrating to using `*_t` for our + types. + + * NEWS, data/skeletons/glr.c, data/skeletons/yacc.c, doc/bison.texi, + * examples/c/bistromathic/parse.y, src/parse-gram.y, tests/local.at: + (yyparse_context_t, yyparse_context_location, yyparse_context_token): + Rename as... + (yypcontext_t, yypcontext_location, yypcontext_token): these. + +2020-04-04 Akim Demaille + + readme: more about the coding style + +2020-04-04 Akim Demaille + + java: fixes in SymbolType + Reported by Paolo Bonzini. + https://github.com/akimd/bison/pull/34#issuecomment-609029634 + + * data/skeletons/java.m4 (SymbolType): Use 'final' where possible. + (get): Rewrite on top of an array instead of a switch. + +2020-04-04 Akim Demaille + + java: use SymbolType + The Java enums are very different from the C model. As a consequence, + one cannot "build" an enum directly from an integer, we must retrieve + it. That's the purpose of the SymbolType.get class method. + + * data/skeletons/java.m4 (b4_symbol_enum, b4_case_code_symbol) + (b4_declare_symbol_enum): New. + * data/skeletons/lalr1.java: Use SymbolType, + SymbolType.YYSYMBOL_YYEMPTY, etc. + * examples/java/calc/Calc.y, tests/local.at: Adjust. + +2020-04-04 Akim Demaille + + examples: java: use explicit token identifiers + * examples/java/calc/Calc.y: Declare all the tokens, so that we are + compatibile with api.token.raw. + * examples/java/calc/Calc.test: Adjust. + +2020-04-04 Akim Demaille + + news: announce that Bison 3.6 drops YYERROR_VERBOSE + * NEWS: here. + +2020-04-04 Akim Demaille + + news: update for 3.5.4 + +2020-04-04 Akim Demaille + + style: fix spellos + * src/complain.c, src/print.c, src/print-xml.c, src/symtab.h: here. + +2020-04-04 Adrian Vogelsgesang + + typo: succesful -> successful + * tests/calc.at: Here. + +2020-04-04 Akim Demaille + + package: improve the readme + * README: Describe what Bison is. + +2020-04-04 Akim Demaille + + java: check and fix support for api.token.raw + * tests/local.at (AT_LANG_MATCH, AT_YYERROR_DECLARE(java)) + (AT_YYERROR_DECLARE_EXTERN(java), AT_PARSER_CLASS): New. + (AT_MAIN_DEFINE(java)): Use AT_PARSER_CLASS. + * tests/scanner.at: Add a test for Java. + * data/skeletons/lalr1.java (yytranslate_): Cast the result. + +2020-04-04 Akim Demaille + + d: use the SymbolType enum for symbol kinds + * data/skeletons/d.m4 (b4_symbol_enum, b4_declare_symbol_enum): New. + * data/skeletons/lalr1.d: Use them. + Use SymbolType, SymbolType.YYSYMBOL_YYEMPTY etc. where appropriate. + (undef_token_, token_number_type, yy_error_token_): Remove. + +2020-04-04 Akim Demaille + + java: style: prefer 'int[] foo' to 'int foo[]' + * data/skeletons/java.m4 (b4_typed_parser_table_define): Here. + +2020-04-04 Akim Demaille + + build: fix syntax-check issues + * src/system.h, tests/local.mk: Fix indentation. + +2020-04-02 Akim Demaille + + tests: recheck: work properly when the test suite was interrupted + * tests/local.mk (recheck): Look at the per-test logs, not the overall + log, which, when interrupted, contains only information about... the + tests that passed. + +2020-04-02 Akim Demaille + + doc: c++: promote api.token.raw + * doc/bison.texi (Calc++ Parser): Here. + +2020-04-02 Akim Demaille + + build: fix compatibility with old compilers + GCC 4.2 dies with + + src/InadequacyList.c: In function 'InadequacyList__new_conflict': + src/InadequacyList.c:37: error: #pragma GCC diagnostic not allowed inside functions + src/InadequacyList.c:37: error: #pragma GCC diagnostic not allowed inside functions + src/InadequacyList.c:40: error: #pragma GCC diagnostic not allowed inside functions + + Reported by Evan Lavelle. + See https://lists.gnu.org/r/bug-bison/2020-03/msg00021.html + and https://trac.macports.org/ticket/59927. + + * src/system.h (GCC_VERSION): New. + Use it to control IGNORE_TYPE_LIMITS_BEGIN and + IGNORE_TYPE_LIMITS_END. + +2020-04-02 Akim Demaille + + examples: reccalc: compile cleanly in C99 + See https://trac.macports.org/ticket/59927. + + * examples/c/reccalc/parse.y: C99 does not allow multiple typedefs. + +2020-04-01 Akim Demaille + + c++: replace symbol_number_type with symbol_type_type + * data/skeletons/c++.m4, data/skeletons/glr.cc, + * data/skeletons/lalr1.cc: here. + +2020-04-01 Akim Demaille + + c++: also use symbol_type_type + Because of the insane current implementation of glr.cc, things are a + bit nasty. We will rename symbol_number_type as symbol_type_type + later, to keep this commit small. + + * data/skeletons/c++.m4 (b4_declare_symbol_enum): New. + Also define YYNTOKENS to avoid type clashes when yyntokens_ was + actually defined in another enum. + Use it. + (symbol_number_type): Be an alias of symbol_type_type. + Use YYSYMBOL_YYEMPTY and the like. + Use symbol_number_type where appropriate. + (empty_symbol): Remove. + (yytranslate_): Use symbol_number_type, not token_number_type. + * data/skeletons/lalr1.cc: Use symbol_number_type where appropriate. + Adjust to the replacement of empty_symbol by YYSYMBOL_YYEMPTY. + (yy_error_token_, yy_undef_token_, yyeof_, yyntokens_): Remove. + Adjust dependencies. + + * data/skeletons/glr.cc: Use symbol_number_type where appropriate. + Forward definitions of YYSYMBOL_YYEMPTY, etc. to glr.c. + + * tests/headers.at: Accept YYNTOKENS and other YYSYMBOL_*. + * tests/local.at (AT_YYERROR_DEFINE(c++)): Use symbol_number_type. + +2020-04-01 Akim Demaille + + glr.c: remove the yySymbol alias + * data/skeletons/glr.c: Use yysymbol_type_t only. + +2020-04-01 Akim Demaille + + regen + +2020-04-01 Akim Demaille + + glr.c, yacc.c: propagate yysymbol_type_t + Now that yacc.c and glr.c both know yysymbol_type_t, convert the + common routines. + + * data/skeletons/c.m4 (yydestruct, yy_symbol_value_print) + (yy_symbol_print): Use yysymbol_type_t instead of int. + * data/skeletons/glr.c: Use yySymbol where appropriate. + * data/skeletons/yacc.c (YY_ACCESSING_SYMBOL): New wrapper around + yystos. + Use it. + * tests/local.at (yyreport_syntax_error): Use yysymbol_type_t where + appropriate. + +2020-04-01 Akim Demaille + + glr.c: use yysymbol_type_t, YYSYMBOL_YYEOF etc. + Apply the same changes as in yacc.c. Now yySymbol and yysymbol_type_t + are aliases. We will remove the former later, to avoid cluttering + this commit. + + * data/skeletons/glr.c: Use b4_declare_symbol_enum. + Use YYSYMBOL_YYEOF etc. where appropriate. + (YYUNDEFTOK, YYTERROR): Remove. + (YYTRANSLATE, yySymbol, yyexpected_tokens, yysyntax_error_arguments): + Adjust. + (yy_accessing_symbol): New. + Use it where appropriate. + +2020-04-01 Akim Demaille + + regen + +2020-04-01 Akim Demaille + + yacc.c: fix more errors from make maintainer-check-g++ + * data/skeletons/yacc.c (yyexpected_tokens): Use casts where needed. + +2020-04-01 Akim Demaille + + regen + +2020-04-01 Akim Demaille + + yacc.c: revert to not using yysymbol_type_t in the yytranslate table + This triggers warnings with several compilers. For instance ICC fills + the logs with pages and pages of + + input.c(477): error: a value of type "int" cannot be used to initialize an entity of type "const yysymbol_type_t={yysymbol_type_t}" + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + ^ + + input.c(477): error: a value of type "int" cannot be used to initialize an entity of type "const yysymbol_type_t={yysymbol_type_t}" + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + ^ + + And so does G++9 when compiling yacc.c's (C) output + + input.c:545:8: error: invalid conversion from 'int' to 'yysymbol_type_t' [-fpermissive] + 545 | 0, 5, 9, 2, 2, 2, 2, 2, 2, 2, + | ^ + | | + | int + input.c:545:15: error: invalid conversion from 'int' to 'yysymbol_type_t' [-fpermissive] + 545 | 0, 5, 9, 2, 2, 2, 2, 2, 2, 2, + | ^ + | | + | int + + Clang++ is no exception + + input.c:545:8: error: cannot initialize an array element of type 'const yysymbol_type_t' with an rvalue of type 'int' + 0, 5, 9, 2, 2, 2, 2, 2, 2, 2, + ^ + input.c:545:15: error: cannot initialize an array element of type 'const yysymbol_type_t' with an rvalue of type 'int' + 0, 5, 9, 2, 2, 2, 2, 2, 2, 2, + ^ + + At some point we could use yysymbol_type_t's enumerators to define + yytranslate. Meanwhile... + + * data/skeletons/yacc.c (yytranslate): Use the original integral type + to define it. + (YYTRANSLATE): Cast the result into yysymbol_type_t. + +2020-04-01 Akim Demaille + + regen + +2020-04-01 Akim Demaille + + yysymbol_type_t: always assign an enumerator + Currently we define enumerators only for symbols that have an + identifier. That rules out tokens such as '+', and nonterminals such + as foo-bar and foo.bar. As a consequence we are taking chances: the + compiler might compile yysymbol_type_t as too small an integral type + for some symbol codes. + + * data/skeletons/bison.m4 (b4_symbol_sid): Forge a unique symbol + identifier for symbols that don't have an ID. + +2020-04-01 Akim Demaille + + bistromathic: use symbol numbers instead of YYTRANSLATE + * examples/c/bistromathic/parse.y: here. + +2020-04-01 Akim Demaille + + regen + +2020-04-01 Akim Demaille + + yacc.c: prefer YYSYMBOL_YYERROR to YYSYMBOL_error + * data/skeletons/bison.m4 (b4_symbol_sid): Map "error" to YYSYMBOL_YYERROR. + * data/skeletons/yacc.c: Adjust. + +2020-04-01 Akim Demaille + + regen + +2020-04-01 Akim Demaille + + yacc.c: also define a symbol number for the empty token + This is not only cleaner, it also protects us from mixing signed + values (YYEMPTY is #defined as -2) with unsigned types (the + yysymbol_type_t enum is typically compiled as a small unsigned). + For instance GCC 9: + + input.c: In function 'yyparse': + input.c:1107:7: error: conversion to 'unsigned int' from 'int' + may change the sign of the result + [-Werror=sign-conversion] + 1107 | yyn += yytoken; + | ^~ + input.c:1107:10: error: conversion to 'int' from 'unsigned int' + may change the sign of the result + [-Werror=sign-conversion] + 1107 | yyn += yytoken; + | ^~~~~~~ + input.c:1108:47: error: comparison of integer expressions of + different signedness: + 'yytype_int8' {aka 'const signed char'} and + 'yysymbol_type_t' {aka 'enum yysymbol_type_t'} + [-Werror=sign-compare] + 1108 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + | ^~ + input.c:702:25: error: operand of ?: changes signedness from 'int' + to 'unsigned int' due to unsignedness of + other operand [-Werror=sign-compare] + 702 | #define YYEMPTY (-2) + | ^~~~ + input.c:1220:33: note: in expansion of macro 'YYEMPTY' + 1220 | yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + | ^~~~~~~ + input.c:1220:41: error: unsigned conversion from 'int' to + 'unsigned int' changes value + from '-2' to '4294967294' + [-Werror=sign-conversion] + 1220 | yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + | ^ + + Eventually, it might be interesting to move away from -2 (which is the + only possible negative symbol number) and use the next available + number, to save bits. We could actually even simply use "0" and shift + the rest, which would allow to write "!yytoken" to mean really + "yytoken != YYEMPTY". + + * data/skeletons/c.m4 (b4_declare_symbol_enum): Define YYSYMBOL_YYEMPTY. + * data/skeletons/yacc.c: Use it. + + * src/parse-gram.y (yyreport_syntax_error): Use YYSYMBOL_YYEMPTY, not + YYEMPTY, when dealing with a symbol. + + * tests/regression.at: Adjust. + +2020-04-01 Akim Demaille + + yacc.c: use yysymbol_type_t instead of int for yytoken + Now that we have a proper type for internal symbol numbers, let's use + it. More code needs conversion, e.g., printers and destructors, but + they are shared with glr.c, which is not ready yet for this change. + + It will also help us deal with warnings such as (GCC9 on GNU/Linux): + + input.c: In function 'int yyparse()': + input.c:475:37: error: enumeral and non-enumeral type in conditional expression [-Werror=extra] + 475 | (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYSYMBOL_YYUNDEF) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + input.c:1024:17: note: in expansion of macro 'YYTRANSLATE' + 1024 | yytoken = YYTRANSLATE (yychar); + | ^~~~~~~~~~~ + + * data/skeletons/yacc.c (yytranslate, yysymbol_name) + (yyparse_context_t, yyexpected_tokens, yypstate_expected_tokens) + (yysyntax_error_arguments): + Use yysymbol_type_t instead of int. + +2020-04-01 Akim Demaille + + regen + +2020-04-01 Akim Demaille + + yacc.c: introduce an enum that defines the symbol's number + There's a number of advantage in exposing the symbol (internal) + numbers: + + - custom error messages can use them to decide how to represent a + given symbol, or a set of symbols. + + - we need something similar in uses of yyexpected_tokens. For + instance, currently, bistromathic's completion() reads: + + int ntokens = expected_tokens (line, tokens, YYNTOKENS); + [...] + for (int i = 0; i < ntokens; ++i) + if (tokens[i] == YYTRANSLATE (TOK_VAR)) + [...] + else if (tokens[i] == YYTRANSLATE (TOK_FUN)) + [...] + else + [...] + + - now that it's a compile-time expression, we can easily build static + tables, switch, etc. + + - some users depended on the ability to get the token number from a + symbol to write test cases for their scanners. But Bison 3.5 + removed the table this feature depended upon (a reverse + yytranslate). Now they can check against the actual symbol number, + without having pay (space and time) a conversion. + See https://lists.gnu.org/r/bug-bison/2020-01/msg00001.html, and + https://lists.gnu.org/archive/html/bug-bison/2020-03/msg00015.html. + + - it helps us clearly separate the internal symbol numbers from the + external token numbers, whose difference is sometimes blurred in the + code when values coincide (e.g. "yychar = yytoken = YYEOF"). + + - it allows us to get rid of ugly macros with inconsistent names such + as YYUNDEFTOK and YYTERROR, and to group related definitions + together. + + - similarly it provides a clean access to the $accept symbol (which + proves convenient in a current experimentation of mine with several + %start symbols). + + Let's declare this type as a private type (in the *.c file, not + the *.h one). So it does not need to be influenced by the api prefix. + + * data/skeletons/bison.m4 (b4_symbol_sid): New. + (b4_symbol): Use it. + * data/skeletons/c.m4 (b4_symbol_enum, b4_declare_symbol_enum): New. + * data/skeletons/yacc.c: Use b4_declare_symbol_enum. + (YYUNDEFTOK, YYTERROR): Remove. + Use the corresponding symbol enum instead. + +2020-03-30 Akim Demaille + + style: comment changes about token numbers + * data/skeletons/bison.m4, data/skeletons/c.m4: here. + +2020-03-30 Akim Demaille + + tests: recheck: work properly when the test suite was interrupted + * tests/local.mk (recheck): Look at the per-test logs, not the overall + log, which, when interrupted, contains only information about... the + tests that passed. + +2020-03-30 Akim Demaille + + java: move away from _ for internationalization + The "_" is becoming a keyword in Java, which causes tons of warnings + currently in our test suite. GNU Gettext is now using "i18n" instead + of "_" + (https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=e89fea36545f27487d9652a13e6a0adbea1117d0). + + * data/skeletons/java.m4: Use "i18n", not "_". + * examples/java/calc/Calc.y, tests/calc.at: Adjust. + +2020-03-28 Akim Demaille + + regen + +2020-03-28 Akim Demaille + + c: use YYNOMEM instead of -2 + See 84b1972c96060866b4bd94a33b97711f8f7d0b6c. + + * data/skeletons/glr.c, data/skeletons/yacc.c (YYNOMEM): New. + Use it. + +2020-03-28 Akim Demaille + + todo: update + * TODO (Token Number): We have to clean this. + (Naming conventions, Symbol numbers): New. + (Bad styling): Addressed in e21ff47f5d0b64da693a47b7dd200a1a44a5bbeb. + +2020-03-28 Akim Demaille + + regen + +2020-03-28 Akim Demaille + + java: make yysyntaxErrorArguments a private detail + * data/skeletons/lalr1.java (yysyntaxErrorArguments): Move it from the + context, to the parser object. + Generate only for detailed and verbose error messages. + * tests/local.at (AT_YYERROR_DEFINE(java)): Use yyexpectedTokens + instead. + +2020-03-28 Akim Demaille + + skeletons: make yysyntax_error_arguments a private detail + We could just "inline yysyntax_error_arguments back" in the routines + it was originally extracted from, but I think the code is nicer to + read this way. + + * data/skeletons/glr.c (yysyntax_error_arguments): Generate only for + detailed and verbose error messages. + * data/skeletons/yacc.c: Likewise. + * data/skeletons/lalr1.cc (parser::context::yysyntax_error_arguments): + Move as... + (parser::yysyntax_error_arguments_): this. + And only for detailed and verbose error messages. + +2020-03-28 Akim Demaille + + lalr1.cc: avoid using yysyntax_error_arguments + * data/skeletons/lalr1.cc (context::token): New. + * tests/local.at (yyreport_syntax_error): Don't use + yysyntax_error_arguments. + +2020-03-28 Akim Demaille + + bison: avoid using yysyntax_error_arguments + * src/parse-gram.y (yyreport_syntax_error): Use yyparse_context_token + and yyexpected_tokens. + +2020-03-28 Akim Demaille + + tests: yacc.c: avoid yysyntax_error_arguments + Because glr.c shares the same testing routines, we also need to + convert it. + + * data/skeletons/glr.c (yyparse_context_token): New. + * tests/local.at (yyreport_syntax_error): here. + +2020-03-28 Akim Demaille + + examples: don't use yysyntax_error_arguments + Suggested by Adrian Vogelsgesang. + https://lists.gnu.org/archive/html/bison-patches/2020-02/msg00069.html + + * data/skeletons/lalr1.java (Context.EMPTY, Context.getToken): New. + (Context.yyntokens): Rename as... + (Context.NTOKENS): this. + Because (i) all the Java coding styles recommend upper case for + constants, and (ii) the Java Skeleton exposes Lexer.EOF, not + Lexer.YYEOF. + * data/skeletons/yacc.c (yyparse_context_token): New. + * examples/c/bistromathic/parse.y (yyreport_syntax_error): Don't use + yysyntax_error_arguments. + * examples/java/calc/Calc.y (yyreportSyntaxError): Likewise. + +2020-03-28 Akim Demaille + + skeletons: fix incorrect type for translatable tokens + * data/skeletons/glr.c, data/skeletons/lalr1.c, data/skeletons/yacc.c: + Fix confusion between the "translatable" and the "translate" tables. + +2020-03-23 Akim Demaille + + yacc.c: use negative numbers for errors in auxiliary functions + yyparse returns 0, 1, 2 since ages (accept, reject, memory exhausted). + Some of our auxiliary functions such as yy_lac and + yyreport_syntax_error also need to return error codes and also use 0, + 1, 2. Because it uses yy_lac, yyexpected_tokens also needs to return + "problem", "memory exhausted", but in case of success, it needs to + return the number of tokens, so it cannot use 1 and 2 as error code. + Currently it uses -1 and -2, which is later converted into 1 and 2 as + yacc.c expects it. + + Let's simplify this and use consistently -1 and -2 for auxiliary + functions that are not exposed (or not yet exposed) to the user. In + particular this will save the user from having to convert + yyexpected_tokens's -2 into yyreport_syntax_error's 2: both return -1 + or -2. + + * data/skeletons/yacc.c (yy_lac, yyreport_syntax_error) + (yy_lac_stack_realloc): Return -1, -2 for errors instead of 1, 2. + Adjust callers. + * examples/c/bistromathic/parse.y (yyreport_syntax_error): Do take + error codes into account. + Issue a syntax error message even if we ran out of memory. + * src/parse-gram.y, tests/local.at (yyreport_syntax_error): Adjust. + +2020-03-23 Akim Demaille + + style: reduce length of private constant + * data/skeletons/glr.c, data/skeletons/lalr1.cc, data/skeletons/yacc.c + (YYERROR_VERBOSE_ARGS_MAXIMUM): Rename as... + (YYARGS_MAX): this. + * src/parse-gram.y (YYERROR_VERBOSE_ARGS_MAXIMUM): Rename as... + (ARGS_MAX): this. + +2020-03-23 Akim Demaille + + doc: c++: promote api.token.raw + * doc/bison.texi (Calc++ Parser): Here. + +2020-03-22 Akim Demaille + + bench: calc: no need for super long inputs + * etc/bench.pl.in ($iterations): Restore initial value, -1, meaning + "at least one second". + ($calc_input): There is no need to generate 400 lines. + +2020-03-22 Akim Demaille + + bench: calc: work on a string instead of a file + The cost of the file layer is large and makes benchmarks too coarse, + as seen for in following example, first with a file, then with a + literal string: + + 0. %skeleton "yacc.c" %define parse.lac full + 1. %skeleton "yacc-v1.c" %define nofinal %define parse.lac full + 2. %skeleton "yacc-v2.c" %define nofinal %define parse.lac full + 3. %skeleton "yacc-v3.c" %define nofinal %define parse.lac full + 4. %skeleton "yacc.c" + 5. %skeleton "yacc-v1.c" %define nofinal + 6. %skeleton "yacc-v2.c" %define nofinal + 7. %skeleton "yacc-v3.c" %define nofinal + -------------------------------------------------- + Benchmark Time CPU Iterations + -------------------------------------------------- + BM_y0 32558 ns 32537 ns 21228 + BM_y1 32400 ns 32369 ns 21233 + BM_y2 33485 ns 33464 ns 20625 + BM_y3 32139 ns 32125 ns 21446 + BM_y4 31343 ns 31329 ns 21747 + BM_y5 31344 ns 31317 ns 22035 + BM_y6 31287 ns 31255 ns 22039 + BM_y7 31387 ns 31373 ns 22178 + -------------------------------------------------- + Benchmark Time CPU Iterations + -------------------------------------------------- + BM_y0 10642 ns 10634 ns 63601 + BM_y1 10657 ns 10654 ns 63625 + BM_y2 10441 ns 10432 ns 65957 + BM_y3 10558 ns 10554 ns 64546 + BM_y4 9521 ns 9516 ns 72011 + BM_y5 9179 ns 9157 ns 75028 + BM_y6 9360 ns 9356 ns 73770 + BM_y7 9365 ns 9359 ns 72609 + + Of course, at the same time it is less realistic: most users read + files rather that strings, so it might lead to us to pay attention to + costs most people don't see. + + * etc/bench.pl.in (&calc_input): Output into a file given as argument. + Output in C syntax. + (&generate_grammar_calc): Use it. + Simplify the grammar: remove operators we don't care about. + Rewrite the scanner to work on a char* instead of a FILE*. + +2020-03-22 Akim Demaille + + bench: add a "latest" symlink + * etc/bench.pl.in: here. + +2020-03-22 Akim Demaille + + bench: use the same prefix in both bench methods + * etc/bench.pl.in (&bench_with_timethese): Also use y$i, as in + &bench_with_gbenchmark. + (&generate_grammar_calc): Don't add a prefix, let the callers do it. + +2020-03-22 Akim Demaille + + bench: use a C++-11 compiler + See https://github.com/google/benchmark#a-faster-keeprunning-loop. + + * etc/bench.pl.in ($cxx): Be C++11. + (&bench_with_gbenchmark): Adjust. + +2020-03-22 Akim Demaille + + bench: create a README file with benches + * etc/bench.pl.in (&bench_with_gbenchmark): Here. + +2020-03-21 Akim Demaille + + bench: calc: add support for google benchmark + * etc/bench.pl.in (&compiler): New, extracted from... + (&compile): here. + Don't link when using gbm. + (&calc_input): Don't make massive input for micro + benchmarks. + (&generate_grammar_calc): When using gbm, use api.prefix to avoid name + collisions. + Be ready to issue BENCHMARKS instead of a main. + (&bench): Rename as... + (&bench_with_timethese): this. + (&bench_with_gbenchmark): New. + (&bench): New. + Dispatch on these two. + +2020-03-21 Akim Demaille + + bench: better error messages on invalid input + * etc/bench.pl.in: here. + +2020-03-21 Akim Demaille + + bench: simplify the calc grammar + * etc/bench.pl.in (generate_grammar_calc): We don't need global_result + etc. + +2020-03-21 Akim Demaille + + bench: die clearly on incorrect --grammar arguments + * etc/bench.pl.in (getopt): here. + +2020-03-17 Akim Demaille + + regen + +2020-03-17 Akim Demaille + + yacc.c: style: prefer switch to if + * data/skeletons/yacc.c: Prefer switch to decode yy_lac's return value. + +2020-03-17 Akim Demaille + + yacc.c: yypstate_expected_tokens + In push parsers, when asking for the list of expected tokens at some + point, it makes no sense to build a yyparse_context_t: the yypstate + alone suffices (the only difference being the lookahead). Instead of + forcing the user to build a useless shell around yypstate, let's offer + yypstate_expected_tokens. + + See https://lists.gnu.org/r/bison-patches/2020-03/msg00025.html. + + * data/skeletons/yacc.c (yypstate): Declare earlier, so that we can + use it for... + (yypstate_expected_tokens): this new function, when in push parsers. + Adjust dependencies. + * examples/c/bistromathic/parse.y: Simplify: use + yypstate_expected_tokens. + Style fixes. + Reduce scopes (reported by Joel E. Denny). + +2020-03-09 Akim Demaille + + examples: bistromathic: simplify + * examples/c/bistromathic/parse.y (expected_tokens): Remove useless "break". + +2020-03-08 Akim Demaille + + merge branch 'maint' + * upstream/maint: + maint: post-release administrivia + version 3.5.3 + news: update for 3.5.3 + yacc.c: make sure we properly propagated the user's number for error + diagnostics: don't crash because of repeated definitions of error + style: initialize some struct members + diagnostics: beware of zero-width characters + diagnostics: be sure to close the styling when lines are too short + muscles: fix incorrect decoding of $ + code: be robust to reference with invalid tags + build: fix typo + doc: update recommandation for libtextstyle + style: comment changes + examples: use consistently the GFDL header for readmes + style: remove useless declarations + typo: succesful -> successful + README: point to tests/bison, and document --trace + gnulib: update + maint: post-release administrivia + +2020-03-08 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-03-08 Akim Demaille + + version 3.5.3 + * NEWS: Record release date. + +2020-03-08 Akim Demaille + + news: update for 3.5.3 + +2020-03-08 Akim Demaille + + yacc.c: make sure we properly propagated the user's number for error + * data/skeletons/yacc.c (YYERRCODE): Be truthful. + * tests/input.at (Redefining the error token): Check that. + +2020-03-08 Akim Demaille + + diagnostics: don't crash because of repeated definitions of error + According to https://www.unix.com/man-page/POSIX/1posix/yacc/, the + user is allowed to specify her user number for the error token: + + The token error shall be reserved for error handling. The name + error can be used in grammar rules. It indicates places where the + parser can recover from a syntax error. The default value of error + shall be 256. Its value can be changed using a %token + declaration. The lexical analyzer should not return the value of + error. + + I think this feature is useless, the user should not have to deal with + that. The intend is probably to give the user a means to use 256 if + she wants to, but provided "error" cleared the path first by being + assigned another number. In the case of Bison, 256 is assigned to + "error" at the end if the user did not use it for a token of hers. So + this feature is useless. + + Yet it is valid, and if the user assigns twice a token number to + "error", then the second time we want to complain about it and want to + show the original definition. At this point, we try to display the + built-in definition of "error", whose location is NULL, and we crash. + + Rather, the location of the first user definition of "error" should + become its defining location. + + Reported byg Ahcheong Lee. + https://lists.gnu.org/r/bug-bison/2020-03/msg00007.html + + * src/symtab.c (symbol_class_set): If this is a declaration and the + symbol was not declared yet, keep this as defining location. + * tests/input.at (Redefining the error token): New. + +2020-03-08 Akim Demaille + + style: initialize some struct members + * src/symtab.c (sym_content_new): Initialize all the location members. + Not needed by the code, but disturbing values when using a debugger. + +2020-03-08 Akim Demaille + + diagnostics: beware of zero-width characters + Currenly we rely on (visual) width of the characters to decide where + to open and close the styling of the quoted lines. This breaks when + we deal with zero-width characters: we cannot just rely on (visual) + columns, we need to know whether we are before, inside, or after the + highlighted portion. + + * src/location.c (location_caret): col_end: no longer add 1, "regular" + characters have a width of 1, only 0-width characters have 0-width. + opened: replace with 'state', a three-valued enum. + Don't reopen the style if we already did. + * tests/diagnostics.at (Zero-width characters): New. + +2020-03-07 Akim Demaille + + diagnostics: be sure to close the styling when lines are too short + bar.y:4.12-17: error: redefining user token number of foo + - 4 | %token foo 123 + + 4 | %token foo 123 + | ^~~~~~ + + * src/location.c (location_caret): Be sure to close. + * tests/diagnostics.at (Line is too short, and then you die): New. + +2020-03-07 Akim Demaille + + muscles: fix incorrect decoding of $ + Bug introduced in 458171e6df5a0110a35ee45ad8b2e9f6fb426f1d. + https://lists.gnu.org/archive/html/bison-patches/2013-11/msg00009.html + + Reported by Ahcheong Lee. + https://lists.gnu.org/r/bug-bison/2020-03/msg00010.html + + * src/muscle-tab.c (COMMON_DECODE): "$" is coded as "$][", not "$[][". + * tests/input.at ("%define" enum variables): Check that case. + +2020-03-06 Akim Demaille + + code: be robust to reference with invalid tags + Because we want to support $b>$, we must accept -> in type tags, + and reject $<->$, as it is unfinished. + Reported by Ahcheong Lee. + + * src/scan-code.l (yylex): Make sure "tag" does not end with -, since + -> does not close the tag. + * tests/input.at (Stray $ or @): Check this. + +2020-03-06 Akimn Demaille + + build: fix typo + * build-aux/cross-options.pl: here. + +2020-03-06 Akim Demaille + + doc: update recommandation for libtextstyle + * README: here. + +2020-03-06 Akim Demaille + + style: comment changes + * src/symtab.h, src/lr0.c: here. + +2020-03-06 Akim Demaille + + examples: use consistently the GFDL header for readmes + * examples/c++/README.md, examples/c++/calc++/README.md, + * examples/c/calc/README.md, examples/c/lexcalc/README.md, + * examples/c/reccalc/README.md: + Prefer the GFDL banner to the GPL one. + +2020-03-06 Akim Demaille + + style: remove useless declarations + * src/reader.h: Don't duplicate what parse-gram.h already exposes. + * src/lr0.h: Remove useless include. + +2020-03-06 Adrian Vogelsgesang + + typo: succesful -> successful + * data/skeletons/lalr1.cc: here + * etc/bench.pl.in: here + * src/location.c: and here. + +2020-03-06 Akim Demaille + + README: point to tests/bison, and document --trace + Reported by Victor Morales Cayuela. + + * README, README-hacking.md: here. + +2020-03-06 Akim Demaille + + gnulib: update + +2020-03-05 Akim Demaille + + README: point to tests/bison, and document --trace + Reported by Victor Morales Cayuela. + + * README, README-hacking.md: here. + +2020-03-05 Akim Demaille + + yacc.c: simplify yyparse_context_t member names + * data/skeletons/yacc.c (yyparse_context_t): Rename yyes_p and + yyes_capacity_p as... + (yyes, yyes_capacity): These. + +2020-03-05 Akim Demaille + + yacc.c: yyerror_range does not need to be preserved accross calls + * data/skeletons/yacc.c (b4_parse_state_variable_macros): Don't define + yyerror_range. + (yyparse): Add yyerror_range as local variable. + +2020-03-05 Akim Demaille + + yacc.c: push: undefine the pstate macros for the epilogue + * data/skeletons/yacc.c (b4_macro_define, b4_macro_undef) + (b4_pstate_macro_define, b4_parse_state_variable_macros): + New. + Use them. + * examples/c/bistromathic/parse.y: Remove now useless undefs. + +2020-03-05 Akim Demaille + + yacc.c: push: initialize the pstate variables in pstate_new + Currently pstate_new does not set up its variables, this task is left + to yypush_parse. This was probably to share more code with usual pull + parsers, where these (local) variables are indeed initialized by + yyparse. + + But as a consequence yyexpected_tokens crashes at the very beginning + of the parse, since, for instance, the stacks are not even set up. + See https://lists.gnu.org/r/bison-patches/2020-03/msg00001.html. + + The fix could have very simple, but the documentation actually makes + it very clear that we can reuse a pstate for several parses: + + After yypush_parse returns a status other than YYPUSH_MORE, the + parser instance yyps may be reused for a new parse. + + so we need to restore the parser to its pristine state so that (i) it + is ready to run the next parse, (ii) it properly supports + yyexpected_tokens for the next run. + + * data/skeletons/yacc.c (b4_initialize_parser_state_variables): New, + extracted from the top of yyparse/yypush_parse. + (yypstate_clear): New. + (yypstate_new): Use it when push parsers are enabled. + Define after the yyps macros so that we can use the same code as the + regular pull parsers. + (yyparse): Use it when push parsers are _not_ enabled. + + * examples/c/bistromathic/bistromathic.test: Check the completion on + the beginning of the line. + +2020-03-04 Akim Demaille + + style: formatting changes + * data/skeletons/yacc.c, tests/torture.at: here. + +2020-03-04 Akim Demaille + + bistromathic: properly compute the lcp, as expected by readline + Currently completion on "at" proposes only "atan", but does not + actually complete "at" into "atan". + + * examples/c/bistromathic/parse.y (completion): Install the lcp in + matches[0]. + * examples/c/bistromathic/bistromathic.test: Check that case. + +2020-03-04 Akim Demaille + + bistromathic: don't require spaces after operators for completion + Currently "(1+" does not work as expected, because "+" is not a + word breaking character. + + * examples/c/bistromathic/parse.y (init_readline): Specify our word + breaking characters. + * examples/c/bistromathic/bistromathic.test: Avoid trailing spaces. + +2020-03-02 Akim Demaille + + bistromathic: check completion + * examples/c/bistromathic/bistromathic.test: here. + * examples/c/bistromathic/parse.y (expected_tokens): Fix a memory + leak. + +2020-03-02 Akim Demaille + + m4: remove b4_function_define and b4_function_declare + * data/skeletons/c.m4: here. + +2020-03-02 Akim Demaille + + m4: decommission b4_function_declare + * data/skeletons/glr.c, data/skeletons/glr.cc, data/skeletons/yacc.c: + Stop using b4_function_declare. + +2020-03-02 Akim Demaille + + m4: decommission function generating macro + These macros have been extremely useful when we had to support K&R C, + which we dropped long ago. Now, they merely make the code uselessly + hard to read. + + * data/skeletons/c.m4, data/skeletons/glr.c, data/skeletons/glr.cc, + * data/skeletons/yacc.c: + Stop using b4_function_define. + +2020-03-01 Akim Demaille + + examples: bistromathic: demonstrate the use of yyexpected_tokens + Let's use GNU readline and its TAB autocompletion to demonstrate the + use of yyexpected_tokens. + + This shows a number of weaknesses in our current approach: + + - some macros (yyssp, etc.) from push parsers "leak" in user code, we + need to undefine them + + - the context needed by yyexpected_tokens does not need the token, + yypstate actually suffices + + - yypstate is not properly setup when first allocated, which results + in a crash of yyexpected_tokens if fired before a first token was + read. We should move initialization from yypush_parse into + yypstate_new. + + * examples/c/bistromathic/parse.y (yylex): Take input as a string, not + a file. + (EXIT): New token. + (input): Adjust to work only on a line. + (line): Remove. + (symbol_count, process_line, expected_tokens, completion) + (init_readline): New. + * examples/c/bistromathic/bistromathic.test: Adjust expectations. + +2020-03-01 Akim Demaille + + examples: use consistently the GFDL header for readmes + * examples/c++/README.md, examples/c++/calc++/README.md, + * examples/c/calc/README.md, examples/c/lexcalc/README.md, + * examples/c/pushcalc/README.md, examples/c/reccalc/README.md: + Prefer the GFDL banner to the GPL one. + +2020-03-01 Akim Demaille + + gnulib: use readline + +2020-02-29 Akim Demaille + + examples: bistromathic: don't use Flex + This example will soon use GNU readline, so its scanner should be easy + to use (concurrently) on strings, not streams. This is not a place + where Flex shines, and anyway, these are examples of Bison, not Flex. + There's already lexcalc and reccalc that demonstrate the use of Flex. + + * examples/c/bistromathic/scan.l: Remove. + * examples/c/bistromathic/parse.y (yylex): New. + Adjust dependencies. + +2020-02-29 Akim Demaille + + examples: bistromathic: strengthen tests + * examples/c/bistromathic/bistromathic.test: here. + * examples/test: Be clearer on failing tests. + +2020-02-29 Akim Demaille + + examples: lexcalc: demonstrate location tracking + The bistromathic example should not use Flex, it makes it too complex. + But it was the only example to show location tracking with Flex. + + * examples/c/lexcalc/lexcalc.test, examples/c/lexcalc/parse.y, + * examples/c/lexcalc/scan.l: Demonstrate location tracking as is done + in bistromathic. + +2020-02-27 Akim Demaille + + c++: don't copy the lookahead + The current implementation of parser::context keeps a copy of the + lookahead. This is troublesome since we support move-only types. + Besides, while GCC is happy with the current implementation, Clang + complains that the ctor it needs to build the copy of the lookahead is + not yet available. + + 461. calc.at:1120: testing Calculator C++ %defines %locations parse.error=verbose %name-prefix "calc" %verbose ... + calc.at:1120: COLUMNS=1000; export COLUMNS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y + calc.at:1120: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS + stderr: + In file included from calc-lex.cc:7: + calc.hh:351:12: error: instantiation of function 'calc::parser::basic_symbol::basic_symbol' required here, but no definition is available [-Werror,-Wundefined-func-template] + struct symbol_type : basic_symbol + ^ + calc.hh:273:7: note: forward declaration of template entity is here + basic_symbol (const basic_symbol& that); + ^ + calc.hh:351:12: note: add an explicit instantiation declaration to suppress this warning if 'calc::parser::basic_symbol::basic_symbol' is explicitly instantiated in another translation unit + struct symbol_type : basic_symbol + ^ + 1 error generated. + In file included from calc-main.cc:7: + calc.hh:351:12: error: instantiation of function 'calc::parser::basic_symbol::basic_symbol' required here, but no definition is available [-Werror,-Wundefined-func-template] + struct symbol_type : basic_symbol + ^ + calc.hh:273:7: note: forward declaration of template entity is here + basic_symbol (const basic_symbol& that); + ^ + calc.hh:351:12: note: add an explicit instantiation declaration to suppress this warning if 'calc::parser::basic_symbol::basic_symbol' is explicitly instantiated in another translation unit + struct symbol_type : basic_symbol + ^ + 1 error generated. + stdout: + calc.at:1120: exit code was 1, expected 0 + 461. calc.at:1120: 461. Calculator C++ %defines %locations parse.error=verbose %name-prefix "calc" %verbose (calc.at:1120): FAILED (calc.at:1120) + + * data/skeletons/lalr1.cc (context::yyla_): Make it a const-ref. + Move the implementation out of the declaration. + +2020-02-27 Akim Demaille + + c++: minor fixes + Address compiler warnings such as + + warning: declaration of 'yyla' shadows a member of 'yy::parser::context' [-Wshadow] + + * data/skeletons/lalr1.cc (context): Don't use the same names for + variables and members. + Use foo_ for private members, as in parser. + Also, use the + trick in array accesses to please ICC and provide it + with an int. + +2020-02-27 Adrian Vogelsgesang + + c++: add support for parse.error=custom + * data/skeletons/lalr1.cc: added support here + * tests/calc.at: added test cases + * tests/local.at: added yyreport_syntax_error implementation + for C++ test cases + +2020-02-27 Adrian Vogelsgesang + + c++: add parser::context for syntax error handling + * data/skeletons/lalr1.cc: here + +2020-02-27 Adrian Vogelsgesang + + c++: add support for parse.error=detailed + * data/skeletons/lalr1.cc: added support here + * tests/calc.at: added a test case + +2020-02-27 Adrian Vogelsgesang + + skeletons: prefer b4_parse_error_{case,bmatch} over manual solution + Prefer b4_parse_error_case over the adhoc solution + `m4_case + b4_percent_define_get`. Same for b4_parse_error_bmatch. + + * data/skeletons/glr.c: here + * data/skeletons/yacc.c: here + +2020-02-27 Adrian Vogelsgesang + + typo: succesful -> successful + * data/skeletons/lalr1.cc: here + * etc/bench.pl.in: here + * src/location.c: here + * tests/calc.at: and here + +2020-02-24 Akim Demaille + + bench.pl: clean up the dust + * etc/bench.pl.in: Adjust to the current use of %define's values. + Don't use %error-verbose. + Prefer Bison to CPP (e.g., api.value.type). + Avoid returning characters directly, so that %define api.token.raw works. + +2020-02-23 Akim Demaille + + style: comment changes + * src/symtab.h, src/lr0.c: here. + +2020-02-23 Akim Demaille + + style: avoid using 'this' as an identifier + LLDB insists on parsing 'this' as a C++ keyword, even when debugging a + C program. + + * src/symtab.c: Please the dictator. + +2020-02-23 Akim Demaille + + style: remove useless declarations + * src/reader.h: Don't duplicate what parse-gram.h already exposes. + * src/lr0.h: Remove useless include. + +2020-02-19 Akim Demaille + + examples: fix c/calc + * examples/c/calc/calc.y: Remove experiment traces. + +2020-02-19 Akim Demaille + + todo: update + +2020-02-15 Akim Demaille + + doc: update recommandation for libtextstyle + * README: here. + +2020-02-15 Akimn Demaille + + build: fix typo + * build-aux/cross-options.pl: here. + +2020-02-15 Akim Demaille + + doc: simplify the cross references + * doc/bison.texi: here. + +2020-02-15 Akim Demaille + + doc: document token internationalization + * doc/bison.texi (Parser Internationalization): Move most of its + content into... + (Enabling I18n): this new node. + (Token I18n): New. + (Token Decl): Refer to token internationalization. + (Error Reporting Function): Promote parse.error detailed. + +2020-02-15 Akim Demaille + + regen + +2020-02-15 Victor Morales Cayuela + + diagnostics: modernize the display of submessages + Since Bison 2.7, output was indented four spaces for explanatory + statements. For example: + + input.y:2.7-13: error: %type redeclaration for exp + input.y:1.7-11: previous declaration + + Since the introduction of caret-diagnostics, it became less clear. + Remove the indentation and display submessages as in GCC: + + input.y:2.7-13: error: %type redeclaration for exp + 2 | %type exp + | ^~~~~~~ + input.y:1.7-11: note: previous declaration + 1 | %type exp + | ^~~~~ + + * src/complain.h (SUB_INDENT): Remove. + (warnings): Add "note" to the enum. + * src/complain.h, src/complain.c (complain_indent): Replace by... + (subcomplain): this. + Adjust all dependencies. + * tests/actions.at, tests/diagnostics.at, tests/glr-regression.at, + * tests/input.at, tests/named-refs.at, tests/regression.at: + Adjust expectations. + +2020-02-13 Akim Demaille + + doc: simplify uses of references + This reverts "doc: work around problems with PDF generation", commit + d810aa3d8f76b1a4d7d402072f45a0662152ffd4. Upstream issue is fixed. + https://lists.gnu.org/r/bug-texinfo/2020-02/msg00006.html + + * gnulib: Update. + * doc/bison.texi: Simplify. + +2020-02-13 Akim Demaille + + java: provide a Context ctor + This is really a private auxiliary inner class, so it should not + matter. But it's better style. + + * data/skeletons/lalr1.java: here. + +2020-02-13 Akim Demaille + + Merge tag 'v3.5.2' + bison 3.5.2 + + * tag 'v3.5.2': + version 3.5.2 + news: 3.5.2 + gnulib: update + doc: update Doxygen template + java: avoid trailing white spaces + m4: fix b4_token_format + doc: clearly state that %yacc only makes sense with yacc.c + doc: spell check + examples: be more robust to spaces in paths + larlr1.cc: Reject unsupported values for parse.lac + +2020-02-13 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + +2020-02-13 Akim Demaille + + version 3.5.2 + * NEWS: Record release date. + +2020-02-13 Akim Demaille + + news: 3.5.2 + * NEWS: Update. + +2020-02-13 Akim Demaille + + gnulib: update + +2020-02-13 Akim Demaille + + doc: update Doxygen template + * Doxyfile.in: Run doxygen -u on it. + +2020-02-13 Akim Demaille + + java: avoid trailing white spaces + * data/skeletons/java.m4 (b4_maybe_throws): Issue a space before when needed. + * data/skeletons/lalr1.java: Avoid trailing spaces. + +2020-02-13 Akim Demaille + + m4: fix b4_token_format + We used to emit: + + /** Token number,to be returned by the scanner. */ + static final int NUM = 258; + /** Token number,to be returned by the scanner. */ + static final int NEG = 259; + + with no space after the comma. Fix that. + + * data/skeletons/bison.m4 (b4_token_format): Quote where appropriate. + +2020-02-13 Akim Demaille + + doc: clearly state that %yacc only makes sense with yacc.c + * doc/bison.texi: here. + +2020-02-13 Akim Demaille + + doc: spell check + * doc/bison.texi: here. + +2020-02-12 Akim Demaille + + examples: bistromathic: demonstrate named references + * examples/c/bistromathic/parse.y: here. + +2020-02-12 Akim Demaille + + c++: simplify + * data/skeletons/stack.hh (ssize): Remove, same as size. + +2020-02-12 Akim Demaille + + tests: check calls to yyerror from the user actions + This revealed a number of things I had not realized: + + - the Java location tracking was aliasing the same pair of positions + for all the symbols (see previous commit). + + - in impure parsers, it's quite easy to use incorrect locations for + diagnostics, since yyerror uses yylloc, which is the location of the + lookahead, not that of the current lhs. So we need something like + + { + YYLTYPE old_yylloc = yylloc; + yylloc = @$; + yyerror (]AT_PARAM_IF([result, count, nerrs, ])[buf); + yylloc = old_yylloc; + } + + Maybe we should do that little yylloc dance in the skeleton instead + of leaving it to the user? It might be costly... But that's only + for users of the impure parsers, which are asking for trouble + anyway. + + - in glr.cc invoking yyerror is somewhat cumbersome: the C++ interface + is not available as we are in yyparse (which in C), and yyerror is + used by glr.cc itself to bind it to the user's parser::error. If we + call yyerror, we need: + + yyerror (]AT_LOCATION_IF([[&@$, ]])[yyparser, ]AT_PARAM_IF([result, count, nerrs, ])[msg); + + However calling yy::parser::error is easier, once we know that the + current parser object is available as 'yyparser'. Which also saves + us from having to pass the parse-params ourselves: + + yyparser.error (]AT_LOCATION_IF([[@$, ]])[msg); + + * tests/calc.at: Invoke yyerror by hand, instead of using fprintf etc. + Adjust expectations. + +2020-02-11 Akim Demaille + + java: beware not to alias the locations of the various symbols + * examples/java/calc/Calc.y, tests/calc.at, tests/local.at + (getStartPos, getEndPos): Always return a new object. + * doc/bison.texi: Clarify this. + +2020-02-11 Akim Demaille + + java: check that parse.error custom|detailed work with push parsers + * tests/calc.at: here. + +2020-02-11 Akim Demaille + + java: don't expose the Context's members + * data/skeletons/lalr1.java (Context): Make data members private. + (Context.getLocation): New. + * examples/java/calc/Calc.y, tests/java.at, tests/local.at: Adjust. + +2020-02-10 Akim Demaille + + build: pacify syntax-check + * src/complain.c: Fix indentation. + * cfg.mk: Using strcmp is ok in the tests. + Test cases and examples don't need Bison's PO support. + +2020-02-10 Akim Demaille + + regen + +2020-02-10 Akim Demaille + + gnulib: update + +2020-02-10 Akim Demaille + + build: prefer %D% and %C% to hard coded values + * doc/local.mk: here. + +2020-02-10 Akim Demaille + + parse.error: document and diagnose the incompatibility with %token-table + * doc/bison.texi (Tokens from Literals): Move to code using + %token-table to... + (Decl Summary: %token-table): here. + * data/skeletons/bison.m4: Implement mutual exclusion. + * tests/input.at: Check it. + * doc/local.mk: Be robust to the removal of doc/. + +2020-02-10 Akim Demaille + + doc: spell check + * doc/bison.texi: here. + +2020-02-10 Akim Demaille + + doc: formatting changes + * doc/bison.texi: here. + +2020-02-10 Akim Demaille + + doc: work around problems with PDF generation + With texinfo.tex 2019-09-24.13, node names with + are not properly + handled. + https://lists.gnu.org/r/bug-texinfo/2020-02/msg00004.html + + * doc/bison.texi: Always use the three-argument form for references to + node with a + in the name. + +2020-02-10 Akim Demaille + + java: revert "style: avoid useless initializers" + This reverts commit ebab1ffca8a728158051481795ae798231cfd93d. + This commit removed "useless" initializers, going from + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ + private static final byte yypact_[] = yypact_init (); + private static final byte[] yypact_init () + { + return new byte[] + { + 25, -7, -8, 37, -8, 40, -8, 20, -8, 61, + -8, -8, 3, 9, 51, -8, -8, -2, -2, -2, + -2, -2, -2, -8, -8, -8, 1, 66, 66, 3, + 3, 3 + }; + } + + to + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ + private static final byte[] yypact_ = + { + 25, -7, -8, 37, -8, 40, -8, 20, -8, 61, + -8, -8, 3, 9, 51, -8, -8, -2, -2, -2, + -2, -2, -2, -8, -8, -8, 1, 66, 66, 3, + 3, 3 + }; + + But it turns out that this was on purpose, to work around the 64KB + limitation in JVM methods. It was introduced on the 2008-11-10 by + Di-an Jan in 09ccae9b18a7c09ebf7bb8df2a18c8c4a6def248: "Work around + Java's ``code too large'' problem for parser tables". See + https://lists.gnu.org/r/help-bison/2008-11/msg00004.html. A real + test, where we would hit the JVM limitation, would be nice. + + To avoid further regressions, add comments. + +2020-02-10 Akim Demaille + + skeletons: avoid b4_error_verbose_if, which is confusing + parse.error has more than two possible values. + + * data/skeletons/bison.m4 (b4_error_verbose_if, b4_error_verbose_flag): + Remove. + (b4_parse_error_case, b4_parse_error_bmatch): New. + Adjust dependencies. + +2020-02-10 Akim Demaille + + skeletons: decorelate %token-table from verbose error messages + Reported by Adrian Vogelsgesang. + + * data/skeletons/bison.m4: Here. + * data/skeletons/lalr1.cc: Adjust. + +2020-02-10 Akim Demaille + + doc: formatting changes + * doc/bison.texi: here. + +2020-02-09 Akim Demaille + + doc: clearly state that %yacc only makes sense with yacc.c + * doc/bison.texi: here. + * tests/calc.at: Stop testing %yacc with non yacc.c skeletons. + +2020-02-09 Adrian Vogelsgesang + + style: stylistic cleanups in the C skeletons + * data/skeletons/glr.c, data/skeletons/yacc.c: + Avoid duplicated declaration of yysymbol_name. + +2020-02-08 Akim Demaille + + java: provide Context with a more OO interface + * data/skeletons/lalr1.java (yyexpectedTokens) + (yysyntaxErrorArguments): Make them methods of Context. + (Context.yysymbolName): New. + * tests/local.at: Adjust. + +2020-02-08 Akim Demaille + + java: add support for parse.error custom + * data/skeletons/lalr1.java: Add support for custom parse errors. + (yyntokens_): Make it public. Under... + (yyntokens): this name. + (Context): Capture the location too. + * examples/c/bistromathic/parse.y, + * examples/c/bistromathic/bistromathic.test: + Improve error message. + * examples/java/calc/Calc.test, examples/java/calc/Calc.y: Use custom + error messages. + * tests/calc.at, tests/local.at: Check custom error messages. + +2020-02-08 Akim Demaille + + java: let the Context give access to yyntokens + * data/skeletons/lalr1.java (Context.yytokens): New. + +2020-02-08 Akim Demaille + + java: make the syntax error format string translatable + The error format should be translated, but contrary to the case of + C/C++, we cannot just depend on macros to adapt on the + presence/absence of '_'. Let's consider that the message format is to + be translated iff there are some internationalized tokens. + + * src/output.c (prepare_symbol_names): Define b4_has_translations. + * data/skeletons/java.m4 (b4_trans): New. + * data/skeletons/lalr1.java: Use it to emit translatable or not the + format string. + +2020-02-08 Akim Demaille + + java: introduce yyexpectedTokens + And allow syntax error messages for 'detailed' and 'verbose' to be + translated. + + * data/skeletons/lalr1.java (Context, yyexpectedTokens) + (yysyntaxErrorArguments): New. + (yysyntax_error): Use it. + +2020-02-08 Akim Demaille + + java: add support for parse.error=detailed + In Java there is no need for N_ and yytranslate_. So instead of + hard-coding the use of N_ in the table of the symbol names, rely on + b4_symbol_translate. + + * src/output.c (prepare_symbol_names): Use b4_symbol_translate instead + of N_. + * data/skeletons/c.m4 (b4_symbol_translate): New. + * data/skeletons/lalr1.java (yysymbolName): New. + Use it. + * examples/java/calc/Calc.y: Use parse.error=detailed. + * tests/calc.at: Check parse.error=detailed. + +2020-02-08 Akim Demaille + + m4: fix b4_token_format + We used to emit: + + /** Token number,to be returned by the scanner. */ + static final int NUM = 258; + /** Token number,to be returned by the scanner. */ + static final int NEG = 259; + + with no space after the comma. Fix that. + + * data/skeletons/bison.m4 (b4_token_format): Quote where appropriate. + +2020-02-05 Akim Demaille + + java: tests: remove now redundant tests + * tests/javapush.at: here. + +2020-02-05 Akim Demaille + + java: tests: check push parsers like the others + Currently in javapush.at. + + * tests/calc.at: Here. + +2020-02-05 Akim Demaille + + java: tests: remove now redundant tests + * tests/java.at: Calculator tests are now in calc.at. + +2020-02-05 Akim Demaille + + java: tests: check location tracking in the calculator + Unfortunately in the Java skeleton the user cannot override the way + locations are displayed, and locations don't know the structure of the + positions. So they cannot implement the tricks used in the C/C++ + skeletons to display "1.1" instead of "1.1-1.2". + + * tests/local.at (Java): Add support for column tracking in the + locations, as we did in examples/java/calc. + * tests/calc.at: Use AT_CALC_YYLEX. + +2020-02-05 Akim Demaille + + java: tests: prepare the replacement of calculator tests + Soon calculator tests for Java will move from java.at to calc.at. + Which implies improving the Java testing infrastructure in + local.at (for instance really tracking columns in positions, not just + token number). Detach java.at from local.at. + + * tests/java.at (AT_JAVA_POSITION_DEFINE_OLD): New. + Use it. + +2020-02-05 Akim Demaille + + java: style: avoid useless initializers + Instead of + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ + private static final byte yypact_[] = yypact_init (); + private static final byte[] yypact_init () + { + return new byte[] + { + 25, -7, -8, 37, -8, 40, -8, 20, -8, 61, + -8, -8, 3, 9, 51, -8, -8, -2, -2, -2, + -2, -2, -2, -8, -8, -8, 1, 66, 66, 3, + 3, 3 + }; + } + + generate + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ + private static final byte[] yypact_ = + { + 25, -7, -8, 37, -8, 40, -8, 20, -8, 61, + -8, -8, 3, 9, 51, -8, -8, -2, -2, -2, + -2, -2, -2, -8, -8, -8, 1, 66, 66, 3, + 3, 3 + }; + + I have no idea what motivated the previous approach. + + * data/skeletons/java.m4 (b4_typed_parser_table_define): Here. + +2020-02-05 Akim Demaille + + java: style: prefer putting the square brackets on the type + * examples/java/calc/Calc.y, examples/java/simple/Calc.y, + * tests/calc.at, tests/local.at: here. + +2020-02-05 Akim Demaille + + java: examples: fix the tracking of locations + * examples/java/calc/Calc.y: The StreamTokenizer cannot "peek" for the + next character, it reads it, and keeps it for the next call. So the + current location is one passed the end of the current token. To avoid + this, keep the previous position, and use it to end the current token. + * examples/java/calc/Calc.test: Adjust. + +2020-02-05 Akim Demaille + + java: examples: prefer switch to chains of else-if + * examples/java/calc/Calc.y, examples/java/simple/Calc.y: here. + * examples/java/simple/Calc.y: Use the tokenizer's handling of blanks. + +2020-02-05 Akim Demaille + + java: examples: split in two + * examples/java: Split in... + * examples/java/simple, examples/java/calc: these. + +2020-02-05 Akim Demaille + + traces: don't print the stack before the gotos + The C, C++ and D skeletons used to show the stack right after popping + the stack during the reduction. Now that the stack is printed after + reaching a new state, that has become useless: + + Entering state 1 + Stack now 0 1 + Reducing stack by rule 5 (line 83): + $1 = token "number" (1) + -> $$ = nterm exp (1) + Stack now 0 + Entering state 8 + Stack now 0 8 + + Remove the "Stack now 0" line. + + * data/skeletons/lalr1.cc, data/skeletons/lalr1.d, + * data/skeletons/lalr1.java, data/skeletons/yacc.c: + Here. + +2020-02-05 Akim Demaille + + traces: show the stack after reading a token + Currently, if we have long rules and series of shift, we stack states + without showing stack. Let's be more incremental, and do how the Java + skeleton does. + + * data/skeletons/lalr1.cc, data/skeletons/lalr1.d, + * data/skeletons/yacc.c: + Here. + Adjust test cases. + * tests/torture.at (AT_DATA_STACK_TORTURE): Disable stack traces: this + test produces a very large stack, and showing the stack each time we + shift a token goes quadatric. + +2020-02-04 Akim Demaille + + traces: write the "Reading a token" alone on its line + The Java skeleton displays + + Reading a token: + Next token is token "number" (1) + + while the other display + + Reading a token: Next token is token "number" (1) + + When generating logs in the scanner, the first part is separated from + the second, and the end of the scanner logs have the second part + pasted in. So let's propagate the Java way, but with the colon. + + * data/skeletons/glr.c, data/skeletons/lalr1.cc, data/skeletons/lalr1.d, + * data/skeletons/lalr1.java, data/skeletons/yacc.c: Do it. + Adjust test cases and doc. + +2020-02-02 Akim Demaille + + java: use the same calc tests as the other skeletons + * tests/local.at (AT_LANG_MATCH): New. + (AT_YYERROR_DECLARE(java), AT_YYERROR_DECLARE_EXTERN(java)): New. + * tests/calc.at: The grammar file for Java is quite different for the + others, and continuing to assemble it from pieces makes the grammar + file hard to understand. Let's also dispatch on the language to + assemble it, and isolate Java from the others. + Most of this comes from java.at. + +2020-02-02 Akim Demaille + + java: add access to the number of errors + * data/skeletons/lalr1.java (yynewrrs, getNumberOfErrors): New. + Formatting changes. + +2020-02-02 Akim Demaille + + java: formatting changes + * data/skeletons/java.m4, data/skeletons/lalr1.java: here. + +2020-02-02 Akim Demaille + + java: avoid trailing white spaces + * data/skeletons/java.m4 (b4_maybe_throws): Issue a space before when needed. + * data/skeletons/lalr1.java: Avoid trailing spaces. + +2020-02-02 Akim Demaille + + java: example: properly track the locations + This example, so far, was tracking the current token number, not the + current column number. This is not nice for an example... + + * examples/java/Calc.y (PositionReader): New. + Use it. + * examples/java/Calc.test: Check the output. + +2020-02-02 Akim Demaille + + java: example: improve + * examples/java/Calc.y: Propagate the exit status. + Support -p. + +2020-02-02 Akim Demaille + + java: example: rely on autoboxing + AFAICT, autoboxing/unboxing was added in Java 5 (September 30, 2004). + I think we can afford to use it. It should help us merge some Java + tests with the main ones. + + However, beware that != does not unbox: it compares the object + addresses. + + * examples/java/Calc.y, tests/java.at: Simplify. + * examples/java/Calc.test, tests/java.at: Improve tests. + +2020-02-02 Akim Demaille + + tests: comment changes + * tests/calc.at: Shorten titles and reduce redundancy. + +2020-02-02 Akim Demaille + + skeletons: add support for %code epilogue + When building the test cases, emitting code in the epilogue is very + constraining. Let's make it simpler thanks to %code epilogue. + + However, I don't want to document this: it is bad style to use it (we + should avoid having too many ways to write the same thing, + TI!MTOWTDI), just put your code in the true epilogue section. + + * data/skeletons/glr.c, data/skeletons/lalr1.d, data/skeletons/lalr1.java, + * data/skeletons/yacc.c: Implement support for %code epilogue. + Remove useless comments. + * tests/calc.at, tests/java.at: Simplify. + +2020-02-02 Akim Demaille + + examples: bistromathic: fix location tracking + * examples/c/bistromathic/scan.l (LOCATION_STEP): New. + Use to properly ignore blanks. + * examples/c/bistromathic/bistromathic.test: Check that case. + +2020-02-02 Akim Demaille + + doc: document new features of parse.error + * doc/bison.texi (Error Reporting): Rename as... + (Error Reporting Function): this. + Adjust dependencies. + Make it a subsection of this... + (Error Reporting): new section. + (Syntax Error Reporting Function): New. + (parse.error): Update description. + +2020-01-29 Akim Demaille + + glr.c: add support for parse.error=custom + * data/skeletons/glr.c (yyreportSyntaxError): Call the user's + yyreport_syntax_error in custom mode. + * tests/calc.at: Check it. + +2020-01-29 Akim Demaille + + glr.c: add support for parse.error=detailed + * data/skeletons/glr.c (yystrlen, yysymbol_name): New. + Implement parse.error detailed. + * tests/calc.at: Check it. + +2020-01-29 Akim Demaille + + glr.c: introduce yyexpected_tokens and yysyntax_error_arguments + Modeled after what was done in yacc.c, yet somewhat different since + yyGLRStack play the role of the full yyparse_context_t. It will + probably be defined as a alias, to make interfaces compatible. + + LAC is not supported here. And is somewhat tricky. + + * data/skeletons/glr.c (yyexpected_tokens, yysyntax_error_arguments): New. + +2020-01-29 Akim Demaille + + glr.c: move code around + * data/skeletons/glr.c: Move the handling of error messages after the + definition of types. Especially after yyGLRStack, which we will need + in forthcoming patches. + Simplify: yyGLRStack is defined at this point. + +2020-01-29 Akim Demaille + + glr.c: rename yyStateNum as yy_state_t + * data/skeletons/glr.c: here. + For consistency with yacc.c. + +2020-01-29 Akim Demaille + + yacc.c: fix misleading indentation + * data/skeletons/yacc.c: here. + +2020-01-27 Akim Demaille + + doc: simplify uses of @ref + The PDF output is more consistent: some nodes were not pointed to with + their title. The HTML output becomes "see section Foo" instead of + "see Foo", but this should be addressed in the next Texinfo release. + Info output is simplified, as it uses only the node name and not its + title. But it's considered easier to read this way. + See https://lists.gnu.org/r/help-texinfo/2020-01/msg00031.html. + + * doc/bison.texi: Set @xrefautomaticsectiontitle on. + Simplify all uses of ref. + +2020-01-27 Akim Demaille + + examples: be more robust to spaces in paths + Reported by Nikki Valen. + https://lists.gnu.org/r/bug-bison/2020-01/msg00032.html + + * examples/test ($prog): Remove, replaced by... + (prog): This new function, which pays attention to quoting shell + variables. + +2020-01-27 Akim Demaille + + doc: don't pretend trigonometry is part of arithmetics + * doc/bison.texi (arith_funs): Rename as... + (funs): this. + +2020-01-27 Akim Demaille + + doc: update Doxygen template + * Doxyfile.in: Run doxygen -u on it. + +2020-01-27 Akim Demaille + + examples: add a complete example with all the bells and whistles + * examples/c/bistromathic/Makefile, + * examples/c/bistromathic/README.md, + * examples/c/bistromathic/bistromathic.test, + * examples/c/bistromathic/local.mk, + * examples/c/bistromathic/parse.y, + * examples/c/bistromathic/scan.l: + New. + + * Makefile.am (AM_YFLAGS_WITH_LINES): Add -Wdangling-alias. + * examples/test: Make failure errors easier to read. + +2020-01-26 Akim Demaille + + examples: add an example of a push parser + Add an example to demonstrate the use of push parser. I'm pleasantly + surprised: parse.error=detailed works like a charm with push parsers. + + * examples/c/local.mk, examples/c/pushcalc/Makefile + * examples/c/pushcalc/README.md, examples/c/pushcalc/calc.test, + * examples/c/pushcalc/calc.y, examples/c/pushcalc/local.mk: + New. + +2020-01-26 Akim Demaille + + examples: more tests + * examples/c/mfcalc/mfcalc.test: here. + +2020-01-26 Akim Demaille + + examples: clean up + * examples/c/calc/calc.y: Restore to its original state, with + parse.error=detailed instead of parse.error=custom (this example + should be simple). + * examples/c/calc/calc.test: Check syntax errors. + * examples/c/lexcalc/parse.y: Add comments. + +2020-01-26 Akim Demaille + + tests: check custom error messages and push parsers + * tests/local.at (AT_LAC_IF): New. + * tests/calc.at: And also check the suppot for LAC. + +2020-01-26 Akim Demaille + + style: formatting changes + * data/skeletons/lalr1.java: here. + +2020-01-26 Akim Demaille + + todo: update + +2020-01-26 Akim Demaille + + bison: pretend to 3.6 already + * src/parse-gram.y: here. + +2020-01-26 Akim Demaille + + git: update ignores + * lib/.gitignore: here. + +2020-01-23 Akim Demaille + + regen + +2020-01-23 Akim Demaille + + diagnostics: modernize bison's syntax errors + We used to display the unexpected token first: + + $ bison foo.y + foo.y:1.8-13: error: syntax error, unexpected %token, expecting character literal or identifier or + 1 | %token %token + | ^~~~~~ + + GCC uses a different format: + + $ gcc-mp-9 foo.c + foo.c:1:5: error: expected identifier or '(' before ')' token + 1 | int()()() + | ^ + + and so does Clang: + + $ clang-mp-9.0 foo.c + foo.c:1:5: error: expected identifier or '(' + int()()() + ^ + 1 error generated. + + They display the unexpected token last (or not at all). Also, they + don't waste width with "syntax error". Let's try that. It gives, for + the same example as above: + + $ bison foo.y + foo.y:1.8-13: error: expected character literal or identifier or before %token + 1 | %token %token + | ^~~~~~ + + * src/complain.h, src/complain.c (syntax_error): New. + * src/parse-gram.y (yyreport_syntax_error): Use it. + +2020-01-23 Akim Demaille + + regen + +2020-01-23 Akim Demaille + + diagnostics: report syntax errors in color + * src/parse-gram.y (parse.error): Set to 'custom'. + (yyreport_syntax_error): New. + * data/bison-default.css (.expected, .unexpected): New. + * tests/diagnostics.at: Adjust. + +2020-01-23 Akim Demaille + + regen + +2020-01-23 Akim Demaille + + diagnostics: translate bison's own tokens + As a test case, support translations in Bison itself. + + * src/parse-gram.y: Mark the translatable tokens. + While at it, use clearer names. + * tests/input.at: Adjust expectations. + +2020-01-22 Akim Demaille + + diagnostics: handle -fno-caret in the called functions + Don't force callers of location_caret to have to deal with flags that + disable it. + + * src/location.h, src/location.c (location_caret) + (location_caret_suggestion): Early return if disabled. + * src/complain.c: Simplify. + +2020-01-22 Akim Demaille + + yacc.c: fixes + * data/skeletons/yacc.c: Avoid warnings about unused functions. + Fix typo. + +2020-01-21 Akim Demaille + + examples: be more robust to spaces in paths + Reported by Nikki Valen. + https://lists.gnu.org/r/bug-bison/2020-01/msg00032.html + + * examples/test ($prog): Remove, replaced by... + (prog): This new function, which pays attention to quoting shell + variables. + +2020-01-21 Adrian Vogelsgesang + + larlr1.cc: Reject unsupported values for parse.lac + Just as the yacc.c skeleton, the lalr1.cc skeleton should reject + invalid values for parse.lac. + + * data/skeletons/lalr1.cc: check validity of parse.lac + * tests/input.at: new test cases + +2020-01-21 Adrian Vogelsgesang + + larlr1.cc: Reject unsupported values for parse.lac + Just as the yacc.c skeleton, the lalr1.cc skeleton should reject + invalid values for parse.lac. + + * data/skeletons/lalr1.cc: check validity of parse.lac + * tests/input.at: new test cases + +2020-01-19 Akim Demaille + + parsers: issue tname with i18n markup + Some users would like to avoid having to "parse" the *.y file to find + the strings to translate. Let's issue the translatable tokens with N_ + to allow "parsing" the generated parsers instead. + + See + https://lists.gnu.org/archive/html/bison-patches/2019-01/msg00015.html + + * src/output.c (prepare_symbol_names): Issue symbol_names with N_() + markup. + +2020-01-19 Akim Demaille + + tests: check token internationalization + * tests/calc.at: Check it. + +2020-01-19 Akim Demaille + + regen + +2020-01-19 Akim Demaille + + parsers: support translatable token aliases + In addition to + + %token NUM "number" + + accept + + %token NUM _("number") + + in which case the token will be translated in error messages. + Do not use _() in the output if there are no translatable tokens. + + * src/symtab.h, src/symtab.c (symbol): Add a 'translatable' member. + * src/parse-gram.y (TSTRING): New token. + (string_as_id.opt): Replace with... + (alias): this. + Use it. + * src/scan-gram.l (SC_ESCAPED_TSTRING): New start conditions, to match + TSTRINGs. + * src/output.c (prepare_symbols): Define b4_translatable if there are + translatable strings. + + * data/skeletons/glr.c, data/skeletons/lalr1.cc, + * data/skeletons/yacc.c (yytnamerr): Receive b4_translatable, and use it. + +2020-01-19 Akim Demaille + + tests: check that detailed error messages preserve UTF-8 characters + * tests/regression.at: here. + +2020-01-19 Akim Demaille + + yacc.c: escape trigraphs in detailed parse.error + * src/output.c (escape_trigraphs, xescape_trigraphs): New. + (prepare_symbol_names): Use it. + * tests/regression.at: Check the handling of trigraphs with + parse.error = detailed. + +2020-01-19 Akim Demaille + + regen + +2020-01-19 Akim Demaille + + bison: use detailed error messages + * #: . + +2020-01-19 Akim Demaille + + regen + +2020-01-19 Akim Demaille + + yacc.c: tests: check detailed error messages + * tests/local.at (AT_ERROR_DETAILED_IF): New. + (AT_ERROR_SIMPLE_IF): Adjust. + * tests/calc.at: Check parse.error=detailed. + +2020-01-19 Akim Demaille + + yacc.c: add support for parse.error detailed + "detailed" error messages are almost like "verbose", except that we + don't double escape them, they don't get inner quotes, we don't use + yytnamerr, and we hide the table. + + "custom" is exposed with the "detailed" tokens, not the "verbose" + ones: they are not double-quoted. + + Because there's a risk that some people use yytname even without + "verbose", let's keep yytname (instead of yys_name) in "simple" + parse.error. + + * src/output.c (prepare_symbol_names): Be ready to output symbol names + unquoted. + (prepare_symbol_names): Output both the old tname table, and the new + symbol_names one. + * data/skeletons/bison.m4: Accept 'detailed'. + * data/skeletons/yacc.c: When parse.error is 'detailed', don't emit + yytname and yytnamerr, just yysymbol_name with the table inside. + * tests/calc.at: Adjust. + +2020-01-19 Akim Demaille + + c: use yysymbol_name in traces + Only parse.error verbose and simple will get the original yytname: the + other options will rely on a different table. So let's move on top of + the yysymbol_name function. + + * data/skeletons/c.m4 (yy_symbol_print): Use yysymbol_name. + * data/skeletons/glr.c (yytokenName): Rename as... + (yysymbol_name): this. + The change of naming scheme is unfortunate, but it's definitely glr.c + which is "wrong". + +2020-01-19 Akim Demaille + + glr.c: move some functions after the definition of types + Currently yy_symbol_print is defined before yytokenName, although it + should use it instead of read yytname directly. Move blocks around to + avoid this. + + * data/skeletons/glr.c (yy_symbol_print): Move its definition after + that of yytokenName. + +2020-01-19 Akim Demaille + + Merge branch 'maint' + * maint: + maint: post-release administrivia + version 3.5.1 + news: update + CI: use ICC again + warnings: pacify ICC in lalr1.cc + test: report.at: avoid tiny new failure + git: update ignores + +2020-01-19 Akim Demaille + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + 2020-01-19 Akim Demaille version 3.5.1 @@ -38,6 +12026,268 @@ git: update ignores +2020-01-17 Akim Demaille + + regen + +2020-01-17 Akim Demaille + + yacc.c: portability to G++ 4.8 + Currently we get warnings with GCC 4.8 when running the + maintainer-check-g++ tests: + + 143. skeletons.at:85: testing Installed skeleton file names ... + ../../tests/skeletons.at:120: COLUMNS=1000; export COLUMNS; bison --color=no -fno-caret --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y + ../../tests/skeletons.at:121: $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input-cmd-line input-cmd-line.c $LIBS + stderr: + input-cmd-line.c: In function 'int yysyntax_error(long int*, char**, const yyparse_context_t*)': + input-cmd-line.c:977:52: error: conversion to 'int' from 'long int' may alter its value [-Werror=conversion] + YYSIZEOF (yyarg) / YYSIZEOF (*yyarg)); + ^ + cc1plus: all warnings being treated as errors + stdout: + ../../tests/skeletons.at:121: exit code was 1, expected 0 + + and + + 429. calc.at:823: testing Calculator parse.error=custom %locations api.prefix={calc} ... + ../../tests/calc.at:823: COLUMNS=1000; export COLUMNS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y + ../../tests/calc.at:823: $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS + stderr: + calc.y: In function 'int yyreport_syntax_error(const yyparse_context_t*)': + calc.y:157:58: error: conversion to 'int' from 'long unsigned int' may alter its value [-Werror=conversion] + int n = yysyntax_error_arguments (ctx, arg, sizeof arg / sizeof *arg); + ^ + cc1plus: all warnings being treated as errors + stdout: + ../../tests/calc.at:823: exit code was 1, expected 0 + + We could use a cast to avoid the warning, but it becomes too + cluttered. We can also use YYPTRDIFF_T, but that forces the user to + use YYPTRDIFF_T too, although this is an array of tokens, which is + limited by YYNTOKENS, an int. So let's completely avoid this warning. + + * data/skeletons/yacc.c, tests/local.at (yyreport_syntax_error): Avoid + relying on sizeof to compute the array capacity. + +2020-01-17 Akim Demaille + + yacc.c: pass the parse-params to yyreport_syntax_error + Enhance the calculator tests: show that passing arguments to yyerror + works. + + * tests/calc.at: Add a new parse-param, nerrs, which counts the number + of syntax errors in a run. + * tests/local.at: Adjust to handle the new 'nerrs' argument, when + present. + + The custom error reporting function show sees the user's additional + arguments. Let's experiment with passing them as arguments to + yyreport_syntax_error, but maybe storing them in the context would be + a bettter alternative. + + * data/skeletons/yacc.c (yyreport_syntax_error): Handle the + parse-params. + * tests/calc.at, tests/local.at: Adjust. + +2020-01-17 Akim Demaille + + tests: a clearer test for parse-params + Currently the parse-params are tested in calc.at by checking that the + global variable and the parse-params have the same value. But it does + not check that value, that could remain being 0 just as well. + + * tests/calc.at: Don't define the params when they are not used. + Check the final value of result and count. + Also, do count the number of line of logs. + +2020-01-17 Akim Demaille + + yacc.c: check custom error messages with parse-params + * tests/calc.at: Check with prefix and parse-params. + +2020-01-17 Akim Demaille + + yacc.c: let custom error messages see the location + * data/skeletons/yacc.c (yyparse_context_t): Add yylloc when + applicable. + (yyparse_context_location): New. + * tests/local.at (AT_YYERROR_DEFINE(c)): Handle the location. + * tests/calc.at: Check it. + +2020-01-17 Akim Demaille + + yacc.c: isolate yyexpected_tokens + Provide users with a means to query for the currently allowed tokens. + Could be used for autocompletion for instance. + + * data/skeletons/yacc.c (yyexpected_tokens): New, extracted from + yysyntax_error_arguments. + * examples/c/calc/calc.y (PRINT_EXPECTED_TOKENS): New. + Use it. + +2020-01-17 Akim Demaille + + tests: compute verbose error messages from the custom ones + We use a different format to check parse.error custom. Compute the + "verbose" one from it instead of forcing the test author to provide + the various formats of expected error messages. + + * tests/calc.at (_AT_CHECK_CALC_ERROR): Handle this transformation + when needed. + Simplify callers. + +2020-01-17 Akim Demaille + + yacc.c: check custom error messages + * tests/local.at (AT_ERROR_CUSTOM_IF, AT_ERROR_VERBOSE_IF) + (AT_ERROR_SIMPLE_IF): New. + (AT_YYERROR_DEFINE(c)): Generate yyreport_syntax_error. + * tests/calc.at (_AT_CHECK_CALC_ERROR): Accept custom error messages + as additional test case. + Use it. + Add a new test case for %define parse.error custom. + +2020-01-17 Akim Demaille + + yacc.c: add custom error message generation + When parse.error is custom, let users define a yyreport_syntax_error + function, and use it. + + * data/skeletons/bison.m4 (b4_error_verbose_if): Accept 'custom'. + * data/skeletons/yacc.c: Implement it. + * examples/c/calc/calc.y: Experiment with it. + +2020-01-17 Akim Demaille + + yacc.c: style: avoid macros + * data/skeletons/yacc.c (YYSYNTAX_ERROR): Remove, the call is now + sufficiently small so that we can afford to duplicate it. + +2020-01-17 Akim Demaille + + yacc.c: store token numbers, not token strings + That allows users to cover more cases, such as easily filtering some + arguments they don't want to expose. But they now have to call + yysymbol_name explicitly. + + * data/skeletons/yacc.c (yysyntax_error_arguments, yysyntax_error): + Deal with symbol numbers instead of symbol names. + +2020-01-17 Akim Demaille + + yacc.c: extract yyerror_message_arguments + Isolate a function that returns the list of expected and unexpected + tokens. It will be exposed to users willing to customize their error + messages. + + * data/skeletons/yacc.c (yyparse_context_t): New. + (yyerror_message_arguments): New, extracted from yysyntax_error. + +2020-01-17 Akim Demaille + + regen + +2020-01-15 Akim Demaille + + tests: make AT_PARSE_PARAMS usable at the end of arguments + When not empty, AT_PARSE_PARAMS was guaranteed to end with a comma. + Remove the trailing comma, so that we can use AT_PARSE_PARAMS at the + end of the arguments, not only at the beginning. + + * tests/local.at: here. + Unfortunately, m4_append relies on the macro not being defined whereas + we would have preferred it to check for emptiness. So use + m4_define/m4_undefine instead of m4_pushdef/m4_popdef. + +2020-01-15 Akim Demaille + + tests: fix AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS pairs + * tests/glr-regression.at, tests/java.at, tests/javapush.at: + Close properly what is opened. + Do not nest. + +2020-01-15 Akim Demaille + + d, java: use traces more alike that of C + Same order, same places, same content. + + * data/skeletons/lalr1.d, data/skeletons/lalr1.java: here. + +2020-01-15 Akim Demaille + + c++: report the stack at the same places as in C + Let's have C be the reference, and match it elsewhere. Maybe C is too + verbose and some adjustments are needed, but then that would be done + in another batch of patches. + + * data/skeletons/lalr1.cc: Print the stack once we popped after + YYERROR, and before emptying the stack at the end of parsing. + +2020-01-15 Akim Demaille + + c++: display the stack in the same order as in C + Currently the C and C++ parse traces differ in the order in which the + stack is displayed: bottom up in C, top down in C++. Let's stick to + the C order. + + * data/skeletons/stack.hh (stack::iterator, stack::const_iterator) + (begin, end): Be forward, not backward. + +2020-01-15 Akim Demaille + + style: avoid redundancy in the tests + * tests/local.at (m4_rpatsubst): New. + Use it to handle %parse-params. + * tests/calc.at: Use %parse-params with several arguments. + +2020-01-11 Akim Demaille + + yacc.c: comment changes + In particular, import Adrian Vogelsgesang's comments about LAC from + lalr1.cc. + + * data/skeletons/yacc.c: here. + +2020-01-11 Akim Demaille + + yacc.c: style: double-quote the argument of b4_percent_define_get + * data/skeletons/yacc.c: Here, for consistency. + +2020-01-11 Akim Demaille + + yacc.c: introduce yysymbol_name + Provide the users with a public API to get the name of the tokens. A + thin wrapper around yytname. + + * data/skeletons/yacc.c (yysymbol_name): New. + Use it. + +2020-01-11 Akim Demaille + + CI: check on PPC64le, ARM64 and s390x + I was hoping it would help us catch warnings when char is + unsigned (see 78bb152a63f711af65364881c434af4c198e1ee0), but it does + not seem to help. It's a pity that the compiler is the same all over + the place, I would have preferred testing others. + + * .travis.yml: here. + +2020-01-11 Akim Demaille + + todo: update + +2020-01-11 Akim Demaille + + Merge branch 'maint' into HEAD + * maint: + gnulib: update + lalr1.cc: avoid static_cast + glr.c: add missing cast + regen + package: bump copyrights to 2020 + gitignore: update + 2020-01-11 Akim Demaille gnulib: update @@ -71,6 +12321,84 @@ gitignore: update +2020-01-10 Akim Demaille + + regen + +2020-01-09 Akim Demaille + + yacc.c: simplify use of YYDPRINTF + * data/skeletons/yacc.c (YYDPRINTF): Expand to no-op (instead of + nothing) when disabled. + Simplify callers. + +2020-01-05 Akim Demaille + + package: bump copyrights to 2020 + Run 'make update-copyright'. + +2020-01-05 Akim Demaille + + gitignore: update + +2020-01-04 Akim Demaille + + doc: YYERROR_VERBOSE is no longer supported + * doc/bison.texi (Table of Symbols): Remove last reference to it. + * NEWS: Be clear about that. + +2020-01-04 Akim Demaille + + glr.c: no longer support YYERROR_VERBOSE + * data/skeletons/glr.c: Rather, dispatch directly on parse.error's + value. + +2020-01-04 Akim Demaille + + yacc.c: no longer support YYERROR_VERBOSE + Supporting YYERROR_VERBOSE via cpp is a nuisance: m4 is in charge of + handling alternatives. When adding more options for %define + parse.error, supporting both CPP and M4 is too complex. Anyway, + YYERROR_VERBOSE was deprecated long ago. + + * data/skeletons/yacc.c: Use m4 only to handle verbose/simple error + messages. + +2020-01-03 Akim Demaille + + yacc.c: avoid negations + * data/skeletons/yacc.c (yyerrlab): here. + +2019-12-31 Akim Demaille + + glr.c: clarify yyreportSyntaxError + See the previous commit. + + * data/skeletons/glr.c (yyreportSyntaxError): First compute the + arguments of the error message, _then_ th error message size. + +2019-12-31 Akim Demaille + + yacc: restructure and fix yysyntax_error + I would like to offer new ways to build the error message. As a first + step, let's simplify yysyntax_error whose first loop does two things + at the same time: (i) collect the tokens to be reported in the error + message, and (ii) accumulate their sizes and possibly return + "overflow". Let's pull (ii) in a second step. + + Then test 525 (regression.at:1193: parse.error=verbose overflow) + failed. This test checks that we correctly report "memory overflow" + when the error message is too large. However the test is mistaken: it + is triggered in a place where there are five (large) expected tokens, + so anyway we would not display them, so there is no (memory) overflow + here! Transform this test to (i) check that indeed there is no + overflow, and (ii) create syntax_error3 which does check the intended + behavior, but with four expected tokens. + + * data/skeletons/yacc.c (yysyntax_error): First compute the list of + arguments, then compute yysize. + * tests/regression.at (parse.error=verbose overflow): Enhance and fix. + 2019-12-31 Akim Demaille tests: also check -Wchar-subscripts diff -Nru bison-3.5.1+dfsg/ChangeLog-2012 bison-3.8.2+dfsg/ChangeLog-2012 --- bison-3.5.1+dfsg/ChangeLog-2012 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/ChangeLog-2012 2021-08-29 14:22:08.000000000 +0000 @@ -77,7 +77,7 @@ Empty unions are not accepted by the ISO C99 grammar or by at least some versions of Sun Studio. Reported by Wolfgang S. Kechel at - . + . * NEWS (2.5.1): Document fix. * THANKS (Wolfgang S. Kechel): Add. * tests/existing.at (GNU Cim Grammar) @@ -104,7 +104,7 @@ build: avoid YACC typo inherited from Autoconf. The typo shows up in the `configure --help' output. Reported by W.C.A. Wijngaards and Paul Eggert at - . + . * README-hacking (Release Procedure): Remind about updating maintainer tools before a release. * THANKS (W.C.A. Wijngaards): Add. @@ -115,7 +115,7 @@ build: create xz instead of bzip2 tarballs. Suggested by Jim Meyering at - . + . * README-hacking (Release Procedure): Update example. * configure.ac (AM_INIT_AUTOMAKE): Replace dist-bzip2 with dist-xz. @@ -153,7 +153,7 @@ doc: motivate named references. Suggested by Hans Aberg at - . + . * doc/bison.texinfo (Named References): Explain briefly how they're better than the traditional positional references. @@ -161,7 +161,7 @@ doc: discuss named references after locations. Reported by Hans Aberg at - . + . * NEWS (2.5.1): Document. * doc/bison.texinfo (Named References): Because it discusses locations in addition to semantic values, move this subsection out @@ -187,7 +187,7 @@ configure with --enable-gcc-warnings) and the sources that Bison users build. Instead, use PACIFY_CC, which doesn't. This change fixes compiler warnings reported by Tys Lefering at - . + . * configure.ac: Don't AC_DEFINE lint regardless of the configure options. This change affects imported gnulib sources, where IF_LINT still appears and depends on lint. @@ -242,7 +242,7 @@ tests: pacify gcc 4.6.0's -Wunused-but-set-variable. Reported by Jim Meyering at - . + . * tests/actions.at (Default %printer and %destructor for mid-rule values): Define YYLLOC_DEFAULT so that it uses its Rhs argument. @@ -254,7 +254,7 @@ about yyresolveLocations's local yyrhsloc. When locations are enabled, there's no such warning because YYLLOC_DEFAULT then uses yyrhsloc. Reported by Jim Meyering at - . + . * data/glr.c (yyresolveLocations): Omit definition when locations are disabled. (yyresolveValue): Omit yyresolveLocations invocation when @@ -282,7 +282,7 @@ Fix missing updates to GPLv3. Reported by Tys Lefering at - . + . * src/print-xml.c, src/print-xml.h: In these files. 2011-03-27 Joel E. Denny @@ -291,7 +291,7 @@ Thus, conflict reports are now affected by -Werror and -Wnone (unless %expect or %expect-rr is specified). Reported by George Neuner at - . + . * NEWS (2.5): Document. * doc/bison.texinfo (Bison Options): Document. * src/complain.c, src/complain.h (set_warning_issued): Export @@ -327,7 +327,7 @@ Add -Wother so -Wnone suppresses all warnings. Reported by George Neuner at - . + . * NEWS (2.5): Document. * THANKS (George Neuner): Add. * doc/bison.texinfo (Bison Options): Document. @@ -356,7 +356,7 @@ Don't let -Wnone disable -Werror. Discussed at - . + . * NEWS (2.5): Document. * src/getargs.c (flags_argmatch): Accept a new argument that specifies what flags "all" and thus "none" affect. @@ -397,7 +397,7 @@ named references: fix double free. In `rhs[name]: "a" | "b"', do not free "name" twice. Reported by Tys Lefering. - + * src/named-ref.h, src/named-ref.c (named_ref_copy): New. * src/parse-gram.y (current_lhs): Rename as... (current_lhs_symbol): this. @@ -432,7 +432,7 @@ java: fix parser stack popping bug. Reported at - . + . * THANKS (Angelo Borsotti): Add. * data/lalr1.java (YYParser::YYStack::pop): Fix off-by-one error in clearing the value stack. Previously, the top element of the @@ -520,7 +520,7 @@ java: fix location handling bug. Reported at - . + . * data/lalr1.java (YYParser::yylloc): For non-empty RHS, fix reversed access to location stack. * THANKS (Bernd Kiefer): Add. @@ -548,7 +548,7 @@ doc: finish splitting apart the manual's Decl Summary section. Suggested by Akim Demaille at - . + . * doc/bison.texinfo (Decl Summary): Extract most of the %define entry into... (%define Summary): ... this new subsection, and update all @@ -562,7 +562,7 @@ doc: begin to split apart the manual's Decl Summary section. Discussed in thread starting at - . + . * doc/bison.texinfo (Decl Summary): Extract most of the %code entry into... (%code Summary): ... this new subsection, and update all @@ -619,8 +619,8 @@ parses `%token ID -123' as `%token ID - 123' and handles `-' as an identifier. Now, `-' cannot be an identifier. Discussed in threads beginning at - , - . + , + . * NEWS (2.5): Update entry describing the dash extension to grammar symbol names. Also, move that entry before the named references entry because the latter mentions the former. @@ -664,7 +664,7 @@ name. In reality, this is a syntax error, so the reference is invalid regardless of the symbols actually appearing in the production. Discussed at - . + . * src/scan-code.l (parse_ref): Report the above case as a syntax error. Other than that, continue to handle this case like any other invalid reference that Bison manages to parse because @@ -675,7 +675,7 @@ doc: don't use @acronym. Lately, many GNU packages are dropping it. See - . + . * doc/bison.texinfo: Remove all uses. 2011-01-05 Alex Rozenman @@ -683,7 +683,7 @@ Do not allow identifiers that start with a negative number. Reported by Paul Hilfinger as a side effect of named references support at - . + . Suggested by Paul Eggert. * src/scan-code.l ({letter}, {id}): Adjust lexical definitions. * src/scan-gram.l ({letter}, {id}): Likewise. @@ -711,7 +711,7 @@ maint: prepare to use year ranges in copyright notices. * README (Copyright statements): New section explaining the range notation. The GNU maintainers document requires this explanation: - . + . I copied our explanation from coreutils. * build-aux/update-b4-copyright: Revert 2010-06-17 changes that disabled Bison's automated use of ranges. @@ -791,7 +791,7 @@ parse.lac: implement as %define variable. LAC = lookahead correction. See discussion at - . + . However, one point there must be corrected: because of %nonassoc, LAC is *not* always redundant for lr.type=canonical-lr. * data/yacc.c: Accept values of "none" (default) or "full" for @@ -919,7 +919,7 @@ Fix portability problem on OpenBSD 4.7. Jim Meyering reported this in - . + . * data/yacc.c: Use EXIT_SUCCESS as a witness for stdlib.h, not _STDLIB_H. EXIT_SUCCESS has been defined by the standard for quite some time. @@ -983,8 +983,8 @@ maint: add gettext version to release announcements. Suggested by Paul Hilfinger at - - . + + . * cfg.mk (bootstrap-tools): Add gettext. 2010-08-04 Joel E. Denny @@ -1112,10 +1112,10 @@ Update from GFDL GFDL 1.2 to 1.3. * doc/bison.texinfo: Update GFDL version number. * doc/fdl.texi: Update to version 1.3, taken from: - http://www.gnu.org/licenses/fdl.texi + https://www.gnu.org/licenses/fdl.texi Do not use date ranges in copyright notices. - See http://www.gnu.org/prep/maintain/maintain.html#Copyright-Notices + See https://www.gnu.org/prep/maintain/maintain.html#Copyright-Notices * HACKING, Makefile.am, NEWS, PACKAGING, README, README-alpha: * TODO, bootstrap, bootstrap.conf: @@ -1289,7 +1289,7 @@ That is, keep them as warnings because that should be sufficient to satisfy POSIX without creating backward compatibility issues. Suggested by Richard Stallman at - . + . * NEWS (2.5): Remove mention of complaint. * src/reader.c (grammar_rule_check): Convert complaint back to warning. @@ -1299,7 +1299,7 @@ build: don't require src/bison during bootstrap. Suggested by Eric Blake at - . + . * bootstrap.conf (bootstrap_epilogue): New function to make sure src/parse-gram.[ch] are stamped later than src/parse-gram.y. @@ -1307,7 +1307,7 @@ i18n: fix untranslatable string. Reported by Goran Uddeborg at - . + . * src/muscle-tab.c (muscle_percent_define_insert): Here. 2010-04-13 Akim Demaille @@ -1366,7 +1366,7 @@ tests: fix for newer Sun Studio C++. Reported by Dagobert Michelsen at - . + . * THANKS (Dagobert Michelsen): Add. * configure.ac (AC_PREREQ): Set to 2.64 so we get the latest Autoconf macro for handling the restrict keyword. @@ -1377,7 +1377,7 @@ portability: fix pointer arithmetic to conform to C standard. Reported by Tys Lefering at - . + . This fix is already implemented in glr.c and does not apply to lalr1.java. * data/lalr1.cc (yy::parser::parse): Increase size of @@ -1401,7 +1401,7 @@ portability: fix test suite for GCC 4.5's new #error message. Reported by Tys Lefering at - . + . * NEWS (2.4.3): Mention. * tests/synclines.at (AT_TEST_SYNCLINE): Implement. @@ -1421,7 +1421,7 @@ portability: fix for BSD make. Reported by Johan van Selst at - . + . * tests/local.mk ($(TESTSUITE)): Qualify package.m4 in this dependency list as in package.m4's target rule. @@ -1429,7 +1429,7 @@ portability: fix spawning on at least FreeBSD 8 and FreeBSD 9. Reported by Johan van Selst at - . + . * NEWS (2.4.3): New. * THANKS (Johan van Selst): Add. * etc/prefix-gnulib-mk (prefix): Adjust regex for makefile @@ -1470,11 +1470,11 @@ then reported it. However, there's some sort of race condition, because the new test group occasionally succeeded. Reported by Albert Chin at - . + . There were also problems with the test suite livelocking on Tru64 5.1b. Reported by Didier Godefroy at - . + . Switching to create_pipe_bidi suggested by Akim Demaille. To attempt to solve both of these problems, switch to gnulib's @@ -1603,7 +1603,7 @@ POSIX: warn if %prec's token was not defined. Reported by Florian Krohm at - . + . * NEWS (2.4.2): Document. * src/reader.c (grammar_rule_check): Implement. (grammar_current_rule_prec_set): Add comments explaining that we @@ -1755,9 +1755,9 @@ portability: use -DGNULIB_POSIXCHECK. Reported by Eric Blake. See discussions at - + and - . + . * HACKING (Release checks): Suggest -DGNULIB_POSIXCHECK. * bootstrap.conf (gnulib_modules): Add all the printf modules suggested by -DGNULIB_POSIXCHECK. Add realloc-posix as @@ -1785,7 +1785,7 @@ Expand GLR acronym in summary of Bison. Based on discussion with Akim Demaille starting at - . + . * doc/bison.texinfo (Introduction): Here. * src/getargs.c (usage): Here. @@ -1853,7 +1853,7 @@ tests: skip tests of file names that platform does not support. Reported by Michael Raskin at - . + . * THANKS (Michael Raskin): Add. * tests/output.at (AT_CHECK_OUTPUT_FILE_NAME): Fix. Cygwin used to fail at least for file names containing ":" or "\". @@ -2155,7 +2155,7 @@ Fix gcc 3.4.4 shadowing warning reported by Eric Blake. See - . + . * src/scan-code.h (code_props_rule_action_init): Rename named_ref arg to name so it doesn't shadow named_ref type. This makes it consistent with the function definition in scan-code.l @@ -2334,7 +2334,7 @@ Fix complaints about escape sequences. Discussed starting at - . + . * src/scan-gram.l (SC_ESCAPED_STRING, SC_ESCAPED_CHARACTER): For a \0 and similar escape sequences meaning the null character, report an invalid escape sequence instead of an @@ -2368,7 +2368,7 @@ This patch simplifies "variables: rename namespace as api.namespace", commit 67501061076ba46355cfd9f9361c7eed861b389c. Suggested by Joel E. Denny in - http://lists.gnu.org/archive/html/bison-patches/2009-07/msg00006.html + https://lists.gnu.org/r/bison-patches/2009-07/msg00006.html * src/muscle-tab.c (muscle_percent_variable_update): New. (muscle_percent_define_insert): Use it in replacement of the @@ -2432,7 +2432,7 @@ build: require gettext 0.17. Suggested by Bruno Haible. - http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00009.html + https://lists.gnu.org/r/bug-bison/2009-08/msg00009.html * configure.ac: require gettext 0.17 to ensure compatibility with gnulib. @@ -2443,7 +2443,7 @@ Bison was uselessly requiring the formatstring macros from gettext, which resulted in mo files not being installed on systems that perfectly supported Bison mo files. Lower the requirement. - http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html + https://lists.gnu.org/r/bug-bison/2009-08/msg00006.html * configure.ac: Require need-ngettext instead of need-formatstring-macros. @@ -2698,7 +2698,7 @@ Some M4 cleanup in the testsuite. Suggested by Eric Blake at - . + . * tests/existing.at (_AT_TEST_EXISTING_GRAMMAR): Do not complicate the code by distinguishing between a missing value and an empty string value for an optional argument. This fix is @@ -2718,7 +2718,7 @@ Revert unnecessary column realignment in --help output. Reported by Akim Demaille at - . + . * src/getargs.c (usage): Here. 2009-07-04 Alex Rozenman @@ -2813,7 +2813,7 @@ variables: rename namespace as api.namespace. Discussed in - http://lists.gnu.org/archive/html/bison-patches/2009-04/msg00033.html + https://lists.gnu.org/r/bison-patches/2009-04/msg00033.html * data/bison.m4 (b4_percent_define_copy_, b4_percent_define_copy): New. @@ -2867,7 +2867,7 @@ cases. Avoid this. Addresses another form of nondeterminism reported by Joel E. Denny. - http://lists.gnu.org/archive/html/bison-patches/2009-05/msg00023.html + https://lists.gnu.org/r/bison-patches/2009-05/msg00023.html * tests/input.at (Numbered tokens): Split the hexadecimal/decimal test in two. @@ -2889,7 +2889,7 @@ deterministic user-token-number redeclaration errors. Address nondeterminism reported by Joel E. Denny. - http://lists.gnu.org/archive/html/bison-patches/2009-05/msg00023.html + https://lists.gnu.org/r/bison-patches/2009-05/msg00023.html * src/uniqstr.h: Comment changes. * src/location.h (boundary_cmp, location_cmp): New. @@ -2970,7 +2970,7 @@ Rename token.prefix as api.tokens.prefix. Discussed here. - http://lists.gnu.org/archive/html/bison-patches/2009-05/msg00024.html. + https://lists.gnu.org/r/bison-patches/2009-05/msg00024.html. * NEWS, data/bison.m4, data/c.m4, data/java.m4, doc/bison.texinfo, * tests/c++.at, tests/calc.at, tests/java.at, tests/local.at @@ -3088,7 +3088,7 @@ List accepted values for a %define enum variable with an invalid value. Suggested by Akim Demaille at - . + . * data/bison.m4 (_b4_percent_define_check_values): Implement. * src/muscle-tab.c (muscle_percent_define_check_values): Implement. * tests/input.at (%define lr.default_reductions invalid values): Merge @@ -3488,9 +3488,9 @@ Fix strange %define locations for default values. Reported by Akim Demaille at - + and discussed again starting at - . + . * data/bison.m4 (b4_percent_define_default): Leave syncline blank because location information is bogus. Use angle brackets to delimit fake file name because square brackets @@ -4173,7 +4173,7 @@ Fix unexpanded macros in GLR defines file. Reported by Csaba Raduly at - . + . * THANKS (Csaba Raduly): Add. * data/glr.c: Fix overquoting on b4_prefix for yylval and yylloc. * tests/calc.at (_AT_DATA_CALC_Y): If %defines is specified, generate @@ -5376,7 +5376,7 @@ Fix user actions without a trailing semicolon. Reported by Sergei Steshenko at - . + . * THANKS (Sergei Steshenko): Add. * src/scan-code.l (SC_RULE_ACTION): Fix it. * tests/regression.at (Fix user actions without a trailing semicolon): @@ -5767,7 +5767,7 @@ Say %language is experimental. We're thinking of extending it's effect on output file naming. See the thread at - . + . * NEWS: Say it's experimental. * doc/bison.texinfo (Decl Summary): Say it's experimental, and so don't recommend it over %skeleton for now. @@ -5905,7 +5905,7 @@ Fix yyerror_range for user-defined location type in C++. Reported by Georg Sauthoff at - . + . * data/lalr1.cc (parse): Change type of yyerror_range to location_type. * THANKS (Georg Sauthoff): Add. @@ -6007,7 +6007,7 @@ * Makefile.am ($(top_srcdir)/.version): Declare configure as a dependency, and add comments justifying this in more detail. Discussed starting at - . + . 2008-08-06 Eric Blake @@ -6052,7 +6052,7 @@ * configure.ac (AM_INIT_AUTOMAKE): Set gnu strictness during development and gnits strictness for releases. Based on Eric Blake's suggestion at - . + . 2008-07-31 Paolo Bonzini @@ -6139,7 +6139,7 @@ Fix untranslatable composition of sentences. Reported by Goran Uddeborg at - . + . * THANKS (Goran Uddeborg): Add. * src/reduce.c (reduce_print): Report the number of nonterminals and rules useless in the grammar in separate sentences. @@ -6171,7 +6171,7 @@ 2008-07-15 Joel E. Denny Improve forward-compatibility with GNU M4. Reported by Eric Blake at - . + . * bootstrap.conf (gnulib_modules): Add unsetenv. * lib/.gitignore, lib/.cvsignore (/unsetenv.c): Add. * m4/.gitignore, m4/.cvsignore (/environ.m4): Add. @@ -6253,7 +6253,7 @@ Work-around an Autoconf 2.62 AT_SETUP bug that was not present in 2.61. Reported by Juan Manuel Guerrero at - . + . * tests/output.at ("Output file name: ("): Comment out test case for now. ("Output file name: )"): Likewise. @@ -6286,7 +6286,7 @@ 2008-04-20 Joel E. Denny Fix make dist infinite loop reported by Juan Manuel Guerrero at - . + . * .cvsignore: Add .version. * .version.in: New. * bootstrap.conf (gnulib_modules): Add git-version-gen. @@ -6359,7 +6359,7 @@ 2008-02-20 Joel E. Denny Fix impure push parser compile error reported by Bob Rossi at - . + . * data/yacc.c: Clean up whitespace in the output a little. (yypstate_allocated): Define for impure push parsers regardless of whether the pull interface is also requested. @@ -6397,7 +6397,7 @@ 2008-02-16 Joel E. Denny Fix documentation problems reported by Tim Josling at - . + . * NEWS (2.3a+): Mention removal of --no-parser, -n, and %no-parser. * doc/bison.texinfo (Token Decl): Token numbers are *nonnegative* integers. Explain the effect of literal string aliases on error @@ -6408,7 +6408,7 @@ Accept a token number in a %left, %right, or %nonassoc for POSIX conformance. Reported by Tim Josling at - . + . * NEWS (2.3a+): Mention. * doc/bison.texinfo (Precedence Decl): Describe how literal strings and code numbers are treated by precedence declarations. @@ -6450,7 +6450,7 @@ * data/yacc.c (yyparse): Correct the comment when locations aren't used. Problem reported by Claudio Saavedra in - . + . 2008-01-05 Wojciech Polak @@ -6461,7 +6461,7 @@ Automate regression testing of the XML/XSLT implementation. Discussed starting at - . + . * configure.ac (XSLTPROC): New substitution. * Makefile.am (maintainer-xml-check): New phony target invoking... * tests/Makefile.am (maintainer-xml-check): ... this new phony target @@ -6521,7 +6521,7 @@ * src/print-xml.h (xml_indent): Prototype. * tests/existing.at (GNU pic Grammar): Fix a rule miscopied from - . + . 2007-12-08 Joel E. Denny @@ -6535,7 +6535,7 @@ In the XML output, don't print the list of rules where symbols appear. Compute it in XSLT instead. Discussed at - . + . * data/xslt/bison.xsl (bison:ruleByLhs): New. (bison:ruleByRhs): New. * data/xslt/xml2text.xsl (xsl:template match="terminal"): Use @@ -6559,7 +6559,7 @@ Don't let --report affect XML output; always print all information. Discussed at - . + . * src/conflicts.c (log_resolution): Implement. * src/print-xml.c (print_core): Implement. (print_state): Implement. @@ -6577,7 +6577,7 @@ In the XML output, list useless and unused symbols and rules with the useful ones and add a "usefulness" attribute. Discussed starting at - . + . * src/gram.c (grammar_rules_partial_print_xml): Remove. (grammar_rules_print_xml): Print all rules instead of just those useful in the grammar, and add a "usefulness" attribute. @@ -6639,7 +6639,7 @@ When reporting useless rules and nonterminals, say "useless in grammar" instead of "useless", and say "useless in parser" instead of "never reduced". Discussed starting at - . + . * NEWS (2.3a+): Mention this change. * data/xslt/xml2text.xsl: Update output text and expected input XML element names to match changes below. @@ -6744,7 +6744,7 @@ Deprecate %pure-parser and add `%define api.pure'. Discussed starting at - . + . * NEWS (2.3a+): Mention. * data/bison.m4 (b4_pure_if): Don't define it here. * data/c.m4 (b4_identification): Depend on individual skeletons to @@ -6788,7 +6788,7 @@ 2007-10-28 Joel E. Denny %define push_pull -> %define api.push_pull. Discussed starting at - . + . * data/push.c: Expect the new name. * data/yacc.c: Likewise. * doc/bison.texinfo (Push Decl): Update. @@ -6813,7 +6813,7 @@ For the XML output's terminal element, rename @number to @token-number, and add @symbol-number. In the nonterminal element, rename @number to @symbol-number. Discussed starting at - . + . * data/xslt/xml2text.xsl (xsl:template match="terminal"): Update for renames. (xsl:template match="nonterminal"): Likewise. @@ -6947,7 +6947,7 @@ 2007-10-08 Joel E. Denny Improve C++ namespace support. Discussed starting at - . + . * data/c++.m4: (b4_namespace_ref, b4_namespace_open, b4_namespace_close): New macros that interpret the %define variable "namespace" so its value can contain "::" to indicate nested @@ -7302,7 +7302,7 @@ * data/yacc.c (yyexhaustedlab): Define it when YYERROR_VERBOSE is true since it's then always used regardless of whether yyoverflow is defined. Reported by Christian Burger at - . + . * THANKS: Add Christian Burger. * ChangeLog: For changes in doc/bison.texinfo, consistently reference @@ -7319,7 +7319,7 @@ 2007-07-27 Joel E. Denny Fix push parsing memory leak reported by Brandon Lucia at - . + . * THANKS: Add Brandon Lucia. * data/push.c (yypstate_delete): Free the stack if it was reallocated but the parse never completed and thus freed it. @@ -7376,7 +7376,7 @@ 2007-07-02 Joel E. Denny Fix C++ test cases after recent Gnulib changes. Discussed starting at - . + . * examples/calc++/Makefile.am (DEFAULT_INCLUDES): Override Automake's definition in order to avoid Gnulib headers since we don't use config.h here. @@ -7450,11 +7450,11 @@ * src/Makefile.am (yacc): Quote target action commands properly so that the yacc script isn't corrupt. Reported by Hans Aberg at - . + . * data/glr.c (yylval): As in yacc.c, don't extern in the header for the case of pure parsers. Reported by Frans Englich at - . + . * THANKS: Add Frans Englich. * NEWS (2.3a+): In the %code entry, reference section `Bison @@ -7664,7 +7664,7 @@ Use YYFPRINTF instead of fprintf where appropriate. Reported by Sebastien Fricker at - . + . * THANKS: Add Sebastien Fricker. * data/glr.c, data/push.c, data/yacc.c (yy_reduce_print): Implement. * doc/bison.texinfo (Tracing): Make it clearer that YYFPRINTF must @@ -7699,7 +7699,7 @@ Enable the Java related testsuite tests when the only Java compiler found is a gcj < 4.3. Discussed at - . + . * configure.ac (gt_JAVACOMP): Don't specify a target_version. 2007-02-11 Joel E. Denny @@ -7872,7 +7872,7 @@ Implement support for relative and absolute skeleton file names. Discussed starting at - . + . * doc/bison.texinfo (Decl Summary): Document in %skeleton entry. (Bison Options): Document in --skeleton entry. * src/output.c (output_skeleton): Use strncpy rather than strcpy since @@ -7990,7 +7990,7 @@ Ignore YYSTACK_USE_ALLOCA for push parsers since the stacks can't be locals. Reported by Juan Manuel Guerrero at - . + . * data/push.c: Enclose the #ifdef YYSTACK_USE_ALLOCA in b4_push_if. Fix some indentation also. * tests/torture.at (Exploding the Stack Size with Alloca): Add comment @@ -8035,7 +8035,7 @@ qualifiers in %code directives, and restrict the characters that are allowed in them to M4-friendly ones. For %define, continue to support the quoted form as a deprecated feature. Discussed starting at - . + . * NEWS (2.3a+): Add entry for the change to %define. Update entry for %code. * doc/bison.texinfo (Prologue Alternatives): Update. @@ -8206,7 +8206,7 @@ This provides more flexibility than m4_fatal, improves the error message format, and captures messages for translation. Discussed starting at - . + . * data/bison.m4 (b4_error): New, invoked by... (b4_warn, b4_complain, b4_fatal): ... these new macros to wrap the skeleton scanner's new @warn(...@), @complain(...@), and @fatal(...@) @@ -8256,7 +8256,7 @@ Consolidate the 4 prologue alternative directives (%code, %requires, %provides, and %code-top) into a single %code directive with an optional qualifier field. Discussed at - . + . * NEWS (2.3a+): Rewrite the existing entry for the prologue alternatives. * doc/bison.texinfo (Prologue Alternatives): Update. @@ -8370,7 +8370,7 @@ interface. This patch merely implements code_props in scan-code.h and scan-code.l. Future patches will rewrite other modules to use it. Discussed starting at - . + . * src/location.h (EMPTY_LOCATION_INIT): Define so that it's easier to consistently initialize const structs that have an empty location field. @@ -8460,7 +8460,7 @@ instead of passing a yylexp argument to yypull_parse, and don't generate yypull_parse or yyparse unless %push-pull-parser is declared. Discussed starting at - . + . * data/bison.m4 (b4_pull_if): New. * data/c.m4 (b4_identification): Define YYPULL similar to YYPUSH. * data/push.c: Improve M4 quoting a little. @@ -8752,7 +8752,7 @@ 2006-12-16 Joel E. Denny Make %push-parser imply %pure-parser. This fixes several bugs; see - . + . * src/parse-gram.y (prologue_declaration): For %push-parser, also set pure_parser = true. * data/push.c: Don't bother testing b4_push_if when deciding whether @@ -8906,7 +8906,7 @@ Document Yacc prologue alternatives and default %destructor's and %printer's as experimental. Don't mention Java yet. Discussed at - . + . * NEWS (2.3a+): Say they're experimental. Remove any mention of Java. (2.3a): Annotate this entry to say the old forms of these features were also experimental. @@ -8918,7 +8918,7 @@ Support a file name argument to %defines. Deprecate `=' in %file-prefix, %name-prefix, and %output. Discussed at - . + . * NEWS (2.3a+): Mention. * doc/bison.texinfo (Decl Summary, Table of Symbols): Add entry for new form of %defines, and remove `=' from entries for %file-prefix, @@ -8948,7 +8948,7 @@ 2006-11-20 Joel E. Denny Rename to <>. Discussed starting at - . + . * NEWS (2.3a+): Update. * doc/bison.texinfo (Freeing Discarded Symbols, Table of Symbols): Update. @@ -8985,7 +8985,7 @@ Fix memory leaks in scanners generated by at least Flex 2.5.9 and later. Reported by Paul Eggert in - . + . * src/flex-scanner.h (yylex_destroy): Define for Flex before 2.5.9. * src/scan-code.l (translate_action): Don't bother invoking yy_delete_buffer (YY_CURRENT_BUFFER) before creating the first buffer. @@ -9079,7 +9079,7 @@ Disable unset/unused mid-rule value warnings by default, and recognize --warnings=midrule-values to enable them. Discussed starting at - . + . * NEWS (2.3a+): Mention. * src/getargs.c, src/getargs.h (warnings_args, warnings_types, enum warnings): Add entry for midrule-values subargument. @@ -9122,7 +9122,7 @@ Split the default %destructor/%printer into two kinds: <*> and . Discussed starting at - . + . * NEWS (2.3a+): Mention. * doc/bison.texinfo (Freeing Discarded Symbols): Document this and the previous change today related to mid-rules. @@ -9168,7 +9168,7 @@ Don't apply the default %destructor/%printer to an unreferenced midrule value. Mentioned at - . + . * src/symtab.c (dummy_symbol_get): Name all dummy symbols initially like $@n instead of just @n so that the default %destructor/%printer logic doesn't see them as user-defined symbols. @@ -9206,7 +9206,7 @@ Similar to the recently removed %before-header, add %code-top as the alternative to the pre-prologue. Mentioned at - . + . Also, let the prologue alternatives appear in the grammar section. * src/parse-gram.y (PERCENT_CODE_TOP): New token. (prologue_declaration): Move the existing prologue alternatives to... @@ -9234,7 +9234,7 @@ 2006-10-16 Paolo Bonzini Replace %*-header with %provides, %requires, %code. See discussion at - http://lists.gnu.org/archive/html/bison-patches/2006-10/msg00002.html + https://lists.gnu.org/r/bison-patches/2006-10/msg00002.html * data/bison.m4 (b4_user_requires, b4_user_provides): New. (b4_user_start_header): Remove. @@ -9346,7 +9346,7 @@ * doc/bison.texinfo (Understanding, Bison Options): Likewise. * THANKS: Add Satya Kiran Popuri, who proposed the initial version of this change in - . + . * TODO: Remove Graphviz entry. * src/Makefile.am (bison_SOURCES): Add graphviz.c and graphviz.h; remove vcg.c, vcg.h, vcg_defaults.h. @@ -9408,7 +9408,7 @@ 2006-10-05 Paul Eggert Fix test failure reported by Tom Lane in - + and try to make such failures easier to catch in the future. * data/glr.c (YYTRANSLATE): Don't check for nonpositive arg; that's now the caller's responsibility. @@ -9533,7 +9533,7 @@ Port to GCC 2.95. First two problems reported by Michael Deutschmann in - . + . * src/parse-gram.y (symbol_declaration): Don't put statements before declarations; it's not portable to C89. @@ -9622,7 +9622,7 @@ * data/glr.c (b4_shared_declarations): Put start-header first, before any #includes that we generate, so that feature-test macros work. Problem reported by Michael Deutschmann in - . + . * data/lalr1.cc: Likewise. * doc/bison.texinfo (Prologue): Document that feature-test macros should be defined before any Bison declarations. @@ -9632,7 +9632,7 @@ * doc/bison.texinfo (Calc++ Parser): Fix memory leak reported by Sander Brandenburg in - . + . Also, fix minor white space and comment issues. (Prologue): Mention that it's better to define feature-test macros before Bison declarations. Problem reported by Michael Deutschmann. @@ -9646,9 +9646,9 @@ Finish implementation of per-type %destructor/%printer. Discussed starting at - + and - . + . * NEWS (2.3+): Add a description of this feature to the default %destructor/%printer description. * doc/bison.texinfo (Freeing Discarded Symbols): Likewise. @@ -9676,7 +9676,7 @@ Require default %destructor/%printer to be declared using %symbol-default instead of an empty symbol list, and start working on new per-type %destructor/%printer. Discussed at - . + . * NEWS (2.3+): Add %symbol-default to example. * bison.texinfo (Freeing Discarded Symbols): Likewise. (Table of Symbols): Add entry for %symbol-default. @@ -9881,10 +9881,10 @@ not declare a specific %printer/%destructor. Thus, the parser uses it for token 0 if the user declares it but not if Bison generates it as $end. Discussed starting at - , - , + , + , and - . + . * NEWS (2.3+): Mention. * doc/bison.texinfo (Actions in Mid-Rule): It's no longer impossible to declare a %destructor for a mid-rule's semantic value. It's just @@ -9922,9 +9922,9 @@ Clean up handling of %destructor for the end token (token 0). Discussed starting at - + and - . + . Make the skeletons consistent in how they pop the end token and invoke its %destructor. @@ -10006,7 +10006,7 @@ rather than a for-loop that declares a local bool variable. This should work around a compatibility problem with a Cray x1e C++ compiler reported by Hung Nguyen in - . + . The for-loop was introduced in the 2004-11-17 change but I don't know why it was needed. @@ -10080,7 +10080,7 @@ 2006-07-09 Joel E. Denny Change %merge result type clash warnings to errors. Discussed at - . + . * src/reader.c (record_merge_function_type): Use complain_at. * tests/glr-regression.at (Missed %merge type warnings when LHS type is declared later): Update test case results. @@ -10211,9 +10211,9 @@ Get action warnings (grammar_rule_check) right even when symbol declarations appear after the rules. Discussed at - + and - . + . Don't mistake the type of $$ in a midrule to be that of its parent rule's $$. * src/reader.c (grammar_current_rule_end): Don't invoke @@ -10280,7 +10280,7 @@ Fix bug that mistakes braced code in a declaration in the rules section to be a rule action. Mentioned at - . + . * src/scan-gram.l: Move midrule action detection from the start of the scanning of any braced code to... * src/parse-gram.y (rhs): ... the parsing of braced code as a rule @@ -10308,7 +10308,7 @@ blocks from post-prologue blocks. Add new order-independent declarations %before-header and %after-header as alternatives to the traditional Yacc pre-prologue and post-prologue blocks. Discussed at - . + . * NEWS (2.3+): Update for these changes. * data/glr.c (b4_before_definitions): Update to... (b4_start_header): ... this. @@ -10348,7 +10348,7 @@ 2006-06-22 Joel E. Denny Add comparison operators for C++ location classes. Discussed at - . + . * data/c++.m4 (b4_define_location_comparison): New boolean %define declaration indicating whether filename_type has an operator==. If filename_type is `std::string', it defaults to `1', `0' otherwise. @@ -10371,10 +10371,10 @@ the token definitions. Add new %before-definitions and %after-definitions to declare code that will go in both the header file and code file. Discussed at - , - , + , + , and - . + . * NEWS (2.3+): Describe these changes. * data/glr.c (b4_pre_prologue): Move from within to before... (b4_shared_declarations): ... this. @@ -10477,10 +10477,10 @@ For associating token numbers with token names for "yacc.c", don't use #define statements unless `--yacc' is specified; always use enum yytokentype. Most important discussions start at: - , - , + , + , and - . + . * NEWS (2.3+): Mention. * data/c.m4 (b4_yacc_if): New. (b4_token_enums_defines): Use b4_yacc_if to decide whether to add the @@ -10509,9 +10509,9 @@ For consistency, use `lookahead' instead of `look-ahead' or `look_ahead'. Discussed starting at - + and then at - . + . * NEWS: For the next release, note the change to `--report'. * TODO, doc/bison.1: Update English. * doc/bison.texinfo: Update English. @@ -10687,14 +10687,14 @@ * src/getargs.c (usage): Mention GLR not just LALR(1) in --help output. Use Akim's wording from - . + . 2006-06-06 Joel E. Denny Between Bison releases, manually append `+' to the previous Bison release number, and use that as a signal to automatically print the ChangeLog's CVS Id keyword from --version. Discussed starting at - . + . * ChangeLog: Add Id header. * configure.ac (AC_INIT): Append `+' to `2.3'. * src/.cvsignore: Add revision.c. @@ -10716,7 +10716,7 @@ * data/glr.c (YYRECOVERING): Define to be a function-like macro with no arguments, not as an object-like macro. This is for compatibility with data/yacc.c. Problem reported by John P. Hartmann in - . + . * doc/bison.texinfo (Action Features, Error Recovery, Table of Symbols): Document this. @@ -10739,7 +10739,7 @@ * data/yacc.c (yy_reduce_print): Omit trailing white space in generated source code. Problem reported by Frans Englich in - . + . 2006-05-22 Paul Eggert @@ -10765,7 +10765,7 @@ state before an empty RHS is always resolved here. Only the location of that state is guaranteed to be resolved, and that's enough. This fixes the remaining bug reported by Derek M. Jones in - . + . * tests/glr-regression.at (Uninitialized location when reporting ambiguity): Test the above case. Also, the embedded comments in this test case claim it checks the case @@ -10780,7 +10780,7 @@ (b4_yy_symbol_print_generate): Use 'YYSTYPE const' rather than 'const YYSTYPE', and similarly for YYLTYPE. This fixes one of the bugs reported today by Derek M Jones in - . + . * doc/bison.texinfo (Value Type): Document that YYSTYPE must be defined to be a type name without parens or brackets. (Location Type): Similarly for YYLTYPE. @@ -10798,7 +10798,7 @@ * data/glr.c (yyreportTree): Make room in yystates for the state preceding the RHS. This fixes the segmentation fault reported by Derek M. Jones in - . + . (yyreportTree, yypdumpstack): Subtract 1 from yyrule before printing to the user. Reported for yyreportTree by Derek M. Jones later in the same thread. @@ -10812,7 +10812,7 @@ checking against YYLAST that caused the parser to miss a potential alternative in its diagnostic. Problem reported by Maria Jose Moron Fernandez in - . + . * data/lalr1.cc (yysyntax_error_): Likewise. * data/yacc.c (yysyntax_error): Likewise. * tests/regression.at (_AT_DATA_DANCER_Y): Use static array for @@ -11096,7 +11096,7 @@ declarations of malloc and free, to avoid problems with incompatible declarations (using 'throw') C++'s stdlib.h. This should fix Debian bug 340012 - , + , reported by Guillaume Melquiond. 2006-02-13 Paul Eggert @@ -11168,7 +11168,7 @@ 2006-02-01 Paul Eggert Work around portability problems summarized by Nelson H. F. Beebe in - . + . * m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): Check that '#include ' works. @@ -12621,7 +12621,7 @@ * tests/glr-regression.at (User destructor after an error during a split parse): New test case. Problem reported by Joel E. Denny in: - http://lists.gnu.org/archive/html/bison-patches/2005-08/msg00029.html + https://lists.gnu.org/r/bison-patches/2005-08/msg00029.html 2005-08-25 Paul Eggert @@ -12648,7 +12648,7 @@ * tests/glr-regression.at (User destructor for unresolved GLR semantic value): New test case. Problem reported by Joel E. Denny in: - http://lists.gnu.org/archive/html/bison-patches/2005-08/msg00016.html + https://lists.gnu.org/r/bison-patches/2005-08/msg00016.html 2005-08-21 Paul Eggert @@ -12660,7 +12660,7 @@ * data/glr.c (yyreturn): Use "Cleanup:" rather than "Error:" in yydestruct diagnostic, since it might not be an error. Problem reported by Joel Denny near end of - . + . * data/lalr1.cc (yyerturn): Likewise. * data/yacc.c (yyreturn): Likewise. * tests/calc.at (_AT_CHECK_CALC_ERROR): Adjust to the above change. @@ -12670,18 +12670,18 @@ * data/glr.c (YY_SYMBOL_PRINT): Append a newline, for consistency with the other templates, and to fix bogus run-on messages such as the one reported at the end of - . + . All callers changed to avoid the newline. (yyprocessOneStack): Output two lines rather than one, to accommodate the above change. This changes the debug output format slightly. * data/glr.c (yyresolveValue): Fix redundant parse tree problem reported by Joel E. Denny in - + (trivial change). * tests/glr-regression.at (Duplicate representation of merged trees): New test, from Joel E. Denny in: - . + . * THANKS: Add Joel E. Denny. * configure.ac (AC_INIT): Bump to 2.0c. @@ -12705,7 +12705,7 @@ version of GCC, since the macro is used with non-GCC compilers. Fix core dump reported by Pablo De Napoli in - . + . * tests/regression.at (Invalid inputs with {}): New test. * src/parse-gram.y (token_name): Translate type before using it as an index. @@ -12949,7 +12949,7 @@ don't have to worry about garbage getting in that file. We'll make sure after the next official release that old msgids don't get lost. See - . + . * runtime-po/Makefile.in.in, runtime-po/bison-runtime.pot: Remove. Now auto-generated. @@ -13366,7 +13366,7 @@ * data/glr.c, data/lalr1.cc: Update copyright date. Fix a destructor bug reported by Wolfgang Spraul in - . + . * data/yacc.c (yyabortlab): Don't call destructor, and don't set yychar to EMPTY. (yyoverflowlab): Don't call destructor. @@ -13559,7 +13559,7 @@ (symbol_destructors_output, symbol_printers_output): Escape symbol tags too. Problem reported by Matyas Forstner in - . + . * src/muscle_tab.c (muscle_code_grow): Don't quote numbers; it's not needed. @@ -14145,7 +14145,7 @@ * doc/bison.texinfo (Language and Grammar): In example, "int" is a keyword, not an identifier. Problem reported by Baron Schwartz in - . + . 2004-10-11 Akim Demaille @@ -14441,7 +14441,7 @@ Fix bug with non-%union parsers that have printers or destructors, which led to a Bison core dump. Reported by Peter Fales in - . + . * data/c.m4 (b4_symbol_actions): Don't assume %union was used. * data/lalr1.cc (yystype) [defined YYSTYPE]: Define to YYSTYPE, @@ -14514,7 +14514,7 @@ Fix some "make check" problems with C++ reported by Albert Chin-A-Young for Tru64 C++ in this thread: - http://lists.gnu.org/archive/html/bug-bison/2004-05/msg00049.html + https://lists.gnu.org/r/bug-bison/2004-05/msg00049.html * m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): Check for std::cerr. * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): @@ -14545,7 +14545,7 @@ * src/parse-gram.y (lloc_default): Rewrite to avoid compiler bug in SGI MIPSpro 7.4.1m. Problem reported by Albert Chin-A-Young in - . + . * configure.ac (AC_PREREQ): Bump to 2.58, since 2.57 doesn't work (it fails with a Autoconf-without-aclocal-m4 diagnostic). @@ -14596,7 +14596,7 @@ Ensure that the C++ compiler used for testing actually works on a simple test program; if not, skip the C++-related tests. Problem reported by Vin Shelton in: - http://lists.gnu.org/archive/html/bug-bison/2004-05/msg00026.html + https://lists.gnu.org/r/bug-bison/2004-05/msg00026.html * m4/cxx.m4: New file. * configure.ac (BISON_TEST_FOR_WORKING_CXX_COMPILER): Add. @@ -14607,8 +14607,7 @@ * data/glr.c (yylloc): Output this macro even if locations are not being generated, as the GLR parser needs it even in that case. - Problem reported by Troy A. Johnson - . + Problem reported by Troy A. Johnson . * configure.ac (AC_INIT): Update to 1.875e. @@ -14883,7 +14882,7 @@ 2004-03-08 Paul Eggert Add support for hex token numbers. Suggested by Odd Arild Olsen in - . + . * NEWS: Document hexadecimal tokens, no NUL bytes, %destructor in lalr1.cc. @@ -14900,7 +14899,7 @@ * tests/local.at (AT_COMPILE, AT_COMPILE_CXX): Ignore stdout from compilers. This fixes a problem with Intel's C++ compiler being chatty, reported by Guido Trentalancia in - . + . 2004-02-09 Alexandre Duret-Lutz @@ -15096,7 +15095,7 @@ Have lalr1.cc catch with Paul Eggert's patch to fix the infinite error recovery loops. This patch is based on - . + . Also, augment the similarity between lalr1.cc and yacc.c. Note: the locations of error recovery rules are not correct yet. @@ -15145,14 +15144,14 @@ * data/glr.c (yyglrReduce): Don't use C89 string concatenation, for portability to K&R C (after ansi2knr, presumably). See - + by Frank Heckenbach, though I have omitted the structure-initialization part of his glr-knr.diff patch since I recall that the Portable C Compiler didn't require that change. Let the user specify how to allocate and free memory. Derived from a suggestion by Frank Heckenbach in - . + . * data/glr.c (YYFREE, YYMALLOC, YYREALLOC): New macros. All uses of free, malloc, realloc changed to use these macros, and unnecessary casts removed. @@ -15162,7 +15161,7 @@ * data/lalr1.cc (operator<<(std::ostream&, const Position&)): use s.empty() rather than s == "" to test for empty string; see - + (trivial change) 2003-06-25 Akim Demaille @@ -15185,7 +15184,7 @@ yyreportTree): Do not assume that size_t is the same width as int, when printing sizes. Print sizes using an unsigned format. Problem reported by Frank Heckenbach in - . + . Port to Forte Developer 7 C compiler. * data/glr.c (struct YYLTYPE): If locations are not being used, @@ -15230,7 +15229,7 @@ (ATTRIBUTE_UNUSED): Define unconditionally. Upgrade to 2003-06-08 libbitset, submitted by Michael Hayes in: - + * lib/Makefile.am (bitsets_sources): Add vbitset.c, vbitset.h. * lib/vbitset.c, lib/vbitset.h: New files. * lib/abitset.c, lib/bbitset.h, lib/bitset.c, lib/bitset.h, @@ -15350,7 +15349,7 @@ * tests/local.at (AT_COMPILE_CXX): Use it instead of CFLAGS. Fix a GLR parser bug I reported in February; see - . + . The problem was that GLR parsers did not conform to the C standard, because actions like { $1 = $2 + $3; } expanded to expressions that invoked YYFILL in separate subexpressions, and YYFILL assigned @@ -15371,7 +15370,7 @@ parser can loop. Provide a test case and a fix for yacc.c. I don't have a fix for lalr1.cc or for glr.c, unfortunately. The original bug report is in: - + * data/yacc.c (YYERROR): Now just 'goto yyerrorlab', since the macro's size was becoming unwieldy. @@ -15504,14 +15503,14 @@ * lib/bitset.h (__INT_TO_PTR): Define to a value that presumes C89. This avoids a diagnostic on compilers that define __STDC__ to 0, fixing a problem with Tru64 cc reported by Martin Mokrejs in - . + . 2003-05-03 Paul Eggert * lib/bitset.h (BITSET_FOR_EACH, BITSET_FOR_EACH_REVERSE): Do not overrun array bounds. This should fix a bug reported today by Olatunji Oluwabukunmi in - . + . 2003-04-29 Akim Demaille @@ -15543,7 +15542,7 @@ 2003-04-27 Paul Eggert Avoid gcc -Wundef warnings reported by Gerald Pfeifer in - . + . * data/yacc.c (YYSTACK_ALLOC): Don't evaluate YYSTACK_USE_ALLOCA if it is not defined. (YYMAXDEPTH): Don't evaluate YYMAXDEPTH if it is not defined. @@ -15555,13 +15554,13 @@ type suitable for the corresponding table, since the latter might be unsigned but the ninf value might be negative. This fixes a bug reported by Alexandre Duret-Lutz in - . + . * configure.ac (AC_FUNC_ERROR_AT_LINE): Remove, since gl_ERROR invokes it. We shouldn't invoke it twice because it will attempt to put error.o in the archive twice. This fixes a glitch reported by Martin Mokrejs in - . + . 2003-04-21 Paul Eggert @@ -15588,7 +15587,7 @@ * src/conflicts.c (set_conflicts): Resolve all conflicts, not just the first one. This change is from Paul Hilfinger, and it fixes regression reported by Werner Lemberg in - . + . (resolve_sr_conflict): Don't invoke state_errs_set unless one or more tokens have been explicitly made errors. @@ -15637,7 +15636,7 @@ (<>, <>): Set *loc to the scanner cursor, instead of leaving it undefined. This fixes a bug reported by Tim Van Holder in - . + . * tests/input.at (Torturing the Scanner): Test the scanner on an empty input file, which was Tim Van Holder's test case. @@ -15645,7 +15644,7 @@ can be included, include sys/time.h and sys/times.h first, if available. This works around the SunOS 4.1.4 porting bug reported by Bruce Becker in - . + . * m4/subpipe.m4 (BISON_PREREQ_SUBPIPE): Don't AC_CHECK_HEADERS([sys/wait.h]), as this interferes with @@ -15759,7 +15758,7 @@ * lib/mbswidth.c: Include before "mbswidth.h", to work around a UnixWare 7.1.1 porting bug reported by John Hughes in - . + . 2003-02-26 Paul Eggert @@ -15774,7 +15773,7 @@ * data/glr.c (yy_reduce_print): yylineno -> yylno, to avoid collision with flex use of yylineno. Problem reported by Bruce Lilly in - . + . * data/lalr1.cc (yy::]b4_parser_class_name[::parse): Likewise. * data/yacc.c (yy_reduce_print): Likewise. @@ -15844,13 +15843,13 @@ * tests/atlocal.in (LDFLAGS, LIBS): New vars. * tests/testsuite.at (AT_COMPILE): Use them. This fixes the testsuite problem reported by Robert Lentz in - . + . 2003-02-12 Paul Eggert * data/yacc.c (yyerrlab) [YYERROR_VERBOSE]: Avoid subscript error in yycheck. Bug reported by Andrew Suffield in - . + . * data/glr.c (yyreportSyntaxError) [YYERROR_VERBOSE]: Likewise. Check for malloc failure, for consistency with yacc.c. (yytname_size): Remove, for consistency with yacc.c. @@ -15980,7 +15979,7 @@ Changes in response to error report by S. Eken: GLR mode does not handle negative $ indices or $ indices in embedded rules correctly. - See . + See . * data/glr.c (b4_rhs_value): Change to use YYFILL macro. (b4_rhs_location): Ditto. @@ -16011,8 +16010,8 @@ * data/lalr1.cc: Do not use @output_header_name@ unless b4_defines_flag is set. This fixes two bugs reported by Tim Van Holder in - - and . + + and . 2003-01-21 Paul Eggert @@ -16030,7 +16029,7 @@ * src/output.c (symbol_printers_output): Fix typo that led to core dump. Problem reported by Antonio Rus in - . + . 2003-01-13 Akim Demaille , Quoc Peyrot , @@ -16048,7 +16047,7 @@ * NEWS: %expect-violations are now just warnings, reverting to Bison 1.30 and 1.75 behavior. This fixes the GCC 3.2 bootstrapping problem reported by Matthias Klose; see - . + . * src/conflicts.c (conflicts_print): Likewise. * tests/conflicts.at (%expect not enough, %expect too much, %expect with reduce conflicts): Likewise. @@ -16176,7 +16175,7 @@ Fix a bug where error locations were not being recorded correctly. This problem was originally reported by Paul Hilfinger in - . + . * data/yacc.c (yyparse): New local var yylerrsp, to record the top of the location stack's error locations. @@ -16224,7 +16223,7 @@ Remove obsolete references to bison.simple and bison.hairy. Problem mentioned by Aubin Mahe in - . + . * data/glr.c: Comment fix. * doc/bison.1: Remove references. Also, mention "yacc". @@ -16359,7 +16358,7 @@ * config/install-sh: Sync with autotools. Fix a bad interaction with flex 2.5.23 reported by Bruce Lilly in - . + . * data/yacc.c (YYLTYPE, struct yyltype): Do not define unless locations are requested. (union yyalloc): Do not depend on YYLTYPE_IS_TRIVIAL unless @@ -16640,7 +16639,7 @@ sequences like "@" that are treated specially by src/scan-skel.l. Instead, just use the file's basename. This fixes the bug reported by Martin Mokrejs in - . + . 2002-12-06 Paul Eggert @@ -16738,7 +16737,7 @@ * configure.ac (AC_REPLACE_FUNCS): Add strtoul. * lib/strtoul.c: New file, from gnulib. This fixes a porting bug reported by Peter Klein in - . + . 2002-11-30 Paul Eggert @@ -16790,7 +16789,7 @@ * data/c.m4 (b4_yysymprint_generate): yyout -> yyoutput, to avoid collision with lex macro described by Bruce Lilly in - . + . * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Likewise. * doc/bison.texinfo (Prologue, Tracing): yyprint -> print_token_value. * src/parse-gram.y (print_token_value): Renamed from yyprint. @@ -16888,7 +16887,7 @@ * data/glr.c (yygetLRActions): Replace `yyindex' with `yytable[yyindex]' to fix typo introduced in my 2002-11-09 patch. This fixes the regression with Sun ONE Studio 7 cc that I reported in - . + . 2002-11-18 Akim Demaille @@ -17006,7 +17005,7 @@ duplicating xfopen's body. Fix bugs reported by Nelson H. F. Beebe in - . + . * tests/headers.at (AT_TEST_CPP_GUARD_H): Don't assume that "$CC -E foo.h" is allowed, as this doesn't work with the Portland @@ -17049,7 +17048,7 @@ 2002-11-13 Paul Eggert Fix some bugs reported by Albert Chin-A-Young in - . + . * tests/input.at (Torturing the Scanner): Don't invoke "cc a.c b.c -o c"; the HP C compiler chatters during compilation. @@ -17078,7 +17077,7 @@ (yyglrReduce): Return yyok, not 0. This should avoid the enumerated-type warnings reported by Nelson H. F. Beebe in - . + . * lib/bbitset.h (BITSET_INLINE): Remove. * lib/bitset.h [! BITSET_INLINE]: Remove. @@ -17088,12 +17087,12 @@ * data/glr.c (inline): Remove #define. It's the user's responsibility to #define it away, just like 'const'. This fixes one of the bugs reported by Nelson H. F. Beebe in - . + . * Makefile.maint (po-check): Scan .l and .y files instead of the .c and the .h files that they generate. This fixes the bug reported by Tim Van Holder in: - + Look for N_ as well as for _. Try to avoid matching #define for N_ and _. * po/POTFILES.in: Remove src/parse-gram.c, src/scan-gram.c, @@ -17254,7 +17253,7 @@ Revamp to fix many (but not all) of the C- and M4-related quoting problems. Among other things, this fixes the Bison bug reported by Jan Hubicka when processing the Bash grammar; see: - + Use new @ escapes consistently. Represent brackets with @{ and @} rather than @<:@ and @:>@, since this works a bit better with dumb @@ -17322,7 +17321,7 @@ 2002-11-09 Paul Eggert Fix the test failure due to GCC warnings described in - . + . * data/glr.c (yyis_pact_ninf, yyis_table_ninf): New macros, which evaluate to 0 if it's impossible for NINF to be in the respective table. @@ -17674,8 +17673,8 @@ * data/glr.c (struct yyltype): Define members even when not doing locations. This is more consistent with yacc.c, and it works around the following bug reports: - http://lists.gnu.org/archive/html/bug-bison/2002-10/msg00106.html - http://lists.gnu.org/archive/html/bug-bison/2002-10/msg00111.html + https://lists.gnu.org/r/bug-bison/2002-10/msg00106.html + https://lists.gnu.org/r/bug-bison/2002-10/msg00111.html * doc/bison.texinfo: Minor spelling and typographical fixes. Use @acronym consistently. Standardize on "Yacc" instead of "YACC", @@ -18107,7 +18106,7 @@ 2002-10-13 Paul Eggert Fix problem reported by Henrik Grubbstroem in - : + : "nonterm: { $$ = 123; } { $$ = $1; };" was wrongly rejected, because the Bison parser reads the second action before reducing the first one. @@ -18124,7 +18123,7 @@ Include when checking for clock_t and struct tms. Use same include order as source. This is for the SunOS 4.1.4 porting bug reported by Peter Klein in - . + . * lib/timevar.c: Update copyright date and clarify comments. (get_time) [IN_GCC]: Keep the GCC version for reference. @@ -18137,13 +18136,13 @@ * src/reader.c (grammar_current_rule_check): Don't worry about the default action if $$ is untyped. Prevents bogus warnings reported by Jim Gifford in - . + . * data/c.m4 (b4_token_enum): Do not define YYTOKENTYPE. * data/glr.c, data/lalr1.cc, data/yacc.c: Output token definitions before the first part of user declarations. Fixes compatibility problem reported by Jim Gifford for kbd in - . + . 2002-10-11 Paul Eggert @@ -18268,7 +18267,7 @@ * lib/bitset.h (bitset_reset): Do not assume that bitset_word is the same width as int. This reapplies a hunk of the 2002-08-12 patch - , + , which was inadvertently undone by the 2002-09-30 patch. * lib/lbitset.c (debug_lbitset): Do not assume that bitset_word is the same width as int. @@ -26733,7 +26732,7 @@ ----- - Copyright (C) 1987-1988, 1991-2015, 2018-2020 Free Software + Copyright (C) 1987-1988, 1991-2015, 2018-2021 Free Software Foundation, Inc. Copying and distribution of this file, with or without diff -Nru bison-3.5.1+dfsg/configure bison-3.8.2+dfsg/configure --- bison-3.5.1+dfsg/configure 2020-01-19 13:18:15.000000000 +0000 +++ bison-3.8.2+dfsg/configure 2021-09-25 08:44:09.000000000 +0000 @@ -1,11 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for GNU Bison 3.5.1. +# Generated by GNU Autoconf 2.71 for GNU Bison 3.8.2. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -16,14 +17,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -33,46 +36,46 @@ fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -81,13 +84,6 @@ fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -96,8 +92,12 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -109,30 +109,10 @@ as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -154,20 +134,22 @@ exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -187,42 +169,53 @@ as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else +else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else +else $as_nop as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -230,14 +223,21 @@ esac as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi - if test "x$CONFIG_SHELL" != x; then : + if test "x$CONFIG_SHELL" != x +then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -255,18 +255,19 @@ exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and bug-bison@gnu.org + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and bug-bison@gnu.org $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do @@ -294,6 +295,7 @@ } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -311,6 +313,14 @@ as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -325,7 +335,7 @@ as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -334,7 +344,7 @@ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -373,12 +383,13 @@ # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -390,18 +401,27 @@ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -413,9 +433,9 @@ as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -442,7 +462,7 @@ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -486,7 +506,7 @@ s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -500,6 +520,10 @@ exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -513,6 +537,13 @@ ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -580,51 +611,47 @@ # Identity of this package. PACKAGE_NAME='GNU Bison' PACKAGE_TARNAME='bison' -PACKAGE_VERSION='3.5.1' -PACKAGE_STRING='GNU Bison 3.5.1' +PACKAGE_VERSION='3.8.2' +PACKAGE_STRING='GNU Bison 3.8.2' PACKAGE_BUGREPORT='bug-bison@gnu.org' PACKAGE_URL='https://www.gnu.org/software/bison/' # Factoring default headers for most tests. ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include +#include +#ifdef HAVE_STDIO_H +# include #endif -#ifdef STDC_HEADERS +#ifdef HAVE_STDLIB_H # include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif #endif #ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif # include #endif -#ifdef HAVE_STRINGS_H -# include -#endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_UNISTD_H # include #endif" +ac_header_c_list= gl_use_threads_default= gl_use_winpthreads_default= -ac_header_list= -ac_func_list= +gl_libtextstyle_minversion=' 0.20 ' +ac_func_c_list= gl_getopt_required=POSIX gt_needs= ac_config_libobj_dir=lib @@ -639,6 +666,8 @@ LIBOBJS GCC AUTOM4TE +ENABLE_BISTROMATHIC_FALSE +ENABLE_BISTROMATHIC_TRUE CROSS_COMPILING_FALSE CROSS_COMPILING_TRUE VALGRIND_OPTS_SUPPRESSION @@ -647,8 +676,6 @@ BISON_LOCALEDIR POSUB INTLLIBS -LTLIBICONV -LIBICONV INTL_MACOSX_LIBS XGETTEXT_EXTRA_OPTIONS MSGMERGE @@ -675,10 +702,10 @@ gl_GNULIB_ENABLED_503a4cb75d69c787103d0aa2ab7d8440_TRUE gl_GNULIB_ENABLED_ed5616be3593d355b981ffab56b9f37b_FALSE gl_GNULIB_ENABLED_ed5616be3593d355b981ffab56b9f37b_TRUE -gl_GNULIB_ENABLED_sys_stat_FALSE -gl_GNULIB_ENABLED_sys_stat_TRUE gl_GNULIB_ENABLED_strnlen_FALSE gl_GNULIB_ENABLED_strnlen_TRUE +gl_GNULIB_ENABLED_strings_FALSE +gl_GNULIB_ENABLED_strings_TRUE gl_GNULIB_ENABLED_1f32594a85e6221ba15f884daeee8c2a_FALSE gl_GNULIB_ENABLED_1f32594a85e6221ba15f884daeee8c2a_TRUE gl_GNULIB_ENABLED_dbb57f49352be8fb86869629a254fb72_FALSE @@ -687,49 +714,94 @@ gl_GNULIB_ENABLED_strchrnul_TRUE gl_GNULIB_ENABLED_0137e3d3638b33e5819d132d0b23165c_FALSE gl_GNULIB_ENABLED_0137e3d3638b33e5819d132d0b23165c_TRUE -gl_GNULIB_ENABLED_stat_FALSE -gl_GNULIB_ENABLED_stat_TRUE gl_GNULIB_ENABLED_cdeb0f2aaf9d280baa6526bfa1b07f70_FALSE gl_GNULIB_ENABLED_cdeb0f2aaf9d280baa6526bfa1b07f70_TRUE gl_GNULIB_ENABLED_e7e881d32ca02f1c997b13c737c64bbd_FALSE gl_GNULIB_ENABLED_e7e881d32ca02f1c997b13c737c64bbd_TRUE -gl_GNULIB_ENABLED_9bc5f216d57e231e4834049d67d0db62_FALSE -gl_GNULIB_ENABLED_9bc5f216d57e231e4834049d67d0db62_TRUE +gl_GNULIB_ENABLED_d4850532688ba16d685f036076611f21_FALSE +gl_GNULIB_ENABLED_d4850532688ba16d685f036076611f21_TRUE gl_GNULIB_ENABLED_rmdir_FALSE gl_GNULIB_ENABLED_rmdir_TRUE -gl_GNULIB_ENABLED_rawmemchr_FALSE -gl_GNULIB_ENABLED_rawmemchr_TRUE +gl_GNULIB_ENABLED_rewinddir_FALSE +gl_GNULIB_ENABLED_rewinddir_TRUE +gl_GNULIB_ENABLED_readdir_FALSE +gl_GNULIB_ENABLED_readdir_TRUE gl_GNULIB_ENABLED_332607f759618fb73dfc3076748afea7_FALSE gl_GNULIB_ENABLED_332607f759618fb73dfc3076748afea7_TRUE +gl_GNULIB_ENABLED_opendir_FALSE +gl_GNULIB_ENABLED_opendir_TRUE +gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7_FALSE +gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7_TRUE +gl_GNULIB_ENABLED_1840129d490f3a00c8a098316d0fa345_FALSE +gl_GNULIB_ENABLED_1840129d490f3a00c8a098316d0fa345_TRUE +gl_GNULIB_ENABLED_openat_FALSE +gl_GNULIB_ENABLED_openat_TRUE +gl_GNULIB_ENABLED_memrchr_FALSE +gl_GNULIB_ENABLED_memrchr_TRUE gl_GNULIB_ENABLED_malloca_FALSE gl_GNULIB_ENABLED_malloca_TRUE gl_GNULIB_ENABLED_lstat_FALSE gl_GNULIB_ENABLED_lstat_TRUE -gl_GNULIB_ENABLED_2049e887c7e5308faad27b3f894bb8c9_FALSE -gl_GNULIB_ENABLED_2049e887c7e5308faad27b3f894bb8c9_TRUE gl_GNULIB_ENABLED_locale_FALSE gl_GNULIB_ENABLED_locale_TRUE -gl_GNULIB_ENABLED_21ee726a3540c09237a8e70c0baf7467_FALSE -gl_GNULIB_ENABLED_21ee726a3540c09237a8e70c0baf7467_TRUE gl_GNULIB_ENABLED_ldexp_FALSE gl_GNULIB_ENABLED_ldexp_TRUE gl_GNULIB_ENABLED_3f0e593033d1fc2c127581960f641b66_FALSE gl_GNULIB_ENABLED_3f0e593033d1fc2c127581960f641b66_TRUE gl_GNULIB_ENABLED_30838f5439487421042f2225bed3af76_FALSE gl_GNULIB_ENABLED_30838f5439487421042f2225bed3af76_TRUE +gl_GNULIB_ENABLED_getline_FALSE +gl_GNULIB_ENABLED_getline_TRUE gl_GNULIB_ENABLED_getdtablesize_FALSE gl_GNULIB_ENABLED_getdtablesize_TRUE +gl_GNULIB_ENABLED_getdelim_FALSE +gl_GNULIB_ENABLED_getdelim_TRUE +gl_GNULIB_ENABLED_3d094ef542bfdd238a5194e172bfe5f6_FALSE +gl_GNULIB_ENABLED_3d094ef542bfdd238a5194e172bfe5f6_TRUE +gl_GNULIB_ENABLED_fstatat_FALSE +gl_GNULIB_ENABLED_fstatat_TRUE gl_GNULIB_ENABLED_fstat_FALSE gl_GNULIB_ENABLED_fstat_TRUE gl_GNULIB_ENABLED_fseterr_FALSE gl_GNULIB_ENABLED_fseterr_TRUE +gl_GNULIB_ENABLED_fca9852db2a43bb33f02f0fbdbc174f6_FALSE +gl_GNULIB_ENABLED_fca9852db2a43bb33f02f0fbdbc174f6_TRUE +gl_GNULIB_ENABLED_ffs_FALSE +gl_GNULIB_ENABLED_ffs_TRUE +gl_GNULIB_ENABLED_fdopendir_FALSE +gl_GNULIB_ENABLED_fdopendir_TRUE gl_GNULIB_ENABLED_43fe87a341d9b4b93c47c3ad819a5239_FALSE gl_GNULIB_ENABLED_43fe87a341d9b4b93c47c3ad819a5239_TRUE +gl_GNULIB_ENABLED_fchdir_FALSE +gl_GNULIB_ENABLED_fchdir_TRUE +gl_GNULIB_ENABLED_dup_FALSE +gl_GNULIB_ENABLED_dup_TRUE +gl_GNULIB_ENABLED_dirfd_FALSE +gl_GNULIB_ENABLED_dirfd_TRUE +gl_GNULIB_ENABLED_dirent_FALSE +gl_GNULIB_ENABLED_dirent_TRUE +gl_GNULIB_ENABLED_75c65a2c014cf8235dd95289676302a4_FALSE +gl_GNULIB_ENABLED_75c65a2c014cf8235dd95289676302a4_TRUE +gl_GNULIB_ENABLED_closedir_FALSE +gl_GNULIB_ENABLED_closedir_TRUE +gl_GNULIB_ENABLED_8198daae261b932d64a998f8586f5005_FALSE +gl_GNULIB_ENABLED_8198daae261b932d64a998f8586f5005_TRUE gl_GNULIB_ENABLED_chdir_FALSE gl_GNULIB_ENABLED_chdir_TRUE +gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b_FALSE +gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b_TRUE +HAVE_STRINGS_H +NEXT_AS_FIRST_DIRECTIVE_STRINGS_H +NEXT_STRINGS_H +GL_GNULIB_LOCALENAME +GL_GNULIB_DUPLOCALE +GL_GNULIB_SETLOCALE_NULL +GL_GNULIB_SETLOCALE +GL_GNULIB_LOCALECONV NEXT_AS_FIRST_DIRECTIVE_LOCALE_H NEXT_LOCALE_H HAVE_XLOCALE_H +LOCALENAME_ENHANCE_LOCALE_FUNCS REPLACE_STRUCT_LCONV REPLACE_FREELOCALE REPLACE_DUPLOCALE @@ -739,82 +811,110 @@ HAVE_FREELOCALE HAVE_DUPLOCALE HAVE_NEWLOCALE -GNULIB_LOCALENAME -GNULIB_DUPLOCALE -GNULIB_SETLOCALE_NULL -GNULIB_SETLOCALE -GNULIB_LOCALECONV LIB_HARD_LOCALE LIB_SETLOCALE_NULL -WINDOWS_64_BIT_ST_SIZE -WINDOWS_STAT_TIMESPEC -NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H -NEXT_SYS_STAT_H -REPLACE_UTIMENSAT -REPLACE_STAT -REPLACE_MKNOD -REPLACE_MKFIFO -REPLACE_MKDIR -REPLACE_LSTAT -REPLACE_FUTIMENS -REPLACE_FSTATAT -REPLACE_FSTAT -HAVE_UTIMENSAT -HAVE_MKNODAT -HAVE_MKNOD -HAVE_MKFIFOAT -HAVE_MKFIFO -HAVE_MKDIRAT -HAVE_LSTAT -HAVE_LCHMOD -HAVE_FUTIMENS -HAVE_FSTATAT -HAVE_FCHMODAT -GNULIB_OVERRIDES_STRUCT_STAT -GNULIB_UTIMENSAT -GNULIB_STAT -GNULIB_MKNODAT -GNULIB_MKNOD -GNULIB_MKFIFOAT -GNULIB_MKFIFO -GNULIB_MKDIRAT -GNULIB_LSTAT -GNULIB_LCHMOD -GNULIB_FUTIMENS -GNULIB_FSTATAT -GNULIB_FSTAT -GNULIB_FCHMODAT +GL_GNULIB_FFS +HAVE_DECL_STRNCASECMP +HAVE_STRCASECMP +HAVE_FFS +HAVE_DIRENT_H +NEXT_AS_FIRST_DIRECTIVE_DIRENT_H +NEXT_DIRENT_H +GL_GNULIB_ALPHASORT +GL_GNULIB_SCANDIR +GL_GNULIB_FDOPENDIR +GL_GNULIB_DIRFD +GL_GNULIB_CLOSEDIR +GL_GNULIB_REWINDDIR +GL_GNULIB_READDIR +GL_GNULIB_OPENDIR +REPLACE_FDOPENDIR +REPLACE_DIRFD +REPLACE_CLOSEDIR +REPLACE_OPENDIR +HAVE_ALPHASORT +HAVE_SCANDIR +HAVE_FDOPENDIR +HAVE_DECL_FDOPENDIR +HAVE_DECL_DIRFD +HAVE_CLOSEDIR +HAVE_REWINDDIR +HAVE_READDIR +HAVE_OPENDIR NEXT_AS_FIRST_DIRECTIVE_WCHAR_H NEXT_WCHAR_H LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_FALSE LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE LIBUNISTRING_UNIWIDTH_H LIBUNISTRING_UNITYPES_H +LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_FALSE +LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_TRUE +LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_FALSE +LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_TRUE +LIBUNISTRING_UNISTR_H HAVE_UNISTD_H NEXT_AS_FIRST_DIRECTIVE_UNISTD_H NEXT_UNISTD_H +GL_GNULIB_MDA_TZSET +GL_GNULIB_TZSET +GL_GNULIB_TIME_RZ +GL_GNULIB_TIME_R +GL_GNULIB_TIMESPEC_GET +GL_GNULIB_TIMEGM +GL_GNULIB_STRPTIME +GL_GNULIB_STRFTIME +GL_GNULIB_NANOSLEEP +GL_GNULIB_LOCALTIME +GL_GNULIB_MKTIME +GL_GNULIB_CTIME +TIME_H_DEFINES_TIME_UTC UNISTD_H_DEFINES_STRUCT_TIMESPEC PTHREAD_H_DEFINES_STRUCT_TIMESPEC SYS_TIME_H_DEFINES_STRUCT_TIMESPEC TIME_H_DEFINES_STRUCT_TIMESPEC NEXT_AS_FIRST_DIRECTIVE_TIME_H NEXT_TIME_H +REPLACE_LOCALTIME +REPLACE_GMTIME +GNULIB_GETTIMEOFDAY +REPLACE_TZSET +REPLACE_TIMEGM +REPLACE_STRFTIME +REPLACE_NANOSLEEP +REPLACE_MKTIME +REPLACE_LOCALTIME_R +REPLACE_CTIME +HAVE_TIMEZONE_T +HAVE_TIMESPEC_GET +HAVE_TIMEGM +HAVE_STRPTIME +HAVE_NANOSLEEP +HAVE_DECL_LOCALTIME_R +GL_GNULIB_TCGETSID +NEXT_AS_FIRST_DIRECTIVE_TERMIOS_H +NEXT_TERMIOS_H +HAVE_TERMIOS_H +HAVE_DECL_TCGETSID +GL_GNULIB_WAITPID NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H NEXT_SYS_WAIT_H -GNULIB_WAITPID WINDOWS_STAT_INODES WINDOWS_64_BIT_OFF_T NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H NEXT_SYS_TYPES_H +GL_GNULIB_TIMES HAVE_SYS_TIMES_H NEXT_AS_FIRST_DIRECTIVE_SYS_TIMES_H NEXT_SYS_TIMES_H HAVE_TIMES HAVE_STRUCT_TMS -GNULIB_TIMES HAVE_SYS_RESOURCE_H NEXT_AS_FIRST_DIRECTIVE_SYS_RESOURCE_H NEXT_SYS_RESOURCE_H +GL_GNULIB_IOCTL +NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H +NEXT_SYS_IOCTL_H +HAVE_SYS_IOCTL_H NEXT_AS_FIRST_DIRECTIVE_STRING_H NEXT_STRING_H NEXT_AS_FIRST_DIRECTIVE_STDLIB_H @@ -833,18 +933,68 @@ GL_GENERATE_STDBOOL_H_FALSE GL_GENERATE_STDBOOL_H_TRUE STDBOOL_H +GL_GENERATE_STDALIGN_H_FALSE +GL_GENERATE_STDALIGN_H_TRUE +STDALIGN_H +GL_GNULIB_MDA_UMASK +GL_GNULIB_MDA_MKDIR +GL_GNULIB_MDA_CHMOD +GL_GNULIB_OVERRIDES_STRUCT_STAT +GL_GNULIB_UTIMENSAT +GL_GNULIB_STAT +GL_GNULIB_MKNODAT +GL_GNULIB_MKNOD +GL_GNULIB_MKFIFOAT +GL_GNULIB_MKFIFO +GL_GNULIB_MKDIRAT +GL_GNULIB_MKDIR +GL_GNULIB_LSTAT +GL_GNULIB_LCHMOD +GL_GNULIB_GETUMASK +GL_GNULIB_FUTIMENS +GL_GNULIB_FSTATAT +GL_GNULIB_FSTAT +GL_GNULIB_FCHMODAT +WINDOWS_64_BIT_ST_SIZE +WINDOWS_STAT_TIMESPEC +NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H +NEXT_SYS_STAT_H +REPLACE_UTIMENSAT +REPLACE_STAT +REPLACE_MKNODAT +REPLACE_MKNOD +REPLACE_MKFIFOAT +REPLACE_MKFIFO +REPLACE_MKDIR +REPLACE_LSTAT +REPLACE_FUTIMENS +REPLACE_FSTATAT +REPLACE_FSTAT +REPLACE_FCHMODAT +HAVE_UTIMENSAT +HAVE_MKNODAT +HAVE_MKNOD +HAVE_MKFIFOAT +HAVE_MKFIFO +HAVE_MKDIRAT +HAVE_LSTAT +HAVE_LCHMOD +HAVE_GETUMASK +HAVE_FUTIMENS +HAVE_FSTATAT +HAVE_FCHMODAT HAVE_SPAWN_H NEXT_AS_FIRST_DIRECTIVE_SPAWN_H NEXT_SPAWN_H NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H NEXT_SIGNAL_H +GL_GNULIB_SCHED_YIELD HAVE_STRUCT_SCHED_PARAM HAVE_SCHED_H NEXT_AS_FIRST_DIRECTIVE_SCHED_H NEXT_SCHED_H REPLACE_SCHED_YIELD HAVE_SCHED_YIELD -GNULIB_SCHED_YIELD RELOCATABLE_STRIP RELOCATABLE_BUILD_DIR RELOCATABLE_SRC_DIR @@ -857,6 +1007,13 @@ INSTALL_PROGRAM_ENV RELOCATABLE_LDFLAGS RELOCATABLE +LTLIBREADLINE +LIBREADLINE +GL_GNULIB_SIGACTION +GL_GNULIB_SIGPROCMASK +GL_GNULIB_SIGNAL_H_SIGPIPE +GL_GNULIB_RAISE +GL_GNULIB_PTHREAD_SIGMASK REPLACE_RAISE REPLACE_PTHREAD_SIGMASK HAVE_SIGHANDLER_T @@ -868,12 +1025,30 @@ HAVE_RAISE HAVE_PTHREAD_SIGMASK HAVE_POSIX_SIGNALBLOCKING -GNULIB_SIGACTION -GNULIB_SIGPROCMASK -GNULIB_SIGNAL_H_SIGPIPE -GNULIB_RAISE -GNULIB_PTHREAD_SIGMASK ASM_SYMBOL_PREFIX +GL_GNULIB_POSIX_SPAWNATTR_DESTROY +GL_GNULIB_POSIX_SPAWNATTR_SETSIGMASK +GL_GNULIB_POSIX_SPAWNATTR_GETSIGMASK +GL_GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT +GL_GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT +GL_GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY +GL_GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY +GL_GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM +GL_GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM +GL_GNULIB_POSIX_SPAWNATTR_SETPGROUP +GL_GNULIB_POSIX_SPAWNATTR_GETPGROUP +GL_GNULIB_POSIX_SPAWNATTR_SETFLAGS +GL_GNULIB_POSIX_SPAWNATTR_GETFLAGS +GL_GNULIB_POSIX_SPAWNATTR_INIT +GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY +GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN +GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR +GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2 +GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE +GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR +GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT +GL_GNULIB_POSIX_SPAWNP +GL_GNULIB_POSIX_SPAWN LIB_POSIX_SPAWN REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR @@ -886,110 +1061,51 @@ HAVE_POSIX_SPAWN_FILE_ACTIONS_T HAVE_POSIX_SPAWNATTR_T HAVE_POSIX_SPAWN -GNULIB_POSIX_SPAWNATTR_DESTROY -GNULIB_POSIX_SPAWNATTR_SETSIGMASK -GNULIB_POSIX_SPAWNATTR_GETSIGMASK -GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT -GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT -GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY -GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY -GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM -GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM -GNULIB_POSIX_SPAWNATTR_SETPGROUP -GNULIB_POSIX_SPAWNATTR_GETPGROUP -GNULIB_POSIX_SPAWNATTR_SETFLAGS -GNULIB_POSIX_SPAWNATTR_GETFLAGS -GNULIB_POSIX_SPAWNATTR_INIT -GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY -GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN -GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR -GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2 -GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE -GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR -GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT -GNULIB_POSIX_SPAWNP -GNULIB_POSIX_SPAWN -UNDEFINE_STRTOK_R -REPLACE_STRSIGNAL -REPLACE_STRERROR_R -REPLACE_STRERROR -REPLACE_STRTOK_R -REPLACE_STRCASESTR -REPLACE_STRSTR -REPLACE_STRNLEN -REPLACE_STRNDUP -REPLACE_STRNCAT -REPLACE_STRDUP -REPLACE_STRCHRNUL -REPLACE_STPNCPY -REPLACE_MEMMEM -REPLACE_MEMCHR -HAVE_STRVERSCMP -HAVE_DECL_STRSIGNAL -HAVE_DECL_STRERROR_R -HAVE_DECL_STRTOK_R -HAVE_STRCASESTR -HAVE_STRSEP -HAVE_STRPBRK -HAVE_DECL_STRNLEN -HAVE_DECL_STRNDUP -HAVE_DECL_STRDUP -HAVE_STRCHRNUL -HAVE_STPNCPY -HAVE_STPCPY -HAVE_RAWMEMCHR -HAVE_DECL_MEMRCHR -HAVE_MEMPCPY -HAVE_DECL_MEMMEM -HAVE_MEMCHR -HAVE_FFSLL -HAVE_FFSL -HAVE_EXPLICIT_BZERO -HAVE_MBSLEN -GNULIB_STRVERSCMP -GNULIB_STRSIGNAL -GNULIB_STRERROR_R -GNULIB_STRERROR -GNULIB_MBSTOK_R -GNULIB_MBSSEP -GNULIB_MBSSPN -GNULIB_MBSPBRK -GNULIB_MBSCSPN -GNULIB_MBSCASESTR -GNULIB_MBSPCASECMP -GNULIB_MBSNCASECMP -GNULIB_MBSCASECMP -GNULIB_MBSSTR -GNULIB_MBSRCHR -GNULIB_MBSCHR -GNULIB_MBSNLEN -GNULIB_MBSLEN -GNULIB_STRTOK_R -GNULIB_STRCASESTR -GNULIB_STRSTR -GNULIB_STRSEP -GNULIB_STRPBRK -GNULIB_STRNLEN -GNULIB_STRNDUP -GNULIB_STRNCAT -GNULIB_STRDUP -GNULIB_STRCHRNUL -GNULIB_STPNCPY -GNULIB_STPCPY -GNULIB_RAWMEMCHR -GNULIB_MEMRCHR -GNULIB_MEMPCPY -GNULIB_MEMMEM -GNULIB_MEMCHR -GNULIB_FFSLL -GNULIB_FFSL -GNULIB_EXPLICIT_BZERO +GL_GNULIB_MDA_WCSDUP +GL_GNULIB_WCSFTIME +GL_GNULIB_WCSWIDTH +GL_GNULIB_WCSTOK +GL_GNULIB_WCSSTR +GL_GNULIB_WCSPBRK +GL_GNULIB_WCSSPN +GL_GNULIB_WCSCSPN +GL_GNULIB_WCSRCHR +GL_GNULIB_WCSCHR +GL_GNULIB_WCSDUP +GL_GNULIB_WCSXFRM +GL_GNULIB_WCSCOLL +GL_GNULIB_WCSNCASECMP +GL_GNULIB_WCSCASECMP +GL_GNULIB_WCSNCMP +GL_GNULIB_WCSCMP +GL_GNULIB_WCSNCAT +GL_GNULIB_WCSCAT +GL_GNULIB_WCPNCPY +GL_GNULIB_WCSNCPY +GL_GNULIB_WCPCPY +GL_GNULIB_WCSCPY +GL_GNULIB_WCSNLEN +GL_GNULIB_WCSLEN +GL_GNULIB_WMEMSET +GL_GNULIB_WMEMPCPY +GL_GNULIB_WMEMMOVE +GL_GNULIB_WMEMCPY +GL_GNULIB_WMEMCMP +GL_GNULIB_WMEMCHR +GL_GNULIB_WCWIDTH +GL_GNULIB_WCSNRTOMBS +GL_GNULIB_WCSRTOMBS +GL_GNULIB_WCRTOMB +GL_GNULIB_MBSNRTOWCS +GL_GNULIB_MBSRTOWCS +GL_GNULIB_MBRLEN +GL_GNULIB_MBRTOWC +GL_GNULIB_MBSINIT +GL_GNULIB_WCTOB +GL_GNULIB_BTOWC HAVE_VISIBILITY CFLAG_VISIBILITY LIB_MBRTOWC -LOCALE_ZH_CN -LOCALE_FR_UTF8 -LOCALE_JA REPLACE_WCSTOK REPLACE_WCSFTIME REPLACE_WCSWIDTH @@ -1006,6 +1122,7 @@ REPLACE_BTOWC REPLACE_MBSTATE_T HAVE_DECL_WCWIDTH +HAVE_DECL_WCSDUP HAVE_DECL_WCTOB HAVE_WCSFTIME HAVE_WCSWIDTH @@ -1032,6 +1149,7 @@ HAVE_WCSNLEN HAVE_WCSLEN HAVE_WMEMSET +HAVE_WMEMPCPY HAVE_WMEMMOVE HAVE_WMEMCPY HAVE_WMEMCMP @@ -1045,46 +1163,6 @@ HAVE_MBRTOWC HAVE_MBSINIT HAVE_BTOWC -GNULIB_WCSFTIME -GNULIB_WCSWIDTH -GNULIB_WCSTOK -GNULIB_WCSSTR -GNULIB_WCSPBRK -GNULIB_WCSSPN -GNULIB_WCSCSPN -GNULIB_WCSRCHR -GNULIB_WCSCHR -GNULIB_WCSDUP -GNULIB_WCSXFRM -GNULIB_WCSCOLL -GNULIB_WCSNCASECMP -GNULIB_WCSCASECMP -GNULIB_WCSNCMP -GNULIB_WCSCMP -GNULIB_WCSNCAT -GNULIB_WCSCAT -GNULIB_WCPNCPY -GNULIB_WCSNCPY -GNULIB_WCPCPY -GNULIB_WCSCPY -GNULIB_WCSNLEN -GNULIB_WCSLEN -GNULIB_WMEMSET -GNULIB_WMEMMOVE -GNULIB_WMEMCPY -GNULIB_WMEMCMP -GNULIB_WMEMCHR -GNULIB_WCWIDTH -GNULIB_WCSNRTOMBS -GNULIB_WCSRTOMBS -GNULIB_WCRTOMB -GNULIB_MBSNRTOWCS -GNULIB_MBSRTOWCS -GNULIB_MBRLEN -GNULIB_MBRTOWC -GNULIB_MBSINIT -GNULIB_WCTOB -GNULIB_BTOWC NEXT_AS_FIRST_DIRECTIVE_MATH_H NEXT_MATH_H SED @@ -1097,15 +1175,19 @@ LIBPMULTITHREAD LIBPTHREAD LOCALCHARSET_TESTS_ENVIRONMENT -GL_GENERATE_TEXTSTYLE_H_FALSE -GL_GENERATE_TEXTSTYLE_H_TRUE -TEXTSTYLE_H -LIBTEXTSTYLE_PREFIX -LTLIBTEXTSTYLE -LIBTEXTSTYLE -HAVE_LIBTEXTSTYLE LDEXPL_LIBM LDEXP_LIBM +LOCALE_ZH_CN +LOCALE_FR_UTF8 +LOCALE_JA +LOCALE_FR +GL_GNULIB_TOWCTRANS +GL_GNULIB_WCTRANS +GL_GNULIB_ISWCTYPE +GL_GNULIB_WCTYPE +GL_GNULIB_ISWXDIGIT +GL_GNULIB_ISWDIGIT +GL_GNULIB_ISWBLANK REPLACE_TOWLOWER REPLACE_ISWCNTRL HAVE_WCTYPE_H @@ -1114,25 +1196,25 @@ HAVE_CRTDEFS_H HAVE_WINT_T HAVE_ISWCNTRL +REPLACE_ISWXDIGIT +REPLACE_ISWDIGIT REPLACE_ISWBLANK HAVE_WCTRANS_T HAVE_WCTYPE_T HAVE_ISWBLANK -GNULIB_TOWCTRANS -GNULIB_WCTRANS -GNULIB_ISWCTYPE -GNULIB_WCTYPE -GNULIB_ISWBLANK ISNAN_LIBM ISNANL_LIBM ISNAND_LIBM ISNANF_LIBM +GL_GNULIB_STRTOUMAX +GL_GNULIB_STRTOIMAX +GL_GNULIB_IMAXDIV +GL_GNULIB_IMAXABS NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H NEXT_INTTYPES_H UINT64_MAX_EQ_ULONG_MAX UINT32_MAX_LT_UINTMAX_MAX PRIPTR_PREFIX -PRI_MACROS_BROKEN INT64_MAX_EQ_LONG_MAX INT32_MAX_LT_INTMAX_MAX REPLACE_STRTOUMAX @@ -1142,10 +1224,6 @@ HAVE_DECL_STRTOIMAX HAVE_DECL_IMAXDIV HAVE_DECL_IMAXABS -GNULIB_STRTOUMAX -GNULIB_STRTOIMAX -GNULIB_IMAXDIV -GNULIB_IMAXABS GL_GENERATE_STDINT_H_FALSE GL_GENERATE_STDINT_H_TRUE STDINT_H @@ -1176,31 +1254,19 @@ LIMITS_H NEXT_AS_FIRST_DIRECTIVE_LIMITS_H NEXT_LIMITS_H -REPLACE_LOCALTIME -REPLACE_GMTIME -REPLACE_TZSET -REPLACE_TIMEGM -REPLACE_STRFTIME -REPLACE_NANOSLEEP -REPLACE_MKTIME -REPLACE_LOCALTIME_R -REPLACE_CTIME -HAVE_TIMEZONE_T -HAVE_TZSET -HAVE_TIMEGM -HAVE_STRPTIME -HAVE_NANOSLEEP -HAVE_DECL_LOCALTIME_R -GNULIB_TZSET -GNULIB_TIME_RZ -GNULIB_TIME_R -GNULIB_TIMEGM -GNULIB_STRPTIME -GNULIB_STRFTIME -GNULIB_NANOSLEEP -GNULIB_LOCALTIME -GNULIB_MKTIME -GNULIB_CTIME +NEXT_AS_FIRST_DIRECTIVE_ICONV_H +NEXT_ICONV_H +GL_GNULIB_ICONV +GL_GENERATE_ICONV_H_FALSE +GL_GENERATE_ICONV_H_TRUE +ICONV_H +REPLACE_ICONV_UTF +REPLACE_ICONV_OPEN +REPLACE_ICONV +ICONV_CONST +LTLIBICONV +LIBICONV +GL_GNULIB_GETTIMEOFDAY NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H NEXT_SYS_TIME_H REPLACE_STRUCT_TIMEVAL @@ -1208,12 +1274,10 @@ HAVE_SYS_TIME_H HAVE_STRUCT_TIMEVAL HAVE_GETTIMEOFDAY -GNULIB_GETTIMEOFDAY LTLIBINTL LIBINTL +GL_GNULIB_GETRUSAGE HAVE_GETRUSAGE -GNULIB_GETRUSAGE -GNULIB_GL_UNISTD_H_GETOPT GETOPT_CDEFS_H GETOPT_H HAVE_SYS_CDEFS_H @@ -1221,6 +1285,107 @@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H NEXT_GETOPT_H LIB_GETHRXTIME +GL_GNULIB_MDA_YN +GL_GNULIB_MDA_Y1 +GL_GNULIB_MDA_Y0 +GL_GNULIB_MDA_JN +GL_GNULIB_MDA_J1 +GL_GNULIB_MDA_J0 +GL_GNULIB_TRUNCL +GL_GNULIB_TRUNCF +GL_GNULIB_TRUNC +GL_GNULIB_TANHF +GL_GNULIB_TANL +GL_GNULIB_TANF +GL_GNULIB_SQRTL +GL_GNULIB_SQRTF +GL_GNULIB_SINHF +GL_GNULIB_SINL +GL_GNULIB_SINF +GL_GNULIB_SIGNBIT +GL_GNULIB_ROUNDL +GL_GNULIB_ROUNDF +GL_GNULIB_ROUND +GL_GNULIB_RINTL +GL_GNULIB_RINTF +GL_GNULIB_RINT +GL_GNULIB_REMAINDERL +GL_GNULIB_REMAINDERF +GL_GNULIB_REMAINDER +GL_GNULIB_POWF +GL_GNULIB_MODFL +GL_GNULIB_MODFF +GL_GNULIB_MODF +GL_GNULIB_LOGBL +GL_GNULIB_LOGBF +GL_GNULIB_LOGB +GL_GNULIB_LOG2L +GL_GNULIB_LOG2F +GL_GNULIB_LOG2 +GL_GNULIB_LOG1PL +GL_GNULIB_LOG1PF +GL_GNULIB_LOG1P +GL_GNULIB_LOG10L +GL_GNULIB_LOG10F +GL_GNULIB_LOG10 +GL_GNULIB_LOGL +GL_GNULIB_LOGF +GL_GNULIB_LOG +GL_GNULIB_LDEXPL +GL_GNULIB_LDEXPF +GL_GNULIB_ISNANL +GL_GNULIB_ISNAND +GL_GNULIB_ISNANF +GL_GNULIB_ISNAN +GL_GNULIB_ISINF +GL_GNULIB_ISFINITE +GL_GNULIB_ILOGBL +GL_GNULIB_ILOGBF +GL_GNULIB_ILOGB +GL_GNULIB_HYPOTL +GL_GNULIB_HYPOTF +GL_GNULIB_HYPOT +GL_GNULIB_FREXPL +GL_GNULIB_FREXP +GL_GNULIB_FREXPF +GL_GNULIB_FMODL +GL_GNULIB_FMODF +GL_GNULIB_FMOD +GL_GNULIB_FMAL +GL_GNULIB_FMAF +GL_GNULIB_FMA +GL_GNULIB_FLOORL +GL_GNULIB_FLOORF +GL_GNULIB_FLOOR +GL_GNULIB_FABSL +GL_GNULIB_FABSF +GL_GNULIB_EXPM1L +GL_GNULIB_EXPM1F +GL_GNULIB_EXPM1 +GL_GNULIB_EXP2L +GL_GNULIB_EXP2F +GL_GNULIB_EXP2 +GL_GNULIB_EXPL +GL_GNULIB_EXPF +GL_GNULIB_COSHF +GL_GNULIB_COSL +GL_GNULIB_COSF +GL_GNULIB_COPYSIGNL +GL_GNULIB_COPYSIGNF +GL_GNULIB_COPYSIGN +GL_GNULIB_CEILL +GL_GNULIB_CEILF +GL_GNULIB_CEIL +GL_GNULIB_CBRTL +GL_GNULIB_CBRTF +GL_GNULIB_CBRT +GL_GNULIB_ATAN2F +GL_GNULIB_ATANL +GL_GNULIB_ATANF +GL_GNULIB_ASINL +GL_GNULIB_ASINF +GL_GNULIB_ACOSL +GL_GNULIB_ACOSF REPLACE_TRUNCL REPLACE_TRUNCF REPLACE_TRUNC @@ -1230,7 +1395,7 @@ REPLACE_SQRTF REPLACE_SINHF REPLACE_SINF -REPLACE_SIGNBIT_USING_GCC +REPLACE_SIGNBIT_USING_BUILTINS REPLACE_SIGNBIT REPLACE_ROUNDL REPLACE_ROUNDF @@ -1396,105 +1561,69 @@ HAVE_ASINF HAVE_ACOSL HAVE_ACOSF -GNULIB_TRUNCL -GNULIB_TRUNCF -GNULIB_TRUNC -GNULIB_TANHF -GNULIB_TANL -GNULIB_TANF -GNULIB_SQRTL -GNULIB_SQRTF -GNULIB_SINHF -GNULIB_SINL -GNULIB_SINF -GNULIB_SIGNBIT -GNULIB_ROUNDL -GNULIB_ROUNDF -GNULIB_ROUND -GNULIB_RINTL -GNULIB_RINTF -GNULIB_RINT -GNULIB_REMAINDERL -GNULIB_REMAINDERF -GNULIB_REMAINDER -GNULIB_POWF -GNULIB_MODFL -GNULIB_MODFF -GNULIB_MODF -GNULIB_LOGBL -GNULIB_LOGBF -GNULIB_LOGB -GNULIB_LOG2L -GNULIB_LOG2F -GNULIB_LOG2 -GNULIB_LOG1PL -GNULIB_LOG1PF -GNULIB_LOG1P -GNULIB_LOG10L -GNULIB_LOG10F -GNULIB_LOG10 -GNULIB_LOGL -GNULIB_LOGF -GNULIB_LOG -GNULIB_LDEXPL -GNULIB_LDEXPF -GNULIB_ISNANL -GNULIB_ISNAND -GNULIB_ISNANF -GNULIB_ISNAN -GNULIB_ISINF -GNULIB_ISFINITE -GNULIB_ILOGBL -GNULIB_ILOGBF -GNULIB_ILOGB -GNULIB_HYPOTL -GNULIB_HYPOTF -GNULIB_HYPOT -GNULIB_FREXPL -GNULIB_FREXP -GNULIB_FREXPF -GNULIB_FMODL -GNULIB_FMODF -GNULIB_FMOD -GNULIB_FMAL -GNULIB_FMAF -GNULIB_FMA -GNULIB_FLOORL -GNULIB_FLOORF -GNULIB_FLOOR -GNULIB_FABSL -GNULIB_FABSF -GNULIB_EXPM1L -GNULIB_EXPM1F -GNULIB_EXPM1 -GNULIB_EXP2L -GNULIB_EXP2F -GNULIB_EXP2 -GNULIB_EXPL -GNULIB_EXPF -GNULIB_COSHF -GNULIB_COSL -GNULIB_COSF -GNULIB_COPYSIGNL -GNULIB_COPYSIGNF -GNULIB_COPYSIGN -GNULIB_CEILL -GNULIB_CEILF -GNULIB_CEIL -GNULIB_CBRTL -GNULIB_CBRTF -GNULIB_CBRT -GNULIB_ATAN2F -GNULIB_ATANL -GNULIB_ATANF -GNULIB_ASINL -GNULIB_ASINF -GNULIB_ACOSL -GNULIB_ACOSF HAVE_FEATURES_H -GNULIB_OVERRIDES_WINT_T +GNULIBHEADERS_OVERRIDE_WINT_T APPLE_UNIVERSAL_BUILD HAVE_SAME_LONG_DOUBLE_AS_DOUBLE +GL_GNULIB_MDA_TEMPNAM +GL_GNULIB_MDA_PUTW +GL_GNULIB_MDA_GETW +GL_GNULIB_MDA_FILENO +GL_GNULIB_MDA_FDOPEN +GL_GNULIB_MDA_FCLOSEALL +GL_GNULIB_VSPRINTF_POSIX +GL_GNULIB_VSNPRINTF +GL_GNULIB_VPRINTF_POSIX +GL_GNULIB_VPRINTF +GL_GNULIB_VFPRINTF_POSIX +GL_GNULIB_VFPRINTF +GL_GNULIB_VDPRINTF +GL_GNULIB_VSCANF +GL_GNULIB_VFSCANF +GL_GNULIB_VASPRINTF +GL_GNULIB_TMPFILE +GL_GNULIB_STDIO_H_SIGPIPE +GL_GNULIB_STDIO_H_NONBLOCKING +GL_GNULIB_SPRINTF_POSIX +GL_GNULIB_SNPRINTF +GL_GNULIB_SCANF +GL_GNULIB_RENAMEAT +GL_GNULIB_RENAME +GL_GNULIB_REMOVE +GL_GNULIB_PUTS +GL_GNULIB_PUTCHAR +GL_GNULIB_PUTC +GL_GNULIB_PRINTF_POSIX +GL_GNULIB_PRINTF +GL_GNULIB_POPEN +GL_GNULIB_PERROR +GL_GNULIB_PCLOSE +GL_GNULIB_OBSTACK_PRINTF_POSIX +GL_GNULIB_OBSTACK_PRINTF +GL_GNULIB_GETLINE +GL_GNULIB_GETDELIM +GL_GNULIB_GETCHAR +GL_GNULIB_GETC +GL_GNULIB_FWRITE +GL_GNULIB_FTELLO +GL_GNULIB_FTELL +GL_GNULIB_FSEEKO +GL_GNULIB_FSEEK +GL_GNULIB_FSCANF +GL_GNULIB_FREOPEN +GL_GNULIB_FREAD +GL_GNULIB_FPUTS +GL_GNULIB_FPUTC +GL_GNULIB_FPURGE +GL_GNULIB_FPRINTF_POSIX +GL_GNULIB_FPRINTF +GL_GNULIB_FOPEN +GL_GNULIB_FGETS +GL_GNULIB_FGETC +GL_GNULIB_FFLUSH +GL_GNULIB_FDOPEN +GL_GNULIB_FCLOSE +GL_GNULIB_DPRINTF REPLACE_VSPRINTF REPLACE_VSNPRINTF REPLACE_VPRINTF @@ -1543,78 +1672,112 @@ HAVE_DECL_FTELLO HAVE_DECL_FSEEKO HAVE_DECL_FPURGE -GNULIB_VSPRINTF_POSIX -GNULIB_VSNPRINTF -GNULIB_VPRINTF_POSIX -GNULIB_VPRINTF -GNULIB_VFPRINTF_POSIX -GNULIB_VFPRINTF -GNULIB_VDPRINTF -GNULIB_VSCANF -GNULIB_VFSCANF -GNULIB_VASPRINTF -GNULIB_TMPFILE -GNULIB_STDIO_H_SIGPIPE -GNULIB_STDIO_H_NONBLOCKING -GNULIB_SPRINTF_POSIX -GNULIB_SNPRINTF -GNULIB_SCANF -GNULIB_RENAMEAT -GNULIB_RENAME -GNULIB_REMOVE -GNULIB_PUTS -GNULIB_PUTCHAR -GNULIB_PUTC -GNULIB_PRINTF_POSIX -GNULIB_PRINTF -GNULIB_POPEN -GNULIB_PERROR -GNULIB_PCLOSE -GNULIB_OBSTACK_PRINTF_POSIX -GNULIB_OBSTACK_PRINTF -GNULIB_GETLINE -GNULIB_GETDELIM -GNULIB_GETCHAR -GNULIB_GETC -GNULIB_FWRITE -GNULIB_FTELLO -GNULIB_FTELL -GNULIB_FSEEKO -GNULIB_FSEEK -GNULIB_FSCANF -GNULIB_FREOPEN -GNULIB_FREAD -GNULIB_FPUTS -GNULIB_FPUTC -GNULIB_FPURGE -GNULIB_FPRINTF_POSIX -GNULIB_FPRINTF -GNULIB_FOPEN -GNULIB_FGETS -GNULIB_FGETC -GNULIB_FFLUSH -GNULIB_FDOPEN -GNULIB_FCLOSE -GNULIB_DPRINTF +HAVE_DECL_FCLOSEALL REPLACE_ITOLD GL_GENERATE_FLOAT_H_FALSE GL_GENERATE_FLOAT_H_TRUE FLOAT_H NEXT_AS_FIRST_DIRECTIVE_FLOAT_H NEXT_FLOAT_H +GL_GNULIB_MDA_STRDUP +GL_GNULIB_MDA_MEMCCPY +GL_GNULIB_STRVERSCMP +GL_GNULIB_STRSIGNAL +GL_GNULIB_SIGDESCR_NP +GL_GNULIB_SIGABBREV_NP +GL_GNULIB_STRERRORNAME_NP +GL_GNULIB_STRERROR_R +GL_GNULIB_STRERROR +GL_GNULIB_MBSTOK_R +GL_GNULIB_MBSSEP +GL_GNULIB_MBSSPN +GL_GNULIB_MBSPBRK +GL_GNULIB_MBSCSPN +GL_GNULIB_MBSCASESTR +GL_GNULIB_MBSPCASECMP +GL_GNULIB_MBSNCASECMP +GL_GNULIB_MBSCASECMP +GL_GNULIB_MBSSTR +GL_GNULIB_MBSRCHR +GL_GNULIB_MBSCHR +GL_GNULIB_MBSNLEN +GL_GNULIB_MBSLEN +GL_GNULIB_STRTOK_R +GL_GNULIB_STRCASESTR +GL_GNULIB_STRSTR +GL_GNULIB_STRSEP +GL_GNULIB_STRPBRK +GL_GNULIB_STRNLEN +GL_GNULIB_STRNDUP +GL_GNULIB_STRNCAT +GL_GNULIB_STRDUP +GL_GNULIB_STRCHRNUL +GL_GNULIB_STPNCPY +GL_GNULIB_STPCPY +GL_GNULIB_RAWMEMCHR +GL_GNULIB_MEMRCHR +GL_GNULIB_MEMPCPY +GL_GNULIB_MEMMEM +GL_GNULIB_MEMCHR +GL_GNULIB_FFSLL +GL_GNULIB_FFSL +GL_GNULIB_EXPLICIT_BZERO +UNDEFINE_STRTOK_R +REPLACE_STRSIGNAL +REPLACE_STRERRORNAME_NP +REPLACE_STRERROR_R +REPLACE_STRERROR +REPLACE_STRTOK_R +REPLACE_STRCASESTR +REPLACE_STRSTR +REPLACE_STRNLEN +REPLACE_STRNDUP +REPLACE_STRNCAT +REPLACE_STRDUP +REPLACE_STRCHRNUL +REPLACE_STPNCPY +REPLACE_MEMMEM +REPLACE_MEMCHR +REPLACE_FFSLL +HAVE_STRVERSCMP +HAVE_DECL_STRSIGNAL +HAVE_SIGDESCR_NP +HAVE_SIGABBREV_NP +HAVE_STRERRORNAME_NP +HAVE_DECL_STRERROR_R +HAVE_DECL_STRTOK_R +HAVE_STRCASESTR +HAVE_STRSEP +HAVE_STRPBRK +HAVE_DECL_STRNLEN +HAVE_DECL_STRNDUP +HAVE_DECL_STRDUP +HAVE_STRCHRNUL +HAVE_STPNCPY +HAVE_STPCPY +HAVE_RAWMEMCHR +HAVE_DECL_MEMRCHR +HAVE_MEMPCPY +HAVE_DECL_MEMMEM +HAVE_FFSLL +HAVE_FFSL +HAVE_EXPLICIT_BZERO +HAVE_MBSLEN NEXT_AS_FIRST_DIRECTIVE_FCNTL_H NEXT_FCNTL_H +GL_GNULIB_MDA_OPEN +GL_GNULIB_MDA_CREAT +GL_GNULIB_OPENAT +GL_GNULIB_OPEN +GL_GNULIB_NONBLOCKING +GL_GNULIB_FCNTL +GL_GNULIB_CREAT REPLACE_OPENAT REPLACE_OPEN REPLACE_FCNTL REPLACE_CREAT HAVE_OPENAT HAVE_FCNTL -GNULIB_OPENAT -GNULIB_OPEN -GNULIB_NONBLOCKING -GNULIB_FCNTL -GNULIB_CREAT EOVERFLOW_VALUE EOVERFLOW_HIDDEN ENOLINK_VALUE @@ -1631,12 +1794,221 @@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE INCLUDE_NEXT pkglibexecdir -runstatedir lispdir HAVE_WINSOCK2_H +REPLACE_IOCTL +SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS +SYS_IOCTL_H_HAVE_WINSOCK2_H HAVE_MSVC_INVALID_PARAMETER_HANDLER +LIB_CLOCK_GETTIME +GL_GNULIB_MDA_PUTENV +GL_GNULIB_MDA_MKTEMP +GL_GNULIB_MDA_GCVT +GL_GNULIB_MDA_FCVT +GL_GNULIB_MDA_ECVT +GL_GNULIB_WCTOMB +GL_GNULIB_UNSETENV +GL_GNULIB_UNLOCKPT +GL_GNULIB_SYSTEM_POSIX +GL_GNULIB_STRTOULL +GL_GNULIB_STRTOUL +GL_GNULIB_STRTOLL +GL_GNULIB_STRTOLD +GL_GNULIB_STRTOL +GL_GNULIB_STRTOD +GL_GNULIB_SETENV +GL_GNULIB_SECURE_GETENV +GL_GNULIB_RPMATCH +GL_GNULIB_REALPATH +GL_GNULIB_REALLOC_POSIX +GL_GNULIB_REALLOCARRAY +GL_GNULIB_RANDOM_R +GL_GNULIB_RANDOM +GL_GNULIB_QSORT_R +GL_GNULIB_PUTENV +GL_GNULIB_PTSNAME_R +GL_GNULIB_PTSNAME +GL_GNULIB_POSIX_OPENPT +GL_GNULIB_POSIX_MEMALIGN +GL_GNULIB_MKSTEMPS +GL_GNULIB_MKSTEMP +GL_GNULIB_MKOSTEMPS +GL_GNULIB_MKOSTEMP +GL_GNULIB_MKDTEMP +GL_GNULIB_MBTOWC +GL_GNULIB_MALLOC_POSIX +GL_GNULIB_GRANTPT +GL_GNULIB_GETSUBOPT +GL_GNULIB_GETLOADAVG +GL_GNULIB_FREE_POSIX +GL_GNULIB_CANONICALIZE_FILE_NAME +GL_GNULIB_CALLOC_POSIX +GL_GNULIB_ATOLL +GL_GNULIB_ALIGNED_ALLOC +GL_GNULIB__EXIT +REPLACE_WCTOMB +REPLACE_UNSETENV +REPLACE_STRTOULL +REPLACE_STRTOUL +REPLACE_STRTOLL +REPLACE_STRTOLD +REPLACE_STRTOL +REPLACE_STRTOD +REPLACE_SETSTATE +REPLACE_SETENV +REPLACE_REALPATH +REPLACE_REALLOCARRAY +REPLACE_REALLOC +REPLACE_RANDOM_R +REPLACE_RANDOM +REPLACE_QSORT_R +REPLACE_PUTENV +REPLACE_PTSNAME_R +REPLACE_PTSNAME +REPLACE_POSIX_MEMALIGN +REPLACE_MKSTEMP +REPLACE_MBTOWC +REPLACE_MALLOC +REPLACE_INITSTATE +REPLACE_FREE +REPLACE_CANONICALIZE_FILE_NAME +REPLACE_CALLOC +REPLACE_ALIGNED_ALLOC +HAVE_DECL_UNSETENV +HAVE_UNLOCKPT +HAVE_SYS_LOADAVG_H +HAVE_STRUCT_RANDOM_DATA +HAVE_STRTOULL +HAVE_STRTOUL +HAVE_STRTOLL +HAVE_STRTOLD +HAVE_STRTOL +HAVE_STRTOD +HAVE_DECL_SETSTATE +HAVE_SETSTATE +HAVE_DECL_SETENV +HAVE_SETENV +HAVE_SECURE_GETENV +HAVE_RPMATCH +HAVE_REALPATH +HAVE_REALLOCARRAY +HAVE_RANDOM_R +HAVE_RANDOM_H +HAVE_RANDOM +HAVE_QSORT_R +HAVE_PTSNAME_R +HAVE_PTSNAME +HAVE_POSIX_OPENPT +HAVE_POSIX_MEMALIGN +HAVE_MKSTEMPS +HAVE_MKSTEMP +HAVE_MKOSTEMPS +HAVE_MKOSTEMP +HAVE_MKDTEMP +HAVE_MBTOWC +HAVE_DECL_INITSTATE +HAVE_INITSTATE +HAVE_GRANTPT +HAVE_GETSUBOPT +HAVE_DECL_GETLOADAVG +HAVE_DECL_GCVT +HAVE_DECL_FCVT +HAVE_DECL_ECVT +HAVE_CANONICALIZE_FILE_NAME +HAVE_ATOLL +HAVE_ALIGNED_ALLOC +HAVE__EXIT +HAVE_ALLOCA_H +GL_GENERATE_ALLOCA_H_FALSE +GL_GENERATE_ALLOCA_H_TRUE +ALLOCA_H +ALLOCA +GL_GNULIB_MDA_WRITE +GL_GNULIB_MDA_UNLINK +GL_GNULIB_MDA_SWAB +GL_GNULIB_MDA_RMDIR +GL_GNULIB_MDA_READ +GL_GNULIB_MDA_LSEEK +GL_GNULIB_MDA_ISATTY +GL_GNULIB_MDA_GETPID +GL_GNULIB_MDA_GETCWD +GL_GNULIB_MDA_EXECVPE +GL_GNULIB_MDA_EXECVP +GL_GNULIB_MDA_EXECVE +GL_GNULIB_MDA_EXECV +GL_GNULIB_MDA_EXECLP +GL_GNULIB_MDA_EXECLE +GL_GNULIB_MDA_EXECL +GL_GNULIB_MDA_DUP2 +GL_GNULIB_MDA_DUP +GL_GNULIB_MDA_CLOSE +GL_GNULIB_MDA_CHDIR +GL_GNULIB_MDA_ACCESS +GL_GNULIB_WRITE +GL_GNULIB_USLEEP +GL_GNULIB_UNLINKAT +GL_GNULIB_UNLINK +GL_GNULIB_UNISTD_H_SIGPIPE +GL_GNULIB_UNISTD_H_NONBLOCKING +GL_GNULIB_UNISTD_H_GETOPT +GL_GNULIB_TTYNAME_R +GL_GNULIB_TRUNCATE +GL_GNULIB_SYMLINKAT +GL_GNULIB_SYMLINK +GL_GNULIB_SLEEP +GL_GNULIB_SETHOSTNAME +GL_GNULIB_RMDIR +GL_GNULIB_READLINKAT +GL_GNULIB_READLINK +GL_GNULIB_READ +GL_GNULIB_PWRITE +GL_GNULIB_PREAD +GL_GNULIB_PIPE2 +GL_GNULIB_PIPE +GL_GNULIB_LSEEK +GL_GNULIB_LINKAT +GL_GNULIB_LINK +GL_GNULIB_LCHOWN +GL_GNULIB_ISATTY +GL_GNULIB_GROUP_MEMBER +GL_GNULIB_GETUSERSHELL +GL_GNULIB_GETPASS +GL_GNULIB_GETPAGESIZE +GL_GNULIB_GETOPT_POSIX +GL_GNULIB_GETLOGIN_R +GL_GNULIB_GETLOGIN +GL_GNULIB_GETHOSTNAME +GL_GNULIB_GETGROUPS +GL_GNULIB_GETENTROPY +GL_GNULIB_GETDTABLESIZE +GL_GNULIB_GETDOMAINNAME +GL_GNULIB_GETCWD +GL_GNULIB_FTRUNCATE +GL_GNULIB_FSYNC +GL_GNULIB_FDATASYNC +GL_GNULIB_FCHOWNAT +GL_GNULIB_FCHDIR +GL_GNULIB_FACCESSAT +GL_GNULIB_EXECVPE +GL_GNULIB_EXECVP +GL_GNULIB_EXECVE +GL_GNULIB_EXECV +GL_GNULIB_EXECLP +GL_GNULIB_EXECLE +GL_GNULIB_EXECL +GL_GNULIB_EUIDACCESS +GL_GNULIB_ENVIRON +GL_GNULIB_DUP3 +GL_GNULIB_DUP2 +GL_GNULIB_DUP +GL_GNULIB_COPY_FILE_RANGE +GL_GNULIB_CLOSE +GL_GNULIB_CHOWN +GL_GNULIB_CHDIR +GL_GNULIB_ACCESS UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS UNISTD_H_HAVE_WINSOCK2_H +UNISTD_H_HAVE_SYS_RANDOM_H REPLACE_WRITE REPLACE_USLEEP REPLACE_UNLINKAT @@ -1667,6 +2039,13 @@ REPLACE_FTRUNCATE REPLACE_FCHOWNAT REPLACE_FACCESSAT +REPLACE_EXECVPE +REPLACE_EXECVP +REPLACE_EXECVE +REPLACE_EXECV +REPLACE_EXECLP +REPLACE_EXECLE +REPLACE_EXECL REPLACE_DUP2 REPLACE_DUP REPLACE_CLOSE @@ -1684,6 +2063,7 @@ HAVE_DECL_GETDOMAINNAME HAVE_DECL_FDATASYNC HAVE_DECL_FCHDIR +HAVE_DECL_EXECVPE HAVE_DECL_ENVIRON HAVE_USLEEP HAVE_UNLINKAT @@ -1706,6 +2086,7 @@ HAVE_GETLOGIN HAVE_GETHOSTNAME HAVE_GETGROUPS +HAVE_GETENTROPY HAVE_GETDTABLESIZE HAVE_FTRUNCATE HAVE_FSYNC @@ -1713,162 +2094,11 @@ HAVE_FCHOWNAT HAVE_FCHDIR HAVE_FACCESSAT +HAVE_EXECVPE HAVE_EUIDACCESS HAVE_DUP3 -HAVE_DUP2 HAVE_COPY_FILE_RANGE HAVE_CHOWN -GNULIB_WRITE -GNULIB_USLEEP -GNULIB_UNLINKAT -GNULIB_UNLINK -GNULIB_UNISTD_H_SIGPIPE -GNULIB_UNISTD_H_NONBLOCKING -GNULIB_TTYNAME_R -GNULIB_TRUNCATE -GNULIB_SYMLINKAT -GNULIB_SYMLINK -GNULIB_SLEEP -GNULIB_SETHOSTNAME -GNULIB_RMDIR -GNULIB_READLINKAT -GNULIB_READLINK -GNULIB_READ -GNULIB_PWRITE -GNULIB_PREAD -GNULIB_PIPE2 -GNULIB_PIPE -GNULIB_LSEEK -GNULIB_LINKAT -GNULIB_LINK -GNULIB_LCHOWN -GNULIB_ISATTY -GNULIB_GROUP_MEMBER -GNULIB_GETUSERSHELL -GNULIB_GETPASS -GNULIB_GETPAGESIZE -GNULIB_GETOPT_POSIX -GNULIB_GETLOGIN_R -GNULIB_GETLOGIN -GNULIB_GETHOSTNAME -GNULIB_GETGROUPS -GNULIB_GETDTABLESIZE -GNULIB_GETDOMAINNAME -GNULIB_GETCWD -GNULIB_FTRUNCATE -GNULIB_FSYNC -GNULIB_FDATASYNC -GNULIB_FCHOWNAT -GNULIB_FCHDIR -GNULIB_FACCESSAT -GNULIB_EUIDACCESS -GNULIB_ENVIRON -GNULIB_DUP3 -GNULIB_DUP2 -GNULIB_DUP -GNULIB_COPY_FILE_RANGE -GNULIB_CLOSE -GNULIB_CHOWN -GNULIB_CHDIR -GNULIB_ACCESS -LIB_CLOCK_GETTIME -REPLACE_WCTOMB -REPLACE_UNSETENV -REPLACE_STRTOLD -REPLACE_STRTOD -REPLACE_SETSTATE -REPLACE_SETENV -REPLACE_REALPATH -REPLACE_REALLOC -REPLACE_RANDOM_R -REPLACE_RANDOM -REPLACE_QSORT_R -REPLACE_PUTENV -REPLACE_PTSNAME_R -REPLACE_PTSNAME -REPLACE_MKSTEMP -REPLACE_MBTOWC -REPLACE_MALLOC -REPLACE_INITSTATE -REPLACE_CANONICALIZE_FILE_NAME -REPLACE_CALLOC -HAVE_DECL_UNSETENV -HAVE_UNLOCKPT -HAVE_SYS_LOADAVG_H -HAVE_STRUCT_RANDOM_DATA -HAVE_STRTOULL -HAVE_STRTOLL -HAVE_STRTOLD -HAVE_STRTOD -HAVE_DECL_SETSTATE -HAVE_SETSTATE -HAVE_DECL_SETENV -HAVE_SETENV -HAVE_SECURE_GETENV -HAVE_RPMATCH -HAVE_REALPATH -HAVE_REALLOCARRAY -HAVE_RANDOM_R -HAVE_RANDOM_H -HAVE_RANDOM -HAVE_QSORT_R -HAVE_PTSNAME_R -HAVE_PTSNAME -HAVE_POSIX_OPENPT -HAVE_MKSTEMPS -HAVE_MKSTEMP -HAVE_MKOSTEMPS -HAVE_MKOSTEMP -HAVE_MKDTEMP -HAVE_MBTOWC -HAVE_DECL_INITSTATE -HAVE_INITSTATE -HAVE_GRANTPT -HAVE_GETSUBOPT -HAVE_DECL_GETLOADAVG -HAVE_CANONICALIZE_FILE_NAME -HAVE_ATOLL -HAVE__EXIT -GNULIB_WCTOMB -GNULIB_UNSETENV -GNULIB_UNLOCKPT -GNULIB_SYSTEM_POSIX -GNULIB_STRTOULL -GNULIB_STRTOLL -GNULIB_STRTOLD -GNULIB_STRTOD -GNULIB_SETENV -GNULIB_SECURE_GETENV -GNULIB_RPMATCH -GNULIB_REALPATH -GNULIB_REALLOC_POSIX -GNULIB_REALLOCARRAY -GNULIB_RANDOM_R -GNULIB_RANDOM -GNULIB_QSORT_R -GNULIB_PUTENV -GNULIB_PTSNAME_R -GNULIB_PTSNAME -GNULIB_POSIX_OPENPT -GNULIB_MKSTEMPS -GNULIB_MKSTEMP -GNULIB_MKOSTEMPS -GNULIB_MKOSTEMP -GNULIB_MKDTEMP -GNULIB_MBTOWC -GNULIB_MALLOC_POSIX -GNULIB_GRANTPT -GNULIB_GETSUBOPT -GNULIB_GETLOADAVG -GNULIB_CANONICALIZE_FILE_NAME -GNULIB_CALLOC_POSIX -GNULIB_ATOLL -GNULIB__EXIT -HAVE_ALLOCA_H -GL_GENERATE_ALLOCA_H_FALSE -GL_GENERATE_ALLOCA_H_TRUE -ALLOCA_H -ALLOCA GL_COND_LIBTOOL_FALSE GL_COND_LIBTOOL_TRUE XSLTPROC @@ -1936,13 +2166,27 @@ ENABLE_CXX14_TRUE ENABLE_CXX11_FALSE ENABLE_CXX11_TRUE -CXX2A_CXXFLAGS +CXX2B_CXXFLAGS +CXX20_CXXFLAGS CXX17_CXXFLAGS CXX14_CXXFLAGS CXX11_CXXFLAGS CXX03_CXXFLAGS CXX98_CXXFLAGS NO_EXCEPTIONS_CXXFLAGS +GL_GENERATE_TEXTSTYLE_H_FALSE +GL_GENERATE_TEXTSTYLE_H_TRUE +TEXTSTYLE_H +LIBTEXTSTYLE_PREFIX +LTLIBTEXTSTYLE +LIBTEXTSTYLE +HAVE_LIBTEXTSTYLE +RANLIB +ARFLAGS +AR +EGREP +GREP +CPP host_os host_vendor host_cpu @@ -1951,12 +2195,6 @@ build_vendor build_cpu build -RANLIB -ARFLAGS -AR -EGREP -GREP -CPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE @@ -1983,6 +2221,9 @@ AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V +CSCOPE +ETAGS +CTAGS am__untar am__tar AMTAR @@ -2026,6 +2267,7 @@ docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -2052,17 +2294,19 @@ enable_silent_rules enable_dependency_tracking enable_largefile +enable_year2038 enable_threads +with_gnu_ld +enable_rpath +with_libtextstyle_prefix enable_gcc_warnings enable_yacc enable_cross_guesses enable_assert -with_gnu_ld -enable_rpath -with_libtextstyle_prefix +with_libiconv_prefix +with_libreadline_prefix enable_relocatable enable_nls -with_libiconv_prefix with_libintl_prefix ' ac_precious_vars='build_alias @@ -2118,6 +2362,7 @@ sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -2147,8 +2392,6 @@ *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -2189,9 +2432,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -2215,9 +2458,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -2370,6 +2613,15 @@ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -2419,9 +2671,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -2435,9 +2687,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -2481,9 +2733,9 @@ *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -2499,7 +2751,7 @@ case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -2507,7 +2759,7 @@ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -2563,7 +2815,7 @@ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -2620,7 +2872,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures GNU Bison 3.5.1 to adapt to many kinds of systems. +\`configure' configures GNU Bison 3.8.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -2660,6 +2912,7 @@ --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -2690,7 +2943,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of GNU Bison 3.5.1:";; + short | recursive ) echo "Configuration of GNU Bison 3.8.2:";; esac cat <<\_ACEOF @@ -2705,9 +2958,11 @@ --disable-dependency-tracking speeds up one-time build --disable-largefile omit support for large files + --disable-year2038 omit support for timestamps past the year 2038 --enable-threads={isoc|posix|isoc+posix|windows} specify multithreading API --disable-threads build without multithread safety + --disable-rpath do not hardcode runtime library paths --enable-gcc-warnings turn on lots of GCC warnings (not recommended). Also, issue synclines from the examples/ to the corresponding source in the Texinfo doc. @@ -2715,7 +2970,6 @@ --enable-cross-guesses={conservative|risky} specify policy for cross-compilation guesses --disable-assert turn off assertions - --disable-rpath do not hardcode runtime library paths --enable-relocatable install a package that can be moved in the file system --disable-nls do not use Native Language Support @@ -2728,6 +2982,8 @@ --without-libtextstyle-prefix don't search for libtextstyle in includedir and libdir --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir + --with-libreadline-prefix[=DIR] search for libreadline in DIR/include and DIR/lib + --without-libreadline-prefix don't search for libreadline in includedir and libdir --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib --without-libintl-prefix don't search for libintl in includedir and libdir @@ -2756,7 +3012,7 @@ Report bugs to . GNU Bison home page: . -General help using GNU software: . +General help using GNU software: . _ACEOF ac_status=$? fi @@ -2772,9 +3028,9 @@ case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -2802,7 +3058,8 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -2810,7 +3067,7 @@ echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -2819,10 +3076,10 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -GNU Bison configure 3.5.1 -generated by GNU Autoconf 2.69 +GNU Bison configure 3.8.2 +generated by GNU Autoconf 2.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -2839,14 +3096,14 @@ ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2854,14 +3111,15 @@ cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -2877,14 +3135,14 @@ ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2892,14 +3150,15 @@ cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -2909,6 +3168,39 @@ } # ac_fn_cxx_try_compile +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. @@ -2921,7 +3213,7 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2929,14 +3221,15 @@ cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -2946,169 +3239,114 @@ } # ac_fn_c_try_cpp -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## -------------------------------- ## -## Report this to bug-bison@gnu.org ## -## -------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=$ac_status + ac_retval=1 fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_c_try_run +} # ac_fn_c_try_link -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. */ + +#include +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$3=yes" +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_header_compile +} # ac_fn_c_check_func # ac_fn_cxx_try_link LINENO # ------------------------- @@ -3116,14 +3354,14 @@ ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -3131,17 +3369,18 @@ cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -3156,52 +3395,6 @@ } # ac_fn_cxx_try_link -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache @@ -3209,17 +3402,18 @@ ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { if (sizeof ($2)) return 0; @@ -3227,12 +3421,13 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { if (sizeof (($2))) return 0; @@ -3240,88 +3435,65 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop eval "$3=yes" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + ac_retval=$ac_status fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -} # ac_fn_c_check_func +} # ac_fn_c_try_run # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- @@ -3337,7 +3509,7 @@ /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; @@ -3347,14 +3519,15 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; @@ -3364,9 +3537,10 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=$ac_mid; break -else +else $as_nop as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= @@ -3374,14 +3548,14 @@ fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; @@ -3391,14 +3565,15 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; @@ -3408,9 +3583,10 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_lo=$ac_mid; break -else +else $as_nop as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= @@ -3418,14 +3594,14 @@ fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done -else +else $as_nop ac_lo= ac_hi= fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val @@ -3433,7 +3609,7 @@ /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; @@ -3443,12 +3619,13 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=$ac_mid -else +else $as_nop as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; @@ -3458,12 +3635,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } +static long int longval (void) { return $2; } +static unsigned long int ulongval (void) { return $2; } #include #include int -main () +main (void) { FILE *f = fopen ("conftest.val", "w"); @@ -3491,9 +3668,10 @@ return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : echo >>conftest.val; read $3 &5 +printf %s "checking whether $as_decl_name is declared... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + eval ac_save_FLAGS=\$$6 + as_fn_append $6 " $5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { #ifndef $as_decl_name #ifdef __cplusplus @@ -3540,20 +3723,23 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval $6=\$ac_save_FLAGS + fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno ac_compile="$ac_save_ac_compile" -} # ac_fn_c_check_decl +} # ac_fn_check_decl # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- @@ -3562,16 +3748,17 @@ ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +printf %s "checking for $2.$3... " >&6; } +if eval test \${$4+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int -main () +main (void) { static $2 ac_aggr; if (ac_aggr.$3) @@ -3580,14 +3767,15 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$4=yes" -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int -main () +main (void) { static $2 ac_aggr; if (sizeof ac_aggr.$3) @@ -3596,29 +3784,50 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$4=yes" -else +else $as_nop eval "$4=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by GNU Bison $as_me 3.5.1, which was -generated by GNU Autoconf 2.69. Invocation command line was +It was created by GNU Bison $as_me 3.8.2, which was +generated by GNU Autoconf 2.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -3651,8 +3860,12 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -3687,7 +3900,7 @@ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -3722,11 +3935,13 @@ # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -3737,8 +3952,8 @@ case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -3762,7 +3977,7 @@ ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -3770,14 +3985,14 @@ do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -3785,15 +4000,15 @@ do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -3801,8 +4016,8 @@ echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -3816,63 +4031,48 @@ # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -3882,338 +4082,956 @@ # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -as_fn_append ac_header_list " locale.h" -as_fn_append ac_func_list " canonicalize_file_name" -as_fn_append ac_func_list " getcwd" -as_fn_append ac_func_list " readlink" -as_fn_append ac_func_list " realpath" -as_fn_append ac_header_list " sys/param.h" -as_fn_append ac_func_list " readlinkat" -as_fn_append ac_func_list " _set_invalid_parameter_handler" -as_fn_append ac_header_list " sys/socket.h" -as_fn_append ac_header_list " unistd.h" -as_fn_append ac_func_list " fcntl" -as_fn_append ac_func_list " symlink" -as_fn_append ac_header_list " stdio_ext.h" -as_fn_append ac_func_list " vasnprintf" -as_fn_append ac_header_list " features.h" -as_fn_append ac_func_list " snprintf" -as_fn_append ac_func_list " fsync" -as_fn_append ac_func_list " microuptime" -as_fn_append ac_func_list " nanouptime" -gl_getopt_required=GNU -as_fn_append ac_header_list " getopt.h" -as_fn_append ac_header_list " sys/cdefs.h" -as_fn_append ac_func_list " getprogname" -as_fn_append ac_func_list " getexecname" -as_fn_append ac_func_list " getrusage" -as_fn_append ac_func_list " gettimeofday" -as_fn_append ac_header_list " sys/time.h" -as_fn_append ac_header_list " limits.h" -as_fn_append ac_header_list " wchar.h" -as_fn_append ac_header_list " stdint.h" -as_fn_append ac_header_list " inttypes.h" -as_fn_append ac_func_list " iswcntrl" -as_fn_append ac_header_list " crtdefs.h" -as_fn_append ac_header_list " wctype.h" -as_fn_append ac_func_list " iswblank" -as_fn_append ac_func_list " tcdrain" -as_fn_append ac_header_list " threads.h" -as_fn_append ac_header_list " math.h" -as_fn_append ac_func_list " mbsinit" -as_fn_append ac_func_list " mbrtowc" -as_fn_append ac_func_list " isascii" -as_fn_append ac_header_list " sys/mman.h" -as_fn_append ac_func_list " mprotect" -as_fn_append ac_func_list " obstack_printf" -as_fn_append ac_func_list " lstat" -as_fn_append ac_func_list " strerror_r" -as_fn_append ac_func_list " __xpg_strerror_r" -as_fn_append ac_func_list " pipe2" -gl_printf_safe=yes -as_fn_append ac_func_list " setenv" -as_fn_append ac_func_list " link" -as_fn_append ac_func_list " sigaction" -as_fn_append ac_func_list " sigaltstack" -as_fn_append ac_func_list " siginterrupt" -as_fn_append ac_header_list " spawn.h" -as_fn_append ac_func_list " strdup" -as_fn_append ac_func_list " strndup" -as_fn_append ac_header_list " sys/resource.h" -as_fn_append ac_header_list " sys/times.h" -as_fn_append ac_header_list " sys/wait.h" -as_fn_append ac_func_list " pipe" -as_fn_append ac_func_list " wcwidth" -as_fn_append ac_func_list " __fseterr" -as_fn_append ac_header_list " sys/stat.h" -as_fn_append ac_func_list " getdtablesize" -as_fn_append ac_header_list " xlocale.h" -as_fn_append ac_func_list " catgets" -as_fn_append ac_func_list " setlocale" -gt_needs="$gt_needs need-ngettext" -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; -PACKAGE_COPYRIGHT_YEAR=2020 +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' -cat >>confdefs.h <<_ACEOF -#define PACKAGE_COPYRIGHT_YEAR $PACKAGE_COPYRIGHT_YEAR -_ACEOF +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif -ac_aux_dir= -for ac_dir in build-aux "$srcdir"/build-aux; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5 -fi +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; +struct incomplete_array +{ + int datasize; + double data[]; +}; +struct named_init { + int number; + const wchar_t *name; + double average; +}; -# We use Automake 1.14's %D% and %C%. -# -# When we move to Automake 1.16, simplify examples/c/reccalc/local.mk. -# Our CI runs on Xenial, which has only Automake 1.15. -# -# We want gnits strictness only when rolling a stable release. For -# release candidates, we use version strings like 2.4.3_rc1, but gnits -# doesn't like that, so we let the underscore disable gnits. Between -# releases, we want to be able run make dist without being required to -# add a bogus NEWS entry. In that case, the version string -# automatically contains a dash, which we also let disable gnits. -am__api_version='1.16' +typedef const char *ccp; -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} - done -IFS=$as_save_IFS +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); -rm -rf conftest.one conftest.two conftest.dir + const char *str = ""; + int number = 0; + float fnumber = 0; -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + return *str && number && fnumber; +} +' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); ' -case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; -esac -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +# Test code for whether the C++ compiler supports C++98 (global declarations) +ac_cxx_conftest_cxx98_globals=' +// Does the compiler advertise C++98 conformance? +#if !defined __cplusplus || __cplusplus < 199711L +# error "Compiler does not advertise C++98 conformance" +#endif + +// These inclusions are to reject old compilers that +// lack the unsuffixed header files. +#include +#include + +// and are *not* freestanding headers in C++98. +extern void assert (int); +namespace std { + extern int strcmp (const char *, const char *); +} + +// Namespaces, exceptions, and templates were all added after "C++ 2.0". +using std::exception; +using std::strcmp; + +namespace { + +void test_exception_syntax() +{ + try { + throw "test"; + } catch (const char *s) { + // Extra parentheses suppress a warning when building autoconf itself, + // due to lint rules shared with more typical C programs. + assert (!(strcmp) (s, "test")); + } +} + +template struct test_template +{ + T const val; + explicit test_template(T t) : val(t) {} + template T add(U u) { return static_cast(u) + val; } +}; + +} // anonymous namespace +' + +# Test code for whether the C++ compiler supports C++98 (body of main) +ac_cxx_conftest_cxx98_main=' + assert (argc); + assert (! argv[0]); +{ + test_exception_syntax (); + test_template tt (2.0); + assert (tt.add (4) == 6.0); + assert (true && !false); +} +' + +# Test code for whether the C++ compiler supports C++11 (global declarations) +ac_cxx_conftest_cxx11_globals=' +// Does the compiler advertise C++ 2011 conformance? +#if !defined __cplusplus || __cplusplus < 201103L +# error "Compiler does not advertise C++11 conformance" +#endif + +namespace cxx11test +{ + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + class delegate + { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate + { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy + { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; + + // for testing lambda expressions + template Ret eval(Fn f, Ret v) + { + return f(v); + } + + // for testing variadic templates and trailing return types + template auto sum(V first) -> V + { + return first; + } + template auto sum(V first, Args... rest) -> V + { + return first + sum(rest...); + } +} +' + +# Test code for whether the C++ compiler supports C++11 (body of main) +ac_cxx_conftest_cxx11_main=' +{ + // Test auto and decltype + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + int total = 0; + for (auto i = a3; *i; ++i) { total += *i; } + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for + int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, + 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (auto &x : array) { x += 23; } +} +{ + // Test lambda expressions + using cxx11test::eval; + assert (eval ([](int x) { return x*2; }, 21) == 42); + double d = 2.0; + assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); + assert (d == 5.0); + assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); + assert (d == 5.0); +} +{ + // Test use of variadic templates + using cxx11test::sum; + auto a = sum(1); + auto b = sum(1, 2); + auto c = sum(1.0, 2.0, 3.0); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + test_template<::test_template> v(test_template(12)); +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +' + +# Test code for whether the C compiler supports C++11 (complete). +ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} +${ac_cxx_conftest_cxx11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + ${ac_cxx_conftest_cxx11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C++98 (complete). +ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H" +as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H" +gl_libtextstyle_minversion="$gl_libtextstyle_minversion 0.20.5 " +as_fn_append ac_func_c_list " tcdrain HAVE_TCDRAIN" +as_fn_append ac_header_c_list " locale.h locale_h HAVE_LOCALE_H" +as_fn_append ac_func_c_list " canonicalize_file_name HAVE_CANONICALIZE_FILE_NAME" +as_fn_append ac_func_c_list " faccessat HAVE_FACCESSAT" +as_fn_append ac_func_c_list " realpath HAVE_REALPATH" +as_fn_append ac_func_c_list " lstat HAVE_LSTAT" +as_fn_append ac_header_c_list " sys/param.h sys_param_h HAVE_SYS_PARAM_H" +as_fn_append ac_func_c_list " readlinkat HAVE_READLINKAT" +as_fn_append ac_func_c_list " _set_invalid_parameter_handler HAVE__SET_INVALID_PARAMETER_HANDLER" +as_fn_append ac_header_c_list " sys/socket.h sys_socket_h HAVE_SYS_SOCKET_H" +as_fn_append ac_func_c_list " fchdir HAVE_FCHDIR" +as_fn_append ac_func_c_list " fcntl HAVE_FCNTL" +as_fn_append ac_func_c_list " symlink HAVE_SYMLINK" +as_fn_append ac_func_c_list " ffsl HAVE_FFSL" +as_fn_append ac_header_c_list " stdio_ext.h stdio_ext_h HAVE_STDIO_EXT_H" +as_fn_append ac_func_c_list " vasnprintf HAVE_VASNPRINTF" +as_fn_append ac_header_c_list " features.h features_h HAVE_FEATURES_H" +as_fn_append ac_func_c_list " snprintf HAVE_SNPRINTF" +as_fn_append ac_func_c_list " fsync HAVE_FSYNC" +as_fn_append ac_func_c_list " microuptime HAVE_MICROUPTIME" +as_fn_append ac_func_c_list " nanouptime HAVE_NANOUPTIME" +gl_getopt_required=GNU +as_fn_append ac_header_c_list " getopt.h getopt_h HAVE_GETOPT_H" +as_fn_append ac_header_c_list " sys/cdefs.h sys_cdefs_h HAVE_SYS_CDEFS_H" +as_fn_append ac_func_c_list " getprogname HAVE_GETPROGNAME" +as_fn_append ac_func_c_list " getexecname HAVE_GETEXECNAME" +as_fn_append ac_func_c_list " getrusage HAVE_GETRUSAGE" +as_fn_append ac_func_c_list " gettimeofday HAVE_GETTIMEOFDAY" +as_fn_append ac_header_c_list " sys/time.h sys_time_h HAVE_SYS_TIME_H" +as_fn_append ac_header_c_list " iconv.h iconv_h HAVE_ICONV_H" +as_fn_append ac_header_c_list " limits.h limits_h HAVE_LIMITS_H" +as_fn_append ac_func_c_list " iswcntrl HAVE_ISWCNTRL" +as_fn_append ac_header_c_list " crtdefs.h crtdefs_h HAVE_CRTDEFS_H" +as_fn_append ac_header_c_list " wctype.h wctype_h HAVE_WCTYPE_H" +as_fn_append ac_func_c_list " iswblank HAVE_ISWBLANK" +as_fn_append ac_header_c_list " threads.h threads_h HAVE_THREADS_H" +as_fn_append ac_header_c_list " math.h math_h HAVE_MATH_H" +as_fn_append ac_func_c_list " mbsinit HAVE_MBSINIT" +as_fn_append ac_func_c_list " mbrtowc HAVE_MBRTOWC" +as_fn_append ac_func_c_list " isascii HAVE_ISASCII" +as_fn_append ac_header_c_list " sys/mman.h sys_mman_h HAVE_SYS_MMAN_H" +as_fn_append ac_func_c_list " mprotect HAVE_MPROTECT" +as_fn_append ac_func_c_list " obstack_printf HAVE_OBSTACK_PRINTF" +as_fn_append ac_func_c_list " strerror_r HAVE_STRERROR_R" +as_fn_append ac_func_c_list " __xpg_strerror_r HAVE___XPG_STRERROR_R" +as_fn_append ac_func_c_list " pipe HAVE_PIPE" +as_fn_append ac_func_c_list " pipe2 HAVE_PIPE2" +as_fn_append ac_func_c_list " posix_spawn_file_actions_addchdir_np HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP" +as_fn_append ac_func_c_list " posix_spawn_file_actions_addchdir HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR" +gl_printf_safe=yes +as_fn_append ac_func_c_list " readlink HAVE_READLINK" +as_fn_append ac_func_c_list " setenv HAVE_SETENV" +as_fn_append ac_func_c_list " link HAVE_LINK" +as_fn_append ac_func_c_list " sigaction HAVE_SIGACTION" +as_fn_append ac_func_c_list " sigaltstack HAVE_SIGALTSTACK" +as_fn_append ac_func_c_list " siginterrupt HAVE_SIGINTERRUPT" +as_fn_append ac_header_c_list " spawn.h spawn_h HAVE_SPAWN_H" +as_fn_append ac_func_c_list " stpncpy HAVE_STPNCPY" +as_fn_append ac_func_c_list " strndup HAVE_STRNDUP" +as_fn_append ac_header_c_list " sys/ioctl.h sys_ioctl_h HAVE_SYS_IOCTL_H" +as_fn_append ac_header_c_list " sys/resource.h sys_resource_h HAVE_SYS_RESOURCE_H" +as_fn_append ac_header_c_list " sys/times.h sys_times_h HAVE_SYS_TIMES_H" +as_fn_append ac_header_c_list " sys/wait.h sys_wait_h HAVE_SYS_WAIT_H" +as_fn_append ac_header_c_list " termios.h termios_h HAVE_TERMIOS_H" +as_fn_append ac_func_c_list " wcwidth HAVE_WCWIDTH" +as_fn_append ac_header_c_list " dirent.h dirent_h HAVE_DIRENT_H" +as_fn_append ac_func_c_list " fdopendir HAVE_FDOPENDIR" +as_fn_append ac_func_c_list " mempcpy HAVE_MEMPCPY" +as_fn_append ac_func_c_list " __fseterr HAVE___FSETERR" +as_fn_append ac_func_c_list " fstatat HAVE_FSTATAT" +as_fn_append ac_func_c_list " getdelim HAVE_GETDELIM" +as_fn_append ac_func_c_list " getdtablesize HAVE_GETDTABLESIZE" +as_fn_append ac_header_c_list " xlocale.h xlocale_h HAVE_XLOCALE_H" +as_fn_append ac_func_c_list " openat HAVE_OPENAT" +as_fn_append ac_func_c_list " catgets HAVE_CATGETS" +as_fn_append ac_func_c_list " setlocale HAVE_SETLOCALE" +gt_needs="$gt_needs need-ngettext" + +# Auxiliary files required by this configure script. +ac_aux_files="config.rpath config.guess config.sub compile missing install-sh" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}/build-aux" + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +PACKAGE_COPYRIGHT_YEAR=2021 + + +printf "%s\n" "#define PACKAGE_COPYRIGHT_YEAR $PACKAGE_COPYRIGHT_YEAR" >>confdefs.h + + + + + +# When we move to Automake 1.16, simplify examples/c/reccalc/local.mk. +# Our CI build the packages on Bionic, which has only Automake 1.15. +# +# We want gnits strictness only when rolling a stable release. For +# release candidates, we use version strings like 2.4.3_rc1, but gnits +# doesn't like that, so we let the underscore disable gnits. Between +# releases, we want to be able run make dist without being required to +# add a bogus NEWS entry. In that case, the version string +# automatically contains a dash, which we also let disable gnits. +am__api_version='1.16' + + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test ${ac_cv_path_install+y}; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then @@ -4232,8 +5050,8 @@ as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= @@ -4252,26 +5070,23 @@ # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then @@ -4291,11 +5106,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -4303,11 +5119,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4318,11 +5138,11 @@ fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4331,11 +5151,12 @@ ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -4343,11 +5164,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4358,11 +5183,11 @@ fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -4370,8 +5195,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -4383,25 +5208,31 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done @@ -4412,7 +5243,7 @@ fi test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then + if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a @@ -4422,18 +5253,19 @@ MKDIR_P="$ac_install_sh -d" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else @@ -4441,11 +5273,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4456,24 +5292,25 @@ fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @@ -4489,12 +5326,12 @@ rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } SET_MAKE= else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -4508,7 +5345,8 @@ rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : +if test ${enable_silent_rules+y} +then : enableval=$enable_silent_rules; fi @@ -4518,12 +5356,13 @@ *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 @@ -4535,8 +5374,8 @@ am_cv_make_support_nested_variables=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' @@ -4568,17 +5407,13 @@ # Define the identity of the package. PACKAGE='bison' - VERSION='3.5.1' + VERSION='3.8.2' -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. @@ -4618,6 +5453,20 @@ +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile @@ -4662,7 +5511,8 @@ fi # Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : +if test ${enable_silent_rules+y} +then : enableval=$enable_silent_rules; fi @@ -4672,12 +5522,13 @@ *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 @@ -4689,8 +5540,8 @@ am_cv_make_support_nested_variables=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' @@ -4704,67 +5555,13 @@ # Checks for the compiler. -DEPDIR="${am__leading_dot}deps" -ac_config_commands="$ac_config_commands depfiles" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 -$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } -cat > confinc.mk << 'END' -am__doit: - @echo this is the am__doit target >confinc.out -.PHONY: am__doit -END -am__include="#" -am__quote= -# BSD make does it like this. -echo '.include "confinc.mk" # ignored' > confmf.BSD -# Other make implementations (GNU, Solaris 10, AIX) do it like this. -echo 'include confinc.mk # ignored' > confmf.GNU -_am_result=no -for s in GNU BSD; do - { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 - (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - case $?:`cat confinc.out 2>/dev/null` in #( - '0:this is the am__doit target') : - case $s in #( - BSD) : - am__include='.include' am__quote='"' ;; #( - *) : - am__include='include' am__quote='' ;; -esac ;; #( - *) : - ;; -esac - if test "$am__include" != "#"; then - _am_result="yes ($s style)" - break - fi -done -rm -f confinc.* confmf.* -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 -$as_echo "${_am_result}" >&6; } -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi + + + ac_ext=c @@ -4775,11 +5572,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -4787,11 +5585,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4802,11 +5604,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4815,11 +5617,12 @@ ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -4827,11 +5630,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4842,11 +5649,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -4854,8 +5661,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -4868,11 +5675,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -4880,11 +5688,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4895,11 +5707,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4908,11 +5720,12 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -4921,15 +5734,19 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4945,18 +5762,18 @@ # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4967,11 +5784,12 @@ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -4979,11 +5797,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4994,11 +5816,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5011,11 +5833,12 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -5023,11 +5846,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5038,11 +5865,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5054,8 +5881,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -5067,11 +5894,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -5079,11 +5907,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5094,11 +5926,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5107,11 +5939,12 @@ ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -5119,11 +5952,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5134,11 +5971,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -5146,8 +5983,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -5159,13 +5996,13 @@ fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do @@ -5175,7 +6012,7 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -5185,7 +6022,7 @@ cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -5193,7 +6030,7 @@ /* end confdefs.h. */ int -main () +main (void) { ; @@ -5205,9 +6042,9 @@ # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -5228,11 +6065,12 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -5249,7 +6087,7 @@ # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -5265,44 +6103,46 @@ done test "$ac_cv_exeext" = no && ac_cv_exeext= -else +else $as_nop ac_file='' fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -5316,15 +6156,15 @@ * ) break;; esac done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -5333,7 +6173,7 @@ /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -5345,8 +6185,8 @@ ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -5354,10 +6194,10 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -5365,39 +6205,40 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -5411,11 +6252,12 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -5424,31 +6266,32 @@ break;; esac done -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -5458,29 +6301,33 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -5489,57 +6336,60 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -5554,609 +6404,441 @@ CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 -$as_echo_n "checking for $CC option to enable C11 features... " >&6; } -if ${ac_cv_prog_cc_c11+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include -#include -#include -#include - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -#define debug(...) fprintf (stderr, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - your preprocessor is broken; -#endif -#if BIG_OK -#else - your preprocessor is broken; -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\0'; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static bool -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str = ""; - int number = 0; - float fnumber = 0; - - while (*format) - { - switch (*format++) - { - case 's': // string - str = va_arg (args_copy, const char *); - break; - case 'd': // int - number = va_arg (args_copy, int); - break; - case 'f': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); - - return *str && number && fnumber; -} -// Check _Alignas. -char _Alignas (double) aligned_as_double; -char _Alignas (0) no_special_alignment; -extern char aligned_as_int; -char _Alignas (0) _Alignas (int) aligned_as_int; - -// Check _Alignof. -enum -{ - int_alignment = _Alignof (int), - int_array_alignment = _Alignof (int[100]), - char_alignment = _Alignof (char) -}; -_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); - -// Check _Noreturn. -int _Noreturn does_not_return (void) { for (;;) continue; } - -// Check _Static_assert. -struct test_static_assert -{ - int x; - _Static_assert (sizeof (int) <= sizeof (long int), - "_Static_assert does not work in struct"); - long int y; -}; - -// Check UTF-8 literals. -#define u8 syntax error! -char const utf8_literal[] = u8"happens to be ASCII" "another string"; - -// Check duplicate typedefs. -typedef long *long_ptr; -typedef long int *long_ptr; -typedef long_ptr long_ptr; - -// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. -struct anonymous -{ - union { - struct { int i; int j; }; - struct { int k; long int l; } w; - }; - int m; -} v1; - -int -main () -{ - - // Check bool. - _Bool success = false; - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - success &= test_varargs ("s, d' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' - || dynamic_array[ni.number - 1] != 543); - - v1.i = 2; - v1.w.k = 5; - _Static_assert ((offsetof (struct anonymous, i) - == offsetof (struct anonymous, w.k)), - "Anonymous union alignment botch"); - - ; - return 0; -} +$ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c11=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC +fi +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" fi -# AC_CACHE_VAL -ac_prog_cc_stdc_options= -case "x$ac_cv_prog_cc_c11" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - ac_prog_cc_stdc_options=" $ac_cv_prog_cc_c11" - CC=$CC$ac_prog_cc_stdc_options - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 -$as_echo "$ac_cv_prog_cc_c11" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c11" != xno; then : + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 -$as_echo_n "checking for $CC option to enable C99 features... " >&6; } -if ${ac_cv_prog_cc_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include -#include -#include -#include - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -#define debug(...) fprintf (stderr, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - your preprocessor is broken; -#endif -#if BIG_OK -#else - your preprocessor is broken; -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\0'; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static bool -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str = ""; - int number = 0; - float fnumber = 0; - - while (*format) - { - switch (*format++) - { - case 's': // string - str = va_arg (args_copy, const char *); - break; - case 'd': // int - number = va_arg (args_copy, int); - break; - case 'f': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); - - return *str && number && fnumber; -} -int -main () -{ - - // Check bool. - _Bool success = false; - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - success &= test_varargs ("s, d' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' - || dynamic_array[ni.number - 1] != 543); - - ; - return 0; -} +$ac_c_conftest_c99_program _ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc1x -qlanglvl=extc99 +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c99=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC +fi +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" fi -# AC_CACHE_VAL -ac_prog_cc_stdc_options= -case "x$ac_cv_prog_cc_c99" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - ac_prog_cc_stdc_options=" $ac_cv_prog_cc_c99" - CC=$CC$ac_prog_cc_stdc_options - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c99" != xno; then : + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 -$as_echo_n "checking for $CC option to enable C89 features... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC +fi +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" fi -# AC_CACHE_VAL -ac_prog_cc_stdc_options= -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - ac_prog_cc_stdc_options=" $ac_cv_prog_cc_c89" - CC=$CC$ac_prog_cc_stdc_options - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 -else - ac_prog_cc_stdc=no - ac_cv_prog_cc_stdc=no fi - fi -fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -depcc="$CC" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler is clang" >&5 +printf %s "checking whether the compiler is clang... " >&6; } +if test ${gl_cv_compiler_clang+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + #ifdef __clang__ + barfbarf + #endif - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ +int +main (void) +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_compiler_clang=no +else $as_nop + gl_cv_compiler_clang=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_compiler_clang" >&5 +printf "%s\n" "$gl_cv_compiler_clang" >&6; } + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for compiler option needed when checking for declarations" >&5 +printf %s "checking for compiler option needed when checking for declarations... " >&6; } +if test ${gl_cv_compiler_check_decl_option+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test $gl_cv_compiler_clang = yes; then + save_ac_compile="$ac_compile" + ac_compile="$ac_compile -Werror=implicit-function-declaration" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration' +else $as_nop + gl_cv_compiler_check_decl_option=none +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_compile="$save_ac_compile" + else + gl_cv_compiler_check_decl_option=none + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_compiler_check_decl_option" >&5 +printf "%s\n" "$gl_cv_compiler_check_decl_option" >&6; } + if test "x$gl_cv_compiler_check_decl_option" != xnone; then + ac_compile_for_check_decl="$ac_compile $gl_cv_compiler_check_decl_option" + else + ac_compile_for_check_decl="$ac_compile" + fi + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } + +# Check whether --enable-dependency-tracking was given. +if test ${enable_dependency_tracking+y} +then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +depcc="$CC" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && @@ -6185,8 +6867,8 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if @@ -6201,6 +6883,11 @@ + + + + + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -6215,11 +6902,12 @@ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else @@ -6227,11 +6915,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6242,11 +6934,11 @@ fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -6259,11 +6951,12 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else @@ -6271,11 +6964,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6286,11 +6983,11 @@ fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -6302,8 +6999,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX @@ -6313,7 +7010,7 @@ fi fi # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do @@ -6323,7 +7020,7 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -6333,20 +7030,21 @@ cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -6356,29 +7054,33 @@ return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi -ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no @@ -6387,57 +7089,60 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_g=yes -else +else $as_nop CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : -else +else $as_nop ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then @@ -6452,419 +7157,98 @@ CXXFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 -$as_echo_n "checking for $CXX option to enable C++11 features... " >&6; } -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if ${ac_cv_prog_cxx_cxx11+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cxx_cxx11=no +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_11=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#include -#include -#include -#include -#include -#include -#include - -namespace cxx11test -{ - typedef std::shared_ptr sptr; - typedef std::weak_ptr wptr; - - typedef std::tuple tp; - typedef std::array int_array; - - constexpr int get_val() { return 20; } - - struct testinit - { - int i; - double d; - }; - - class delegate { - public: - delegate(int n) : n(n) {} - delegate(): delegate(2354) {} - - virtual int getval() { return this->n; }; - protected: - int n; - }; - - class overridden : public delegate { - public: - overridden(int n): delegate(n) {} - virtual int getval() override final { return this->n * 2; } - }; - - class nocopy { - public: - nocopy(int i): i(i) {} - nocopy() = default; - nocopy(const nocopy&) = delete; - nocopy & operator=(const nocopy&) = delete; - private: - int i; - }; -} - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace test { - typedef std::vector string_vec; - typedef std::pair map_value; - typedef std::map map_type; - typedef std::set set_type; - - template - class printer { - public: - printer(std::ostringstream& os): os(os) {} - void operator() (T elem) { os << elem << std::endl; } - private: - std::ostringstream& os; - }; -} - -int -main () -{ - -{ - // Test auto and decltype - std::deque d; - d.push_front(43); - d.push_front(484); - d.push_front(3); - d.push_front(844); - int total = 0; - for (auto i = d.begin(); i != d.end(); ++i) { total += *i; } - - auto a1 = 6538; - auto a2 = 48573953.4; - auto a3 = "String literal"; - - decltype(a2) a4 = 34895.034; -} -{ - // Test constexpr - short sa[cxx11test::get_val()] = { 0 }; -} -{ - // Test initializer lists - cxx11test::testinit il = { 4323, 435234.23544 }; -} -{ - // Test range-based for and lambda - cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; - for (int &x : array) { x += 23; } - std::for_each(array.begin(), array.end(), [](int v1){ std::cout << v1; }); -} -{ - using cxx11test::sptr; - using cxx11test::wptr; - - sptr sp(new std::string("ASCII string")); - wptr wp(sp); - sptr sp2(wp); -} -{ - cxx11test::tp tuple("test", 54, 45.53434); - double d = std::get<2>(tuple); - std::string s; - int i; - std::tie(s,i,d) = tuple; -} -{ - static std::regex filename_regex("^_?([a-z0-9_.]+-)+[a-z0-9]+$"); - std::string testmatch("Test if this string matches"); - bool match = std::regex_search(testmatch, filename_regex); -} -{ - cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; - cxx11test::int_array::size_type size = array.size(); -} -{ - // Test constructor delegation - cxx11test::delegate d1; - cxx11test::delegate d2(); - cxx11test::delegate d3(45); -} -{ - // Test override and final - cxx11test::overridden o1(55464); -} -{ - // Test nullptr - char *c = nullptr; -} -{ - // Test template brackets - std::vector> v1; -} -{ - // Unicode literals - char const *utf8 = u8"UTF-8 string \u2500"; - char16_t const *utf16 = u"UTF-8 string \u2500"; - char32_t const *utf32 = U"UTF-32 string \u2500"; -} - - - -try { - // Basic string. - std::string teststr("ASCII text"); - teststr += " string"; - - // Simple vector. - test::string_vec testvec; - testvec.push_back(teststr); - testvec.push_back("foo"); - testvec.push_back("bar"); - if (testvec.size() != 3) { - throw std::runtime_error("vector size is not 1"); - } - - // Dump vector into stringstream and obtain string. - std::ostringstream os; - for (test::string_vec::const_iterator i = testvec.begin(); - i != testvec.end(); ++i) { - if (i + 1 != testvec.end()) { - os << teststr << '\n'; - } - } - // Check algorithms work. - std::for_each(testvec.begin(), testvec.end(), test::printer(os)); - std::string os_out = os.str(); - - // Test pair and map. - test::map_type testmap; - testmap.insert(std::make_pair(std::string("key"), - std::make_pair(53,false))); - - // Test set. - int values[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; - test::set_type testset(values, values + sizeof(values)/sizeof(values[0])); - std::list testlist(testset.begin(), testset.end()); - std::copy(testset.begin(), testset.end(), std::back_inserter(testlist)); -} catch (const std::exception& e) { - std::cerr << "Caught exception: " << e.what() << std::endl; - - // Test fstream - std::ofstream of("test.txt"); - of << "Test ASCII text\n" << std::flush; - of << "N= " << std::hex << std::setw(8) << std::left << 534 << std::endl; - of.close(); -} -std::exit(0); - - ; - return 0; -} +$ac_cxx_conftest_cxx11_program _ACEOF -for ac_arg in '' -std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA do CXX="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO"; then : + if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_cxx11=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx11" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX +fi +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" fi -# AC_CACHE_VAL -ac_prog_cxx_stdcxx_options= -case "x$ac_cv_prog_cxx_cxx11" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - ac_prog_cxx_stdcxx_options=" $ac_cv_prog_cxx_cxx11" - CXX=$CXX$ac_prog_cxx_stdcxx_options - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 -$as_echo "$ac_cv_prog_cxx_cxx11" >&6; } ;; -esac -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test "x$ac_cv_prog_cxx_cxx11" != xno; then : + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 ac_prog_cxx_stdcxx=cxx11 - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 - ac_cv_prog_cxx_cxx98=$ac_cv_prog_cxx_cxx11 -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 -$as_echo_n "checking for $CXX option to enable C++98 features... " >&6; } -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if ${ac_cv_prog_cxx_cxx98+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cxx_cxx98=no +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_98+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_98=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace test { - typedef std::vector string_vec; - typedef std::pair map_value; - typedef std::map map_type; - typedef std::set set_type; - - template - class printer { - public: - printer(std::ostringstream& os): os(os) {} - void operator() (T elem) { os << elem << std::endl; } - private: - std::ostringstream& os; - }; -} - -int -main () -{ - - -try { - // Basic string. - std::string teststr("ASCII text"); - teststr += " string"; - - // Simple vector. - test::string_vec testvec; - testvec.push_back(teststr); - testvec.push_back("foo"); - testvec.push_back("bar"); - if (testvec.size() != 3) { - throw std::runtime_error("vector size is not 1"); - } - - // Dump vector into stringstream and obtain string. - std::ostringstream os; - for (test::string_vec::const_iterator i = testvec.begin(); - i != testvec.end(); ++i) { - if (i + 1 != testvec.end()) { - os << teststr << '\n'; - } - } - // Check algorithms work. - std::for_each(testvec.begin(), testvec.end(), test::printer(os)); - std::string os_out = os.str(); - - // Test pair and map. - test::map_type testmap; - testmap.insert(std::make_pair(std::string("key"), - std::make_pair(53,false))); - - // Test set. - int values[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; - test::set_type testset(values, values + sizeof(values)/sizeof(values[0])); - std::list testlist(testset.begin(), testset.end()); - std::copy(testset.begin(), testset.end(), std::back_inserter(testlist)); -} catch (const std::exception& e) { - std::cerr << "Caught exception: " << e.what() << std::endl; - - // Test fstream - std::ofstream of("test.txt"); - of << "Test ASCII text\n" << std::flush; - of << "N= " << std::hex << std::setw(8) << std::left << 534 << std::endl; - of.close(); -} -std::exit(0); - - ; - return 0; -} +$ac_cxx_conftest_cxx98_program _ACEOF for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA do CXX="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO"; then : + if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_cxx98=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx98" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX +fi +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" fi -# AC_CACHE_VAL -ac_prog_cxx_stdcxx_options= -case "x$ac_cv_prog_cxx_cxx98" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - ac_prog_cxx_stdcxx_options=" $ac_cv_prog_cxx_cxx98" - CXX=$CXX$ac_prog_cxx_stdcxx_options - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 -$as_echo "$ac_cv_prog_cxx_cxx98" >&6; } ;; -esac -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test "x$ac_cv_prog_cxx_cxx98" != xno; then : + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 ac_prog_cxx_stdcxx=cxx98 - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 -else - ac_prog_cxx_stdcxx=no - ac_cv_prog_cxx_stdcxx=no fi - fi ac_ext=c @@ -6875,11 +7259,12 @@ depcc="$CXX" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CXX_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CXX_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -6986,8 +7371,8 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if @@ -7004,133 +7389,385 @@ # Gnulib (early checks). -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes +ac_header= ac_cache= +for ac_item in $ac_header_c_list do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h -else - # Broken: fails on valid input. -continue fi -rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if test ${ac_cv_safe_to_define___extensions__+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - done - ac_cv_prog_CPP=$CPP +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main (void) +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_safe_to_define___extensions__=yes +else $as_nop + ac_cv_safe_to_define___extensions__=no fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 +printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } +if test ${ac_cv_should_define__xopen_source+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_should_define__xopen_source=no + if test $ac_cv_header_wchar_h = yes +then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext + #include + mbstate_t x; +int +main (void) +{ - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext -done + #define _XOPEN_SOURCE 500 + #include + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_should_define__xopen_source=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 +printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } + + printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h + + printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h + + printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h + + if test $ac_cv_header_minix_config_h = yes +then : + MINIX=yes + printf "%s\n" "#define _MINIX 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h + +else $as_nop + MINIX= +fi + if test $ac_cv_safe_to_define___extensions__ = yes +then : + printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h + +fi + if test $ac_cv_should_define__xopen_source = yes +then : + printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h + +fi + + + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + + + + + case "$host_os" in + openbsd*) + +printf "%s\n" "#define _ISOC11_SOURCE 1" >>confdefs.h + + ;; + esac + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test ${ac_cv_prog_CPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +if $ac_preproc_ok +then : + break +fi + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + ac_cv_prog_CPP=$CPP +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf "%s\n" "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi @@ -7142,11 +7779,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST @@ -7154,10 +7792,15 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP @@ -7166,13 +7809,13 @@ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -7200,16 +7843,17 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else @@ -7220,10 +7864,15 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP @@ -7232,13 +7881,13 @@ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -7267,288 +7916,20 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = xyes; then : - MINIX=yes -else - MINIX= -fi - - - if test "$MINIX" = yes; then - -$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h - - -$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h - - -$as_echo "#define _MINIX 1" >>confdefs.h - - -$as_echo "#define _NETBSD_SOURCE 1" >>confdefs.h - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 -$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if ${ac_cv_safe_to_define___extensions__+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# define __EXTENSIONS__ 1 - $ac_includes_default -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_safe_to_define___extensions__=yes -else - ac_cv_safe_to_define___extensions__=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 -$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } - test $ac_cv_safe_to_define___extensions__ = yes && - $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h - - $as_echo "#define _ALL_SOURCE 1" >>confdefs.h - - $as_echo "#define _DARWIN_C_SOURCE 1" >>confdefs.h - - $as_echo "#define _GNU_SOURCE 1" >>confdefs.h - - $as_echo "#define _NETBSD_SOURCE 1" >>confdefs.h - - $as_echo "#define _OPENBSD_SOURCE 1" >>confdefs.h - - $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h - - $as_echo "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h - $as_echo "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h - $as_echo "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h - $as_echo "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h - - $as_echo "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h - - $as_echo "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h - - $as_echo "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h - - $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 -$as_echo_n "checking whether _XOPEN_SOURCE should be defined... " >&6; } -if ${ac_cv_should_define__xopen_source+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_should_define__xopen_source=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - mbstate_t x; -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #define _XOPEN_SOURCE 500 - #include - mbstate_t x; -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_should_define__xopen_source=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 -$as_echo "$ac_cv_should_define__xopen_source" >&6; } - test $ac_cv_should_define__xopen_source = yes && - $as_echo "#define _XOPEN_SOURCE 500" >>confdefs.h - - $as_echo "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Minix Amsterdam compiler" >&5 -$as_echo_n "checking for Minix Amsterdam compiler... " >&6; } -if ${gl_cv_c_amsterdam_compiler+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Minix Amsterdam compiler" >&5 +printf %s "checking for Minix Amsterdam compiler... " >&6; } +if test ${gl_cv_c_amsterdam_compiler+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7559,17 +7940,18 @@ _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Amsterdam" >/dev/null 2>&1; then : + $EGREP "Amsterdam" >/dev/null 2>&1 +then : gl_cv_c_amsterdam_compiler=yes -else +else $as_nop gl_cv_c_amsterdam_compiler=no fi -rm -f conftest* +rm -rf conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c_amsterdam_compiler" >&5 -$as_echo "$gl_cv_c_amsterdam_compiler" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c_amsterdam_compiler" >&5 +printf "%s\n" "$gl_cv_c_amsterdam_compiler" >&6; } if test $gl_cv_c_amsterdam_compiler = yes; then if test -z "$AR"; then @@ -7585,11 +7967,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else @@ -7597,11 +7980,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7612,11 +7999,11 @@ fi AR=$ac_cv_prog_AR if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -7625,11 +8012,12 @@ ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else @@ -7637,11 +8025,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7652,11 +8044,11 @@ fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_AR" = x; then @@ -7664,8 +8056,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR @@ -7687,11 +8079,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else @@ -7699,11 +8092,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7714,11 +8111,11 @@ fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -7727,11 +8124,12 @@ ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else @@ -7739,11 +8137,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7754,11 +8156,11 @@ fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then @@ -7766,8 +8168,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB @@ -7781,77 +8183,6 @@ -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - @@ -7882,17 +8213,19 @@ esac # Check whether --enable-largefile was given. -if test "${enable_largefile+set}" = set; then : +if test ${enable_largefile+y} +then : enableval=$enable_largefile; fi -if test "$enable_largefile" != no; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 -$as_echo_n "checking for special C compiler options needed for large files... " >&6; } -if ${ac_cv_sys_largefile_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test "$enable_largefile" != no +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +printf %s "checking for special C compiler options needed for large files... " >&6; } +if test ${ac_cv_sys_largefile_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC @@ -7906,44 +8239,47 @@ We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int -main () +main (void) { ; return 0; } _ACEOF - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : break fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam CC="$CC -n32" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_sys_largefile_CC=' -n32'; break fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 -$as_echo "$ac_cv_sys_largefile_CC" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } -if ${ac_cv_sys_file_offset_bits+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if test ${ac_cv_sys_file_offset_bits+y} +then : + printf %s "(cached) " >&6 +else $as_nop while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7952,67 +8288,70 @@ We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_sys_file_offset_bits=no; break fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#undef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_sys_file_offset_bits=64; break fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 -$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) -cat >>confdefs.h <<_ACEOF -#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits -_ACEOF +printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h ;; esac rm -rf conftest* - if test $ac_cv_sys_file_offset_bits = unknown; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 -$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } -if ${ac_cv_sys_large_files+:} false; then : - $as_echo_n "(cached) " >&6 -else + case $ac_cv_sys_file_offset_bits in #( + unknown) : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } +if test ${ac_cv_sys_large_files+y} +then : + printf %s "(cached) " >&6 +else $as_nop while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8021,67 +8360,198 @@ We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_sys_large_files=no; break fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#undef _LARGE_FILES #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_sys_large_files=1; break fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 -$as_echo "$ac_cv_sys_large_files" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +printf "%s\n" "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) -cat >>confdefs.h <<_ACEOF -#define _LARGE_FILES $ac_cv_sys_large_files -_ACEOF +printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h ;; esac -rm -rf conftest* - fi +rm -rf conftest* ;; #( + 64) : + + # Check whether --enable-year2038 was given. +if test ${enable_year2038+y} +then : + enableval=$enable_year2038; +fi + + if test "$enable_year2038" != no +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for time_t past the year 2038" >&5 +printf %s "checking for time_t past the year 2038... " >&6; } +if test ${gl_cv_type_time_t_y2038+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + /* Check that time_t can represent 2**32 - 1 correctly. */ + #define LARGE_TIME_T \\ + ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30))) + int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 + && LARGE_TIME_T % 65537 == 0) + ? 1 : -1]; + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_type_time_t_y2038=yes +else $as_nop + gl_cv_type_time_t_y2038=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_time_t_y2038" >&5 +printf "%s\n" "$gl_cv_type_time_t_y2038" >&6; } + if test "$gl_cv_type_time_t_y2038" = no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit time_t with _TIME_BITS=64" >&5 +printf %s "checking for 64-bit time_t with _TIME_BITS=64... " >&6; } +if test ${gl_cv_type_time_t_bits_macro+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _TIME_BITS 64 + #define _FILE_OFFSET_BITS 64 + + #include + /* Check that time_t can represent 2**32 - 1 correctly. */ + #define LARGE_TIME_T \\ + ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30))) + int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 + && LARGE_TIME_T % 65537 == 0) + ? 1 : -1]; +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_type_time_t_bits_macro=yes +else $as_nop + gl_cv_type_time_t_bits_macro=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_time_t_bits_macro" >&5 +printf "%s\n" "$gl_cv_type_time_t_bits_macro" >&6; } + if test "$gl_cv_type_time_t_bits_macro" = yes; then + +printf "%s\n" "#define _TIME_BITS 64" >>confdefs.h + + +printf "%s\n" "#define _FILE_OFFSET_BITS 64" >>confdefs.h + + gl_cv_type_time_t_y2038=yes + fi + fi + if test $gl_cv_type_time_t_y2038 = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef _USE_32BIT_TIME_T + int ok; + #else + error fail + #endif -$as_echo "#define _DARWIN_USE_64_BIT_INODE 1" >>confdefs.h +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The 'time_t' type stops working after January 2038. + Remove _USE_32BIT_TIME_T from the compiler flags. +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + # If not cross-compiling and says we should check, + # and 'touch' works with a large timestamp, then evidently wider time_t + # is desired and supported, so fail and ask the builder to fix the + # problem. Otherwise, just warn the builder. + + if test "$gl_warned_about_y2038" != yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: The 'time_t' type stops working after January 2038, + and this package needs a wider 'time_t' type + if there is any way to access timestamps after that. + Configure with 'CC=\"${CC} -m64\"' perhaps?" >&5 +printf "%s\n" "$as_me: WARNING: The 'time_t' type stops working after January 2038, + and this package needs a wider 'time_t' type + if there is any way to access timestamps after that. + Configure with 'CC=\"${CC} -m64\"' perhaps?" >&2;} + gl_warned_about_y2038=yes + fi fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi +fi + ;; #( + *) : + ;; +esac +fi + + + + case "$host_os" in + mingw*) + +printf "%s\n" "#define __MINGW_USE_VC2005_COMPAT 1" >>confdefs.h + + ;; + esac @@ -8090,9 +8560,10 @@ # Check whether --enable-threads was given. -if test "${enable_threads+set}" = set; then : +if test ${enable_threads+y} +then : enableval=$enable_threads; gl_use_threads=$enableval -else +else $as_nop if test -n "$gl_use_threads_default"; then gl_use_threads="$gl_use_threads_default" else @@ -8156,6 +8627,7 @@ # Code from module absolute-header: + # Code from module access: # Code from module alignof: # Code from module alloca-opt: # Code from module allocator: @@ -8165,63 +8637,90 @@ # Code from module array-list: # Code from module assert: # Code from module assure: + # Code from module at-internal: + # Code from module attribute: + # Code from module basename-lgpl: # Code from module binary-io: # Code from module bitrotate: # Code from module bitset: # Code from module bitsetv: + # Code from module builtin-expect: # Code from module c-ctype: # Code from module c-strcase: # Code from module c-strcaseeq: # Code from module c99: + # Code from module calloc-gnu: # Code from module calloc-posix: + # Code from module canonicalize: # Code from module canonicalize-lgpl: # Code from module careadlinkat: # Code from module chdir: + # Code from module chdir-long: # Code from module clock-time: # Code from module cloexec: # Code from module close: # Code from module close-stream: + # Code from module closedir: # Code from module closeout: # Code from module concat-filename: # Code from module config-h: # Code from module configmake: + # Code from module d-ino: # Code from module diffseq: + # Code from module dirent: + # Code from module dirfd: # Code from module dirname: # Code from module dirname-lgpl: # Code from module do-release-commit-and-tag: - # Code from module dosname: # Code from module double-slash-root: + # Code from module dup: # Code from module dup2: + # Code from module eloop-threshold: # Code from module environ: # Code from module errno: # Code from module error: + # Code from module execute: # Code from module exitfail: # Code from module extensions: # Code from module extern-inline: # Code from module fatal-signal: + # Code from module fchdir: # Code from module fcntl: # Code from module fcntl-h: # Code from module fd-hook: # Code from module fd-safer-flag: # Code from module fdl: + # Code from module fdopendir: + # Code from module ffs: + # Code from module ffsl: + # Code from module file-set: # Code from module filename: + # Code from module filenamecat-lgpl: + # Code from module findprog-in: # Code from module float: # Code from module fopen: + # Code from module fopen-gnu: # Code from module fopen-safer: # Code from module fpending: # Code from module fpieee: # Code from module fprintf-posix: # Code from module fpucw: + # Code from module free-posix: # Code from module frexp-nolibm: # Code from module frexpl-nolibm: # Code from module fseterr: # Code from module fstat: + # Code from module fstatat: # Code from module fstrcmp: # Code from module fsync: # Code from module gendocs: + # Code from module getcwd: + # Code from module getcwd-lgpl: + # Code from module getdelim: # Code from module getdtablesize: # Code from module gethrxtime: + # Code from module getline: # Code from module getopt-gnu: # Code from module getopt-posix: # Code from module getprogname: @@ -8234,11 +8733,23 @@ # Code from module gnu-web-doc-update: # Code from module gnumakefile: # Code from module gnupload: + # Code from module gperf: # Code from module gpl-3.0: # Code from module hard-locale: # Code from module hash: + # Code from module hash-map: + # Code from module hash-pjw: + # Code from module hash-triple-simple: # Code from module havelib: + # Code from module ialloc: + # Code from module iconv: + # Code from module iconv-h: + # Code from module iconv_open: + # Code from module idx: # Code from module include_next: + # Code from module inline: + # Code from module integer_length: + # Code from module integer_length_l: # Code from module intprops: # Code from module inttypes: # Code from module inttypes-incomplete: @@ -8250,26 +8761,30 @@ # Code from module isnanl: # Code from module isnanl-nolibm: # Code from module iswblank: + # Code from module iswdigit: + # Code from module iswxdigit: # Code from module javacomp-script: # Code from module javaexec-script: # Code from module largefile: + # Code from module ldexp: # Code from module ldexpl: # Code from module libc-config: # Code from module libtextstyle: # Code from module libtextstyle-optional: # Code from module limits-h: + # Code from module linked-list: # Code from module list: # Code from module localcharset: # Code from module locale: - # Code from module localtime-buffer: # Code from module lock: # Code from module lstat: # Code from module maintainer-makefile: # Code from module malloc-gnu: # Code from module malloc-posix: # Code from module malloca: + # Code from module map: # Code from module math: # Code from module mbchar: # Code from module mbfile: @@ -8277,6 +8792,8 @@ # Code from module mbsinit: # Code from module mbswidth: # Code from module memchr: + # Code from module mempcpy: + # Code from module memrchr: # Code from module minmax: # Code from module msvc-inval: # Code from module msvc-nothrow: @@ -8286,11 +8803,19 @@ # Code from module obstack: # Code from module obstack-printf: # Code from module open: + # Code from module openat: + # Code from module openat-die: + # Code from module openat-h: + # Code from module opendir: + # Code from module oset: # Code from module pathmax: # Code from module perror: + # Code from module pipe-posix: # Code from module pipe2: # Code from module pipe2-safer: + # Code from module posix_spawn: # Code from module posix_spawn-internal: + # Code from module posix_spawn_file_actions_addchdir: # Code from module posix_spawn_file_actions_addclose: # Code from module posix_spawn_file_actions_adddup2: # Code from module posix_spawn_file_actions_addopen: @@ -8299,6 +8824,7 @@ # Code from module posix_spawnattr_destroy: # Code from module posix_spawnattr_init: # Code from module posix_spawnattr_setflags: + # Code from module posix_spawnattr_setpgroup: # Code from module posix_spawnattr_setsigmask: # Code from module posix_spawnp: # Code from module printf-frexp: @@ -8311,16 +8837,26 @@ # Code from module quotearg-simple: # Code from module raise: # Code from module rawmemchr: + # Code from module rbtree-oset: + # Code from module rbtreehash-list: + # Code from module readdir: + # Code from module readline: # Code from module readlink: # Code from module readme-release: + # Code from module realloc-gnu: # Code from module realloc-posix: + # Code from module reallocarray: # Code from module relocatable-prog: # Code from module relocatable-prog-wrapper: + # Code from module relocatable-script: # Code from module rename: + # Code from module rewinddir: # Code from module rmdir: # Code from module same-inode: + # Code from module save-cwd: # Code from module sched: + # Code from module scratch_buffer: # Code from module setlocale-null: # Code from module sh-filename: # Code from module sigaction: @@ -8341,12 +8877,14 @@ # Code from module stat: # Code from module stat-time: # Code from module std-gnu11: + # Code from module stdalign: # Code from module stdbool: # Code from module stddef: # Code from module stdint: # Code from module stdio: # Code from module stdlib: # Code from module stpcpy: + # Code from module stpncpy: # Code from module strchrnul: # Code from module strdup-posix: # Code from module streq: @@ -8354,15 +8892,20 @@ # Code from module strerror-override: # Code from module strerror_r-posix: # Code from module string: + # Code from module strings: # Code from module strndup: # Code from module strnlen: + # Code from module strtod: # Code from module strverscmp: + # Code from module sys_ioctl: # Code from module sys_resource: # Code from module sys_stat: # Code from module sys_time: # Code from module sys_times: # Code from module sys_types: # Code from module sys_wait: + # Code from module termios: + # Code from module thread-optim: # Code from module threadlib: @@ -8371,13 +8914,18 @@ # Code from module timespec: # Code from module timevar: # Code from module tls: + # Code from module unicodeio: # Code from module unistd: # Code from module unistd-safer: + # Code from module unistr/base: + # Code from module unistr/u8-mbtoucr: + # Code from module unistr/u8-uctomb: # Code from module unitypes: # Code from module uniwidth/base: # Code from module uniwidth/width: # Code from module unlink: # Code from module unlocked-io: + # Code from module unlocked-io-internal: # Code from module unsetenv: # Code from module update-copyright: # Code from module useless-if-before-free: @@ -8400,6 +8948,7 @@ # Code from module windows-once: # Code from module windows-recmutex: # Code from module windows-rwlock: + # Code from module windows-spawn: # Code from module windows-tls: # Code from module winsz-ioctl: # Code from module winsz-termios: @@ -8409,746 +8958,1392 @@ # Code from module xconcat-filename: # Code from module xhash: # Code from module xlist: + # Code from module xmap: # Code from module xmemdup0: # Code from module xreadlink: # Code from module xsize: # Code from module xstrndup: -# Gnulib uses '#pragma GCC diagnostic push' to silence some -# warnings, but older gcc doesn't support this. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pragma GCC diagnostic push works" >&5 -$as_echo_n "checking whether pragma GCC diagnostic push works... " >&6; } -if ${lv_cv_gcc_pragma_push_works+:} false; then : - $as_echo_n "(cached) " >&6 -else +# We want ostream_printf and hyperlink support. - save_CFLAGS=$CFLAGS - CFLAGS='-Wunknown-pragmas -Werror' - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - #pragma GCC diagnostic push - #pragma GCC diagnostic pop -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - lv_cv_gcc_pragma_push_works=yes -else - lv_cv_gcc_pragma_push_works=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS=$save_CFLAGS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lv_cv_gcc_pragma_push_works" >&5 -$as_echo "$lv_cv_gcc_pragma_push_works" >&6; } - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +# Check whether --with-gnu-ld was given. +if test ${with_gnu_ld+y} +then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else $as_nop + with_gnu_ld=no +fi +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Werror -Wunknown-warning-option" >&5 -$as_echo_n "checking whether C++ compiler handles -Werror -Wunknown-warning-option... " >&6; } -if ${gl_cv_warn_cxx__Werror__Wunknown_warning_option+:} false; then : - $as_echo_n "(cached) " >&6 +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld" >&5 +printf %s "checking for ld... " >&6; } +elif test "$GCC" = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "checking for ld used by $CC... " >&6; } +elif test "$with_gnu_ld" = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } +fi +if test -n "$LD"; then + # Let the user override the test with a path. + : else + if test ${acl_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop - gl_save_compiler_FLAGS="$CXXFLAGS" - as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Werror -Wunknown-warning-option" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + acl_cv_path_LD= # Final result of this test + ac_prog=ld # Program to search in $PATH + if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + acl_output=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $acl_output in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` + while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do + acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` + done + # Got the pathname. No search in PATH is needed. + acl_cv_path_LD="$acl_output" + ac_prog= + ;; + "") + # If it fails, then pretend we aren't using GCC. + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + fi + if test -n "$ac_prog"; then + # Search for $ac_prog in $PATH. + acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$acl_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 conftest.$ac_ext /* end confdefs.h. */ +#if defined __powerpc64__ || defined __LP64__ + int ok; + #else + error fail + #endif -int -main () -{ +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + # The compiler produces 64-bit code. Add option '-b64' so that the + # linker groks 64-bit object files. + case "$acl_cv_path_LD " in + *" -b64 "*) ;; + *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;; + esac + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + sparc64-*-netbsd*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __sparcv9 || defined __arch64__ + int ok; + #else + error fail + #endif - ; - return 0; -} _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - gl_cv_warn_cxx__Werror__Wunknown_warning_option=yes -else - gl_cv_warn_cxx__Werror__Wunknown_warning_option=no +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + # The compiler produces 32-bit code. Add option '-m elf32_sparc' + # so that the linker groks 32-bit object files. + case "$acl_cv_path_LD " in + *" -m elf32_sparc "*) ;; + *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;; + esac + fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS="$gl_save_compiler_FLAGS" +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Werror__Wunknown_warning_option" >&5 -$as_echo "$gl_cv_warn_cxx__Werror__Wunknown_warning_option" >&6; } -if test "x$gl_cv_warn_cxx__Werror__Wunknown_warning_option" = xyes; then : - gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror' + + LD="$acl_cv_path_LD" +fi +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } else - gl_unknown_warnings_are_errors= + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 fi - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${acl_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +printf "%s\n" "$acl_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$acl_cv_prog_gnu_ld -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -fno-exceptions" >&5 -$as_echo_n "checking whether C++ compiler handles -fno-exceptions... " >&6; } -if ${gl_cv_warn_cxx__fno_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_save_compiler_FLAGS="$CXXFLAGS" - as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -fno-exceptions" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main () -{ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 +printf %s "checking for shared library run path origin... " >&6; } +if test ${acl_cv_rpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - gl_cv_warn_cxx__fno_exceptions=yes -else - gl_cv_warn_cxx__fno_exceptions=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS="$gl_save_compiler_FLAGS" + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__fno_exceptions" >&5 -$as_echo "$gl_cv_warn_cxx__fno_exceptions" >&6; } -if test "x$gl_cv_warn_cxx__fno_exceptions" = xyes; then : - as_fn_append NO_EXCEPTIONS_CXXFLAGS " -fno-exceptions" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 +printf "%s\n" "$acl_cv_rpath" >&6; } + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + # Check whether --enable-rpath was given. +if test ${enable_rpath+y} +then : + enableval=$enable_rpath; : +else $as_nop + enable_rpath=yes fi -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -for f in '-std=c++98' '-std=c++98 -stdlib=libc++' -do - as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags__$f" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $f" >&5 -$as_echo_n "checking whether C++ compiler accepts $f... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else - ax_check_save_flags=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $f" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking 32-bit host C ABI" >&5 +printf %s "checking 32-bit host C ABI... " >&6; } +if test ${gl_cv_host_cpu_c_abi_32bit+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$gl_cv_host_cpu_c_abi"; then + case "$gl_cv_host_cpu_c_abi" in + i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) + gl_cv_host_cpu_c_abi_32bit=yes ;; + x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 ) + gl_cv_host_cpu_c_abi_32bit=no ;; + *) + gl_cv_host_cpu_c_abi_32bit=unknown ;; + esac + else + case "$host_cpu" in -#include + # CPUs that only support a 32-bit ABI. + arc \ + | bfin \ + | cris* \ + | csky \ + | epiphany \ + | ft32 \ + | h8300 \ + | m68k \ + | microblaze | microblazeel \ + | nds32 | nds32le | nds32be \ + | nios2 | nios2eb | nios2el \ + | or1k* \ + | or32 \ + | sh | sh1234 | sh1234elb \ + | tic6x \ + | xtensa* ) + gl_cv_host_cpu_c_abi_32bit=yes + ;; -typedef std::vector ints; + # CPUs that only support a 64-bit ABI. + alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \ + | mmix ) + gl_cv_host_cpu_c_abi_32bit=no + ;; + i[34567]86 ) + gl_cv_host_cpu_c_abi_32bit=yes + ;; -int -main () -{ + x86_64 ) + # On x86_64 systems, the C compiler may be generating code in one of + # these ABIs: + # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. + # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 + # with native Windows (mingw, MSVC). + # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if (defined __x86_64__ || defined __amd64__ \ + || defined _M_X64 || defined _M_AMD64) \ + && !(defined __ILP32__ || defined _ILP32) + int ok; + #else + error fail + #endif - ; - return 0; -} _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - eval "$as_CACHEVAR=yes" -else - eval "$as_CACHEVAR=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS=$ax_check_save_flags +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi_32bit=no +else $as_nop + gl_cv_host_cpu_c_abi_32bit=yes fi -eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : - CXX98_CXXFLAGS=$f - break +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + + arm* | aarch64 ) + # Assume arm with EABI. + # On arm64 systems, the C compiler may be generating code in one of + # these ABIs: + # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. + # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32) + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi_32bit=no +else $as_nop + gl_cv_host_cpu_c_abi_32bit=yes fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; -done -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) + # On hppa, the C compiler may be generating 32-bit code or 64-bit + # code. In the latter case, it defines _LP64 and __LP64__. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __LP64__ + int ok; + #else + error fail + #endif +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi_32bit=no +else $as_nop + gl_cv_host_cpu_c_abi_32bit=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + ia64* ) + # On ia64 on HP-UX, the C compiler may be generating 64-bit code or + # 32-bit code. In the latter case, it defines _ILP32. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef _ILP32 + int ok; + #else + error fail + #endif -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi_32bit=yes +else $as_nop + gl_cv_host_cpu_c_abi_32bit=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; -for f in '-std=c++03' '-std=c++03 -stdlib=libc++' -do - as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags__$f" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $f" >&5 -$as_echo_n "checking whether C++ compiler accepts $f... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else + mips* ) + # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this + # at 32. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) + int ok; + #else + error fail + #endif - ax_check_save_flags=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $f" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi_32bit=no +else $as_nop + gl_cv_host_cpu_c_abi_32bit=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + + powerpc* ) + # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. + # No need to distinguish them here; the caller may distinguish + # them based on the OS. + # On powerpc64 systems, the C compiler may still be generating + # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may + # be generating 64-bit code. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#if defined __powerpc64__ || defined __LP64__ + int ok; + #else + error fail + #endif -#include +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi_32bit=no +else $as_nop + gl_cv_host_cpu_c_abi_32bit=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; -typedef std::vector ints; + rs6000 ) + gl_cv_host_cpu_c_abi_32bit=yes + ;; + riscv32 | riscv64 ) + # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. + # Size of 'long' and 'void *': + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __LP64__ + int ok; + #else + error fail + #endif +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi_32bit=no +else $as_nop + gl_cv_host_cpu_c_abi_32bit=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; -int -main () -{ + s390* ) + # On s390x, the C compiler may be generating 64-bit (= s390x) code + # or 31-bit (= s390) code. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __LP64__ || defined __s390x__ + int ok; + #else + error fail + #endif - ; - return 0; -} _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - eval "$as_CACHEVAR=yes" -else - eval "$as_CACHEVAR=no" +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi_32bit=no +else $as_nop + gl_cv_host_cpu_c_abi_32bit=yes fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS=$ax_check_save_flags +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + + sparc | sparc64 ) + # UltraSPARCs running Linux have `uname -m` = "sparc64", but the + # C compiler still generates 32-bit code. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __sparcv9 || defined __arch64__ + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi_32bit=no +else $as_nop + gl_cv_host_cpu_c_abi_32bit=yes fi -eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : - CXX03_CXXFLAGS=$f - break +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + + *) + gl_cv_host_cpu_c_abi_32bit=unknown + ;; + esac + fi + fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_host_cpu_c_abi_32bit" >&5 +printf "%s\n" "$gl_cv_host_cpu_c_abi_32bit" >&6; } -done -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -for f in '-std=c++11' '-std=c++11 -stdlib=libc++' -do - as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags__$f" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $f" >&5 -$as_echo_n "checking whether C++ compiler accepts $f... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else - ax_check_save_flags=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $f" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ELF binary format" >&5 +printf %s "checking for ELF binary format... " >&6; } +if test ${gl_cv_elf+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#ifdef __ELF__ + Extensible Linking Format + #endif -#include - -typedef std::vector ints; +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Extensible Linking Format" >/dev/null 2>&1 +then : + gl_cv_elf=yes +else $as_nop + gl_cv_elf=no +fi +rm -rf conftest* -#include -#include -#include -#include -#include - - // C++11 - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - using right_angle_brackets = check>; - - auto f = std::make_shared("shared_ptr"); - - int a; - decltype(a) b; - - typedef check check_type; - check_type c; - check_type&& cr = static_cast(c); - - auto d = a; - - // Some versions of libstdc++ do not support std::set::emplace. - void foo() - { - std::set is; - is.emplace(42); - } - - // Clang++ 3.5, for a while, was unable to process properly - // the for-loop because its variable, r, is a typedef... - // It failed as follows: - // - // error: unexpected ':' in nested name specifier; did you mean '::'? - // for (auto r: std::set{1, 2}) - // ^ - // :: - using r = std::set; - void bar() - { - for (int r: std::set{1, 2}) - continue; - } - - // GCC 4.8.2 on Solaris 11.3 does not support to_string. - auto e = std::to_string(42); - +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_elf" >&5 +printf "%s\n" "$gl_cv_elf" >&6; } + if test $gl_cv_elf = yes; then + # Extract the ELF class of a file (5th byte) in decimal. + # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header + if od -A x < /dev/null >/dev/null 2>/dev/null; then + # Use POSIX od. + func_elfclass () + { + od -A n -t d1 -j 4 -N 1 + } + else + # Use BSD hexdump. + func_elfclass () + { + dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "' + echo + } + fi + # Use 'expr', not 'test', to compare the values of func_elfclass, because on + # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002, + # not 1 or 2. + case $HOST_CPU_C_ABI_32BIT in + yes) + # 32-bit ABI. + acl_is_expected_elfclass () + { + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null + } + ;; + no) + # 64-bit ABI. + acl_is_expected_elfclass () + { + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null + } + ;; + *) + # Unknown. + acl_is_expected_elfclass () + { + : + } + ;; + esac + else + acl_is_expected_elfclass () + { + : + } + fi -int -main () -{ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the common suffixes of directories in the library search path" >&5 +printf %s "checking for the common suffixes of directories in the library search path... " >&6; } +if test ${acl_cv_libdirstems+y} +then : + printf %s "(cached) " >&6 +else $as_nop + acl_libdirstem=lib + acl_libdirstem2= + acl_libdirstem3= + case "$host_os" in + solaris*) + if test $HOST_CPU_C_ABI_32BIT = no; then + acl_libdirstem2=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem3=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem3=lib/amd64 ;; + esac + fi + ;; + *) + searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \ + | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test $HOST_CPU_C_ABI_32BIT != no; then + # 32-bit or unknown ABI. + if test -d /usr/lib32; then + acl_libdirstem2=lib32 + fi + fi + if test $HOST_CPU_C_ABI_32BIT != yes; then + # 64-bit or unknown ABI. + if test -d /usr/lib64; then + acl_libdirstem3=lib64 + fi + fi + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;; + */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib32 ) acl_libdirstem2=lib32 ;; + */lib64 ) acl_libdirstem3=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + if test $HOST_CPU_C_ABI_32BIT = yes; then + # 32-bit ABI. + acl_libdirstem3= + fi + if test $HOST_CPU_C_ABI_32BIT = no; then + # 64-bit ABI. + acl_libdirstem2= + fi + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" + test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem" + acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3" - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - eval "$as_CACHEVAR=yes" -else - eval "$as_CACHEVAR=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS=$ax_check_save_flags -fi -eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : - CXX11_CXXFLAGS=$f - break fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $acl_cv_libdirstems" >&5 +printf "%s\n" "$acl_cv_libdirstems" >&6; } + acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` + acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'` + acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'` -done -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + case "$gl_libtextstyle_minversion" in + *" 0.20.5 "*) + snippet='styled_ostream_t s = term_styled_ostream_create(1,"",TTYCTL_AUTO,""); + ostream_printf(s,"%d",42);' + ;; + *" 0.20 "*) + snippet='term_styled_ostream_create(1,"",TTYCTL_AUTO,"");' + ;; + esac -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -for f in '-std=c++14' '-std=c++14 -stdlib=libc++' -do - as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags__$f" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $f" >&5 -$as_echo_n "checking whether C++ compiler accepts $f... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else - ax_check_save_flags=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $f" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -typedef std::vector ints; -#include -#include -#include -#include -#include - // C++11 - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - using right_angle_brackets = check>; - auto f = std::make_shared("shared_ptr"); - int a; - decltype(a) b; + use_additional=yes - typedef check check_type; - check_type c; - check_type&& cr = static_cast(c); + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" - auto d = a; + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" - // Some versions of libstdc++ do not support std::set::emplace. - void foo() - { - std::set is; - is.emplace(42); - } + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" - // Clang++ 3.5, for a while, was unable to process properly - // the for-loop because its variable, r, is a typedef... - // It failed as follows: - // - // error: unexpected ':' in nested name specifier; did you mean '::'? - // for (auto r: std::set{1, 2}) - // ^ - // :: - using r = std::set; - void bar() - { - for (int r: std::set{1, 2}) - continue; - } - // GCC 4.8.2 on Solaris 11.3 does not support to_string. - auto e = std::to_string(42); +# Check whether --with-libtextstyle-prefix was given. +if test ${with_libtextstyle_prefix+y} +then : + withval=$with_libtextstyle_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then - // C++14 - void mismatch() - { - using ints = std::vector; - auto v1 = ints{1, 2, 3}; - auto v2 = ints{1, 2}; - std::mismatch(std::begin(v1), std::end(v1), - std::begin(v2), std::end(v2)); - } + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" -int -main () -{ + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - eval "$as_CACHEVAR=yes" -else - eval "$as_CACHEVAR=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS=$ax_check_save_flags -fi -eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : - CXX14_CXXFLAGS=$f - break -fi + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + additional_libdir2="$withval/$acl_libdirstem2" + additional_libdir3="$withval/$acl_libdirstem3" + fi + fi -done -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +fi + if test "X$additional_libdir2" = "X$additional_libdir"; then + additional_libdir2= + fi + if test "X$additional_libdir3" = "X$additional_libdir"; then + additional_libdir3= + fi + LIBTEXTSTYLE= + LTLIBTEXTSTYLE= + INCTEXTSTYLE= + LIBTEXTSTYLE_PREFIX= + HAVE_LIBTEXTSTYLE= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='textstyle ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBTEXTSTYLE="${LTLIBTEXTSTYLE}${LTLIBTEXTSTYLE:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do + if test "X$found_dir" = "X"; then + eval dir=\$$additional_libdir_variable + if test -n "$dir"; then + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + fi + done + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBTEXTSTYLE; do + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBTEXTSTYLE="${LTLIBTEXTSTYLE}${LTLIBTEXTSTYLE:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then + LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBTEXTSTYLE; do -for f in '-std=c++17' '-std=c++17 -stdlib=libc++' -do - as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags__$f" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $f" >&5 -$as_echo_n "checking whether C++ compiler accepts $f... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" - ax_check_save_flags=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $f" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$found_so" + else + LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$found_a" + else + LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'textstyle'; then + LIBTEXTSTYLE_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'textstyle'; then + LIBTEXTSTYLE_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem3 | */$acl_libdirstem3/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` + if test "$name" = 'textstyle'; then + LIBTEXTSTYLE_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCTEXTSTYLE; do -#include + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" -typedef std::vector ints; + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCTEXTSTYLE="${INCTEXTSTYLE}${INCTEXTSTYLE:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then + haveit= + if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBTEXTSTYLE; do + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" -#include -#include -#include -#include -#include + if test "X$x" = "X-L$dependency_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$dependency_libdir"; then + LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }-L$dependency_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBTEXTSTYLE; do - // C++11 - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" - using right_angle_brackets = check>; + if test "X$x" = "X-L$dependency_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$dependency_libdir"; then + LTLIBTEXTSTYLE="${LTLIBTEXTSTYLE}${LTLIBTEXTSTYLE:+ }-L$dependency_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dep=`echo "X$dep" | sed -e 's/^X-l//'` + if test "X$dep" != Xc \ + || case $host_os in + linux* | gnu* | k*bsd*-gnu) false ;; + *) true ;; + esac; then + names_next_round="$names_next_round $dep" + fi + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$dep" + LTLIBTEXTSTYLE="${LTLIBTEXTSTYLE}${LTLIBTEXTSTYLE:+ }$dep" + ;; + esac + done + fi + else + LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }-l$name" + LTLIBTEXTSTYLE="${LTLIBTEXTSTYLE}${LTLIBTEXTSTYLE:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBTEXTSTYLE="${LTLIBTEXTSTYLE}${LTLIBTEXTSTYLE:+ }-R$found_dir" + done + fi - auto f = std::make_shared("shared_ptr"); - int a; - decltype(a) b; - typedef check check_type; - check_type c; - check_type&& cr = static_cast(c); - auto d = a; - // Some versions of libstdc++ do not support std::set::emplace. - void foo() - { - std::set is; - is.emplace(42); - } - // Clang++ 3.5, for a while, was unable to process properly - // the for-loop because its variable, r, is a typedef... - // It failed as follows: - // - // error: unexpected ':' in nested name specifier; did you mean '::'? - // for (auto r: std::set{1, 2}) - // ^ - // :: - using r = std::set; - void bar() - { - for (int r: std::set{1, 2}) - continue; - } + ac_save_CPPFLAGS="$CPPFLAGS" - // GCC 4.8.2 on Solaris 11.3 does not support to_string. - auto e = std::to_string(42); + for element in $INCTEXTSTYLE; do + haveit= + for x in $CPPFLAGS; do - // C++14 - void mismatch() - { - using ints = std::vector; - auto v1 = ints{1, 2, 3}; - auto v2 = ints{1, 2}; - std::mismatch(std::begin(v1), std::end(v1), - std::begin(v2), std::end(v2)); - } + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" - // C++17 - namespace ns1::ns2::ns3 {} + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done -#include - auto opt_string = std::optional{}; - auto out = std::ostringstream{}; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libtextstyle" >&5 +printf %s "checking for libtextstyle... " >&6; } +if test ${ac_cv_libtextstyle+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_LIBS="$LIBS" + case " $LIBTEXTSTYLE" in + *" -l"*) LIBS="$LIBS $LIBTEXTSTYLE" ;; + *) LIBS="$LIBTEXTSTYLE $LIBS" ;; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include int -main () +main (void) { - +$snippet ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - eval "$as_CACHEVAR=yes" -else - eval "$as_CACHEVAR=no" +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_libtextstyle=yes +else $as_nop + ac_cv_libtextstyle='no' fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - CXXFLAGS=$ax_check_save_flags -fi -eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : - CXX17_CXXFLAGS=$f - break + LIBS="$ac_save_LIBS" + fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libtextstyle" >&5 +printf "%s\n" "$ac_cv_libtextstyle" >&6; } + if test "$ac_cv_libtextstyle" = yes; then + HAVE_LIBTEXTSTYLE=yes -done -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +printf "%s\n" "#define HAVE_LIBTEXTSTYLE 1" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to link with libtextstyle" >&5 +printf %s "checking how to link with libtextstyle... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIBTEXTSTYLE" >&5 +printf "%s\n" "$LIBTEXTSTYLE" >&6; } + else + HAVE_LIBTEXTSTYLE=no + CPPFLAGS="$ac_save_CPPFLAGS" + LIBTEXTSTYLE= + LTLIBTEXTSTYLE= + LIBTEXTSTYLE_PREFIX= + fi -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -for f in '-std=c++2a' '-std=c++2a -stdlib=libc++' -do - as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags__$f" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $f" >&5 -$as_echo_n "checking whether C++ compiler accepts $f... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else - ax_check_save_flags=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $f" + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +printf %s "checking for inline... " >&6; } +if test ${ac_cv_c_inline+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo (void) {return 0; } +$ac_kw foo_t foo (void) {return 0; } +#endif -#include +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done -typedef std::vector ints; +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +printf "%s\n" "$ac_cv_c_inline" >&6; } +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac -#include -#include -#include -#include -#include +ac_func= +for ac_item in $ac_func_c_list +do + if test $ac_func; then + ac_fn_c_check_func "$LINENO" $ac_func ac_cv_func_$ac_func + if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then + echo "#define $ac_item 1" >> confdefs.h + fi + ac_func= + else + ac_func=$ac_item + fi +done - // C++11 - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - using right_angle_brackets = check>; - auto f = std::make_shared("shared_ptr"); - int a; - decltype(a) b; - typedef check check_type; - check_type c; - check_type&& cr = static_cast(c); - auto d = a; - // Some versions of libstdc++ do not support std::set::emplace. - void foo() - { - std::set is; - is.emplace(42); - } - // Clang++ 3.5, for a while, was unable to process properly - // the for-loop because its variable, r, is a typedef... - // It failed as follows: - // - // error: unexpected ':' in nested name specifier; did you mean '::'? - // for (auto r: std::set{1, 2}) - // ^ - // :: - using r = std::set; - void bar() - { - for (int r: std::set{1, 2}) - continue; - } - // GCC 4.8.2 on Solaris 11.3 does not support to_string. - auto e = std::to_string(42); + if test $HAVE_LIBTEXTSTYLE = yes; then + TEXTSTYLE_H= + else + TEXTSTYLE_H=textstyle.h - // C++14 - void mismatch() - { - using ints = std::vector; - auto v1 = ints{1, 2, 3}; - auto v2 = ints{1, 2}; - std::mismatch(std::begin(v1), std::end(v1), - std::begin(v2), std::end(v2)); - } - // C++17 - namespace ns1::ns2::ns3 {} + fi + + if test -n "$TEXTSTYLE_H"; then + GL_GENERATE_TEXTSTYLE_H_TRUE= + GL_GENERATE_TEXTSTYLE_H_FALSE='#' +else + GL_GENERATE_TEXTSTYLE_H_TRUE='#' + GL_GENERATE_TEXTSTYLE_H_FALSE= +fi + -#include - auto opt_string = std::optional{}; - auto out = std::ostringstream{}; - // C++2A +# Gnulib uses '#pragma GCC diagnostic push' to silence some +# warnings, but older gcc doesn't support this. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pragma GCC diagnostic push works" >&5 +printf %s "checking whether pragma GCC diagnostic push works... " >&6; } +if test ${lv_cv_gcc_pragma_push_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + save_CFLAGS=$CFLAGS + CFLAGS='-Wunknown-pragmas -Werror' + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #pragma GCC diagnostic push + #pragma GCC diagnostic pop int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - eval "$as_CACHEVAR=yes" -else - eval "$as_CACHEVAR=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS=$ax_check_save_flags +if ac_fn_c_try_compile "$LINENO" +then : + lv_cv_gcc_pragma_push_works=yes +else $as_nop + lv_cv_gcc_pragma_push_works=no fi -eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : - CXX2A_CXXFLAGS=$f - break +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$save_CFLAGS fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lv_cv_gcc_pragma_push_works" >&5 +printf "%s\n" "$lv_cv_gcc_pragma_push_works" >&6; } -done ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -9156,861 +10351,1844 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - if test x"$CXX11_CXXFLAGS" != x; then - ENABLE_CXX11_TRUE= - ENABLE_CXX11_FALSE='#' -else - ENABLE_CXX11_TRUE='#' - ENABLE_CXX11_FALSE= -fi - - if test x"$CXX14_CXXFLAGS" != x; then - ENABLE_CXX14_TRUE= - ENABLE_CXX14_FALSE='#' -else - ENABLE_CXX14_TRUE='#' - ENABLE_CXX14_FALSE= -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -# Check whether --enable-gcc-warnings was given. -if test "${enable_gcc_warnings+set}" = set; then : - enableval=$enable_gcc_warnings; case $enable_gcc_warnings in - yes|no) ;; - *) as_fn_error $? "invalid value for --gcc-warnings: $enable_gcc_warnings" "$LINENO" 5;; - esac -else - enable_gcc_warnings=no -fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Werror -Wunknown-warning-option" >&5 +printf %s "checking whether C++ compiler handles -Werror -Wunknown-warning-option... " >&6; } +if test ${gl_cv_warn_cxx__Werror__Wunknown_warning_option+y} +then : + printf %s "(cached) " >&6 +else $as_nop - if test "$enable_gcc_warnings" = yes; then - ENABLE_GCC_WARNINGS_TRUE= - ENABLE_GCC_WARNINGS_FALSE='#' -else - ENABLE_GCC_WARNINGS_TRUE='#' - ENABLE_GCC_WARNINGS_FALSE= -fi - -if test "$enable_gcc_warnings" = yes; then - # -Wno-tautological-constant-out-of-range-compare for Clang 3.3 and - # 3.4 on GNU/Linux that choke on intprops.h's INT_MULTIPLY_WRAPV, - # etc. - # - # ICC: -wr188 - # - # 1669 warnings warnings_default = - # ../src/complain.c(318): error #188: enumerated type mixed with another type - # 1670 Wconflicts_sr | Wconflicts_rr | Wdeprecated | Wother; - # 1671 ^ - # 1672 - # 1673../src/complain.c(393): error #188: enumerated type mixed with another type - # 1674 warnings w = 1 << wbit; - # 1675 ^ - # - # ICC: -wr3179 - # - # char const *usefulness - # = rule_useless_in_grammar_p (&rules[r]) ? "useless-in-grammar" - # : rule_useless_in_parser_p (&rules[r]) ? "useless-in-parser" - # : "useful"; - # - # gives - # - # error #3179: deprecated conversion of string literal to char* (should be const char*) - # - # ICC: -wr2259 (that's in C, in spite of what the error messages which seems to be about C++). - # error #2259: non-pointer conversion from "int" to "yybool={signed char}" may lose significant bits - # yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR; - # ^ - warn_common='-Wall -Wextra - -Wcast-align -Wchar-subscripts - -fparse-all-comments -Wdocumentation - -Wformat -Wimplicit-fallthrough -Wnull-dereference - -Wno-sign-compare -Wno-tautological-constant-out-of-range-compare - -Wpointer-arith -Wshadow - -Wwrite-strings - -wr188 -wr2259 -wr3179' - warn_c='-Wbad-function-cast -Wstrict-prototypes' - warn_cxx='-Wextra-semi -Wnoexcept -Wold-style-cast -Wundefined-func-template - -Wweak-vtables' - # Warnings for the test suite only. - # - # -fno-color-diagnostics: Clang's use of colors in the error - # messages is confusing the tests looking at the compiler's output - # (e.g., synclines.at). - # - # -Wno-keyword-macro: We use the "#define private public" dirty - # trick in the test suite to check some private implementation - # details for lalr1.cc. - warn_tests='-Wundef -pedantic -Wconversion - -Wdeprecated -Wsign-compare -Wsign-conversion - -Wtautological-constant-out-of-range-compare - -fno-color-diagnostics - -Wno-keyword-macro' - - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - # Clang supports many of GCC's -W options, but only issues warnings - # on the ones it does not recognize. In that case, gl_WARN_ADD - # thinks the option is supported, and unknown options are then added - # to CFLAGS. But then, when -Werror is added in the test suite for - # instance, the warning about the unknown option turns into an - # error. - # - # This should be addressed by gnulib's gl_WARN_ADD, but in the - # meanwhile, turn warnings about unknown options into errors in - # CFLAGS, and restore CFLAGS after the tests. - save_CFLAGS=$CFLAGS - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Werror -Wunknown-warning-option" >&5 -$as_echo_n "checking whether C compiler handles -Werror -Wunknown-warning-option... " >&6; } -if ${gl_cv_warn_c__Werror__Wunknown_warning_option+:} false; then : - $as_echo_n "(cached) " >&6 -else - - gl_save_compiler_FLAGS="$CFLAGS" - as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Werror -Wunknown-warning-option" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + gl_save_compiler_FLAGS="$CXXFLAGS" + as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Werror -Wunknown-warning-option" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_warn_c__Werror__Wunknown_warning_option=yes -else - gl_cv_warn_c__Werror__Wunknown_warning_option=no +if ac_fn_cxx_try_link "$LINENO" +then : + gl_cv_warn_cxx__Werror__Wunknown_warning_option=yes +else $as_nop + gl_cv_warn_cxx__Werror__Wunknown_warning_option=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - CFLAGS="$gl_save_compiler_FLAGS" + CXXFLAGS="$gl_save_compiler_FLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Werror__Wunknown_warning_option" >&5 -$as_echo "$gl_cv_warn_c__Werror__Wunknown_warning_option" >&6; } -if test "x$gl_cv_warn_c__Werror__Wunknown_warning_option" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Werror__Wunknown_warning_option" >&5 +printf "%s\n" "$gl_cv_warn_cxx__Werror__Wunknown_warning_option" >&6; } +if test "x$gl_cv_warn_cxx__Werror__Wunknown_warning_option" = xyes +then : gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror' -else +else $as_nop gl_unknown_warnings_are_errors= fi - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Werror=unknown-warning-option" >&5 -$as_echo_n "checking whether C compiler handles -Werror=unknown-warning-option... " >&6; } -if ${gl_cv_warn_c__Werror_unknown_warning_option+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -fno-exceptions" >&5 +printf %s "checking whether C++ compiler handles -fno-exceptions... " >&6; } +if test ${gl_cv_warn_cxx__fno_exceptions+y} +then : + printf %s "(cached) " >&6 +else $as_nop - gl_save_compiler_FLAGS="$CFLAGS" - as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Werror=unknown-warning-option" + gl_save_compiler_FLAGS="$CXXFLAGS" + as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -fno-exceptions" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_warn_c__Werror_unknown_warning_option=yes -else - gl_cv_warn_c__Werror_unknown_warning_option=no +if ac_fn_cxx_try_link "$LINENO" +then : + gl_cv_warn_cxx__fno_exceptions=yes +else $as_nop + gl_cv_warn_cxx__fno_exceptions=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - CFLAGS="$gl_save_compiler_FLAGS" + CXXFLAGS="$gl_save_compiler_FLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Werror_unknown_warning_option" >&5 -$as_echo "$gl_cv_warn_c__Werror_unknown_warning_option" >&6; } -if test "x$gl_cv_warn_c__Werror_unknown_warning_option" = xyes; then : - as_fn_append CFLAGS " -Werror=unknown-warning-option" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__fno_exceptions" >&5 +printf "%s\n" "$gl_cv_warn_cxx__fno_exceptions" >&6; } +if test "x$gl_cv_warn_cxx__fno_exceptions" = xyes +then : + as_fn_append NO_EXCEPTIONS_CXXFLAGS " -fno-exceptions" fi - # Accept this warning only if it is not too touchy (e.g., clang 3.3 - # and 3.4). +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wunreachable-code" >&5 -$as_echo_n "checking whether C compiler handles -Wunreachable-code... " >&6; } -if ${gl_cv_warn_c__Wunreachable_code+:} false; then : - $as_echo_n "(cached) " >&6 -else +for f in '-std=c++98' '-std=c++98 -stdlib=libc++' +do + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cxxflags__$f" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $f" >&5 +printf %s "checking whether C++ compiler accepts $f... " >&6; } +if eval test \${$as_CACHEVAR+y} +then : + printf %s "(cached) " >&6 +else $as_nop - gl_save_compiler_FLAGS="$CFLAGS" - as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wunreachable-code" + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $f" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + + int -main () +main (void) { -if (sizeof (long) < sizeof (int)) return 1; + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_warn_c__Wunreachable_code=yes -else - gl_cv_warn_c__Wunreachable_code=no +if ac_fn_cxx_try_link "$LINENO" +then : + eval "$as_CACHEVAR=yes" +else $as_nop + eval "$as_CACHEVAR=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - CFLAGS="$gl_save_compiler_FLAGS" - + CXXFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wunreachable_code" >&5 -$as_echo "$gl_cv_warn_c__Wunreachable_code" >&6; } -if test "x$gl_cv_warn_c__Wunreachable_code" = xyes; then : - as_fn_append WARN_CFLAGS " -Wunreachable-code" +eval ac_res=\$$as_CACHEVAR + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes +then : + CXX98_CXXFLAGS=$f + break fi +done +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + - for i in $warn_common $warn_c; - do +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -as_gl_Warn=`$as_echo "gl_cv_warn_c_$i" | $as_tr_sh` -gl_positive="$i" -case $gl_positive in - -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles $i" >&5 -$as_echo_n "checking whether C compiler handles $i... " >&6; } -if eval \${$as_gl_Warn+:} false; then : - $as_echo_n "(cached) " >&6 -else +for f in '-std=c++03' '-std=c++03 -stdlib=libc++' +do + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cxxflags__$f" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $f" >&5 +printf %s "checking whether C++ compiler accepts $f... " >&6; } +if eval test \${$as_CACHEVAR+y} +then : + printf %s "(cached) " >&6 +else $as_nop - gl_save_compiler_FLAGS="$CFLAGS" - as_fn_append CFLAGS " $gl_unknown_warnings_are_errors $gl_positive" + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $f" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + + + int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$as_gl_Warn=yes" -else - eval "$as_gl_Warn=no" +if ac_fn_cxx_try_link "$LINENO" +then : + eval "$as_CACHEVAR=yes" +else $as_nop + eval "$as_CACHEVAR=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - CFLAGS="$gl_save_compiler_FLAGS" - + CXXFLAGS=$ax_check_save_flags fi -eval ac_res=\$$as_gl_Warn - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_gl_Warn"\" = x"yes"; then : - as_fn_append WARN_CFLAGS " $i" +eval ac_res=\$$as_CACHEVAR + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes +then : + CXX03_CXXFLAGS=$f + break fi +done +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Werror" >&5 -$as_echo_n "checking whether C compiler handles -Werror... " >&6; } -if ${gl_cv_warn_c__Werror+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - gl_save_compiler_FLAGS="$CFLAGS" - as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Werror" +for f in '-std=c++11' '-std=c++11 -stdlib=libc++' +do + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cxxflags__$f" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $f" >&5 +printf %s "checking whether C++ compiler accepts $f... " >&6; } +if eval test \${$as_CACHEVAR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $f" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_warn_c__Werror=yes -else - gl_cv_warn_c__Werror=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CFLAGS="$gl_save_compiler_FLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Werror" >&5 -$as_echo "$gl_cv_warn_c__Werror" >&6; } -if test "x$gl_cv_warn_c__Werror" = xyes; then : - as_fn_append WERROR_CFLAGS " -Werror" -fi + // C++11 +#include +#include +#include +#include +#include +#include +#include // std::swap +#include + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + using right_angle_brackets = check>; - # Warnings for the test suite, and maybe for bison if GCC is modern - # enough. - test $lv_cv_gcc_pragma_push_works = yes && - as_fn_append WARN_CFLAGS " $WARN_CFLAGS_TEST" + auto f = std::make_shared("shared_ptr"); - # Warnings for the test suite only. - for i in $warn_tests -Wincompatible-pointer-types; - do + int a; + decltype(a) b; + typedef check check_type; + check_type c; + check_type&& cr = static_cast(c); -as_gl_Warn=`$as_echo "gl_cv_warn_c_$i" | $as_tr_sh` -gl_positive="$i" -case $gl_positive in - -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles $i" >&5 -$as_echo_n "checking whether C compiler handles $i... " >&6; } -if eval \${$as_gl_Warn+:} false; then : - $as_echo_n "(cached) " >&6 -else + auto d = a; + + // Some versions of libstdc++ do not support std::set::emplace. + void foo() + { + std::set is; + is.emplace(42); + } + + // Clang++ 3.5, for a while, was unable to process properly + // the for-loop because its variable, r, is a typedef... + // It failed as follows: + // + // error: unexpected ':' in nested name specifier; did you mean '::'? + // for (auto r: std::set{1, 2}) + // ^ + // :: + using r = std::set; + void bar() + { + for (int r: std::set{1, 2}) + continue; + } + + // GCC 4.8.2 on Solaris 11.3 does not support to_string. + auto e = std::to_string(42); + + // Needed by glr2.cc. + void cxx11_vector_data () + { + std::vector ints; + ints.emplace_back (42); + assert (ints.data () == &ints[0]); + } + + // Needed by glr2.cc. + void cxx11_array_swap () + { + int i0[4] = { 1, 2, 3, 4 }; + int i1[4] = { 5, 6, 7, 8 }; + std::swap (i0, i1); + } - gl_save_compiler_FLAGS="$CFLAGS" - as_fn_append CFLAGS " $gl_unknown_warnings_are_errors $gl_positive" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$as_gl_Warn=yes" -else - eval "$as_gl_Warn=no" +if ac_fn_cxx_try_link "$LINENO" +then : + eval "$as_CACHEVAR=yes" +else $as_nop + eval "$as_CACHEVAR=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - CFLAGS="$gl_save_compiler_FLAGS" - + CXXFLAGS=$ax_check_save_flags fi -eval ac_res=\$$as_gl_Warn - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_gl_Warn"\" = x"yes"; then : - as_fn_append WARN_CFLAGS_TEST " $i" +eval ac_res=\$$as_CACHEVAR + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes +then : + CXX11_CXXFLAGS=$f + break fi - - done - CFLAGS=$save_CFLAGS - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +done +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - ac_ext=cpp +ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - save_CXXFLAGS=$CXXFLAGS - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Werror=unknown-warning-option" >&5 -$as_echo_n "checking whether C++ compiler handles -Werror=unknown-warning-option... " >&6; } -if ${gl_cv_warn_cxx__Werror_unknown_warning_option+:} false; then : - $as_echo_n "(cached) " >&6 -else +for f in '-std=c++14' '-std=c++14 -stdlib=libc++' +do + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cxxflags__$f" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $f" >&5 +printf %s "checking whether C++ compiler accepts $f... " >&6; } +if eval test \${$as_CACHEVAR+y} +then : + printf %s "(cached) " >&6 +else $as_nop - gl_save_compiler_FLAGS="$CXXFLAGS" - as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Werror=unknown-warning-option" + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $f" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - gl_cv_warn_cxx__Werror_unknown_warning_option=yes -else - gl_cv_warn_cxx__Werror_unknown_warning_option=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS="$gl_save_compiler_FLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Werror_unknown_warning_option" >&5 -$as_echo "$gl_cv_warn_cxx__Werror_unknown_warning_option" >&6; } -if test "x$gl_cv_warn_cxx__Werror_unknown_warning_option" = xyes; then : - as_fn_append CXXFLAGS " -Werror=unknown-warning-option" -fi + // C++11 +#include +#include +#include +#include +#include +#include +#include // std::swap +#include + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; - for i in $warn_common $warn_cxx; - do + using right_angle_brackets = check>; + auto f = std::make_shared("shared_ptr"); -as_gl_Warn=`$as_echo "gl_cv_warn_cxx_$i" | $as_tr_sh` -gl_positive="$i" -case $gl_positive in - -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles $i" >&5 -$as_echo_n "checking whether C++ compiler handles $i... " >&6; } -if eval \${$as_gl_Warn+:} false; then : - $as_echo_n "(cached) " >&6 -else + int a; + decltype(a) b; - gl_save_compiler_FLAGS="$CXXFLAGS" - as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors $gl_positive" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + typedef check check_type; + check_type c; + check_type&& cr = static_cast(c); -int -main () -{ + auto d = a; - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - eval "$as_gl_Warn=yes" -else - eval "$as_gl_Warn=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS="$gl_save_compiler_FLAGS" + // Some versions of libstdc++ do not support std::set::emplace. + void foo() + { + std::set is; + is.emplace(42); + } -fi -eval ac_res=\$$as_gl_Warn - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_gl_Warn"\" = x"yes"; then : - as_fn_append WARN_CXXFLAGS " $i" -fi + // Clang++ 3.5, for a while, was unable to process properly + // the for-loop because its variable, r, is a typedef... + // It failed as follows: + // + // error: unexpected ':' in nested name specifier; did you mean '::'? + // for (auto r: std::set{1, 2}) + // ^ + // :: + using r = std::set; + void bar() + { + for (int r: std::set{1, 2}) + continue; + } + // GCC 4.8.2 on Solaris 11.3 does not support to_string. + auto e = std::to_string(42); - done - # Accept this warning only if it is not too touchy (e.g., clang 3.3 - # and 3.4). + // Needed by glr2.cc. + void cxx11_vector_data () + { + std::vector ints; + ints.emplace_back (42); + assert (ints.data () == &ints[0]); + } + // Needed by glr2.cc. + void cxx11_array_swap () + { + int i0[4] = { 1, 2, 3, 4 }; + int i1[4] = { 5, 6, 7, 8 }; + std::swap (i0, i1); + } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Wunreachable-code" >&5 -$as_echo_n "checking whether C++ compiler handles -Wunreachable-code... " >&6; } -if ${gl_cv_warn_cxx__Wunreachable_code+:} false; then : - $as_echo_n "(cached) " >&6 -else + // C++14 + void mismatch() + { + using ints = std::vector; + auto v1 = ints{1, 2, 3}; + auto v2 = ints{1, 2}; + std::mismatch(std::begin(v1), std::end(v1), + std::begin(v2), std::end(v2)); + } - gl_save_compiler_FLAGS="$CXXFLAGS" - as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Wunreachable-code" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ int -main () +main (void) { -if (sizeof (long) < sizeof (int)) return 1; + ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - gl_cv_warn_cxx__Wunreachable_code=yes -else - gl_cv_warn_cxx__Wunreachable_code=no +if ac_fn_cxx_try_link "$LINENO" +then : + eval "$as_CACHEVAR=yes" +else $as_nop + eval "$as_CACHEVAR=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - CXXFLAGS="$gl_save_compiler_FLAGS" - + CXXFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Wunreachable_code" >&5 -$as_echo "$gl_cv_warn_cxx__Wunreachable_code" >&6; } -if test "x$gl_cv_warn_cxx__Wunreachable_code" = xyes; then : - as_fn_append WARN_CXXFLAGS " -Wunreachable-code" +eval ac_res=\$$as_CACHEVAR + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes +then : + CXX14_CXXFLAGS=$f + break fi +done +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Wzero-as-null-pointer-constant" >&5 -$as_echo_n "checking whether C++ compiler handles -Wzero-as-null-pointer-constant... " >&6; } -if ${gl_cv_warn_cxx__Wzero_as_null_pointer_constant+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - gl_save_compiler_FLAGS="$CXXFLAGS" - as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Wzero-as-null-pointer-constant" +for f in '-std=c++17' '-std=c++17 -stdlib=libc++' +do + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cxxflags__$f" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $f" >&5 +printf %s "checking whether C++ compiler accepts $f... " >&6; } +if eval test \${$as_CACHEVAR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $f" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -int -main () -{ -nullptr - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - gl_cv_warn_cxx__Wzero_as_null_pointer_constant=yes -else - gl_cv_warn_cxx__Wzero_as_null_pointer_constant=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS="$gl_save_compiler_FLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Wzero_as_null_pointer_constant" >&5 -$as_echo "$gl_cv_warn_cxx__Wzero_as_null_pointer_constant" >&6; } -if test "x$gl_cv_warn_cxx__Wzero_as_null_pointer_constant" = xyes; then : - as_fn_append WARN_CXXFLAGS " -Wzero-as-null-pointer-constant" -fi - - # Before GCC6, the pragmas don't work well enough to neutralize - # this warning. + // C++11 +#include +#include +#include +#include +#include +#include +#include // std::swap +#include -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Wuseless-cast" >&5 -$as_echo_n "checking whether C++ compiler handles -Wuseless-cast... " >&6; } -if ${gl_cv_warn_cxx__Wuseless_cast+:} false; then : - $as_echo_n "(cached) " >&6 -else + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; - gl_save_compiler_FLAGS="$CXXFLAGS" - as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Wuseless-cast" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + using right_angle_brackets = check>; -int -main () -{ + auto f = std::make_shared("shared_ptr"); - #if defined __GNUC__ && ! defined __ICC && ! defined __clang__ && __GNUC__ < 6 - syntax error - #endif + int a; + decltype(a) b; - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - gl_cv_warn_cxx__Wuseless_cast=yes -else - gl_cv_warn_cxx__Wuseless_cast=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS="$gl_save_compiler_FLAGS" + typedef check check_type; + check_type c; + check_type&& cr = static_cast(c); -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Wuseless_cast" >&5 -$as_echo "$gl_cv_warn_cxx__Wuseless_cast" >&6; } -if test "x$gl_cv_warn_cxx__Wuseless_cast" = xyes; then : - as_fn_append WARN_CXXFLAGS " -Wuseless-cast" -fi + auto d = a; + // Some versions of libstdc++ do not support std::set::emplace. + void foo() + { + std::set is; + is.emplace(42); + } + // Clang++ 3.5, for a while, was unable to process properly + // the for-loop because its variable, r, is a typedef... + // It failed as follows: + // + // error: unexpected ':' in nested name specifier; did you mean '::'? + // for (auto r: std::set{1, 2}) + // ^ + // :: + using r = std::set; + void bar() + { + for (int r: std::set{1, 2}) + continue; + } + // GCC 4.8.2 on Solaris 11.3 does not support to_string. + auto e = std::to_string(42); -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Werror" >&5 -$as_echo_n "checking whether C++ compiler handles -Werror... " >&6; } -if ${gl_cv_warn_cxx__Werror+:} false; then : - $as_echo_n "(cached) " >&6 -else + // Needed by glr2.cc. + void cxx11_vector_data () + { + std::vector ints; + ints.emplace_back (42); + assert (ints.data () == &ints[0]); + } + + // Needed by glr2.cc. + void cxx11_array_swap () + { + int i0[4] = { 1, 2, 3, 4 }; + int i1[4] = { 5, 6, 7, 8 }; + std::swap (i0, i1); + } + + // C++14 + void mismatch() + { + using ints = std::vector; + auto v1 = ints{1, 2, 3}; + auto v2 = ints{1, 2}; + std::mismatch(std::begin(v1), std::end(v1), + std::begin(v2), std::end(v2)); + } + + // C++17 + namespace ns1::ns2::ns3 {} + +#include + auto opt_string = std::optional{}; + auto out = std::ostringstream{}; - gl_save_compiler_FLAGS="$CXXFLAGS" - as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Werror" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - gl_cv_warn_cxx__Werror=yes -else - gl_cv_warn_cxx__Werror=no +if ac_fn_cxx_try_link "$LINENO" +then : + eval "$as_CACHEVAR=yes" +else $as_nop + eval "$as_CACHEVAR=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - CXXFLAGS="$gl_save_compiler_FLAGS" - + CXXFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Werror" >&5 -$as_echo "$gl_cv_warn_cxx__Werror" >&6; } -if test "x$gl_cv_warn_cxx__Werror" = xyes; then : - as_fn_append WERROR_CXXFLAGS " -Werror" +eval ac_res=\$$as_CACHEVAR + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes +then : + CXX17_CXXFLAGS=$f + break fi +done +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - # Warnings for the test suite only. - for i in $warn_tests; - do -as_gl_Warn=`$as_echo "gl_cv_warn_cxx_$i" | $as_tr_sh` -gl_positive="$i" -case $gl_positive in - -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles $i" >&5 -$as_echo_n "checking whether C++ compiler handles $i... " >&6; } -if eval \${$as_gl_Warn+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - gl_save_compiler_FLAGS="$CXXFLAGS" - as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors $gl_positive" +for f in '-std=c++20' '-std=c++20 -stdlib=libc++' +do + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cxxflags__$f" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $f" >&5 +printf %s "checking whether C++ compiler accepts $f... " >&6; } +if eval test \${$as_CACHEVAR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $f" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + + + // C++11 +#include +#include +#include +#include +#include +#include +#include // std::swap +#include + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + using right_angle_brackets = check>; + + auto f = std::make_shared("shared_ptr"); + + int a; + decltype(a) b; + + typedef check check_type; + check_type c; + check_type&& cr = static_cast(c); + + auto d = a; + + // Some versions of libstdc++ do not support std::set::emplace. + void foo() + { + std::set is; + is.emplace(42); + } + + // Clang++ 3.5, for a while, was unable to process properly + // the for-loop because its variable, r, is a typedef... + // It failed as follows: + // + // error: unexpected ':' in nested name specifier; did you mean '::'? + // for (auto r: std::set{1, 2}) + // ^ + // :: + using r = std::set; + void bar() + { + for (int r: std::set{1, 2}) + continue; + } + + // GCC 4.8.2 on Solaris 11.3 does not support to_string. + auto e = std::to_string(42); + + // Needed by glr2.cc. + void cxx11_vector_data () + { + std::vector ints; + ints.emplace_back (42); + assert (ints.data () == &ints[0]); + } + + // Needed by glr2.cc. + void cxx11_array_swap () + { + int i0[4] = { 1, 2, 3, 4 }; + int i1[4] = { 5, 6, 7, 8 }; + std::swap (i0, i1); + } + + // C++14 + void mismatch() + { + using ints = std::vector; + auto v1 = ints{1, 2, 3}; + auto v2 = ints{1, 2}; + std::mismatch(std::begin(v1), std::end(v1), + std::begin(v2), std::end(v2)); + } + + // C++17 + namespace ns1::ns2::ns3 {} + +#include + auto opt_string = std::optional{}; + auto out = std::ostringstream{}; + + // C++20 + + int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - eval "$as_gl_Warn=yes" -else - eval "$as_gl_Warn=no" +if ac_fn_cxx_try_link "$LINENO" +then : + eval "$as_CACHEVAR=yes" +else $as_nop + eval "$as_CACHEVAR=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - CXXFLAGS="$gl_save_compiler_FLAGS" - + CXXFLAGS=$ax_check_save_flags fi -eval ac_res=\$$as_gl_Warn - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_gl_Warn"\" = x"yes"; then : - as_fn_append WARN_CXXFLAGS_TEST " $i" +eval ac_res=\$$as_CACHEVAR + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes +then : + CXX20_CXXFLAGS=$f + break fi +done +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - done - # Too many compilers complain about Flex generated code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Wno-error" >&5 -$as_echo_n "checking whether C++ compiler handles -Wno-error... " >&6; } -if ${gl_cv_warn_cxx__Wno_error+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - gl_save_compiler_FLAGS="$CXXFLAGS" - as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Werror" +for f in '-std=c++2b' '-std=c++2b -stdlib=libc++' +do + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cxxflags__$f" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $f" >&5 +printf %s "checking whether C++ compiler accepts $f... " >&6; } +if eval test \${$as_CACHEVAR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $f" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + + + // C++11 +#include +#include +#include +#include +#include +#include +#include // std::swap +#include + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + using right_angle_brackets = check>; + + auto f = std::make_shared("shared_ptr"); + + int a; + decltype(a) b; + + typedef check check_type; + check_type c; + check_type&& cr = static_cast(c); + + auto d = a; + + // Some versions of libstdc++ do not support std::set::emplace. + void foo() + { + std::set is; + is.emplace(42); + } + + // Clang++ 3.5, for a while, was unable to process properly + // the for-loop because its variable, r, is a typedef... + // It failed as follows: + // + // error: unexpected ':' in nested name specifier; did you mean '::'? + // for (auto r: std::set{1, 2}) + // ^ + // :: + using r = std::set; + void bar() + { + for (int r: std::set{1, 2}) + continue; + } + + // GCC 4.8.2 on Solaris 11.3 does not support to_string. + auto e = std::to_string(42); + + // Needed by glr2.cc. + void cxx11_vector_data () + { + std::vector ints; + ints.emplace_back (42); + assert (ints.data () == &ints[0]); + } + + // Needed by glr2.cc. + void cxx11_array_swap () + { + int i0[4] = { 1, 2, 3, 4 }; + int i1[4] = { 5, 6, 7, 8 }; + std::swap (i0, i1); + } + + // C++14 + void mismatch() + { + using ints = std::vector; + auto v1 = ints{1, 2, 3}; + auto v2 = ints{1, 2}; + std::mismatch(std::begin(v1), std::end(v1), + std::begin(v2), std::end(v2)); + } + + // C++17 + namespace ns1::ns2::ns3 {} + +#include + auto opt_string = std::optional{}; + auto out = std::ostringstream{}; + + // C++20 + + // C++2B + + int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - gl_cv_warn_cxx__Wno_error=yes -else - gl_cv_warn_cxx__Wno_error=no +if ac_fn_cxx_try_link "$LINENO" +then : + eval "$as_CACHEVAR=yes" +else $as_nop + eval "$as_CACHEVAR=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - CXXFLAGS="$gl_save_compiler_FLAGS" - + CXXFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Wno_error" >&5 -$as_echo "$gl_cv_warn_cxx__Wno_error" >&6; } -if test "x$gl_cv_warn_cxx__Wno_error" = xyes; then : - as_fn_append FLEX_SCANNER_CXXFLAGS " -Wno-error" +eval ac_res=\$$as_CACHEVAR + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes +then : + CXX2B_CXXFLAGS=$f + break fi +done +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - # Clang++ deprecates compiling C. + if test x"$CXX11_CXXFLAGS" != x; then + ENABLE_CXX11_TRUE= + ENABLE_CXX11_FALSE='#' +else + ENABLE_CXX11_TRUE='#' + ENABLE_CXX11_FALSE= +fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Wno-deprecated" >&5 -$as_echo_n "checking whether C++ compiler handles -Wno-deprecated... " >&6; } -if ${gl_cv_warn_cxx__Wno_deprecated+:} false; then : - $as_echo_n "(cached) " >&6 + if test x"$CXX14_CXXFLAGS" != x; then + ENABLE_CXX14_TRUE= + ENABLE_CXX14_FALSE='#' else + ENABLE_CXX14_TRUE='#' + ENABLE_CXX14_FALSE= +fi - gl_save_compiler_FLAGS="$CXXFLAGS" - as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Wdeprecated" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - gl_cv_warn_cxx__Wno_deprecated=yes -else - gl_cv_warn_cxx__Wno_deprecated=no +# Check whether --enable-gcc-warnings was given. +if test ${enable_gcc_warnings+y} +then : + enableval=$enable_gcc_warnings; case $enable_gcc_warnings in + yes|no) ;; + *) as_fn_error $? "invalid value for --gcc-warnings: $enable_gcc_warnings" "$LINENO" 5;; + esac +else $as_nop + enable_gcc_warnings=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS="$gl_save_compiler_FLAGS" + if test "$enable_gcc_warnings" = yes; then + ENABLE_GCC_WARNINGS_TRUE= + ENABLE_GCC_WARNINGS_FALSE='#' +else + ENABLE_GCC_WARNINGS_TRUE='#' + ENABLE_GCC_WARNINGS_FALSE= fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Wno_deprecated" >&5 -$as_echo "$gl_cv_warn_cxx__Wno_deprecated" >&6; } -if test "x$gl_cv_warn_cxx__Wno_deprecated" = xyes; then : - as_fn_append WNO_DEPRECATED_CXXFLAGS " -Wno-deprecated" -fi + +if test "$enable_gcc_warnings" = yes; then + # -Wno-tautological-constant-out-of-range-compare for Clang 3.3 and + # 3.4 on GNU/Linux that choke on intprops.h's INT_MULTIPLY_WRAPV, + # etc. + # + # ICC: -wr188 + # + # 1669 warnings warnings_default = + # ../src/complain.c(318): error #188: enumerated type mixed with another type + # 1670 Wconflicts_sr | Wconflicts_rr | Wdeprecated | Wother; + # 1671 ^ + # 1672 + # 1673../src/complain.c(393): error #188: enumerated type mixed with another type + # 1674 warnings w = 1 << wbit; + # 1675 ^ + # + # ICC: -wr3179 + # + # char const *usefulness + # = rule_useless_in_grammar_p (&rules[r]) ? "useless-in-grammar" + # : rule_useless_in_parser_p (&rules[r]) ? "useless-in-parser" + # : "useful"; + # + # gives + # + # error #3179: deprecated conversion of string literal to char* (should be const char*) + # + # ICC: -wr2259 (that's in C, in spite of what the error messages which seems to be about C++). + # error #2259: non-pointer conversion from "int" to "yybool={signed char}" may lose significant bits + # yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR; + # ^ + warn_common='-Wall -Wextra + -Wcast-align -Wchar-subscripts + -fparse-all-comments -Wdocumentation + -Wformat -Wimplicit-fallthrough -Wmismatched-dealloc -Wnull-dereference + -Wno-sign-compare -Wno-tautological-constant-out-of-range-compare + -Wpointer-arith -Wshadow -Wstrict-aliasing + -Wwrite-strings + -wr188 -wr2259 -wr3179' + warn_c='-Wbad-function-cast + -Wmissing-prototypes + -Wstrict-prototypes' + warn_cxx='-Wextra-semi -Wnoexcept -Wold-style-cast -Wundefined-func-template + -Wweak-vtables' + # Warnings for the test suite only. + # + # -fno-color-diagnostics: Clang's use of colors in the error + # messages is confusing the tests looking at the compiler's output + # (e.g., synclines.at). + # + # -Wno-keyword-macro: We use the "#define private public" dirty + # trick in the test suite to check some private implementation + # details for lalr1.cc. + warn_tests='-Wundef -pedantic -Wconversion + -Wdeprecated -Wsign-compare -Wsign-conversion + -Wtautological-constant-out-of-range-compare + -fno-color-diagnostics + -Wno-keyword-macro' - CXXFLAGS=$save_CXXFLAGS ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -fi + # Clang supports many of GCC's -W options, but only issues warnings + # on the ones it does not recognize. In that case, gl_WARN_ADD + # thinks the option is supported, and unknown options are then added + # to CFLAGS. But then, when -Werror is added in the test suite for + # instance, the warning about the unknown option turns into an + # error. + # + # This should be addressed by gnulib's gl_WARN_ADD, but in the + # meanwhile, turn warnings about unknown options into errors in + # CFLAGS, and restore CFLAGS after the tests. + save_CFLAGS=$CFLAGS + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Werror -Wunknown-warning-option" >&5 +printf %s "checking whether C compiler handles -Werror -Wunknown-warning-option... " >&6; } +if test ${gl_cv_warn_c__Werror__Wunknown_warning_option+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_save_compiler_FLAGS="$CFLAGS" + as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Werror -Wunknown-warning-option" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - int test_array[CHAR_BIT]; + int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compile a simple C program -See \`config.log' for more details" "$LINENO" 5; } +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_warn_c__Werror__Wunknown_warning_option=yes +else $as_nop + gl_cv_warn_c__Werror__Wunknown_warning_option=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - BISON_C_WORKS=: +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$gl_save_compiler_FLAGS" +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Werror__Wunknown_warning_option" >&5 +printf "%s\n" "$gl_cv_warn_c__Werror__Wunknown_warning_option" >&6; } +if test "x$gl_cv_warn_c__Werror__Wunknown_warning_option" = xyes +then : + gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror' +else $as_nop + gl_unknown_warnings_are_errors= +fi -ac_ext=c + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports POSIXLY_CORRECT=1" >&5 -$as_echo_n "checking whether $CC supports POSIXLY_CORRECT=1... " >&6; } -if ${bison_cv_c_supports_posixly_correct+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }' -case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" conftest.$ac_ext + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Werror=unknown-warning-option" >&5 +printf %s "checking whether C compiler handles -Werror=unknown-warning-option... " >&6; } +if test ${gl_cv_warn_c__Werror_unknown_warning_option+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_save_compiler_FLAGS="$CFLAGS" + as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Werror=unknown-warning-option" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - bison_cv_c_supports_posixly_correct=yes -else - bison_cv_c_supports_posixly_correct=no +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_warn_c__Werror_unknown_warning_option=yes +else $as_nop + gl_cv_warn_c__Werror_unknown_warning_option=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -case $gl_had_POSIXLY_CORRECT in - exported) ;; - yes) { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;}; POSIXLY_CORRECT=1 ;; - *) { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;} ;; -esac + CFLAGS="$gl_save_compiler_FLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bison_cv_c_supports_posixly_correct" >&5 -$as_echo "$bison_cv_c_supports_posixly_correct" >&6; } -case $bison_cv_c_supports_posixly_correct in - yes) C_COMPILER_POSIXLY_CORRECT=true +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Werror_unknown_warning_option" >&5 +printf "%s\n" "$gl_cv_warn_c__Werror_unknown_warning_option" >&6; } +if test "x$gl_cv_warn_c__Werror_unknown_warning_option" = xyes +then : + as_fn_append CFLAGS " -Werror=unknown-warning-option" +fi + + + # Accept this warning only if it is not too touchy (e.g., clang 3.3 + # and 3.4). + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wunreachable-code" >&5 +printf %s "checking whether C compiler handles -Wunreachable-code... " >&6; } +if test ${gl_cv_warn_c__Wunreachable_code+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_save_compiler_FLAGS="$CFLAGS" + as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wunreachable-code" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +if (sizeof (long) < sizeof (int)) return 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_warn_c__Wunreachable_code=yes +else $as_nop + gl_cv_warn_c__Wunreachable_code=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$gl_save_compiler_FLAGS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wunreachable_code" >&5 +printf "%s\n" "$gl_cv_warn_c__Wunreachable_code" >&6; } +if test "x$gl_cv_warn_c__Wunreachable_code" = xyes +then : + as_fn_append WARN_CFLAGS " -Wunreachable-code" +fi + + + for i in $warn_common $warn_c; + do + + +as_gl_Warn=`printf "%s\n" "gl_cv_warn_c_$i" | $as_tr_sh` +gl_positive="$i" +case $gl_positive in + -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;; +esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles $i" >&5 +printf %s "checking whether C compiler handles $i... " >&6; } +if eval test \${$as_gl_Warn+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_save_compiler_FLAGS="$CFLAGS" + as_fn_append CFLAGS " $gl_unknown_warnings_are_errors $gl_positive" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$as_gl_Warn=yes" +else $as_nop + eval "$as_gl_Warn=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$gl_save_compiler_FLAGS" + +fi +eval ac_res=\$$as_gl_Warn + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_gl_Warn"\" = x"yes" +then : + as_fn_append WARN_CFLAGS " $i" +fi + + + done + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Werror" >&5 +printf %s "checking whether C compiler handles -Werror... " >&6; } +if test ${gl_cv_warn_c__Werror+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_save_compiler_FLAGS="$CFLAGS" + as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_warn_c__Werror=yes +else $as_nop + gl_cv_warn_c__Werror=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$gl_save_compiler_FLAGS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Werror" >&5 +printf "%s\n" "$gl_cv_warn_c__Werror" >&6; } +if test "x$gl_cv_warn_c__Werror" = xyes +then : + as_fn_append WERROR_CFLAGS " -Werror" +fi + + + + # Warnings for the test suite, and maybe for bison if GCC is modern + # enough. + test $lv_cv_gcc_pragma_push_works = yes && + as_fn_append WARN_CFLAGS " $WARN_CFLAGS_TEST" + + # Warnings for the test suite only. + for i in $warn_tests -Wincompatible-pointer-types; + do + + +as_gl_Warn=`printf "%s\n" "gl_cv_warn_c_$i" | $as_tr_sh` +gl_positive="$i" +case $gl_positive in + -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;; +esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles $i" >&5 +printf %s "checking whether C compiler handles $i... " >&6; } +if eval test \${$as_gl_Warn+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_save_compiler_FLAGS="$CFLAGS" + as_fn_append CFLAGS " $gl_unknown_warnings_are_errors $gl_positive" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$as_gl_Warn=yes" +else $as_nop + eval "$as_gl_Warn=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$gl_save_compiler_FLAGS" + +fi +eval ac_res=\$$as_gl_Warn + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_gl_Warn"\" = x"yes" +then : + as_fn_append WARN_CFLAGS_TEST " $i" +fi + + + done + CFLAGS=$save_CFLAGS + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + save_CXXFLAGS=$CXXFLAGS + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Werror=unknown-warning-option" >&5 +printf %s "checking whether C++ compiler handles -Werror=unknown-warning-option... " >&6; } +if test ${gl_cv_warn_cxx__Werror_unknown_warning_option+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_save_compiler_FLAGS="$CXXFLAGS" + as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Werror=unknown-warning-option" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + gl_cv_warn_cxx__Werror_unknown_warning_option=yes +else $as_nop + gl_cv_warn_cxx__Werror_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CXXFLAGS="$gl_save_compiler_FLAGS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Werror_unknown_warning_option" >&5 +printf "%s\n" "$gl_cv_warn_cxx__Werror_unknown_warning_option" >&6; } +if test "x$gl_cv_warn_cxx__Werror_unknown_warning_option" = xyes +then : + as_fn_append CXXFLAGS " -Werror=unknown-warning-option" +fi + + + for i in $warn_common $warn_cxx; + do + + +as_gl_Warn=`printf "%s\n" "gl_cv_warn_cxx_$i" | $as_tr_sh` +gl_positive="$i" +case $gl_positive in + -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;; +esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles $i" >&5 +printf %s "checking whether C++ compiler handles $i... " >&6; } +if eval test \${$as_gl_Warn+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_save_compiler_FLAGS="$CXXFLAGS" + as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors $gl_positive" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + eval "$as_gl_Warn=yes" +else $as_nop + eval "$as_gl_Warn=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CXXFLAGS="$gl_save_compiler_FLAGS" + +fi +eval ac_res=\$$as_gl_Warn + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_gl_Warn"\" = x"yes" +then : + as_fn_append WARN_CXXFLAGS " $i" +fi + + + done + # Accept this warning only if it is not too touchy (e.g., clang 3.3 + # and 3.4). + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Wunreachable-code" >&5 +printf %s "checking whether C++ compiler handles -Wunreachable-code... " >&6; } +if test ${gl_cv_warn_cxx__Wunreachable_code+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_save_compiler_FLAGS="$CXXFLAGS" + as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Wunreachable-code" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +if (sizeof (long) < sizeof (int)) return 1; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + gl_cv_warn_cxx__Wunreachable_code=yes +else $as_nop + gl_cv_warn_cxx__Wunreachable_code=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CXXFLAGS="$gl_save_compiler_FLAGS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Wunreachable_code" >&5 +printf "%s\n" "$gl_cv_warn_cxx__Wunreachable_code" >&6; } +if test "x$gl_cv_warn_cxx__Wunreachable_code" = xyes +then : + as_fn_append WARN_CXXFLAGS " -Wunreachable-code" +fi + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Wzero-as-null-pointer-constant" >&5 +printf %s "checking whether C++ compiler handles -Wzero-as-null-pointer-constant... " >&6; } +if test ${gl_cv_warn_cxx__Wzero_as_null_pointer_constant+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_save_compiler_FLAGS="$CXXFLAGS" + as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Wzero-as-null-pointer-constant" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +nullptr + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + gl_cv_warn_cxx__Wzero_as_null_pointer_constant=yes +else $as_nop + gl_cv_warn_cxx__Wzero_as_null_pointer_constant=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CXXFLAGS="$gl_save_compiler_FLAGS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Wzero_as_null_pointer_constant" >&5 +printf "%s\n" "$gl_cv_warn_cxx__Wzero_as_null_pointer_constant" >&6; } +if test "x$gl_cv_warn_cxx__Wzero_as_null_pointer_constant" = xyes +then : + as_fn_append WARN_CXXFLAGS " -Wzero-as-null-pointer-constant" +fi + + + # Before GCC6, the pragmas don't work well enough to neutralize + # this warning. + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Wuseless-cast" >&5 +printf %s "checking whether C++ compiler handles -Wuseless-cast... " >&6; } +if test ${gl_cv_warn_cxx__Wuseless_cast+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_save_compiler_FLAGS="$CXXFLAGS" + as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Wuseless-cast" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + #if defined __GNUC__ && ! defined __ICC && ! defined __clang__ && __GNUC__ < 6 + syntax error + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + gl_cv_warn_cxx__Wuseless_cast=yes +else $as_nop + gl_cv_warn_cxx__Wuseless_cast=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CXXFLAGS="$gl_save_compiler_FLAGS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Wuseless_cast" >&5 +printf "%s\n" "$gl_cv_warn_cxx__Wuseless_cast" >&6; } +if test "x$gl_cv_warn_cxx__Wuseless_cast" = xyes +then : + as_fn_append WARN_CXXFLAGS " -Wuseless-cast" +fi + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Werror" >&5 +printf %s "checking whether C++ compiler handles -Werror... " >&6; } +if test ${gl_cv_warn_cxx__Werror+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_save_compiler_FLAGS="$CXXFLAGS" + as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + gl_cv_warn_cxx__Werror=yes +else $as_nop + gl_cv_warn_cxx__Werror=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CXXFLAGS="$gl_save_compiler_FLAGS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Werror" >&5 +printf "%s\n" "$gl_cv_warn_cxx__Werror" >&6; } +if test "x$gl_cv_warn_cxx__Werror" = xyes +then : + as_fn_append WERROR_CXXFLAGS " -Werror" +fi + + + # Warnings for the test suite only. + for i in $warn_tests; + do + + +as_gl_Warn=`printf "%s\n" "gl_cv_warn_cxx_$i" | $as_tr_sh` +gl_positive="$i" +case $gl_positive in + -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;; +esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles $i" >&5 +printf %s "checking whether C++ compiler handles $i... " >&6; } +if eval test \${$as_gl_Warn+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_save_compiler_FLAGS="$CXXFLAGS" + as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors $gl_positive" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + eval "$as_gl_Warn=yes" +else $as_nop + eval "$as_gl_Warn=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CXXFLAGS="$gl_save_compiler_FLAGS" + +fi +eval ac_res=\$$as_gl_Warn + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_gl_Warn"\" = x"yes" +then : + as_fn_append WARN_CXXFLAGS_TEST " $i" +fi + + + done + # Too many compilers complain about Flex generated code. + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Wno-error" >&5 +printf %s "checking whether C++ compiler handles -Wno-error... " >&6; } +if test ${gl_cv_warn_cxx__Wno_error+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_save_compiler_FLAGS="$CXXFLAGS" + as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + gl_cv_warn_cxx__Wno_error=yes +else $as_nop + gl_cv_warn_cxx__Wno_error=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CXXFLAGS="$gl_save_compiler_FLAGS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Wno_error" >&5 +printf "%s\n" "$gl_cv_warn_cxx__Wno_error" >&6; } +if test "x$gl_cv_warn_cxx__Wno_error" = xyes +then : + as_fn_append FLEX_SCANNER_CXXFLAGS " -Wno-error" +fi + + + # Clang++ deprecates compiling C. + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler handles -Wno-deprecated" >&5 +printf %s "checking whether C++ compiler handles -Wno-deprecated... " >&6; } +if test ${gl_cv_warn_cxx__Wno_deprecated+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_save_compiler_FLAGS="$CXXFLAGS" + as_fn_append CXXFLAGS " $gl_unknown_warnings_are_errors -Wdeprecated" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + gl_cv_warn_cxx__Wno_deprecated=yes +else $as_nop + gl_cv_warn_cxx__Wno_deprecated=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CXXFLAGS="$gl_save_compiler_FLAGS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_cxx__Wno_deprecated" >&5 +printf "%s\n" "$gl_cv_warn_cxx__Wno_deprecated" >&6; } +if test "x$gl_cv_warn_cxx__Wno_deprecated" = xyes +then : + as_fn_append WNO_DEPRECATED_CXXFLAGS " -Wno-deprecated" +fi + + + CXXFLAGS=$save_CXXFLAGS + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + int test_array[CHAR_BIT]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compile a simple C program +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + BISON_C_WORKS=: + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports POSIXLY_CORRECT=1" >&5 +printf %s "checking whether $CC supports POSIXLY_CORRECT=1... " >&6; } +if test ${bison_cv_c_supports_posixly_correct+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }' +case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + bison_cv_c_supports_posixly_correct=yes +else $as_nop + bison_cv_c_supports_posixly_correct=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +case $gl_had_POSIXLY_CORRECT in + exported) ;; + yes) { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;}; POSIXLY_CORRECT=1 ;; + *) { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;} ;; +esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bison_cv_c_supports_posixly_correct" >&5 +printf "%s\n" "$bison_cv_c_supports_posixly_correct" >&6; } +case $bison_cv_c_supports_posixly_correct in + yes) C_COMPILER_POSIXLY_CORRECT=true ;; no) C_COMPILER_POSIXLY_CORRECT=false ;; @@ -10024,11 +12202,12 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX builds executables that work" >&5 -$as_echo_n "checking whether $CXX builds executables that work... " >&6; } -if ${bison_cv_cxx_works+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX builds executables that work" >&5 +printf %s "checking whether $CXX builds executables that work... " >&6; } +if test ${bison_cv_cxx_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -10038,13 +12217,14 @@ bison_cv_cxx_works=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + + #include #include #include #include using namespace std; int -main () +main (void) { std::cerr << ""; cout << ""; @@ -10059,29 +12239,33 @@ return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : if { ac_try='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_objext $LIBS >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - if test "$cross_compiling" = yes; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + if test "$cross_compiling" = yes +then : bison_cv_cxx_works=cross -else +else $as_nop if { ac_try='./conftest$ac_exeext' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : bison_cv_cxx_works=yes fi fi fi rm -f conftest$ac_exeext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -10089,8 +12273,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bison_cv_cxx_works" >&5 -$as_echo "$bison_cv_cxx_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bison_cv_cxx_works" >&5 +printf "%s\n" "$bison_cv_cxx_works" >&6; } case $bison_cv_cxx_works in yes) BISON_CXX_WORKS=':';; @@ -10113,11 +12297,12 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports POSIXLY_CORRECT=1" >&5 -$as_echo_n "checking whether $CXX supports POSIXLY_CORRECT=1... " >&6; } -if ${bison_cv_cxx_supports_posixly_correct+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports POSIXLY_CORRECT=1" >&5 +printf %s "checking whether $CXX supports POSIXLY_CORRECT=1... " >&6; } +if test ${bison_cv_cxx_supports_posixly_correct+y} +then : + printf %s "(cached) " >&6 +else $as_nop gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }' case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" &5 -$as_echo "$bison_cv_cxx_supports_posixly_correct" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bison_cv_cxx_supports_posixly_correct" >&5 +printf "%s\n" "$bison_cv_cxx_supports_posixly_correct" >&6; } case $bison_cv_cxx_supports_posixly_correct in yes) CXX_COMPILER_POSIXLY_CORRECT=true ;; @@ -10173,11 +12359,12 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$DC"; then ac_cv_prog_DC="$DC" # Let the user override the test. else @@ -10185,11 +12372,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10200,11 +12391,11 @@ fi DC=$ac_cv_prog_DC if test -n "$DC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DC" >&5 -$as_echo "$DC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DC" >&5 +printf "%s\n" "$DC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -10215,11 +12406,12 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DCFLAGS+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DCFLAGS+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$DCFLAGS"; then ac_cv_prog_DCFLAGS="$DCFLAGS" # Let the user override the test. else @@ -10227,11 +12419,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DCFLAGS="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10242,11 +12438,11 @@ fi DCFLAGS=$ac_cv_prog_DCFLAGS if test -n "$DCFLAGS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DCFLAGS" >&5 -$as_echo "$DCFLAGS" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DCFLAGS" >&5 +printf "%s\n" "$DCFLAGS" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -10274,12 +12470,13 @@ _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then : + $EGREP "yes" >/dev/null 2>&1 +then : CLASSPATH_SEPARATOR=';' -else +else $as_nop CLASSPATH_SEPARATOR=':' fi -rm -f conftest* +rm -rf conftest* source_version=1.7 test -n "$source_version" || { @@ -10334,8 +12531,8 @@ echo } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Java compiler" >&5 -$as_echo_n "checking for Java compiler... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Java compiler" >&5 +printf %s "checking for Java compiler... " >&6; } CONF_JAVAC= HAVE_JAVAC_ENVVAR= HAVE_GCJ_C= @@ -10354,23 +12551,23 @@ if $JAVAC --version 2>/dev/null | sed -e 1q | grep gcj > /dev/null; then if $JAVAC --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^4\.[012]/d' | grep '^[4-9]' >/dev/null; then rm -f conftest.class - if { echo "$as_me:10357: $JAVAC -d . conftest.java" >&5 + if { echo "$as_me:12554: $JAVAC -d . conftest.java" >&5 $JAVAC -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then rm -f conftest.class rm -f conftestfail.class - if { echo "$as_me:10364: $JAVAC -fsource=$source_version -d . conftest.java" >&5 + if { echo "$as_me:12561: $JAVAC -fsource=$source_version -d . conftest.java" >&5 $JAVAC -fsource="$source_version" -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5 \ - && { echo "$as_me:10369: $JAVAC -d . conftestfail.java" >&5 + && { echo "$as_me:12566: $JAVAC -d . conftestfail.java" >&5 $JAVAC -d . conftestfail.java >&5 2>&1 } \ && test -f conftestfail.class \ - && ! { echo "$as_me:10373: $JAVAC -fsource=$source_version -d . conftestfail.java" >&5 + && ! { echo "$as_me:12570: $JAVAC -fsource=$source_version -d . conftestfail.java" >&5 $JAVAC -fsource="$source_version" -d . conftestfail.java >&5 2>&1 }; then CONF_JAVAC="$JAVAC -fsource=$source_version" @@ -10384,7 +12581,7 @@ else rm -f conftest.class rm -f conftestfail.class - if { echo "$as_me:10387: $JAVAC -fsource=$source_version -ftarget=$target_version -d . conftest.java" >&5 + if { echo "$as_me:12584: $JAVAC -fsource=$source_version -ftarget=$target_version -d . conftest.java" >&5 $JAVAC -fsource="$source_version" -ftarget="$target_version" -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ @@ -10397,7 +12594,7 @@ else if test "$target_version" = 1.4 && test "$source_version" = 1.4; then rm -f conftest.class - if { echo "$as_me:10400: $JAVAC -d . conftest.java" >&5 + if { echo "$as_me:12597: $JAVAC -d . conftest.java" >&5 $JAVAC -d . conftest.java >&5 2>&1 } \ && test -f conftest.class; then @@ -10409,7 +12606,7 @@ if test "$target_version" = 1.4 && test "$source_version" = 1.3; then javac_works= rm -f conftest.class - if { echo "$as_me:10412: $JAVAC -d . conftest.java" >&5 + if { echo "$as_me:12609: $JAVAC -d . conftest.java" >&5 $JAVAC -d . conftest.java >&5 2>&1 } \ && test -f conftest.class; then @@ -10417,7 +12614,7 @@ fi javac_noassert_works= rm -f conftest.class - if { echo "$as_me:10420: $JAVAC -fno-assert -d . conftest.java" >&5 + if { echo "$as_me:12617: $JAVAC -fno-assert -d . conftest.java" >&5 $JAVAC -fno-assert -d . conftest.java >&5 2>&1 } \ && test -f conftest.class; then @@ -10425,11 +12622,11 @@ fi if test -n "$javac_works" && test -n "$javac_noassert_works"; then rm -f conftestfail.class - if { echo "$as_me:10428: $JAVAC -d . conftestfail.java" >&5 + if { echo "$as_me:12625: $JAVAC -d . conftestfail.java" >&5 $JAVAC -d . conftestfail.java >&5 2>&1 } \ && test -f conftestfail.class \ - && ! { echo "$as_me:10432: $JAVAC -fno-assert -d . conftestfail.java" >&5 + && ! { echo "$as_me:12629: $JAVAC -fno-assert -d . conftestfail.java" >&5 $JAVAC -fno-assert -d . conftestfail.java >&5 2>&1 }; then javac_works= @@ -10457,23 +12654,23 @@ esac fi rm -f conftest.class - if { echo "$as_me:10460: $JAVAC -d . conftest.java" >&5 + if { echo "$as_me:12657: $JAVAC -d . conftest.java" >&5 $JAVAC -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then rm -f conftest.class rm -f conftestfail.class - if { echo "$as_me:10467: $JAVAC -source $source_version -d . conftest.java" >&5 + if { echo "$as_me:12664: $JAVAC -source $source_version -d . conftest.java" >&5 $JAVAC -source "$source_version" -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5 \ - && { echo "$as_me:10472: $JAVAC -d . conftestfail.java" >&5 + && { echo "$as_me:12669: $JAVAC -d . conftestfail.java" >&5 $JAVAC -d . conftestfail.java >&5 2>&1 } \ && test -f conftestfail.class \ - && ! { echo "$as_me:10476: $JAVAC -source $source_version -d . conftestfail.java" >&5 + && ! { echo "$as_me:12673: $JAVAC -source $source_version -d . conftestfail.java" >&5 $JAVAC -source "$source_version" -d . conftestfail.java >&5 2>&1 }; then CONF_JAVAC="$JAVAC -source $source_version" @@ -10486,23 +12683,23 @@ fi else rm -f conftest.class - if { echo "$as_me:10489: $JAVAC -target $target_version -d . conftest.java" >&5 + if { echo "$as_me:12686: $JAVAC -target $target_version -d . conftest.java" >&5 $JAVAC -target "$target_version" -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then rm -f conftest.class rm -f conftestfail.class - if { echo "$as_me:10496: $JAVAC -target $target_version -source $source_version -d . conftest.java" >&5 + if { echo "$as_me:12693: $JAVAC -target $target_version -source $source_version -d . conftest.java" >&5 $JAVAC -target "$target_version" -source "$source_version" -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5 \ - && { echo "$as_me:10501: $JAVAC -target $target_version -d . conftestfail.java" >&5 + && { echo "$as_me:12698: $JAVAC -target $target_version -d . conftestfail.java" >&5 $JAVAC -target "$target_version" -d . conftestfail.java >&5 2>&1 } \ && test -f conftestfail.class \ - && ! { echo "$as_me:10505: $JAVAC -target $target_version -source $source_version -d . conftestfail.java" >&5 + && ! { echo "$as_me:12702: $JAVAC -target $target_version -source $source_version -d . conftestfail.java" >&5 $JAVAC -target "$target_version" -source "$source_version" -d . conftestfail.java >&5 2>&1 }; then CONF_JAVAC="$JAVAC -target $target_version -source $source_version" @@ -10515,7 +12712,7 @@ fi else rm -f conftest.class - if { echo "$as_me:10518: $JAVAC -target $target_version -source $source_version -d . conftest.java" >&5 + if { echo "$as_me:12715: $JAVAC -target $target_version -source $source_version -d . conftest.java" >&5 $JAVAC -target "$target_version" -source "$source_version" -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ @@ -10532,9 +12729,10 @@ # Extract the first word of "gcj", so it can be a program name with args. set dummy gcj; ac_word=$2 : -if ${ac_cv_prog_HAVE_GCJ_IN_PATH+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${ac_cv_prog_HAVE_GCJ_IN_PATH+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$HAVE_GCJ_IN_PATH"; then ac_cv_prog_HAVE_GCJ_IN_PATH="$HAVE_GCJ_IN_PATH" # Let the user override the test. else @@ -10542,11 +12740,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_HAVE_GCJ_IN_PATH="yes" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10566,9 +12768,10 @@ # Extract the first word of "javac", so it can be a program name with args. set dummy javac; ac_word=$2 : -if ${ac_cv_prog_HAVE_JAVAC_IN_PATH+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${ac_cv_prog_HAVE_JAVAC_IN_PATH+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$HAVE_JAVAC_IN_PATH"; then ac_cv_prog_HAVE_JAVAC_IN_PATH="$HAVE_JAVAC_IN_PATH" # Let the user override the test. else @@ -10576,11 +12779,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_HAVE_JAVAC_IN_PATH="yes" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10600,9 +12807,10 @@ # Extract the first word of "jikes", so it can be a program name with args. set dummy jikes; ac_word=$2 : -if ${ac_cv_prog_HAVE_JIKES_IN_PATH+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${ac_cv_prog_HAVE_JIKES_IN_PATH+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$HAVE_JIKES_IN_PATH"; then ac_cv_prog_HAVE_JIKES_IN_PATH="$HAVE_JIKES_IN_PATH" # Let the user override the test. else @@ -10610,11 +12818,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_HAVE_JIKES_IN_PATH="yes" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10633,28 +12845,28 @@ if test -z "$HAVE_JAVACOMP" && test -n "$HAVE_GCJ_IN_PATH"; then if gcj --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^3\.[01]/d' | grep '^[3-9]' >/dev/null; then - if { echo "$as_me:10636: gcj -C -d . conftestlib.java" >&5 + if { echo "$as_me:12848: gcj -C -d . conftestlib.java" >&5 gcj -C -d . conftestlib.java >&5 2>&1 }; then if gcj --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^4\.[012]/d' | grep '^[4-9]' >/dev/null; then rm -f conftest.class - if { echo "$as_me:10641: gcj -C -d . conftest.java" >&5 + if { echo "$as_me:12853: gcj -C -d . conftest.java" >&5 gcj -C -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then rm -f conftest.class rm -f conftestfail.class - if { echo "$as_me:10648: gcj -C -fsource=$source_version -d . conftest.java" >&5 + if { echo "$as_me:12860: gcj -C -fsource=$source_version -d . conftest.java" >&5 gcj -C -fsource="$source_version" -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5 \ - && { echo "$as_me:10653: gcj -C -d . conftestfail.java" >&5 + && { echo "$as_me:12865: gcj -C -d . conftestfail.java" >&5 gcj -C -d . conftestfail.java >&5 2>&1 } \ && test -f conftestfail.class \ - && ! { echo "$as_me:10657: gcj -C -fsource=$source_version -d . conftestfail.java" >&5 + && ! { echo "$as_me:12869: gcj -C -fsource=$source_version -d . conftestfail.java" >&5 gcj -C -fsource="$source_version" -d . conftestfail.java >&5 2>&1 }; then CONF_JAVAC="gcj -C -fsource=$source_version" @@ -10668,7 +12880,7 @@ else rm -f conftest.class rm -f conftestfail.class - if { echo "$as_me:10671: gcj -C -fsource=$source_version -ftarget=$target_version -d . conftest.java" >&5 + if { echo "$as_me:12883: gcj -C -fsource=$source_version -ftarget=$target_version -d . conftest.java" >&5 gcj -C -fsource="$source_version" -ftarget="$target_version" -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ @@ -10681,7 +12893,7 @@ else if test "$target_version" = 1.4 && test "$source_version" = 1.4; then rm -f conftest.class - if { echo "$as_me:10684: gcj -C -d . conftest.java" >&5 + if { echo "$as_me:12896: gcj -C -d . conftest.java" >&5 gcj -C -d . conftest.java >&5 2>&1 } \ && test -f conftest.class; then @@ -10692,7 +12904,7 @@ else if test "$target_version" = 1.4 && test "$source_version" = 1.3; then rm -f conftest.class - if { echo "$as_me:10695: gcj -C -fno-assert -d . conftest.java" >&5 + if { echo "$as_me:12907: gcj -C -fno-assert -d . conftest.java" >&5 gcj -C -fno-assert -d . conftest.java >&5 2>&1 } \ && test -f conftest.class; then @@ -10701,7 +12913,7 @@ HAVE_JAVACOMP=1 else rm -f conftest.class - if { echo "$as_me:10704: gcj -C -d . conftest.java" >&5 + if { echo "$as_me:12916: gcj -C -d . conftest.java" >&5 gcj -C -d . conftest.java >&5 2>&1 } \ && test -f conftest.class; then @@ -10726,23 +12938,23 @@ esac fi rm -f conftest.class - if { echo "$as_me:10729: javac -d . conftest.java" >&5 + if { echo "$as_me:12941: javac -d . conftest.java" >&5 javac -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then rm -f conftest.class rm -f conftestfail.class - if { echo "$as_me:10736: javac -source $source_version -d . conftest.java" >&5 + if { echo "$as_me:12948: javac -source $source_version -d . conftest.java" >&5 javac -source "$source_version" -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5 \ - && { echo "$as_me:10741: javac -d . conftestfail.java" >&5 + && { echo "$as_me:12953: javac -d . conftestfail.java" >&5 javac -d . conftestfail.java >&5 2>&1 } \ && test -f conftestfail.class \ - && ! { echo "$as_me:10745: javac -source $source_version -d . conftestfail.java" >&5 + && ! { echo "$as_me:12957: javac -source $source_version -d . conftestfail.java" >&5 javac -source "$source_version" -d . conftestfail.java >&5 2>&1 }; then CONF_JAVAC="javac -source $source_version" @@ -10755,23 +12967,23 @@ fi else rm -f conftest.class - if { echo "$as_me:10758: javac -target $target_version -d . conftest.java" >&5 + if { echo "$as_me:12970: javac -target $target_version -d . conftest.java" >&5 javac -target "$target_version" -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5; then rm -f conftest.class rm -f conftestfail.class - if { echo "$as_me:10765: javac -target $target_version -source $source_version -d . conftest.java" >&5 + if { echo "$as_me:12977: javac -target $target_version -source $source_version -d . conftest.java" >&5 javac -target "$target_version" -source "$source_version" -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&5 \ - && { echo "$as_me:10770: javac -target $target_version -d . conftestfail.java" >&5 + && { echo "$as_me:12982: javac -target $target_version -d . conftestfail.java" >&5 javac -target "$target_version" -d . conftestfail.java >&5 2>&1 } \ && test -f conftestfail.class \ - && ! { echo "$as_me:10774: javac -target $target_version -source $source_version -d . conftestfail.java" >&5 + && ! { echo "$as_me:12986: javac -target $target_version -source $source_version -d . conftestfail.java" >&5 javac -target "$target_version" -source "$source_version" -d . conftestfail.java >&5 2>&1 }; then CONF_JAVAC="javac -target $target_version -source $source_version" @@ -10784,7 +12996,7 @@ fi else rm -f conftest.class - if { echo "$as_me:10787: javac -target $target_version -source $source_version -d . conftest.java" >&5 + if { echo "$as_me:12999: javac -target $target_version -source $source_version -d . conftest.java" >&5 javac -target "$target_version" -source "$source_version" -d . conftest.java >&5 2>&1 } \ && test -f conftest.class \ @@ -10821,2751 +13033,16221 @@ else ac_result="no" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_result" >&5 -$as_echo "$ac_result" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_result" >&5 +printf "%s\n" "$ac_result" >&6; } + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Java virtual machine" >&5 +printf %s "checking for Java virtual machine... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if defined _WIN32 || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + CLASSPATH_SEPARATOR=';' +else $as_nop + CLASSPATH_SEPARATOR=':' +fi +rm -rf conftest* + + CONF_JAVA= + HAVE_JAVA_ENVVAR= + HAVE_GIJ= + HAVE_JAVA= + HAVE_JRE= + HAVE_JVIEW= + HAVE_JAVAEXEC=1 + if test -n "$JAVA"; then + HAVE_JAVA_ENVVAR=1 + CONF_JAVA="$JAVA" + else + # Extract the first word of "gij", so it can be a program name with args. +set dummy gij; ac_word=$2 +: +if test ${ac_cv_prog_HAVE_GIJ_IN_PATH+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$HAVE_GIJ_IN_PATH"; then + ac_cv_prog_HAVE_GIJ_IN_PATH="$HAVE_GIJ_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_GIJ_IN_PATH="yes" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +HAVE_GIJ_IN_PATH=$ac_cv_prog_HAVE_GIJ_IN_PATH +if test -n "$HAVE_GIJ_IN_PATH"; then + : +else + : +fi + + + # Extract the first word of "java", so it can be a program name with args. +set dummy java; ac_word=$2 +: +if test ${ac_cv_prog_HAVE_JAVA_IN_PATH+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$HAVE_JAVA_IN_PATH"; then + ac_cv_prog_HAVE_JAVA_IN_PATH="$HAVE_JAVA_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_JAVA_IN_PATH="yes" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +HAVE_JAVA_IN_PATH=$ac_cv_prog_HAVE_JAVA_IN_PATH +if test -n "$HAVE_JAVA_IN_PATH"; then + : +else + : +fi + + + # Extract the first word of "jre", so it can be a program name with args. +set dummy jre; ac_word=$2 +: +if test ${ac_cv_prog_HAVE_JRE_IN_PATH+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$HAVE_JRE_IN_PATH"; then + ac_cv_prog_HAVE_JRE_IN_PATH="$HAVE_JRE_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_JRE_IN_PATH="yes" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +HAVE_JRE_IN_PATH=$ac_cv_prog_HAVE_JRE_IN_PATH +if test -n "$HAVE_JRE_IN_PATH"; then + : +else + : +fi + + + # Extract the first word of "jview", so it can be a program name with args. +set dummy jview; ac_word=$2 +: +if test ${ac_cv_prog_HAVE_JVIEW_IN_PATH+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$HAVE_JVIEW_IN_PATH"; then + ac_cv_prog_HAVE_JVIEW_IN_PATH="$HAVE_JVIEW_IN_PATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_JVIEW_IN_PATH="yes" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +HAVE_JVIEW_IN_PATH=$ac_cv_prog_HAVE_JVIEW_IN_PATH +if test -n "$HAVE_JVIEW_IN_PATH"; then + : +else + : +fi + + + + export CLASSPATH + if test -n "$HAVE_GIJ_IN_PATH" \ + && gij --version >/dev/null 2>/dev/null \ + ; then + HAVE_GIJ=1 + CONF_JAVA="gij" + else + if test -n "$HAVE_JAVA_IN_PATH" \ + && java -version >/dev/null 2>/dev/null \ + ; then + HAVE_JAVA=1 + CONF_JAVA="java" + else + if test -n "$HAVE_JRE_IN_PATH" \ + && (jre >/dev/null 2>/dev/null || test $? = 1) \ + ; then + HAVE_JRE=1 + CONF_JAVA="jre" + else + if test -n "$HAVE_JVIEW_IN_PATH" \ + && (jview -? >/dev/null 2>/dev/null || test $? = 1) \ + ; then + HAVE_JVIEW=1 + CONF_JAVA="jview" + else + HAVE_JAVAEXEC= + fi + fi + fi + fi + + fi + if test -n "$HAVE_JAVAEXEC"; then + ac_result="$CONF_JAVA" + else + ac_result="no" + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_result" >&5 +printf "%s\n" "$ac_result" >&6; } + + + + + + + + + + if test x"$CONF_JAVAC" != x && test x"$CONF_JAVA" != x; then + ENABLE_JAVA_TRUE= + ENABLE_JAVA_FALSE='#' +else + ENABLE_JAVA_TRUE='#' + ENABLE_JAVA_FALSE= +fi + + + +# Check whether --enable-yacc was given. +if test ${enable_yacc+y} +then : + enableval=$enable_yacc; +else $as_nop + enable_yacc=yes +fi + + if test "$enable_yacc" = yes; then + ENABLE_YACC_TRUE= + ENABLE_YACC_FALSE='#' +else + ENABLE_YACC_TRUE='#' + ENABLE_YACC_FALSE= +fi + +ac_config_files="$ac_config_files src/yacc" + + +# Checks for programs. + +DOT=${DOT-"${am_missing_run}dot"} + +for ac_prog in flex lex +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LEX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LEX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LEX=$ac_cv_prog_LEX +if test -n "$LEX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 +printf "%s\n" "$LEX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$LEX" && break +done +test -n "$LEX" || LEX=":" + +if test "x$LEX" != "x:"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether lex is flex" >&5 +printf %s "checking whether lex is flex... " >&6; } +if test ${ac_cv_prog_lex_is_flex+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat >conftest.l <<_ACEOF +%option debug nodefault noinput nounput noyywrap never-interactive +%x SC_CONF_TEST +%% +a { BEGIN SC_CONF_TEST; } +_ACEOF +if { { ac_try="$LEX conftest.l" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$LEX conftest.l") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + ac_cv_prog_lex_is_flex=yes +else + ac_cv_prog_lex_is_flex=no +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_is_flex" >&5 +printf "%s\n" "$ac_cv_prog_lex_is_flex" >&6; } + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether flex supports --header=FILE" >&5 +printf %s "checking whether flex supports --header=FILE... " >&6; } +if test ${ac_cv_prog_lex_supports_header_opt+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if { { ac_try="$LEX --header=conftest.h conftest.l" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$LEX --header=conftest.h conftest.l") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + ac_cv_prog_lex_supports_header_opt=yes +else + ac_cv_prog_lex_supports_header_opt=no +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_supports_header_opt" >&5 +printf "%s\n" "$ac_cv_prog_lex_supports_header_opt" >&6; } +if test "$ac_cv_prog_lex_supports_header_opt" = yes; then + FLEX_SUPPORTS_HEADER_OPT=true +else + FLEX_SUPPORTS_HEADER_OPT=false +fi + + +cat >conftest.l <<_ACEOF +%% +a { ECHO; } +b { REJECT; } +c { yymore (); } +d { yyless (1); } +e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ + yyless ((input () != 0)); } +f { unput (yytext[0]); } +. { BEGIN INITIAL; } +%% +#ifdef YYTEXT_POINTER +extern char *yytext; +#endif +int +main (void) +{ + return ! yylex () + ! yywrap (); +} +_ACEOF +{ { ac_try="$LEX conftest.l" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$LEX conftest.l") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 +printf %s "checking lex output file root... " >&6; } +if test ${ac_cv_prog_lex_root+y} +then : + printf %s "(cached) " >&6 +else $as_nop + +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 +printf "%s\n" "$ac_cv_prog_lex_root" >&6; } +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root + +if test -z "${LEXLIB+set}"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 +printf %s "checking lex library... " >&6; } +if test ${ac_cv_lib_lex+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ac_save_LIBS=$LIBS + ac_cv_lib_lex='none needed' + for ac_lib in '' -lfl -ll; do + LIBS="$ac_lib $ac_save_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +`cat $LEX_OUTPUT_ROOT.c` +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_lex=$ac_lib +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + test "$ac_cv_lib_lex" != 'none needed' && break + done + LIBS=$ac_save_LIBS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 +printf "%s\n" "$ac_cv_lib_lex" >&6; } + test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 +printf %s "checking whether yytext is a pointer... " >&6; } +if test ${ac_cv_prog_lex_yytext_pointer+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # POSIX says lex can declare yytext either as a pointer or an array; the +# default is implementation-dependent. Figure out which it is, since +# not all implementations provide the %pointer and %array declarations. +ac_cv_prog_lex_yytext_pointer=no +ac_save_LIBS=$LIBS +LIBS="$LEXLIB $ac_save_LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define YYTEXT_POINTER 1 +`cat $LEX_OUTPUT_ROOT.c` +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_prog_lex_yytext_pointer=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_save_LIBS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 +printf "%s\n" "$ac_cv_prog_lex_yytext_pointer" >&6; } +if test $ac_cv_prog_lex_yytext_pointer = yes; then + +printf "%s\n" "#define YYTEXT_POINTER 1" >>confdefs.h + +fi +rm -f conftest.l $LEX_OUTPUT_ROOT.c + +fi +LEX_IS_FLEX=`test "$ac_cv_prog_lex_is_flex" = yes && echo true || echo false` + +if ! "$LEX_IS_FLEX" || test "X$LEX" = X:; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: bypassing lex because flex is required" >&5 +printf "%s\n" "$as_me: WARNING: bypassing lex because flex is required" >&2;} + LEX=: +fi + if $LEX_IS_FLEX && $FLEX_SUPPORTS_HEADER_OPT; then + FLEX_WORKS_TRUE= + FLEX_WORKS_FALSE='#' +else + FLEX_WORKS_TRUE='#' + FLEX_WORKS_FALSE= +fi + + if $LEX_IS_FLEX && $FLEX_SUPPORTS_HEADER_OPT && test $bison_cv_cxx_works = yes; then + FLEX_CXX_WORKS_TRUE= + FLEX_CXX_WORKS_FALSE='#' +else + FLEX_CXX_WORKS_TRUE='#' + FLEX_CXX_WORKS_FALSE= +fi + +for ac_prog in 'bison -y' byacc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_YACC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_YACC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +YACC=$ac_cv_prog_YACC +if test -n "$YACC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 +printf "%s\n" "$YACC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU M4 that supports accurate traces" >&5 +printf %s "checking for GNU M4 that supports accurate traces... " >&6; } +if test ${ac_cv_path_M4+y} +then : + printf %s "(cached) " >&6 +else $as_nop + rm -f conftest.m4f +ac_had_posixly_correct=${POSIXLY_CORRECT:+yes} +{ POSIXLY_CORRECT=; unset POSIXLY_CORRECT;} +if test -z "$M4"; then + ac_path_M4_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in m4 gm4 gnum4 + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_M4="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_M4" || continue + # Root out GNU M4 1.4.5, as well as non-GNU m4 that ignore -t, -F. + # Root out GNU M4 1.4.15 with buggy false negative replacement strstr. + # Root out Glibc 2.9 - 2.12 and GNU M4 1.4.11 - 1.4.15 with buggy + # false positive strstr. + ac_snippet=change'quote(<,>)in''dir(,mac,bug)' + ac_snippet=${ac_snippet}pat'subst(a,\(b\)\|\(a\),\1)d'nl + ac_snippet=${ac_snippet}${as_nl}if'else(in''dex(..wi.d.,.d.),-1,bug)' + ac_snippet=${ac_snippet}${as_nl}if'else(in''dex(;:11-:12-:12-:12-:12-:12-:12-:12-:12.:12.:12.:12.:12.:12.:12.:12.:12-,:12-:12-:12-:12-:12-:12-:12-:12-),-1,,strstr-bug2)' + test -z "`$ac_path_M4 -F conftest.m4f &1`" \ + && test -z "`printf "%s\n" $ac_snippet | $ac_path_M4 --trace=mac 2>&1`" \ + && test -f conftest.m4f \ + && ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=: + rm -f conftest.m4f + $ac_path_M4_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_M4"; then + as_fn_error $? "no acceptable m4 could be found in \$PATH. +GNU M4 1.4.6 or later is required; 1.4.16 or newer is recommended. +GNU M4 1.4.15 uses a buggy replacement strstr on some systems. +Glibc 2.9 - 2.12 and GNU M4 1.4.11 - 1.4.15 have another strstr bug." "$LINENO" 5 + fi +else + ac_cv_path_M4=$M4 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_M4" >&5 +printf "%s\n" "$ac_cv_path_M4" >&6; } + M4=$ac_cv_path_M4 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $ac_cv_path_M4 accepts --gnu" >&5 +printf %s "checking whether $ac_cv_path_M4 accepts --gnu... " >&6; } +if test ${ac_cv_prog_gnu_m4_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case `$M4 --help < /dev/null 2>&1` in + *--gnu*) ac_cv_prog_gnu_m4_gnu=yes ;; + *) ac_cv_prog_gnu_m4_gnu=no ;; + esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gnu_m4_gnu" >&5 +printf "%s\n" "$ac_cv_prog_gnu_m4_gnu" >&6; } + if test "$ac_cv_prog_gnu_m4_gnu" = yes; then + M4_GNU=--gnu + else + M4_GNU= + fi + + if test x$ac_had_posixly_correct = xyes; then + POSIXLY_CORRECT=: + if test $ac_cv_prog_gnu_m4_gnu = no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: the version of M4 that was found does not support -g" >&5 +printf "%s\n" "$as_me: WARNING: the version of M4 that was found does not support -g" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using it with POSIXLY_CORRECT set may cause problems" >&5 +printf "%s\n" "$as_me: WARNING: using it with POSIXLY_CORRECT set may cause problems" >&2;} + fi + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how m4 supports trace files" >&5 +printf %s "checking how m4 supports trace files... " >&6; } +if test ${ac_cv_prog_gnu_m4_debugfile+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case `$M4 --help < /dev/null 2>&1` in + *debugfile*) ac_cv_prog_gnu_m4_debugfile=--debugfile ;; + *) ac_cv_prog_gnu_m4_debugfile=--error-output ;; + esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gnu_m4_debugfile" >&5 +printf "%s\n" "$ac_cv_prog_gnu_m4_debugfile" >&6; } + M4_DEBUGFILE=$ac_cv_prog_gnu_m4_debugfile + + + +printf "%s\n" "#define M4 \"$M4\"" >>confdefs.h + + +printf "%s\n" "#define M4_GNU_OPTION \"$M4_GNU\"" >>confdefs.h + +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PERL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $PERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_PERL="$PERL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PERL="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PERL=$ac_cv_path_PERL +if test -n "$PERL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 +printf "%s\n" "$PERL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + +HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"} + +# Extract the first word of "xsltproc", so it can be a program name with args. +set dummy xsltproc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_XSLTPROC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $XSLTPROC in + [\\/]* | ?:[\\/]*) + ac_cv_path_XSLTPROC="$XSLTPROC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_XSLTPROC="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +XSLTPROC=$ac_cv_path_XSLTPROC +if test -n "$XSLTPROC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $XSLTPROC" >&5 +printf "%s\n" "$XSLTPROC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + + +# Checks for header files. + + + +# Checks for compiler characteristics. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +printf %s "checking for inline... " >&6; } +if test ${ac_cv_c_inline+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo (void) {return 0; } +$ac_kw foo_t foo (void) {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +printf "%s\n" "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + + +# Gnulib (later checks). Putting them here rather than right after +# gl_EARLY avoids some redundant checks. + + + + + + + + + # Check whether --enable-cross-guesses was given. +if test ${enable_cross_guesses+y} +then : + enableval=$enable_cross_guesses; if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: invalid argument supplied to --enable-cross-guesses" >&5 +printf "%s\n" "$as_me: WARNING: invalid argument supplied to --enable-cross-guesses" >&2;} + enableval=conservative + fi + gl_cross_guesses="$enableval" +else $as_nop + gl_cross_guesses=conservative +fi + + if test $gl_cross_guesses = risky; then + gl_cross_guess_normal="guessing yes" + gl_cross_guess_inverted="guessing no" + else + gl_cross_guess_normal="guessing no" + gl_cross_guess_inverted="guessing yes" + fi + LIBC_FATAL_STDERR_=1 + export LIBC_FATAL_STDERR_ + + + + HAVE_CHOWN=1; + HAVE_COPY_FILE_RANGE=1; + HAVE_DUP3=1; + HAVE_EUIDACCESS=1; + HAVE_EXECVPE=1; + HAVE_FACCESSAT=1; + HAVE_FCHDIR=1; + HAVE_FCHOWNAT=1; + HAVE_FDATASYNC=1; + HAVE_FSYNC=1; + HAVE_FTRUNCATE=1; + HAVE_GETDTABLESIZE=1; + HAVE_GETENTROPY=1; + HAVE_GETGROUPS=1; + HAVE_GETHOSTNAME=1; + HAVE_GETLOGIN=1; + HAVE_GETPAGESIZE=1; + HAVE_GETPASS=1; + HAVE_GROUP_MEMBER=1; + HAVE_LCHOWN=1; + HAVE_LINK=1; + HAVE_LINKAT=1; + HAVE_PIPE=1; + HAVE_PIPE2=1; + HAVE_PREAD=1; + HAVE_PWRITE=1; + HAVE_READLINK=1; + HAVE_READLINKAT=1; + HAVE_SETHOSTNAME=1; + HAVE_SLEEP=1; + HAVE_SYMLINK=1; + HAVE_SYMLINKAT=1; + HAVE_UNLINKAT=1; + HAVE_USLEEP=1; + HAVE_DECL_ENVIRON=1; + HAVE_DECL_EXECVPE=1; + HAVE_DECL_FCHDIR=1; + HAVE_DECL_FDATASYNC=1; + HAVE_DECL_GETDOMAINNAME=1; + HAVE_DECL_GETLOGIN=1; + HAVE_DECL_GETLOGIN_R=1; + HAVE_DECL_GETPAGESIZE=1; + HAVE_DECL_GETUSERSHELL=1; + HAVE_DECL_SETHOSTNAME=1; + HAVE_DECL_TRUNCATE=1; + HAVE_DECL_TTYNAME_R=1; + HAVE_OS_H=0; + HAVE_SYS_PARAM_H=0; + REPLACE_ACCESS=0; + REPLACE_CHOWN=0; + REPLACE_CLOSE=0; + REPLACE_DUP=0; + REPLACE_DUP2=0; + REPLACE_EXECL=0; + REPLACE_EXECLE=0; + REPLACE_EXECLP=0; + REPLACE_EXECV=0; + REPLACE_EXECVE=0; + REPLACE_EXECVP=0; + REPLACE_EXECVPE=0; + REPLACE_FACCESSAT=0; + REPLACE_FCHOWNAT=0; + REPLACE_FTRUNCATE=0; + REPLACE_GETCWD=0; + REPLACE_GETDOMAINNAME=0; + REPLACE_GETDTABLESIZE=0; + REPLACE_GETLOGIN_R=0; + REPLACE_GETGROUPS=0; + REPLACE_GETPAGESIZE=0; + REPLACE_GETPASS=0; + REPLACE_ISATTY=0; + REPLACE_LCHOWN=0; + REPLACE_LINK=0; + REPLACE_LINKAT=0; + REPLACE_LSEEK=0; + REPLACE_PREAD=0; + REPLACE_PWRITE=0; + REPLACE_READ=0; + REPLACE_READLINK=0; + REPLACE_READLINKAT=0; + REPLACE_RMDIR=0; + REPLACE_SLEEP=0; + REPLACE_SYMLINK=0; + REPLACE_SYMLINKAT=0; + REPLACE_TRUNCATE=0; + REPLACE_TTYNAME_R=0; + REPLACE_UNLINK=0; + REPLACE_UNLINKAT=0; + REPLACE_USLEEP=0; + REPLACE_WRITE=0; + UNISTD_H_HAVE_SYS_RANDOM_H=0; + UNISTD_H_HAVE_WINSOCK2_H=0; + UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; + + + + + GL_GNULIB_ACCESS=0 + + + + GL_GNULIB_CHDIR=0 + + + + GL_GNULIB_CHOWN=0 + + + + GL_GNULIB_CLOSE=0 + + + + GL_GNULIB_COPY_FILE_RANGE=0 + + + + GL_GNULIB_DUP=0 + + + + GL_GNULIB_DUP2=0 + + + + GL_GNULIB_DUP3=0 + + + + GL_GNULIB_ENVIRON=0 + + + + GL_GNULIB_EUIDACCESS=0 + + + + GL_GNULIB_EXECL=0 + + + + GL_GNULIB_EXECLE=0 + + + + GL_GNULIB_EXECLP=0 + + + + GL_GNULIB_EXECV=0 + + + + GL_GNULIB_EXECVE=0 + + + + GL_GNULIB_EXECVP=0 + + + + GL_GNULIB_EXECVPE=0 + + + + GL_GNULIB_FACCESSAT=0 + + + + GL_GNULIB_FCHDIR=0 + + + + GL_GNULIB_FCHOWNAT=0 + + + + GL_GNULIB_FDATASYNC=0 + + + + GL_GNULIB_FSYNC=0 + + + + GL_GNULIB_FTRUNCATE=0 + + + + GL_GNULIB_GETCWD=0 + + + + GL_GNULIB_GETDOMAINNAME=0 + + + + GL_GNULIB_GETDTABLESIZE=0 + + + + GL_GNULIB_GETENTROPY=0 + + + + GL_GNULIB_GETGROUPS=0 + + + + GL_GNULIB_GETHOSTNAME=0 + + + + GL_GNULIB_GETLOGIN=0 + + + + GL_GNULIB_GETLOGIN_R=0 + + + + GL_GNULIB_GETOPT_POSIX=0 + + + + GL_GNULIB_GETPAGESIZE=0 + + + + GL_GNULIB_GETPASS=0 + + + + GL_GNULIB_GETUSERSHELL=0 + + + + GL_GNULIB_GROUP_MEMBER=0 + + + + GL_GNULIB_ISATTY=0 + + + + GL_GNULIB_LCHOWN=0 + + + + GL_GNULIB_LINK=0 + + + + GL_GNULIB_LINKAT=0 + + + + GL_GNULIB_LSEEK=0 + + + + GL_GNULIB_PIPE=0 + + + + GL_GNULIB_PIPE2=0 + + + + GL_GNULIB_PREAD=0 + + + + GL_GNULIB_PWRITE=0 + + + + GL_GNULIB_READ=0 + + + + GL_GNULIB_READLINK=0 + + + + GL_GNULIB_READLINKAT=0 + + + + GL_GNULIB_RMDIR=0 + + + + GL_GNULIB_SETHOSTNAME=0 + + + + GL_GNULIB_SLEEP=0 + + + + GL_GNULIB_SYMLINK=0 + + + + GL_GNULIB_SYMLINKAT=0 + + + + GL_GNULIB_TRUNCATE=0 + + + + GL_GNULIB_TTYNAME_R=0 + + + + GL_GNULIB_UNISTD_H_GETOPT=0 + + + + GL_GNULIB_UNISTD_H_NONBLOCKING=0 + + + + GL_GNULIB_UNISTD_H_SIGPIPE=0 + + + + GL_GNULIB_UNLINK=0 + + + + GL_GNULIB_UNLINKAT=0 + + + + GL_GNULIB_USLEEP=0 + + + + GL_GNULIB_WRITE=0 + + + + GL_GNULIB_MDA_ACCESS=1 + + + + GL_GNULIB_MDA_CHDIR=1 + + + + GL_GNULIB_MDA_CLOSE=1 + + + + GL_GNULIB_MDA_DUP=1 + + + + GL_GNULIB_MDA_DUP2=1 + + + + GL_GNULIB_MDA_EXECL=1 + + + + GL_GNULIB_MDA_EXECLE=1 + + + + GL_GNULIB_MDA_EXECLP=1 + + + + GL_GNULIB_MDA_EXECV=1 + + + + GL_GNULIB_MDA_EXECVE=1 + + + + GL_GNULIB_MDA_EXECVP=1 + + + + GL_GNULIB_MDA_EXECVPE=1 + + + + GL_GNULIB_MDA_GETCWD=1 + + + + GL_GNULIB_MDA_GETPID=1 + + + + GL_GNULIB_MDA_ISATTY=1 + + + + GL_GNULIB_MDA_LSEEK=1 + + + + GL_GNULIB_MDA_READ=1 + + + + GL_GNULIB_MDA_RMDIR=1 + + + + GL_GNULIB_MDA_SWAB=1 + + + + GL_GNULIB_MDA_UNLINK=1 + + + + GL_GNULIB_MDA_WRITE=1 + + + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define size_t unsigned int" >>confdefs.h + +fi + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 +printf %s "checking for working alloca.h... " >&6; } +if test ${ac_cv_working_alloca_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +char *p = (char *) alloca (2 * sizeof (int)); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_working_alloca_h=yes +else $as_nop + ac_cv_working_alloca_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 +printf "%s\n" "$ac_cv_working_alloca_h" >&6; } +if test $ac_cv_working_alloca_h = yes; then + +printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 +printf %s "checking for alloca... " >&6; } +if test ${ac_cv_func_alloca_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test $ac_cv_working_alloca_h = yes; then + ac_cv_func_alloca_works=yes +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#ifndef alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# else +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + +int +main (void) +{ +char *p = (char *) alloca (1); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_func_alloca_works=yes +else $as_nop + ac_cv_func_alloca_works=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +printf "%s\n" "$ac_cv_func_alloca_works" >&6; } +fi + +if test $ac_cv_func_alloca_works = yes; then + +printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + + + + + +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext + +printf "%s\n" "#define C_ALLOCA 1" >>confdefs.h + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 +printf %s "checking stack direction for C alloca... " >&6; } +if test ${ac_cv_c_stack_direction+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + ac_cv_c_stack_direction=0 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +find_stack_direction (int *addr, int depth) +{ + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; +} + +int +main (int argc, char **argv) +{ + return find_stack_direction (0, argc + !argv + 20) < 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_c_stack_direction=1 +else $as_nop + ac_cv_c_stack_direction=-1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 +printf "%s\n" "$ac_cv_c_stack_direction" >&6; } +printf "%s\n" "#define STACK_DIRECTION $ac_cv_c_stack_direction" >>confdefs.h + + +fi + + + HAVE__EXIT=1; + HAVE_ALIGNED_ALLOC=1; + HAVE_ATOLL=1; + HAVE_CANONICALIZE_FILE_NAME=1; + HAVE_DECL_ECVT=1; + HAVE_DECL_FCVT=1; + HAVE_DECL_GCVT=1; + HAVE_DECL_GETLOADAVG=1; + HAVE_GETSUBOPT=1; + HAVE_GRANTPT=1; + HAVE_INITSTATE=1; + HAVE_DECL_INITSTATE=1; + HAVE_MBTOWC=1; + HAVE_MKDTEMP=1; + HAVE_MKOSTEMP=1; + HAVE_MKOSTEMPS=1; + HAVE_MKSTEMP=1; + HAVE_MKSTEMPS=1; + HAVE_POSIX_MEMALIGN=1; + HAVE_POSIX_OPENPT=1; + HAVE_PTSNAME=1; + HAVE_PTSNAME_R=1; + HAVE_QSORT_R=1; + HAVE_RANDOM=1; + HAVE_RANDOM_H=1; + HAVE_RANDOM_R=1; + HAVE_REALLOCARRAY=1; + HAVE_REALPATH=1; + HAVE_RPMATCH=1; + HAVE_SECURE_GETENV=1; + HAVE_SETENV=1; + HAVE_DECL_SETENV=1; + HAVE_SETSTATE=1; + HAVE_DECL_SETSTATE=1; + HAVE_STRTOD=1; + HAVE_STRTOL=1; + HAVE_STRTOLD=1; + HAVE_STRTOLL=1; + HAVE_STRTOUL=1; + HAVE_STRTOULL=1; + HAVE_STRUCT_RANDOM_DATA=1; + HAVE_SYS_LOADAVG_H=0; + HAVE_UNLOCKPT=1; + HAVE_DECL_UNSETENV=1; + REPLACE_ALIGNED_ALLOC=0; + REPLACE_CALLOC=0; + REPLACE_CANONICALIZE_FILE_NAME=0; + REPLACE_FREE=0; + REPLACE_INITSTATE=0; + REPLACE_MALLOC=0; + REPLACE_MBTOWC=0; + REPLACE_MKSTEMP=0; + REPLACE_POSIX_MEMALIGN=0; + REPLACE_PTSNAME=0; + REPLACE_PTSNAME_R=0; + REPLACE_PUTENV=0; + REPLACE_QSORT_R=0; + REPLACE_RANDOM=0; + REPLACE_RANDOM_R=0; + REPLACE_REALLOC=0; + REPLACE_REALLOCARRAY=0; + REPLACE_REALPATH=0; + REPLACE_SETENV=0; + REPLACE_SETSTATE=0; + REPLACE_STRTOD=0; + REPLACE_STRTOL=0; + REPLACE_STRTOLD=0; + REPLACE_STRTOLL=0; + REPLACE_STRTOUL=0; + REPLACE_STRTOULL=0; + REPLACE_UNSETENV=0; + REPLACE_WCTOMB=0; + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether malloc is ptrdiff_t safe" >&5 +printf %s "checking whether malloc is ptrdiff_t safe... " >&6; } +if test ${gl_cv_malloc_ptrdiff+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +/* 64-bit ptrdiff_t is so wide that no practical platform + can exceed it. */ + #define WIDE_PTRDIFF (PTRDIFF_MAX >> 31 >> 31 != 0) + + /* On rare machines where size_t fits in ptrdiff_t there + is no problem. */ + #define NARROW_SIZE (SIZE_MAX <= PTRDIFF_MAX) + + /* glibc 2.30 and later malloc refuses to exceed ptrdiff_t + bounds even on 32-bit platforms. We don't know which + non-glibc systems are safe. */ + #define KNOWN_SAFE (2 < __GLIBC__ + (30 <= __GLIBC_MINOR__)) + + #if WIDE_PTRDIFF || NARROW_SIZE || KNOWN_SAFE + return 0; + #else + #error "malloc might not be ptrdiff_t safe" + syntax error + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_malloc_ptrdiff=yes +else $as_nop + gl_cv_malloc_ptrdiff=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_malloc_ptrdiff" >&5 +printf "%s\n" "$gl_cv_malloc_ptrdiff" >&6; } + + + + + test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC=1 + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether malloc, realloc, calloc set errno on failure" >&5 +printf %s "checking whether malloc, realloc, calloc set errno on failure... " >&6; } +if test ${gl_cv_func_malloc_posix+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + case "$host_os" in + mingw*) + gl_cv_func_malloc_posix=no ;; + irix* | solaris*) + + gl_cv_func_malloc_posix=no ;; + *) + gl_cv_func_malloc_posix=yes ;; + esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_malloc_posix" >&5 +printf "%s\n" "$gl_cv_func_malloc_posix" >&6; } + + + + + + if test "$gl_cv_func_malloc_posix" = yes; then + +printf "%s\n" "#define HAVE_MALLOC_POSIX 1" >>confdefs.h + + else + REPLACE_MALLOC=1 + fi + + + + + if test $REPLACE_MALLOC = 1; then + REPLACE_CALLOC=1 + fi + + + + GL_GNULIB__EXIT=0 + + + + GL_GNULIB_ALIGNED_ALLOC=0 + + + + GL_GNULIB_ATOLL=0 + + + + GL_GNULIB_CALLOC_POSIX=0 + + + + GL_GNULIB_CANONICALIZE_FILE_NAME=0 + + + + GL_GNULIB_FREE_POSIX=0 + + + + GL_GNULIB_GETLOADAVG=0 + + + + GL_GNULIB_GETSUBOPT=0 + + + + GL_GNULIB_GRANTPT=0 + + + + GL_GNULIB_MALLOC_POSIX=0 + + + + GL_GNULIB_MBTOWC=0 + + + + GL_GNULIB_MKDTEMP=0 + + + + GL_GNULIB_MKOSTEMP=0 + + + + GL_GNULIB_MKOSTEMPS=0 + + + + GL_GNULIB_MKSTEMP=0 + + + + GL_GNULIB_MKSTEMPS=0 + + + + GL_GNULIB_POSIX_MEMALIGN=0 + + + + GL_GNULIB_POSIX_OPENPT=0 + + + + GL_GNULIB_PTSNAME=0 + + + + GL_GNULIB_PTSNAME_R=0 + + + + GL_GNULIB_PUTENV=0 + + + + GL_GNULIB_QSORT_R=0 + + + + GL_GNULIB_RANDOM=0 + + + + GL_GNULIB_RANDOM_R=0 + + + + GL_GNULIB_REALLOCARRAY=0 + + + + GL_GNULIB_REALLOC_POSIX=0 + + + + GL_GNULIB_REALPATH=0 + + + + GL_GNULIB_RPMATCH=0 + + + + GL_GNULIB_SECURE_GETENV=0 + + + + GL_GNULIB_SETENV=0 + + + + GL_GNULIB_STRTOD=0 + + + + GL_GNULIB_STRTOL=0 + + + + GL_GNULIB_STRTOLD=0 + + + + GL_GNULIB_STRTOLL=0 + + + + GL_GNULIB_STRTOUL=0 + + + + GL_GNULIB_STRTOULL=0 + + + + GL_GNULIB_SYSTEM_POSIX=0 + + + + GL_GNULIB_UNLOCKPT=0 + + + + GL_GNULIB_UNSETENV=0 + + + + GL_GNULIB_WCTOMB=0 + + + + GL_GNULIB_MDA_ECVT=1 + + + + GL_GNULIB_MDA_FCVT=1 + + + + GL_GNULIB_MDA_GCVT=1 + + + + GL_GNULIB_MDA_MKTEMP=1 + + + + GL_GNULIB_MDA_PUTENV=1 + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 +printf %s "checking whether lstat correctly handles trailing slash... " >&6; } +if test ${gl_cv_func_lstat_dereferences_slashed_symlink+y} +then : + printf %s "(cached) " >&6 +else $as_nop + rm -f conftest.sym conftest.file + echo >conftest.file + if test "$cross_compiling" = yes +then : + case "$host_os" in + linux-* | linux) + # Guess yes on Linux systems. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; + *-gnu* | gnu*) + # Guess yes on glibc systems. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; + mingw*) + # Guess no on native Windows. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; + *) + # If we don't know, obey --enable-cross-guesses. + gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ +struct stat sbuf; + if (symlink ("conftest.file", "conftest.sym") != 0) + return 1; + /* Linux will dereference the symlink and fail, as required by + POSIX. That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + return lstat ("conftest.sym/", &sbuf) == 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_lstat_dereferences_slashed_symlink=yes +else $as_nop + gl_cv_func_lstat_dereferences_slashed_symlink=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -f conftest.sym conftest.file + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_lstat_dereferences_slashed_symlink" >&5 +printf "%s\n" "$gl_cv_func_lstat_dereferences_slashed_symlink" >&6; } + case "$gl_cv_func_lstat_dereferences_slashed_symlink" in + *yes) + +printf "%s\n" "#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1" >>confdefs.h + + ;; + esac + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether // is distinct from /" >&5 +printf %s "checking whether // is distinct from /... " >&6; } +if test ${gl_cv_double_slash_root+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test x"$cross_compiling" = xyes ; then + # When cross-compiling, there is no way to tell whether // is special + # short of a list of hosts. However, the only known hosts to date + # that have a distinct // are Apollo DomainOS (too old to port to), + # Cygwin, and z/OS. If anyone knows of another system for which // has + # special semantics and is distinct from /, please report it to + # . + case $host in + *-cygwin | i370-ibm-openedition) + gl_cv_double_slash_root=yes ;; + *) + # Be optimistic and assume that / and // are the same when we + # don't know. + gl_cv_double_slash_root='unknown, assuming no' ;; + esac + else + set x `ls -di / // 2>/dev/null` + if test "$2" = "$4" && wc //dev/null >/dev/null 2>&1; then + gl_cv_double_slash_root=no + else + gl_cv_double_slash_root=yes + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_double_slash_root" >&5 +printf "%s\n" "$gl_cv_double_slash_root" >&6; } + if test "$gl_cv_double_slash_root" = yes; then + +printf "%s\n" "#define DOUBLE_SLASH_IS_DISTINCT_ROOT 1" >>confdefs.h + + fi + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether realpath works" >&5 +printf %s "checking whether realpath works... " >&6; } +if test ${gl_cv_func_realpath_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + rm -rf conftest.a conftest.d + touch conftest.a + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + ln -s conftest.a conftest.l + fi + mkdir conftest.d + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_realpath_works="guessing yes" ;; + # Guess 'nearly' on musl systems. + *-musl*) gl_cv_func_realpath_works="guessing nearly" ;; + # Guess no on Cygwin. + cygwin*) gl_cv_func_realpath_works="guessing no" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_realpath_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_realpath_works="$gl_cross_guess_normal" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +#include +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on Mac OS X. */ +#include +#include +#include +#include +#include +#include +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#elif defined _WIN32 && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include +#include +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} +#else +/* Avoid a crash on POSIX systems. */ +#include +#include +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + _exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif + + #include + #include + #include + +int +main (void) +{ + + int result = 0; + /* This test fails on Solaris 10. */ + { + char *name = realpath ("conftest.a", NULL); + if (!(name && *name == '/')) + result |= 1; + free (name); + } + /* This test fails on older versions of Cygwin. */ + { + char *name = realpath ("conftest.b/../conftest.a", NULL); + if (name != NULL) + result |= 2; + free (name); + } + /* This test fails on Cygwin 2.9. */ + #if HAVE_LSTAT + { + char *name = realpath ("conftest.l/../conftest.a", NULL); + if (name != NULL || errno != ENOTDIR) + result |= 4; + free (name); + } + #endif + /* This test fails on Mac OS X 10.13, OpenBSD 6.0. */ + { + char *name = realpath ("conftest.a/", NULL); + if (name != NULL) + result |= 8; + free (name); + } + /* This test fails on AIX 7, Solaris 10. */ + { + char *name1 = realpath (".", NULL); + char *name2 = realpath ("conftest.d//./..", NULL); + if (! name1 || ! name2 || strcmp (name1, name2)) + result |= 16; + free (name1); + free (name2); + } + #ifdef __linux__ + /* On Linux, // is the same as /. See also double-slash-root.m4. + realpath() should respect this. + This test fails on musl libc 1.2.2. */ + { + char *name = realpath ("//", NULL); + if (! name || strcmp (name, "/")) + result |= 32; + free (name); + } + #endif + return result; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_realpath_works=yes +else $as_nop + case $? in + 32) gl_cv_func_realpath_works=nearly ;; + *) gl_cv_func_realpath_works=no ;; + esac + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -rf conftest.a conftest.l conftest.d + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_realpath_works" >&5 +printf "%s\n" "$gl_cv_func_realpath_works" >&6; } + case "$gl_cv_func_realpath_works" in + *yes) + +printf "%s\n" "#define FUNC_REALPATH_WORKS 1" >>confdefs.h + + ;; + *nearly) + +printf "%s\n" "#define FUNC_REALPATH_NEARLY_WORKS 1" >>confdefs.h + + ;; + esac + + + + + + + + + case "$host_os" in + mingw*) ;; + *) ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" +if test "x$ac_cv_func_getcwd" = xyes +then : + printf "%s\n" "#define HAVE_GETCWD 1" >>confdefs.h + +fi + ;; + esac + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 +printf %s "checking for C/C++ restrict keyword... " >&6; } +if test ${ac_cv_c_restrict+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_c_restrict=no + # Put '__restrict__' first, to avoid problems with glibc and non-GCC; see: + # https://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html + # Put 'restrict' last, because C++ lacks it. + for ac_kw in __restrict__ __restrict _Restrict restrict; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +typedef int *int_ptr; + int foo (int_ptr $ac_kw ip) { return ip[0]; } + int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ + int bar (int ip[$ac_kw]) { return ip[0]; } + +int +main (void) +{ +int s[1]; + int *$ac_kw t = s; + t[0] = 0; + return foo (t) + bar (t); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_restrict=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + test "$ac_cv_c_restrict" != no && break + done + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 +printf "%s\n" "$ac_cv_c_restrict" >&6; } + + case $ac_cv_c_restrict in + restrict) ;; + no) printf "%s\n" "#define restrict /**/" >>confdefs.h + ;; + *) printf "%s\n" "#define restrict $ac_cv_c_restrict" >>confdefs.h + ;; + esac + + + + + + if test $ac_cv_func__set_invalid_parameter_handler = yes; then + HAVE_MSVC_INVALID_PARAMETER_HANDLER=1 + +printf "%s\n" "#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1" >>confdefs.h + + else + HAVE_MSVC_INVALID_PARAMETER_HANDLER=0 + fi + + + + SYS_IOCTL_H_HAVE_WINSOCK2_H=0; + SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; + + REPLACE_IOCTL=0; + + + +gl_mda_defines=' +#if defined _WIN32 && !defined __CYGWIN__ +#define access _access +#define chdir _chdir +#define chmod _chmod +#define close _close +#define creat _creat +#define dup _dup +#define dup2 _dup2 +#define ecvt _ecvt +#define execl _execl +#define execle _execle +#define execlp _execlp +#define execv _execv +#define execve _execve +#define execvp _execvp +#define execvpe _execvpe +#define fcloseall _fcloseall +#define fcvt _fcvt +#define fdopen _fdopen +#define fileno _fileno +#define gcvt _gcvt +#define getcwd _getcwd +#define getpid _getpid +#define getw _getw +#define isatty _isatty +#define j0 _j0 +#define j1 _j1 +#define jn _jn +#define lfind _lfind +#define lsearch _lsearch +#define lseek _lseek +#define memccpy _memccpy +#define mkdir _mkdir +#define mktemp _mktemp +#define open _open +#define putenv _putenv +#define putw _putw +#define read _read +#define rmdir _rmdir +#define strdup _strdup +#define swab _swab +#define tempnam _tempnam +#define tzset _tzset +#define umask _umask +#define unlink _unlink +#define utime _utime +#define wcsdup _wcsdup +#define write _write +#define y0 _y0 +#define y1 _y1 +#define yn _yn +#endif +' + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if environ is properly declared" >&5 +printf %s "checking if environ is properly declared... " >&6; } +if test ${gt_cv_var_environ_declaration+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if HAVE_UNISTD_H + #include + #endif + /* mingw, BeOS, Haiku declare environ in , not in . */ + #include + + typedef struct { int foo; } foo_t; + extern foo_t environ; +int +main (void) +{ +environ.foo = 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gt_cv_var_environ_declaration=no +else $as_nop + gt_cv_var_environ_declaration=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_var_environ_declaration" >&5 +printf "%s\n" "$gt_cv_var_environ_declaration" >&6; } + if test $gt_cv_var_environ_declaration = yes; then + +printf "%s\n" "#define HAVE_ENVIRON_DECL 1" >>confdefs.h + + fi + + + if test $gt_cv_var_environ_declaration != yes; then + HAVE_DECL_ENVIRON=0 + fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the preprocessor supports include_next" >&5 +printf %s "checking whether the preprocessor supports include_next... " >&6; } +if test ${gl_cv_have_include_next+y} +then : + printf %s "(cached) " >&6 +else $as_nop + rm -rf conftestd1a conftestd1b conftestd2 + mkdir conftestd1a conftestd1b conftestd2 + cat < conftestd1a/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include_next +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat < conftestd1b/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include +#include_next +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat < conftestd2/conftest.h +#ifndef DEFINED_IN_CONFTESTD1 +#error "include_next test doesn't work" +#endif +#define DEFINED_IN_CONFTESTD2 +EOF + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_have_include_next=yes +else $as_nop + CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_have_include_next=buggy +else $as_nop + gl_cv_have_include_next=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + rm -rf conftestd1a conftestd1b conftestd2 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_include_next" >&5 +printf "%s\n" "$gl_cv_have_include_next" >&6; } + PRAGMA_SYSTEM_HEADER= + if test $gl_cv_have_include_next = yes; then + INCLUDE_NEXT=include_next + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next + if test -n "$GCC"; then + PRAGMA_SYSTEM_HEADER='#pragma GCC system_header' + fi + else + if test $gl_cv_have_include_next = buggy; then + INCLUDE_NEXT=include + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next + else + INCLUDE_NEXT=include + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include + fi + fi + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether source code line length is unlimited" >&5 +printf %s "checking whether source code line length is unlimited... " >&6; } +if test ${gl_cv_source_line_length_unlimited+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __TANDEM +choke me +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "choke me" >/dev/null 2>&1 +then : + gl_cv_source_line_length_unlimited=no +else $as_nop + gl_cv_source_line_length_unlimited=yes +fi +rm -rf conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_source_line_length_unlimited" >&5 +printf "%s\n" "$gl_cv_source_line_length_unlimited" >&6; } + if test $gl_cv_source_line_length_unlimited = no; then + PRAGMA_COLUMNS="#pragma COLUMNS 10000" + else + PRAGMA_COLUMNS= + fi + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for complete errno.h" >&5 +printf %s "checking for complete errno.h... " >&6; } +if test ${gl_cv_header_errno_h_complete+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#if !defined ETXTBSY +booboo +#endif +#if !defined ENOMSG +booboo +#endif +#if !defined EIDRM +booboo +#endif +#if !defined ENOLINK +booboo +#endif +#if !defined EPROTO +booboo +#endif +#if !defined EMULTIHOP +booboo +#endif +#if !defined EBADMSG +booboo +#endif +#if !defined EOVERFLOW +booboo +#endif +#if !defined ENOTSUP +booboo +#endif +#if !defined ENETRESET +booboo +#endif +#if !defined ECONNABORTED +booboo +#endif +#if !defined ESTALE +booboo +#endif +#if !defined EDQUOT +booboo +#endif +#if !defined ECANCELED +booboo +#endif +#if !defined EOWNERDEAD +booboo +#endif +#if !defined ENOTRECOVERABLE +booboo +#endif +#if !defined EILSEQ +booboo +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "booboo" >/dev/null 2>&1 +then : + gl_cv_header_errno_h_complete=no +else $as_nop + gl_cv_header_errno_h_complete=yes +fi +rm -rf conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_complete" >&5 +printf "%s\n" "$gl_cv_header_errno_h_complete" >&6; } + if test $gl_cv_header_errno_h_complete = yes; then + ERRNO_H='' + else + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_errno_h='<'errno.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_errno_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'errno.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_errno_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_errno_h + gl_cv_next_errno_h='"'$gl_header'"' + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_errno_h" >&5 +printf "%s\n" "$gl_cv_next_errno_h" >&6; } + fi + NEXT_ERRNO_H=$gl_cv_next_errno_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'errno.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_errno_h + fi + NEXT_AS_FIRST_DIRECTIVE_ERRNO_H=$gl_next_as_first_directive + + + + + ERRNO_H='errno.h' + fi + + if test -n "$ERRNO_H"; then + GL_GENERATE_ERRNO_H_TRUE= + GL_GENERATE_ERRNO_H_FALSE='#' +else + GL_GENERATE_ERRNO_H_TRUE='#' + GL_GENERATE_ERRNO_H_FALSE= +fi + + + if test -n "$ERRNO_H"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EMULTIHOP value" >&5 +printf %s "checking for EMULTIHOP value... " >&6; } +if test ${gl_cv_header_errno_h_EMULTIHOP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef EMULTIHOP +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_header_errno_h_EMULTIHOP=yes +else $as_nop + gl_cv_header_errno_h_EMULTIHOP=no +fi +rm -rf conftest* + + if test $gl_cv_header_errno_h_EMULTIHOP = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +#ifdef EMULTIHOP +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_header_errno_h_EMULTIHOP=hidden +fi +rm -rf conftest* + + if test $gl_cv_header_errno_h_EMULTIHOP = hidden; then + if ac_fn_c_compute_int "$LINENO" "EMULTIHOP" "gl_cv_header_errno_h_EMULTIHOP" " +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include +" +then : + +fi + + fi + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_EMULTIHOP" >&5 +printf "%s\n" "$gl_cv_header_errno_h_EMULTIHOP" >&6; } + case $gl_cv_header_errno_h_EMULTIHOP in + yes | no) + EMULTIHOP_HIDDEN=0; EMULTIHOP_VALUE= + ;; + *) + EMULTIHOP_HIDDEN=1; EMULTIHOP_VALUE="$gl_cv_header_errno_h_EMULTIHOP" + ;; + esac + + + fi + + + if test -n "$ERRNO_H"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ENOLINK value" >&5 +printf %s "checking for ENOLINK value... " >&6; } +if test ${gl_cv_header_errno_h_ENOLINK+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef ENOLINK +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_header_errno_h_ENOLINK=yes +else $as_nop + gl_cv_header_errno_h_ENOLINK=no +fi +rm -rf conftest* + + if test $gl_cv_header_errno_h_ENOLINK = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +#ifdef ENOLINK +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_header_errno_h_ENOLINK=hidden +fi +rm -rf conftest* + + if test $gl_cv_header_errno_h_ENOLINK = hidden; then + if ac_fn_c_compute_int "$LINENO" "ENOLINK" "gl_cv_header_errno_h_ENOLINK" " +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include +" +then : + +fi + + fi + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_ENOLINK" >&5 +printf "%s\n" "$gl_cv_header_errno_h_ENOLINK" >&6; } + case $gl_cv_header_errno_h_ENOLINK in + yes | no) + ENOLINK_HIDDEN=0; ENOLINK_VALUE= + ;; + *) + ENOLINK_HIDDEN=1; ENOLINK_VALUE="$gl_cv_header_errno_h_ENOLINK" + ;; + esac + + + fi + + + if test -n "$ERRNO_H"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EOVERFLOW value" >&5 +printf %s "checking for EOVERFLOW value... " >&6; } +if test ${gl_cv_header_errno_h_EOVERFLOW+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef EOVERFLOW +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_header_errno_h_EOVERFLOW=yes +else $as_nop + gl_cv_header_errno_h_EOVERFLOW=no +fi +rm -rf conftest* + + if test $gl_cv_header_errno_h_EOVERFLOW = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +#ifdef EOVERFLOW +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_header_errno_h_EOVERFLOW=hidden +fi +rm -rf conftest* + + if test $gl_cv_header_errno_h_EOVERFLOW = hidden; then + if ac_fn_c_compute_int "$LINENO" "EOVERFLOW" "gl_cv_header_errno_h_EOVERFLOW" " +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include +" +then : + +fi + + fi + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_EOVERFLOW" >&5 +printf "%s\n" "$gl_cv_header_errno_h_EOVERFLOW" >&6; } + case $gl_cv_header_errno_h_EOVERFLOW in + yes | no) + EOVERFLOW_HIDDEN=0; EOVERFLOW_VALUE= + ;; + *) + EOVERFLOW_HIDDEN=1; EOVERFLOW_VALUE="$gl_cv_header_errno_h_EOVERFLOW" + ;; + esac + + + fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 +printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } +if test ${ac_cv_c_undeclared_builtin_options+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CFLAGS=$CFLAGS + ac_cv_c_undeclared_builtin_options='cannot detect' + for ac_arg in '' -fno-builtin; do + CFLAGS="$ac_save_CFLAGS $ac_arg" + # This test program should *not* compile successfully. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +(void) strchr; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + # This test program should compile successfully. + # No library function is consistently available on + # freestanding implementations, so test against a dummy + # declaration. Include always-available headers on the + # off chance that they somehow elicit warnings. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +extern void ac_decl (int, char *); + +int +main (void) +{ +(void) ac_decl (0, (char *) 0); + (void) ac_decl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if test x"$ac_arg" = x +then : + ac_cv_c_undeclared_builtin_options='none needed' +else $as_nop + ac_cv_c_undeclared_builtin_options=$ac_arg +fi + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done + CFLAGS=$ac_save_CFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 +printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } + case $ac_cv_c_undeclared_builtin_options in #( + 'cannot detect') : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot make $CC report undeclared builtins +See \`config.log' for more details" "$LINENO" 5; } ;; #( + 'none needed') : + ac_c_undeclared_builtin_options='' ;; #( + *) : + ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; +esac + +ac_fn_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_strerror_r" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_STRERROR_R $ac_have_decl" >>confdefs.h + + +if test $ac_cv_have_decl_strerror_r = yes; then + # For backward compatibility's sake, define HAVE_STRERROR_R. + # (We used to run AC_CHECK_FUNCS_ONCE for strerror_r, as well + # as AC_CHECK_DECLS_ONCE.) + +printf "%s\n" "#define HAVE_STRERROR_R 1" >>confdefs.h + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 +printf %s "checking whether strerror_r returns char *... " >&6; } +if test ${ac_cv_func_strerror_r_char_p+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ac_cv_func_strerror_r_char_p=no + if test $ac_cv_have_decl_strerror_r = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ + + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + char *p = strerror_r (0, buf, sizeof buf); + return !p || x; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_func_strerror_r_char_p=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 +printf "%s\n" "$ac_cv_func_strerror_r_char_p" >&6; } +if test $ac_cv_func_strerror_r_char_p = yes; then + +printf "%s\n" "#define STRERROR_R_CHAR_P 1" >>confdefs.h + +fi + + + XGETTEXT_EXTRA_OPTIONS= + +ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" +if test "x$ac_cv_type_mode_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define mode_t int" >>confdefs.h + +fi + + + + + + ac_fn_c_check_type "$LINENO" "sig_atomic_t" "ac_cv_type_sig_atomic_t" "#include +" +if test "x$ac_cv_type_sig_atomic_t" = xyes +then : + +printf "%s\n" "#define HAVE_SIG_ATOMIC_T 1" >>confdefs.h + + +else $as_nop + +printf "%s\n" "#define sig_atomic_t int" >>confdefs.h + +fi + + + + HAVE_FCNTL=1; + HAVE_OPENAT=1; + REPLACE_CREAT=0; + REPLACE_FCNTL=0; + REPLACE_OPEN=0; + REPLACE_OPENAT=0; + + + + + GL_GNULIB_CREAT=0 + + + + GL_GNULIB_FCNTL=0 + + + + GL_GNULIB_NONBLOCKING=0 + + + + GL_GNULIB_OPEN=0 + + + + GL_GNULIB_OPENAT=0 + + + + GL_GNULIB_MDA_CREAT=1 + + + + GL_GNULIB_MDA_OPEN=1 + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working fcntl.h" >&5 +printf %s "checking for working fcntl.h... " >&6; } +if test ${gl_cv_header_working_fcntl_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess 'no' on native Windows. + mingw*) gl_cv_header_working_fcntl_h='no' ;; + *) gl_cv_header_working_fcntl_h=cross-compiling ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #if HAVE_UNISTD_H + # include + #else /* on Windows with MSVC */ + # include + # include + # defined sleep(n) _sleep ((n) * 1000) + #endif + #include + + +$gl_mda_defines + + #ifndef O_NOATIME + #define O_NOATIME 0 + #endif + #ifndef O_NOFOLLOW + #define O_NOFOLLOW 0 + #endif + static int const constants[] = + { + O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, + O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY + }; + +int +main (void) +{ + + int result = !constants; + #if HAVE_SYMLINK + { + static char const sym[] = "conftest.sym"; + if (symlink ("/dev/null", sym) != 0) + result |= 2; + else + { + int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); + if (fd >= 0) + { + close (fd); + result |= 4; + } + } + if (unlink (sym) != 0 || symlink (".", sym) != 0) + result |= 2; + else + { + int fd = open (sym, O_RDONLY | O_NOFOLLOW); + if (fd >= 0) + { + close (fd); + result |= 4; + } + } + unlink (sym); + } + #endif + { + static char const file[] = "confdefs.h"; + int fd = open (file, O_RDONLY | O_NOATIME); + if (fd < 0) + result |= 8; + else + { + struct stat st0; + if (fstat (fd, &st0) != 0) + result |= 16; + else + { + char c; + sleep (1); + if (read (fd, &c, 1) != 1) + result |= 24; + else + { + if (close (fd) != 0) + result |= 32; + else + { + struct stat st1; + if (stat (file, &st1) != 0) + result |= 40; + else + if (st0.st_atime != st1.st_atime) + result |= 64; + } + } + } + } + } + return result; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_header_working_fcntl_h=yes +else $as_nop + case $? in #( + 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( + 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( + 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( + *) gl_cv_header_working_fcntl_h='no';; + esac +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_fcntl_h" >&5 +printf "%s\n" "$gl_cv_header_working_fcntl_h" >&6; } + + case $gl_cv_header_working_fcntl_h in #( + *O_NOATIME* | no | cross-compiling) ac_val=0;; #( + *) ac_val=1;; + esac + +printf "%s\n" "#define HAVE_WORKING_O_NOATIME $ac_val" >>confdefs.h + + + case $gl_cv_header_working_fcntl_h in #( + *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( + *) ac_val=1;; + esac + +printf "%s\n" "#define HAVE_WORKING_O_NOFOLLOW $ac_val" >>confdefs.h + + + + ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default +" +if test "x$ac_cv_type_pid_t" = xyes +then : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if defined _WIN64 && !defined __CYGWIN__ + LLP64 + #endif + +int +main (void) +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_pid_type='int' +else $as_nop + ac_pid_type='__int64' +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h + + +fi + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_fcntl_h='<'fcntl.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_fcntl_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'fcntl.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_fcntl_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_fcntl_h + gl_cv_next_fcntl_h='"'$gl_header'"' + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_fcntl_h" >&5 +printf "%s\n" "$gl_cv_next_fcntl_h" >&6; } + fi + NEXT_FCNTL_H=$gl_cv_next_fcntl_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'fcntl.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_fcntl_h + fi + NEXT_AS_FIRST_DIRECTIVE_FCNTL_H=$gl_next_as_first_directive + + + + + + + + + + + + + + + HAVE_MBSLEN=0; + HAVE_EXPLICIT_BZERO=1; + HAVE_FFSL=1; + HAVE_FFSLL=1; + HAVE_DECL_MEMMEM=1; + HAVE_MEMPCPY=1; + HAVE_DECL_MEMRCHR=1; + HAVE_RAWMEMCHR=1; + HAVE_STPCPY=1; + HAVE_STPNCPY=1; + HAVE_STRCHRNUL=1; + HAVE_DECL_STRDUP=1; + HAVE_DECL_STRNDUP=1; + HAVE_DECL_STRNLEN=1; + HAVE_STRPBRK=1; + HAVE_STRSEP=1; + HAVE_STRCASESTR=1; + HAVE_DECL_STRTOK_R=1; + HAVE_DECL_STRERROR_R=1; + HAVE_STRERRORNAME_NP=1; + HAVE_SIGABBREV_NP=1; + HAVE_SIGDESCR_NP=1; + HAVE_DECL_STRSIGNAL=1; + HAVE_STRVERSCMP=1; + REPLACE_FFSLL=0; + REPLACE_MEMCHR=0; + REPLACE_MEMMEM=0; + REPLACE_STPNCPY=0; + REPLACE_STRCHRNUL=0; + REPLACE_STRDUP=0; + REPLACE_STRNCAT=0; + REPLACE_STRNDUP=0; + REPLACE_STRNLEN=0; + REPLACE_STRSTR=0; + REPLACE_STRCASESTR=0; + REPLACE_STRTOK_R=0; + REPLACE_STRERROR=0; + REPLACE_STRERROR_R=0; + REPLACE_STRERRORNAME_NP=0; + REPLACE_STRSIGNAL=0; + UNDEFINE_STRTOK_R=0; + + + + + GL_GNULIB_EXPLICIT_BZERO=0 + + + + GL_GNULIB_FFSL=0 + + + + GL_GNULIB_FFSLL=0 + + + + GL_GNULIB_MEMCHR=0 + + + + GL_GNULIB_MEMMEM=0 + + + + GL_GNULIB_MEMPCPY=0 + + + + GL_GNULIB_MEMRCHR=0 + + + + GL_GNULIB_RAWMEMCHR=0 + + + + GL_GNULIB_STPCPY=0 + + + + GL_GNULIB_STPNCPY=0 + + + + GL_GNULIB_STRCHRNUL=0 + + + + GL_GNULIB_STRDUP=0 + + + + GL_GNULIB_STRNCAT=0 + + + + GL_GNULIB_STRNDUP=0 + + + + GL_GNULIB_STRNLEN=0 + + + + GL_GNULIB_STRPBRK=0 + + + + GL_GNULIB_STRSEP=0 + + + + GL_GNULIB_STRSTR=0 + + + + GL_GNULIB_STRCASESTR=0 + + + + GL_GNULIB_STRTOK_R=0 + + + + GL_GNULIB_MBSLEN=0 + + + + GL_GNULIB_MBSNLEN=0 + + + + GL_GNULIB_MBSCHR=0 + + + + GL_GNULIB_MBSRCHR=0 + + + + GL_GNULIB_MBSSTR=0 + + + + GL_GNULIB_MBSCASECMP=0 + + + + GL_GNULIB_MBSNCASECMP=0 + + + + GL_GNULIB_MBSPCASECMP=0 + + + + GL_GNULIB_MBSCASESTR=0 + + + + GL_GNULIB_MBSCSPN=0 + + + + GL_GNULIB_MBSPBRK=0 + + + + GL_GNULIB_MBSSPN=0 + + + + GL_GNULIB_MBSSEP=0 + + + + GL_GNULIB_MBSTOK_R=0 + + + + GL_GNULIB_STRERROR=0 + + + + GL_GNULIB_STRERROR_R=0 + + + + GL_GNULIB_STRERRORNAME_NP=0 + + + + GL_GNULIB_SIGABBREV_NP=0 + + + + GL_GNULIB_SIGDESCR_NP=0 + + + + GL_GNULIB_STRSIGNAL=0 + + + + GL_GNULIB_STRVERSCMP=0 + + + + GL_GNULIB_MDA_MEMCCPY=1 + + + + GL_GNULIB_MDA_STRDUP=1 + + + + + ac_fn_c_check_func "$LINENO" "eaccess" "ac_cv_func_eaccess" +if test "x$ac_cv_func_eaccess" = xyes +then : + +else $as_nop + +printf "%s\n" "#define eaccess access" >>confdefs.h + +fi + + + + HAVE_DECL_FCLOSEALL=1; + HAVE_DECL_FPURGE=1; + HAVE_DECL_FSEEKO=1; + HAVE_DECL_FTELLO=1; + HAVE_DECL_GETDELIM=1; + HAVE_DECL_GETLINE=1; + HAVE_DECL_OBSTACK_PRINTF=1; + HAVE_DECL_SNPRINTF=1; + HAVE_DECL_VSNPRINTF=1; + HAVE_DPRINTF=1; + HAVE_FSEEKO=1; + HAVE_FTELLO=1; + HAVE_PCLOSE=1; + HAVE_POPEN=1; + HAVE_RENAMEAT=1; + HAVE_VASPRINTF=1; + HAVE_VDPRINTF=1; + REPLACE_DPRINTF=0; + REPLACE_FCLOSE=0; + REPLACE_FDOPEN=0; + REPLACE_FFLUSH=0; + REPLACE_FOPEN=0; + REPLACE_FPRINTF=0; + REPLACE_FPURGE=0; + REPLACE_FREOPEN=0; + REPLACE_FSEEK=0; + REPLACE_FSEEKO=0; + REPLACE_FTELL=0; + REPLACE_FTELLO=0; + REPLACE_GETDELIM=0; + REPLACE_GETLINE=0; + REPLACE_OBSTACK_PRINTF=0; + REPLACE_PERROR=0; + REPLACE_POPEN=0; + REPLACE_PRINTF=0; + REPLACE_REMOVE=0; + REPLACE_RENAME=0; + REPLACE_RENAMEAT=0; + REPLACE_SNPRINTF=0; + REPLACE_SPRINTF=0; + REPLACE_STDIO_READ_FUNCS=0; + REPLACE_STDIO_WRITE_FUNCS=0; + REPLACE_TMPFILE=0; + REPLACE_VASPRINTF=0; + REPLACE_VDPRINTF=0; + REPLACE_VFPRINTF=0; + REPLACE_VPRINTF=0; + REPLACE_VSNPRINTF=0; + REPLACE_VSPRINTF=0; + + + + GL_GNULIB_DPRINTF=0 + + + + GL_GNULIB_FCLOSE=0 + + + + GL_GNULIB_FDOPEN=0 + + + + GL_GNULIB_FFLUSH=0 + + + + GL_GNULIB_FGETC=0 + + + + GL_GNULIB_FGETS=0 + + + + GL_GNULIB_FOPEN=0 + + + + GL_GNULIB_FPRINTF=0 + + + + GL_GNULIB_FPRINTF_POSIX=0 + + + + GL_GNULIB_FPURGE=0 + + + + GL_GNULIB_FPUTC=0 + + + + GL_GNULIB_FPUTS=0 + + + + GL_GNULIB_FREAD=0 + + + + GL_GNULIB_FREOPEN=0 + + + + GL_GNULIB_FSCANF=0 + + + + GL_GNULIB_FSEEK=0 + + + + GL_GNULIB_FSEEKO=0 + + + + GL_GNULIB_FTELL=0 + + + + GL_GNULIB_FTELLO=0 + + + + GL_GNULIB_FWRITE=0 + + + + GL_GNULIB_GETC=0 + + + + GL_GNULIB_GETCHAR=0 + + + + GL_GNULIB_GETDELIM=0 + + + + GL_GNULIB_GETLINE=0 + + + + GL_GNULIB_OBSTACK_PRINTF=0 + + + + GL_GNULIB_OBSTACK_PRINTF_POSIX=0 + + + + GL_GNULIB_PCLOSE=0 + + + + GL_GNULIB_PERROR=0 + + + + GL_GNULIB_POPEN=0 + + + + GL_GNULIB_PRINTF=0 + + + + GL_GNULIB_PRINTF_POSIX=0 + + + + GL_GNULIB_PUTC=0 + + + + GL_GNULIB_PUTCHAR=0 + + + + GL_GNULIB_PUTS=0 + + + + GL_GNULIB_REMOVE=0 + + + + GL_GNULIB_RENAME=0 + + + + GL_GNULIB_RENAMEAT=0 + + + + GL_GNULIB_SCANF=0 + + + + GL_GNULIB_SNPRINTF=0 + + + + GL_GNULIB_SPRINTF_POSIX=0 + + + + GL_GNULIB_STDIO_H_NONBLOCKING=0 + + + + GL_GNULIB_STDIO_H_SIGPIPE=0 + + + + GL_GNULIB_TMPFILE=0 + + + + GL_GNULIB_VASPRINTF=0 + + + + GL_GNULIB_VFSCANF=0 + + + + GL_GNULIB_VSCANF=0 + + + + GL_GNULIB_VDPRINTF=0 + + + + GL_GNULIB_VFPRINTF=0 + + + + GL_GNULIB_VFPRINTF_POSIX=0 + + + + GL_GNULIB_VPRINTF=0 + + + + GL_GNULIB_VPRINTF_POSIX=0 + + + + GL_GNULIB_VSNPRINTF=0 + + + + GL_GNULIB_VSPRINTF_POSIX=0 + + + + GL_GNULIB_MDA_FCLOSEALL=1 + + + + GL_GNULIB_MDA_FDOPEN=1 + + + + GL_GNULIB_MDA_FILENO=1 + + + + GL_GNULIB_MDA_GETW=1 + + + + GL_GNULIB_MDA_PUTW=1 + + + + GL_GNULIB_MDA_TEMPNAM=1 + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdint.h" >&5 +printf %s "checking for stdint.h... " >&6; } +if test ${gl_cv_header_stdint_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include +int +main (void) +{ +uintmax_t i = (uintmax_t) -1; return !i; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_header_stdint_h=yes +else $as_nop + gl_cv_header_stdint_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_h" >&5 +printf "%s\n" "$gl_cv_header_stdint_h" >&6; } + if test $gl_cv_header_stdint_h = yes; then + +printf "%s\n" "#define HAVE_STDINT_H_WITH_UINTMAX 1" >>confdefs.h + + fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inttypes.h" >&5 +printf %s "checking for inttypes.h... " >&6; } +if test ${gl_cv_header_inttypes_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main (void) +{ +uintmax_t i = (uintmax_t) -1; return !i; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_header_inttypes_h=yes +else $as_nop + gl_cv_header_inttypes_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_inttypes_h" >&5 +printf "%s\n" "$gl_cv_header_inttypes_h" >&6; } + if test $gl_cv_header_inttypes_h = yes; then + +printf "%s\n" "#define HAVE_INTTYPES_H_WITH_UINTMAX 1" >>confdefs.h + + fi + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports size specifiers as in C99" >&5 +printf %s "checking whether printf supports size specifiers as in C99... " >&6; } +if test ${gl_cv_func_printf_sizes_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + midnightbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on Mac OS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; + darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on OpenBSD >= 3.9. + openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) + gl_cv_func_printf_sizes_c99="guessing no";; + openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; + solaris*) gl_cv_func_printf_sizes_c99="guessing no";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_sizes_c99="guessing no";; + netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on MSVC, no on mingw. + mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_func_printf_sizes_c99="guessing yes" +else $as_nop + gl_cv_func_printf_sizes_c99="guessing no" +fi +rm -rf conftest* + + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_sizes_c99="$gl_cross_guess_normal";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +#include +#if HAVE_STDINT_H_WITH_UINTMAX +# include +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +# include +#endif +static char buf[100]; +int main () +{ + int result = 0; +#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX + buf[0] = '\0'; + if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 + || strcmp (buf, "12345671 33") != 0) + result |= 1; +#else + result |= 1; +#endif + buf[0] = '\0'; + if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 + || strcmp (buf, "12345672 33") != 0) + result |= 2; + buf[0] = '\0'; + if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 + || strcmp (buf, "12345673 33") != 0) + result |= 4; + buf[0] = '\0'; + if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 + || strcmp (buf, "1.5 33") != 0) + result |= 8; + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_sizes_c99=yes +else $as_nop + gl_cv_func_printf_sizes_c99=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_sizes_c99" >&5 +printf "%s\n" "$gl_cv_func_printf_sizes_c99" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports 'long double' arguments" >&5 +printf %s "checking whether printf supports 'long double' arguments... " >&6; } +if test ${gl_cv_func_printf_long_double+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess no on BeOS. + beos*) gl_cv_func_printf_long_double="guessing no";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_long_double="guessing yes";; + # Guess yes on MSVC, no on mingw. + mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_func_printf_long_double="guessing yes" +else $as_nop + gl_cv_func_printf_long_double="guessing no" +fi +rm -rf conftest* + + ;; + *) gl_cv_func_printf_long_double="guessing yes";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +static char buf[10000]; +int main () +{ + int result = 0; + buf[0] = '\0'; + if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.750000 33") != 0) + result |= 1; + buf[0] = '\0'; + if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.750000e+00 33") != 0) + result |= 2; + buf[0] = '\0'; + if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.75 33") != 0) + result |= 4; + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_long_double=yes +else $as_nop + gl_cv_func_printf_long_double=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_long_double" >&5 +printf "%s\n" "$gl_cv_func_printf_long_double" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports infinite 'double' arguments" >&5 +printf %s "checking whether printf supports infinite 'double' arguments... " >&6; } +if test ${gl_cv_func_printf_infinite+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; + midnightbsd*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on Mac OS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; + darwin*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; + hpux*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_infinite="guessing no";; + netbsd*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on OpenBSD >= 6.0. + openbsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; + openbsd*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_infinite="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_infinite="guessing no";; + # Guess yes on MSVC, no on mingw. + mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_func_printf_infinite="guessing yes" +else $as_nop + gl_cv_func_printf_infinite="guessing no" +fi +rm -rf conftest* + + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_infinite="$gl_cross_guess_normal";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +static int +strisnan (const char *string, size_t start_index, size_t end_index) +{ + if (start_index < end_index) + { + if (string[start_index] == '-') + start_index++; + if (start_index + 3 <= end_index + && memcmp (string + start_index, "nan", 3) == 0) + { + start_index += 3; + if (start_index == end_index + || (string[start_index] == '(' && string[end_index - 1] == ')')) + return 1; + } + } + return 0; +} +static int +have_minus_zero () +{ + static double plus_zero = 0.0; + double minus_zero = - plus_zero; + return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0; +} +static char buf[10000]; +static double zero = 0.0; +int main () +{ + int result = 0; + if (sprintf (buf, "%f", 1.0 / zero) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + result |= 1; + if (sprintf (buf, "%f", -1.0 / zero) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + result |= 1; + if (sprintf (buf, "%f", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 2; + if (sprintf (buf, "%e", 1.0 / zero) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + result |= 4; + if (sprintf (buf, "%e", -1.0 / zero) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + result |= 4; + if (sprintf (buf, "%e", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 8; + if (sprintf (buf, "%g", 1.0 / zero) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + result |= 16; + if (sprintf (buf, "%g", -1.0 / zero) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + result |= 16; + if (sprintf (buf, "%g", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 32; + /* This test fails on HP-UX 10.20. */ + if (have_minus_zero ()) + if (sprintf (buf, "%g", - zero) < 0 + || strcmp (buf, "-0") != 0) + result |= 64; + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_infinite=yes +else $as_nop + gl_cv_func_printf_infinite=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_infinite" >&5 +printf "%s\n" "$gl_cv_func_printf_infinite" >&6; } + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +printf %s "checking whether byte ordering is bigendian... " >&6; } +if test ${ac_cv_c_bigendian+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main (void) +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main (void) +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_bigendian=yes +else $as_nop + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_bigendian=yes +else $as_nop + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes +then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +unsigned short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + unsigned short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + unsigned short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + unsigned short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main (void) +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_c_bigendian=no +else $as_nop + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +printf "%s\n" "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + printf "%s\n" "#define WORDS_BIGENDIAN 1" >>confdefs.h +;; #( + no) + ;; #( + universal) + +printf "%s\n" "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + as_fn_error $? "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + esac + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether long double and double are the same" >&5 +printf %s "checking whether long double and double are the same... " >&6; } +if test ${gl_cv_long_double_equals_double+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +typedef int check[sizeof (long double) == sizeof (double) + && LDBL_MANT_DIG == DBL_MANT_DIG + && LDBL_MAX_EXP == DBL_MAX_EXP + && LDBL_MIN_EXP == DBL_MIN_EXP + ? 1 : -1]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_long_double_equals_double=yes +else $as_nop + gl_cv_long_double_equals_double=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_long_double_equals_double" >&5 +printf "%s\n" "$gl_cv_long_double_equals_double" >&6; } + if test $gl_cv_long_double_equals_double = yes; then + +printf "%s\n" "#define HAVE_SAME_LONG_DOUBLE_AS_DOUBLE 1" >>confdefs.h + + HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=1 + else + HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=0 + fi + + + + + + + + if test -n "$gl_printf_safe"; then + +printf "%s\n" "#define CHECK_PRINTF_SAFE 1" >>confdefs.h + + fi + case "$gl_cv_func_printf_long_double" in + *yes) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports infinite 'long double' arguments" >&5 +printf %s "checking whether printf supports infinite 'long double' arguments... " >&6; } +if test ${gl_cv_func_printf_infinite_long_double+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + case "$host_cpu" in + # Guess no on ia64, x86_64, i386. + ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; + *) + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; + midnightbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; + hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on OpenBSD >= 6.0. + openbsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; + openbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; + # Guess yes on MSVC, no on mingw. + mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_func_printf_infinite_long_double="guessing yes" +else $as_nop + gl_cv_func_printf_infinite_long_double="guessing no" +fi +rm -rf conftest* + + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_infinite_long_double="$gl_cross_guess_normal";; + esac + ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on Mac OS X. */ +#include +#include +#include +#include +#include +#include +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#elif defined _WIN32 && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include +#include +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} +#else +/* Avoid a crash on POSIX systems. */ +#include +#include +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + _exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif + +#include +#include +#include +static int +strisnan (const char *string, size_t start_index, size_t end_index) +{ + if (start_index < end_index) + { + if (string[start_index] == '-') + start_index++; + if (start_index + 3 <= end_index + && memcmp (string + start_index, "nan", 3) == 0) + { + start_index += 3; + if (start_index == end_index + || (string[start_index] == '(' && string[end_index - 1] == ')')) + return 1; + } + } + return 0; +} +static char buf[10000]; +static long double zeroL = 0.0L; +int main () +{ + int result = 0; + nocrash_init(); + if (sprintf (buf, "%Lf", 1.0L / zeroL) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + result |= 1; + if (sprintf (buf, "%Lf", -1.0L / zeroL) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + result |= 1; + if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 1; + if (sprintf (buf, "%Le", 1.0L / zeroL) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + result |= 1; + if (sprintf (buf, "%Le", -1.0L / zeroL) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + result |= 1; + if (sprintf (buf, "%Le", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 1; + if (sprintf (buf, "%Lg", 1.0L / zeroL) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + result |= 1; + if (sprintf (buf, "%Lg", -1.0L / zeroL) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + result |= 1; + if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 1; +#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE +/* Representation of an 80-bit 'long double' as an initializer for a sequence + of 'unsigned int' words. */ +# ifdef WORDS_BIGENDIAN +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ + ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \ + (unsigned int) (mantlo) << 16 \ + } +# else +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { mantlo, manthi, exponent } +# endif + { /* Quiet NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 2; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 2; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 2; + } + { + /* Signalling NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 2; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 2; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 2; + } + { /* Pseudo-NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) <= 0) + result |= 4; + if (sprintf (buf, "%Le", x.value) <= 0) + result |= 4; + if (sprintf (buf, "%Lg", x.value) <= 0) + result |= 4; + } + { /* Pseudo-Infinity. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) <= 0) + result |= 8; + if (sprintf (buf, "%Le", x.value) <= 0) + result |= 8; + if (sprintf (buf, "%Lg", x.value) <= 0) + result |= 8; + } + { /* Pseudo-Zero. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) <= 0) + result |= 16; + if (sprintf (buf, "%Le", x.value) <= 0) + result |= 16; + if (sprintf (buf, "%Lg", x.value) <= 0) + result |= 16; + } + { /* Unnormalized number. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) <= 0) + result |= 32; + if (sprintf (buf, "%Le", x.value) <= 0) + result |= 32; + if (sprintf (buf, "%Lg", x.value) <= 0) + result |= 32; + } + { /* Pseudo-Denormal. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) <= 0) + result |= 64; + if (sprintf (buf, "%Le", x.value) <= 0) + result |= 64; + if (sprintf (buf, "%Lg", x.value) <= 0) + result |= 64; + } +#endif + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_infinite_long_double=yes +else $as_nop + gl_cv_func_printf_infinite_long_double=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_infinite_long_double" >&5 +printf "%s\n" "$gl_cv_func_printf_infinite_long_double" >&6; } + ;; + *) + gl_cv_func_printf_infinite_long_double="irrelevant" + ;; + esac + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'a' and 'A' directives" >&5 +printf %s "checking whether printf supports the 'a' and 'A' directives... " >&6; } +if test ${gl_cv_func_printf_directive_a+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + case "$host_os" in + # Guess yes on glibc >= 2.5 systems. + *-gnu* | gnu*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #ifdef __GNU_LIBRARY__ + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__ + BZ2908 + #endif + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "BZ2908" >/dev/null 2>&1 +then : + gl_cv_func_printf_directive_a="guessing yes" +else $as_nop + gl_cv_func_printf_directive_a="guessing no" +fi +rm -rf conftest* + + ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_directive_a="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_a="guessing no";; + # Guess no on native Windows. + mingw*) gl_cv_func_printf_directive_a="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +static char buf[100]; +static double zero = 0.0; +int main () +{ + int result = 0; + if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 + || (strcmp (buf, "0x1.922p+1 33") != 0 + && strcmp (buf, "0x3.244p+0 33") != 0 + && strcmp (buf, "0x6.488p-1 33") != 0 + && strcmp (buf, "0xc.91p-2 33") != 0)) + result |= 1; + if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 + || (strcmp (buf, "-0X1.922P+1 33") != 0 + && strcmp (buf, "-0X3.244P+0 33") != 0 + && strcmp (buf, "-0X6.488P-1 33") != 0 + && strcmp (buf, "-0XC.91P-2 33") != 0)) + result |= 2; + /* This catches a FreeBSD 13.0 bug: it doesn't round. */ + if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 + || (strcmp (buf, "0x1.83p+0 33") != 0 + && strcmp (buf, "0x3.05p-1 33") != 0 + && strcmp (buf, "0x6.0ap-2 33") != 0 + && strcmp (buf, "0xc.14p-3 33") != 0)) + result |= 4; + /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */ + if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 + || (strcmp (buf, "0x2p+0 33") != 0 + && strcmp (buf, "0x3p-1 33") != 0 + && strcmp (buf, "0x6p-2 33") != 0 + && strcmp (buf, "0xcp-3 33") != 0)) + result |= 4; + /* This catches a FreeBSD 6.1 bug. See + */ + if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 + || buf[0] == '0') + result |= 8; + /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */ + if (sprintf (buf, "%.1a", 1.999) < 0 + || (strcmp (buf, "0x1.0p+1") != 0 + && strcmp (buf, "0x2.0p+0") != 0 + && strcmp (buf, "0x4.0p-1") != 0 + && strcmp (buf, "0x8.0p-2") != 0)) + result |= 16; + /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a + glibc 2.4 bug . */ + if (sprintf (buf, "%.1La", 1.999L) < 0 + || (strcmp (buf, "0x1.0p+1") != 0 + && strcmp (buf, "0x2.0p+0") != 0 + && strcmp (buf, "0x4.0p-1") != 0 + && strcmp (buf, "0x8.0p-2") != 0)) + result |= 32; + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_directive_a=yes +else $as_nop + gl_cv_func_printf_directive_a=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_a" >&5 +printf "%s\n" "$gl_cv_func_printf_directive_a" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'F' directive" >&5 +printf %s "checking whether printf supports the 'F' directive... " >&6; } +if test ${gl_cv_func_printf_directive_f+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; + midnightbsd*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on Mac OS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; + darwin*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on OpenBSD >= 6.0. + openbsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; + openbsd*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[1-9][0-9]*) gl_cv_func_printf_directive_f="guessing yes";; + solaris*) gl_cv_func_printf_directive_f="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_f="guessing no";; + # Guess yes on MSVC, no on mingw. + mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_func_printf_directive_f="guessing yes" +else $as_nop + gl_cv_func_printf_directive_f="guessing no" +fi +rm -rf conftest* + + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_directive_f="$gl_cross_guess_normal";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +static char buf[100]; +static double zero = 0.0; +int main () +{ + int result = 0; + if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 + || strcmp (buf, "1234567.000000 33") != 0) + result |= 1; + if (sprintf (buf, "%F", 1.0 / zero) < 0 + || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) + result |= 2; + /* This catches a Cygwin 1.5.x bug. */ + if (sprintf (buf, "%.F", 1234.0) < 0 + || strcmp (buf, "1234") != 0) + result |= 4; + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_directive_f=yes +else $as_nop + gl_cv_func_printf_directive_f=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_f" >&5 +printf "%s\n" "$gl_cv_func_printf_directive_f" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'n' directive" >&5 +printf %s "checking whether printf supports the 'n' directive... " >&6; } +if test ${gl_cv_func_printf_directive_n+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess no on glibc when _FORTIFY_SOURCE >= 2. + *-gnu* | gnu*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if _FORTIFY_SOURCE >= 2 + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_printf_directive_n="guessing yes" +else $as_nop + gl_cv_func_printf_directive_n="guessing no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_n="guessing no";; + # Guess no on native Windows. + mingw*) gl_cv_func_printf_directive_n="guessing no";; + *) gl_cv_func_printf_directive_n="guessing yes";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +#ifdef _MSC_VER +#include +/* See page about "Parameter Validation" on msdn.microsoft.com. + + */ +static void cdecl +invalid_parameter_handler (const wchar_t *expression, + const wchar_t *function, + const wchar_t *file, unsigned int line, + uintptr_t dummy) +{ + exit (1); +} +#endif +static char fmtstring[10]; +static char buf[100]; +int main () +{ + int count = -1; +#ifdef _MSC_VER + _set_invalid_parameter_handler (invalid_parameter_handler); +#endif + /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) + support %n in format strings in read-only memory but not in writable + memory. */ + strcpy (fmtstring, "%d %n"); + if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0 + || strcmp (buf, "123 ") != 0 + || count != 4) + return 1; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_directive_n=yes +else $as_nop + gl_cv_func_printf_directive_n=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_n" >&5 +printf "%s\n" "$gl_cv_func_printf_directive_n" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'ls' directive" >&5 +printf %s "checking whether printf supports the 'ls' directive... " >&6; } +if test ${gl_cv_func_printf_directive_ls+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + case "$host_os" in + # Guess yes on OpenBSD >= 6.0. + openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; + openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; + irix*) gl_cv_func_printf_directive_ls="guessing no";; + solaris*) gl_cv_func_printf_directive_ls="guessing no";; + cygwin*) gl_cv_func_printf_directive_ls="guessing no";; + beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; + # Guess yes on native Windows. + mingw*) gl_cv_func_printf_directive_ls="guessing yes";; + *) gl_cv_func_printf_directive_ls="guessing yes";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +int main () +{ + int result = 0; + char buf[100]; + /* Test whether %ls works at all. + This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on + Cygwin 1.5. */ + { + static const wchar_t wstring[] = { 'a', 'b', 'c', 0 }; + buf[0] = '\0'; + if (sprintf (buf, "%ls", wstring) < 0 + || strcmp (buf, "abc") != 0) + result |= 1; + } + /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an + assertion failure inside libc), but not on OpenBSD 4.0. */ + { + static const wchar_t wstring[] = { 'a', 0 }; + buf[0] = '\0'; + if (sprintf (buf, "%ls", wstring) < 0 + || strcmp (buf, "a") != 0) + result |= 2; + } + /* Test whether precisions in %ls are supported as specified in ISO C 99 + section 7.19.6.1: + "If a precision is specified, no more than that many bytes are written + (including shift sequences, if any), and the array shall contain a + null wide character if, to equal the multibyte character sequence + length given by the precision, the function would need to access a + wide character one past the end of the array." + This test fails on Solaris 10. */ + { + static const wchar_t wstring[] = { 'a', 'b', (wchar_t) 0xfdfdfdfd, 0 }; + buf[0] = '\0'; + if (sprintf (buf, "%.2ls", wstring) < 0 + || strcmp (buf, "ab") != 0) + result |= 8; + } + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_directive_ls=yes +else $as_nop + gl_cv_func_printf_directive_ls=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_ls" >&5 +printf "%s\n" "$gl_cv_func_printf_directive_ls" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports POSIX/XSI format strings with positions" >&5 +printf %s "checking whether printf supports POSIX/XSI format strings with positions... " >&6; } +if test ${gl_cv_func_printf_positions+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + case "$host_os" in + netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) + gl_cv_func_printf_positions="guessing no";; + beos*) gl_cv_func_printf_positions="guessing no";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_positions="guessing yes";; + # Guess no on native Windows. + mingw* | pw*) gl_cv_func_printf_positions="guessing no";; + *) gl_cv_func_printf_positions="guessing yes";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +/* The string "%2$d %1$d", with dollar characters protected from the shell's + dollar expansion (possibly an autoconf bug). */ +static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; +static char buf[100]; +int main () +{ + sprintf (buf, format, 33, 55); + return (strcmp (buf, "55 33") != 0); +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_positions=yes +else $as_nop + gl_cv_func_printf_positions=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_positions" >&5 +printf "%s\n" "$gl_cv_func_printf_positions" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports the grouping flag" >&5 +printf %s "checking whether printf supports the grouping flag... " >&6; } +if test ${gl_cv_func_printf_flag_grouping+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + case "$host_os" in + cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; + netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; + # Guess no on native Windows. + mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; + *) gl_cv_func_printf_flag_grouping="guessing yes";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +static char buf[100]; +int main () +{ + if (sprintf (buf, "%'d %d", 1234567, 99) < 0 + || buf[strlen (buf) - 1] != '9') + return 1; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_flag_grouping=yes +else $as_nop + gl_cv_func_printf_flag_grouping=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_flag_grouping" >&5 +printf "%s\n" "$gl_cv_func_printf_flag_grouping" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports the left-adjust flag correctly" >&5 +printf %s "checking whether printf supports the left-adjust flag correctly... " >&6; } +if test ${gl_cv_func_printf_flag_leftadjust+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + case "$host_os" in + # Guess yes on HP-UX 11. + hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess no on HP-UX 10 and older. + hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess yes on native Windows. + mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess yes otherwise. + *) gl_cv_func_printf_flag_leftadjust="guessing yes";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +static char buf[100]; +int main () +{ + /* Check that a '-' flag is not annihilated by a negative width. */ + if (sprintf (buf, "a%-*sc", -3, "b") < 0 + || strcmp (buf, "ab c") != 0) + return 1; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_flag_leftadjust=yes +else $as_nop + gl_cv_func_printf_flag_leftadjust=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_flag_leftadjust" >&5 +printf "%s\n" "$gl_cv_func_printf_flag_leftadjust" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports the zero flag correctly" >&5 +printf %s "checking whether printf supports the zero flag correctly... " >&6; } +if test ${gl_cv_func_printf_flag_zero+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; + # Guess no on native Windows. + mingw*) gl_cv_func_printf_flag_zero="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +static char buf[100]; +static double zero = 0.0; +int main () +{ + if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0 + || (strcmp (buf, " inf") != 0 + && strcmp (buf, " infinity") != 0)) + return 1; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_flag_zero=yes +else $as_nop + gl_cv_func_printf_flag_zero=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_flag_zero" >&5 +printf "%s\n" "$gl_cv_func_printf_flag_zero" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports large precisions" >&5 +printf %s "checking whether printf supports large precisions... " >&6; } +if test ${gl_cv_func_printf_precision+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + case "$host_os" in + # Guess no only on Solaris, native Windows, and BeOS systems. + solaris*) gl_cv_func_printf_precision="guessing no" ;; + mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; + beos*) gl_cv_func_printf_precision="guessing no" ;; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; + *) gl_cv_func_printf_precision="guessing yes" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +static char buf[5000]; +int main () +{ + int result = 0; +#ifdef __BEOS__ + /* On BeOS, this would crash and show a dialog box. Avoid the crash. */ + return 1; +#endif + if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) + result |= 1; + if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5) + result |= 2; + if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5 + || buf[0] != '1') + result |= 4; + if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5 + || buf[0] != '1') + result |= 4; + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_precision=yes +else $as_nop + gl_cv_func_printf_precision=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_precision" >&5 +printf "%s\n" "$gl_cv_func_printf_precision" >&6; } + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler produces multi-arch binaries" >&5 +printf %s "checking whether the compiler produces multi-arch binaries... " >&6; } +if test ${gl_cv_c_multiarch+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_c_multiarch=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + arch= + prev= + for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do + if test -n "$prev"; then + case $word in + i?86 | x86_64 | ppc | ppc64 | arm | arm64) + if test -z "$arch" || test "$arch" = "$word"; then + arch="$word" + else + gl_cv_c_multiarch=yes + fi + ;; + esac + prev= + else + if test "x$word" = "x-arch"; then + prev=arch + fi + fi + done + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c_multiarch" >&5 +printf "%s\n" "$gl_cv_c_multiarch" >&6; } + if test $gl_cv_c_multiarch = yes; then + APPLE_UNIVERSAL_BUILD=1 + else + APPLE_UNIVERSAL_BUILD=0 + fi + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf survives out-of-memory conditions" >&5 +printf %s "checking whether printf survives out-of-memory conditions... " >&6; } +if test ${gl_cv_func_printf_enomem+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_cv_func_printf_enomem="guessing no" + if test "$cross_compiling" = no; then + if test $APPLE_UNIVERSAL_BUILD = 0; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on Mac OS X. */ +#include +#include +#include +#include +#include +#include +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#elif defined _WIN32 && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include +#include +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} +#else +/* Avoid a crash on POSIX systems. */ +#include +#include +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + _exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif + +#include +#include +#include +#include +#include +int main() +{ + struct rlimit limit; + int ret; + nocrash_init (); + /* Some printf implementations allocate temporary space with malloc. */ + /* On BSD systems, malloc() is limited by RLIMIT_DATA. */ +#ifdef RLIMIT_DATA + if (getrlimit (RLIMIT_DATA, &limit) < 0) + return 77; + if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) + limit.rlim_max = 5000000; + limit.rlim_cur = limit.rlim_max; + if (setrlimit (RLIMIT_DATA, &limit) < 0) + return 77; +#endif + /* On Linux systems, malloc() is limited by RLIMIT_AS. */ +#ifdef RLIMIT_AS + if (getrlimit (RLIMIT_AS, &limit) < 0) + return 77; + if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) + limit.rlim_max = 5000000; + limit.rlim_cur = limit.rlim_max; + if (setrlimit (RLIMIT_AS, &limit) < 0) + return 77; +#endif + /* Some printf implementations allocate temporary space on the stack. */ +#ifdef RLIMIT_STACK + if (getrlimit (RLIMIT_STACK, &limit) < 0) + return 77; + if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) + limit.rlim_max = 5000000; + limit.rlim_cur = limit.rlim_max; + if (setrlimit (RLIMIT_STACK, &limit) < 0) + return 77; +#endif + ret = printf ("%.5000000f", 1.0); + return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); +} + +_ACEOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + (./conftest 2>&5 + result=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $result" >&5 + if test $result != 0 && test $result != 77; then result=1; fi + exit $result + ) >/dev/null 2>/dev/null + case $? in + 0) gl_cv_func_printf_enomem="yes" ;; + 77) gl_cv_func_printf_enomem="guessing no" ;; + *) gl_cv_func_printf_enomem="no" ;; + esac + else + gl_cv_func_printf_enomem="guessing no" + fi + rm -fr conftest* + else + gl_cv_func_printf_enomem="guessing no" + fi + fi + if test "$gl_cv_func_printf_enomem" = "guessing no"; then + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on Solaris. + solaris*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on AIX. + aix*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on HP-UX/hppa. + hpux*) case "$host_cpu" in + hppa*) gl_cv_func_printf_enomem="guessing yes";; + *) gl_cv_func_printf_enomem="guessing no";; + esac + ;; + # Guess yes on IRIX. + irix*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on OSF/1. + osf*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on Haiku. + haiku*) gl_cv_func_printf_enomem="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_enomem="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_enomem="$gl_cross_guess_normal";; + esac + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_enomem" >&5 +printf "%s\n" "$gl_cv_func_printf_enomem" >&6; } + + + + case "$gl_cv_func_printf_long_double" in + *yes) + ;; + *) + +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h + + ;; + esac + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wchar_t" >&5 +printf %s "checking for wchar_t... " >&6; } +if test ${gt_cv_c_wchar_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + wchar_t foo = (wchar_t)'\0'; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gt_cv_c_wchar_t=yes +else $as_nop + gt_cv_c_wchar_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_wchar_t" >&5 +printf "%s\n" "$gt_cv_c_wchar_t" >&6; } + if test $gt_cv_c_wchar_t = yes; then + +printf "%s\n" "#define HAVE_WCHAR_T 1" >>confdefs.h + + fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wint_t" >&5 +printf %s "checking for wint_t... " >&6; } +if test ${gt_cv_c_wint_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + wint_t foo = (wchar_t)'\0'; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gt_cv_c_wint_t=yes +else $as_nop + gt_cv_c_wint_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_wint_t" >&5 +printf "%s\n" "$gt_cv_c_wint_t" >&6; } + if test $gt_cv_c_wint_t = yes; then + +printf "%s\n" "#define HAVE_WINT_T 1" >>confdefs.h + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether wint_t is large enough" >&5 +printf %s "checking whether wint_t is large enough... " >&6; } +if test ${gl_cv_type_wint_t_large_enough+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1]; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_type_wint_t_large_enough=yes +else $as_nop + gl_cv_type_wint_t_large_enough=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wint_t_large_enough" >&5 +printf "%s\n" "$gl_cv_type_wint_t_large_enough" >&6; } + if test $gl_cv_type_wint_t_large_enough = no; then + GNULIBHEADERS_OVERRIDE_WINT_T=1 + else + GNULIBHEADERS_OVERRIDE_WINT_T=0 + fi + else + GNULIBHEADERS_OVERRIDE_WINT_T=0 + fi + + + + + + if test $ac_cv_header_features_h = yes; then + HAVE_FEATURES_H=1 + else + HAVE_FEATURES_H=0 + fi + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for intmax_t" >&5 +printf %s "checking for intmax_t... " >&6; } +if test ${gt_cv_c_intmax_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#if HAVE_STDINT_H_WITH_UINTMAX +#include +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +#include +#endif + +int +main (void) +{ +intmax_t x = -1; return !x; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gt_cv_c_intmax_t=yes +else $as_nop + gt_cv_c_intmax_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_intmax_t" >&5 +printf "%s\n" "$gt_cv_c_intmax_t" >&6; } + if test $gt_cv_c_intmax_t = yes; then + +printf "%s\n" "#define HAVE_INTMAX_T 1" >>confdefs.h + + else + +printf "%s\n" "#define intmax_t long long" >>confdefs.h + + fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'double'" >&5 +printf %s "checking where to find the exponent in a 'double'... " >&6; } +if test ${gl_cv_cc_double_expbit0+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if defined arm || defined __arm || defined __arm__ + mixed_endianness +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "mixed_endianness" >/dev/null 2>&1 +then : + gl_cv_cc_double_expbit0="unknown" +else $as_nop + + : +if test ${ac_cv_c_bigendian+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main (void) +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main (void) +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_bigendian=yes +else $as_nop + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_bigendian=yes +else $as_nop + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes +then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +unsigned short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + unsigned short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + unsigned short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + unsigned short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main (void) +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_c_bigendian=no +else $as_nop + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi +fi +: + case $ac_cv_c_bigendian in #( + yes) + gl_cv_cc_double_expbit0="word 0 bit 20";; #( + no) + gl_cv_cc_double_expbit0="word 1 bit 20" ;; #( + universal) + +printf "%s\n" "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + gl_cv_cc_double_expbit0="unknown" ;; + esac + + +fi +rm -rf conftest* + + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { double value; unsigned int word[NWORDS]; } memory_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (double x) +{ + memory_double m; + size_t i; + /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ + memset (&m, 0, sizeof (memory_double)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25); + add_to_ored_words (0.5); + add_to_ored_words (1.0); + add_to_ored_words (2.0); + add_to_ored_words (4.0); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_cc_double_expbit0=`cat conftest.out` +else $as_nop + gl_cv_cc_double_expbit0="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -f conftest.out + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_double_expbit0" >&5 +printf "%s\n" "$gl_cv_cc_double_expbit0" >&6; } + case "$gl_cv_cc_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` + +printf "%s\n" "#define DBL_EXPBIT0_WORD $word" >>confdefs.h + + +printf "%s\n" "#define DBL_EXPBIT0_BIT $bit" >>confdefs.h + + ;; + esac + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether snprintf returns a byte count as in C99" >&5 +printf %s "checking whether snprintf returns a byte count as in C99... " >&6; } +if test ${gl_cv_func_snprintf_retval_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + midnightbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on Mac OS X >= 10.3. + darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; + darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on OpenBSD >= 3.9. + openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) + gl_cv_func_snprintf_retval_c99="guessing no";; + openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; + solaris*) gl_cv_func_printf_sizes_c99="guessing no";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; + aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_snprintf_retval_c99="guessing no";; + netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on Android. + linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on MSVC, no on mingw. + mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_func_snprintf_retval_c99="guessing yes" +else $as_nop + gl_cv_func_snprintf_retval_c99="guessing no" +fi +rm -rf conftest* + + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_snprintf_retval_c99="$gl_cross_guess_normal";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +#endif +static char buf[100]; +int main () +{ + strcpy (buf, "ABCDEF"); + if (my_snprintf (buf, 3, "%d %d", 4567, 89) != 7) + return 1; + if (my_snprintf (buf, 0, "%d %d", 4567, 89) != 7) + return 2; + if (my_snprintf (NULL, 0, "%d %d", 4567, 89) != 7) + return 3; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_snprintf_retval_c99=yes +else $as_nop + gl_cv_func_snprintf_retval_c99=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_retval_c99" >&5 +printf "%s\n" "$gl_cv_func_snprintf_retval_c99" >&6; } + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether snprintf truncates the result as in C99" >&5 +printf %s "checking whether snprintf truncates the result as in C99... " >&6; } +if test ${gl_cv_func_snprintf_truncation_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + midnightbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on Mac OS X >= 10.3. + darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; + darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on OpenBSD >= 3.9. + openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) + gl_cv_func_snprintf_truncation_c99="guessing no";; + openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on Solaris >= 2.6. + solaris2.[0-5] | solaris2.[0-5].*) + gl_cv_func_snprintf_truncation_c99="guessing no";; + solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; + aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; + hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on IRIX >= 6.5. + irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on OSF/1 >= 5. + osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; + osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_snprintf_truncation_c99="guessing no";; + netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on Android. + linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess no on native Windows. + mingw*) gl_cv_func_snprintf_truncation_c99="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +#endif +static char buf[100]; +int main () +{ + strcpy (buf, "ABCDEF"); + my_snprintf (buf, 3, "%d %d", 4567, 89); + if (memcmp (buf, "45\0DEF", 6) != 0) + return 1; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_snprintf_truncation_c99=yes +else $as_nop + gl_cv_func_snprintf_truncation_c99=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_truncation_c99" >&5 +printf "%s\n" "$gl_cv_func_snprintf_truncation_c99" >&6; } + + + + + + ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" +if test "x$ac_cv_func_snprintf" = xyes +then : + printf "%s\n" "#define HAVE_SNPRINTF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strnlen" "ac_cv_func_strnlen" +if test "x$ac_cv_func_strnlen" = xyes +then : + printf "%s\n" "#define HAVE_STRNLEN 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcslen" "ac_cv_func_wcslen" +if test "x$ac_cv_func_wcslen" = xyes +then : + printf "%s\n" "#define HAVE_WCSLEN 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcsnlen" "ac_cv_func_wcsnlen" +if test "x$ac_cv_func_wcsnlen" = xyes +then : + printf "%s\n" "#define HAVE_WCSNLEN 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mbrtowc" "ac_cv_func_mbrtowc" +if test "x$ac_cv_func_mbrtowc" = xyes +then : + printf "%s\n" "#define HAVE_MBRTOWC 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcrtomb" "ac_cv_func_wcrtomb" +if test "x$ac_cv_func_wcrtomb" = xyes +then : + printf "%s\n" "#define HAVE_WCRTOMB 1" >>confdefs.h + +fi + + ac_fn_check_decl "$LINENO" "_snprintf" "ac_cv_have_decl__snprintf" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl__snprintf" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL__SNPRINTF $ac_have_decl" >>confdefs.h + + + + case "$gl_cv_func_snprintf_retval_c99" in + *yes) + +printf "%s\n" "#define HAVE_SNPRINTF_RETVAL_C99 1" >>confdefs.h + + ;; + esac + + case "$gl_cv_func_snprintf_truncation_c99" in + *yes) + +printf "%s\n" "#define HAVE_SNPRINTF_TRUNCATION_C99 1" >>confdefs.h + + ;; + esac + + + HAVE_ACOSF=1; + HAVE_ACOSL=1; + HAVE_ASINF=1; + HAVE_ASINL=1; + HAVE_ATANF=1; + HAVE_ATANL=1; + HAVE_ATAN2F=1; + HAVE_CBRT=1; + HAVE_CBRTF=1; + HAVE_CBRTL=1; + HAVE_COPYSIGN=1; + HAVE_COPYSIGNL=1; + HAVE_COSF=1; + HAVE_COSL=1; + HAVE_COSHF=1; + HAVE_EXPF=1; + HAVE_EXPL=1; + HAVE_EXPM1=1; + HAVE_EXPM1F=1; + HAVE_FABSF=1; + HAVE_FABSL=1; + HAVE_FMA=1; + HAVE_FMAF=1; + HAVE_FMAL=1; + HAVE_FMODF=1; + HAVE_FMODL=1; + HAVE_FREXPF=1; + HAVE_HYPOTF=1; + HAVE_HYPOTL=1; + HAVE_ILOGB=1; + HAVE_ILOGBF=1; + HAVE_ILOGBL=1; + HAVE_ISNANF=1; + HAVE_ISNAND=1; + HAVE_ISNANL=1; + HAVE_LDEXPF=1; + HAVE_LOGF=1; + HAVE_LOGL=1; + HAVE_LOG10F=1; + HAVE_LOG10L=1; + HAVE_LOG1P=1; + HAVE_LOG1PF=1; + HAVE_LOG1PL=1; + HAVE_LOGBF=1; + HAVE_LOGBL=1; + HAVE_MODFF=1; + HAVE_MODFL=1; + HAVE_POWF=1; + HAVE_REMAINDER=1; + HAVE_REMAINDERF=1; + HAVE_RINT=1; + HAVE_RINTL=1; + HAVE_SINF=1; + HAVE_SINL=1; + HAVE_SINHF=1; + HAVE_SQRTF=1; + HAVE_SQRTL=1; + HAVE_TANF=1; + HAVE_TANL=1; + HAVE_TANHF=1; + HAVE_DECL_ACOSL=1; + HAVE_DECL_ASINL=1; + HAVE_DECL_ATANL=1; + HAVE_DECL_CBRTF=1; + HAVE_DECL_CBRTL=1; + HAVE_DECL_CEILF=1; + HAVE_DECL_CEILL=1; + HAVE_DECL_COPYSIGNF=1; + HAVE_DECL_COSL=1; + HAVE_DECL_EXPL=1; + HAVE_DECL_EXP2=1; + HAVE_DECL_EXP2F=1; + HAVE_DECL_EXP2L=1; + HAVE_DECL_EXPM1L=1; + HAVE_DECL_FLOORF=1; + HAVE_DECL_FLOORL=1; + HAVE_DECL_FREXPL=1; + HAVE_DECL_LDEXPL=1; + HAVE_DECL_LOGL=1; + HAVE_DECL_LOG10L=1; + HAVE_DECL_LOG2=1; + HAVE_DECL_LOG2F=1; + HAVE_DECL_LOG2L=1; + HAVE_DECL_LOGB=1; + HAVE_DECL_REMAINDER=1; + HAVE_DECL_REMAINDERL=1; + HAVE_DECL_RINTF=1; + HAVE_DECL_ROUND=1; + HAVE_DECL_ROUNDF=1; + HAVE_DECL_ROUNDL=1; + HAVE_DECL_SINL=1; + HAVE_DECL_SQRTL=1; + HAVE_DECL_TANL=1; + HAVE_DECL_TRUNC=1; + HAVE_DECL_TRUNCF=1; + HAVE_DECL_TRUNCL=1; + REPLACE_ACOSF=0; + REPLACE_ASINF=0; + REPLACE_ATANF=0; + REPLACE_ATAN2F=0; + REPLACE_CBRTF=0; + REPLACE_CBRTL=0; + REPLACE_CEIL=0; + REPLACE_CEILF=0; + REPLACE_CEILL=0; + REPLACE_COSF=0; + REPLACE_COSHF=0; + REPLACE_EXPF=0; + REPLACE_EXPL=0; + REPLACE_EXPM1=0; + REPLACE_EXPM1F=0; + REPLACE_EXPM1L=0; + REPLACE_EXP2=0; + REPLACE_EXP2L=0; + REPLACE_FABSL=0; + REPLACE_FLOOR=0; + REPLACE_FLOORF=0; + REPLACE_FLOORL=0; + REPLACE_FMA=0; + REPLACE_FMAF=0; + REPLACE_FMAL=0; + REPLACE_FMOD=0; + REPLACE_FMODF=0; + REPLACE_FMODL=0; + REPLACE_FREXPF=0; + REPLACE_FREXP=0; + REPLACE_FREXPL=0; + REPLACE_HUGE_VAL=0; + REPLACE_HYPOT=0; + REPLACE_HYPOTF=0; + REPLACE_HYPOTL=0; + REPLACE_ILOGB=0; + REPLACE_ILOGBF=0; + REPLACE_ILOGBL=0; + REPLACE_ISFINITE=0; + REPLACE_ISINF=0; + REPLACE_ISNAN=0; + REPLACE_LDEXPL=0; + REPLACE_LOG=0; + REPLACE_LOGF=0; + REPLACE_LOGL=0; + REPLACE_LOG10=0; + REPLACE_LOG10F=0; + REPLACE_LOG10L=0; + REPLACE_LOG1P=0; + REPLACE_LOG1PF=0; + REPLACE_LOG1PL=0; + REPLACE_LOG2=0; + REPLACE_LOG2F=0; + REPLACE_LOG2L=0; + REPLACE_LOGB=0; + REPLACE_LOGBF=0; + REPLACE_LOGBL=0; + REPLACE_MODF=0; + REPLACE_MODFF=0; + REPLACE_MODFL=0; + REPLACE_NAN=0; + REPLACE_REMAINDER=0; + REPLACE_REMAINDERF=0; + REPLACE_REMAINDERL=0; + REPLACE_RINTL=0; + REPLACE_ROUND=0; + REPLACE_ROUNDF=0; + REPLACE_ROUNDL=0; + REPLACE_SIGNBIT=0; + REPLACE_SIGNBIT_USING_BUILTINS=0; + REPLACE_SINF=0; + REPLACE_SINHF=0; + REPLACE_SQRTF=0; + REPLACE_SQRTL=0; + REPLACE_TANF=0; + REPLACE_TANHF=0; + REPLACE_TRUNC=0; + REPLACE_TRUNCF=0; + REPLACE_TRUNCL=0; + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether frexp() can be used without linking with libm" >&5 +printf %s "checking whether frexp() can be used without linking with libm... " >&6; } +if test ${gl_cv_func_frexp_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + double x; +int +main (void) +{ +int e; return frexp (x, &e) > 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_frexp_no_libm=yes +else $as_nop + gl_cv_func_frexp_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexp_no_libm" >&5 +printf "%s\n" "$gl_cv_func_frexp_no_libm" >&6; } + +ac_fn_check_decl "$LINENO" "alarm" "ac_cv_have_decl_alarm" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_alarm" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_ALARM $ac_have_decl" >>confdefs.h + + + + GL_GNULIB_ACOSF=0 + + + + GL_GNULIB_ACOSL=0 + + + + GL_GNULIB_ASINF=0 + + + + GL_GNULIB_ASINL=0 + + + + GL_GNULIB_ATANF=0 + + + + GL_GNULIB_ATANL=0 + + + + GL_GNULIB_ATAN2F=0 + + + + GL_GNULIB_CBRT=0 + + + + GL_GNULIB_CBRTF=0 + + + + GL_GNULIB_CBRTL=0 + + + + GL_GNULIB_CEIL=0 + + + + GL_GNULIB_CEILF=0 + + + + GL_GNULIB_CEILL=0 + + + + GL_GNULIB_COPYSIGN=0 + + + + GL_GNULIB_COPYSIGNF=0 + + + + GL_GNULIB_COPYSIGNL=0 + + + + GL_GNULIB_COSF=0 + + + + GL_GNULIB_COSL=0 + + + + GL_GNULIB_COSHF=0 + + + + GL_GNULIB_EXPF=0 + + + + GL_GNULIB_EXPL=0 + + + + GL_GNULIB_EXP2=0 + + + + GL_GNULIB_EXP2F=0 + + + + GL_GNULIB_EXP2L=0 + + + + GL_GNULIB_EXPM1=0 + + + + GL_GNULIB_EXPM1F=0 + + + + GL_GNULIB_EXPM1L=0 + + + + GL_GNULIB_FABSF=0 + + + + GL_GNULIB_FABSL=0 + + + + GL_GNULIB_FLOOR=0 + + + + GL_GNULIB_FLOORF=0 + + + + GL_GNULIB_FLOORL=0 + + + + GL_GNULIB_FMA=0 + + + + GL_GNULIB_FMAF=0 + + + + GL_GNULIB_FMAL=0 + + + + GL_GNULIB_FMOD=0 + + + + GL_GNULIB_FMODF=0 + + + + GL_GNULIB_FMODL=0 + + + + GL_GNULIB_FREXPF=0 + + + + GL_GNULIB_FREXP=0 + + + + GL_GNULIB_FREXPL=0 + + + + GL_GNULIB_HYPOT=0 + + + + GL_GNULIB_HYPOTF=0 + + + + GL_GNULIB_HYPOTL=0 + + + + GL_GNULIB_ILOGB=0 + + + + GL_GNULIB_ILOGBF=0 + + + + GL_GNULIB_ILOGBL=0 + + + + GL_GNULIB_ISFINITE=0 + + + + GL_GNULIB_ISINF=0 + + + + GL_GNULIB_ISNAN=0 + + + + GL_GNULIB_ISNANF=0 + + + + GL_GNULIB_ISNAND=0 + + + + GL_GNULIB_ISNANL=0 + + + + GL_GNULIB_LDEXPF=0 + + + + GL_GNULIB_LDEXPL=0 + + + + GL_GNULIB_LOG=0 + + + + GL_GNULIB_LOGF=0 + + + + GL_GNULIB_LOGL=0 + + + + GL_GNULIB_LOG10=0 + + + + GL_GNULIB_LOG10F=0 + + + + GL_GNULIB_LOG10L=0 + + + + GL_GNULIB_LOG1P=0 + + + + GL_GNULIB_LOG1PF=0 + + + + GL_GNULIB_LOG1PL=0 + + + + GL_GNULIB_LOG2=0 + + + + GL_GNULIB_LOG2F=0 + + + + GL_GNULIB_LOG2L=0 + + + + GL_GNULIB_LOGB=0 + + + + GL_GNULIB_LOGBF=0 + + + + GL_GNULIB_LOGBL=0 + + + + GL_GNULIB_MODF=0 + + + + GL_GNULIB_MODFF=0 + + + + GL_GNULIB_MODFL=0 + + + + GL_GNULIB_POWF=0 + + + + GL_GNULIB_REMAINDER=0 + + + + GL_GNULIB_REMAINDERF=0 + + + + GL_GNULIB_REMAINDERL=0 + + + + GL_GNULIB_RINT=0 + + + + GL_GNULIB_RINTF=0 + + + + GL_GNULIB_RINTL=0 + + + + GL_GNULIB_ROUND=0 + + + + GL_GNULIB_ROUNDF=0 + + + + GL_GNULIB_ROUNDL=0 + + + + GL_GNULIB_SIGNBIT=0 + + + + GL_GNULIB_SINF=0 + + + + GL_GNULIB_SINL=0 + + + + GL_GNULIB_SINHF=0 + + + + GL_GNULIB_SQRTF=0 + + + + GL_GNULIB_SQRTL=0 + + + + GL_GNULIB_TANF=0 + + + + GL_GNULIB_TANL=0 + + + + GL_GNULIB_TANHF=0 + + + + GL_GNULIB_TRUNC=0 + + + + GL_GNULIB_TRUNCF=0 + + + + GL_GNULIB_TRUNCL=0 + + + + GL_GNULIB_MDA_J0=1 + + + + GL_GNULIB_MDA_J1=1 + + + + GL_GNULIB_MDA_JN=1 + + + + GL_GNULIB_MDA_Y0=1 + + + + GL_GNULIB_MDA_Y1=1 + + + + GL_GNULIB_MDA_YN=1 + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether getcwd (NULL, 0) allocates memory for result" >&5 +printf %s "checking whether getcwd (NULL, 0) allocates memory for result... " >&6; } +if test ${gl_cv_func_getcwd_null+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_getcwd_null="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_getcwd_null="guessing yes";; + # Guess yes on Cygwin. + cygwin*) gl_cv_func_getcwd_null="guessing yes";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_getcwd_null="$gl_cross_guess_normal";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# include +# if HAVE_UNISTD_H +# include +# else /* on Windows with MSVC */ +# include +# endif + + +$gl_mda_defines + +# ifndef getcwd + char *getcwd (); +# endif + +int +main (void) +{ + +#if defined _WIN32 && ! defined __CYGWIN__ +/* mingw cwd does not start with '/', but _getcwd does allocate. + However, mingw fails to honor non-zero size. */ +#else + if (chdir ("/") != 0) + return 1; + else + { + char *f = getcwd (NULL, 0); + if (! f) + return 2; + if (f[0] != '/') + { free (f); return 3; } + if (f[1] != '\0') + { free (f); return 4; } + free (f); + return 0; + } +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_getcwd_null=yes +else $as_nop + gl_cv_func_getcwd_null=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getcwd_null" >&5 +printf "%s\n" "$gl_cv_func_getcwd_null" >&6; } + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for getcwd with POSIX signature" >&5 +printf %s "checking for getcwd with POSIX signature... " >&6; } +if test ${gl_cv_func_getcwd_posix_signature+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + + +$gl_mda_defines + +int +main (void) +{ +extern + #ifdef __cplusplus + "C" + #endif + char *getcwd (char *, size_t); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_getcwd_posix_signature=yes +else $as_nop + gl_cv_func_getcwd_posix_signature=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getcwd_posix_signature" >&5 +printf "%s\n" "$gl_cv_func_getcwd_posix_signature" >&6; } + +ac_fn_check_decl "$LINENO" "getcwd" "ac_cv_have_decl_getcwd" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_getcwd" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_GETCWD $ac_have_decl" >>confdefs.h + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for d_ino member in directory struct" >&5 +printf %s "checking for d_ino member in directory struct... " >&6; } +if test ${gl_cv_struct_dirent_d_ino+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems with Linux kernel. + linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;; + # Guess yes on musl systems with Linux kernel. + linux*-musl*) gl_cv_struct_dirent_d_ino="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_struct_dirent_d_ino="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_struct_dirent_d_ino="$gl_cross_guess_normal" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include + +int +main (void) +{ +DIR *dp = opendir ("."); + struct dirent *e; + struct stat st; + if (! dp) + return 1; + e = readdir (dp); + if (! e) + { closedir (dp); return 2; } + if (lstat (e->d_name, &st) != 0) + { closedir (dp); return 3; } + if (e->d_ino != st.st_ino) + { closedir (dp); return 4; } + closedir (dp); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_struct_dirent_d_ino=yes +else $as_nop + gl_cv_struct_dirent_d_ino=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_struct_dirent_d_ino" >&5 +printf "%s\n" "$gl_cv_struct_dirent_d_ino" >&6; } + case "$gl_cv_struct_dirent_d_ino" in + *yes) + +printf "%s\n" "#define D_INO_IN_DIRENT 1" >>confdefs.h + + ;; + esac + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for arithmetic hrtime_t" >&5 +printf %s "checking for arithmetic hrtime_t... " >&6; } +if test ${gl_cv_arithmetic_hrtime_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +hrtime_t x = 0; return x/x; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_arithmetic_hrtime_t=yes +else $as_nop + gl_cv_arithmetic_hrtime_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_arithmetic_hrtime_t" >&5 +printf "%s\n" "$gl_cv_arithmetic_hrtime_t" >&6; } + if test $gl_cv_arithmetic_hrtime_t = yes; then + +printf "%s\n" "#define HAVE_ARITHMETIC_HRTIME_T 1" >>confdefs.h + + fi + + + : + + + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_getopt_h='<'getopt.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_getopt_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $ac_cv_header_getopt_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'getopt.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_getopt_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_getopt_h + gl_cv_next_getopt_h='"'$gl_header'"' + else + gl_cv_next_getopt_h='<'getopt.h'>' + fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_getopt_h" >&5 +printf "%s\n" "$gl_cv_next_getopt_h" >&6; } + fi + NEXT_GETOPT_H=$gl_cv_next_getopt_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'getopt.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_getopt_h + fi + NEXT_AS_FIRST_DIRECTIVE_GETOPT_H=$gl_next_as_first_directive + + + + + if test $ac_cv_header_getopt_h = yes; then + HAVE_GETOPT_H=1 + else + HAVE_GETOPT_H=0 + fi + + + gl_replace_getopt= + + if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then + for ac_header in getopt.h +do : + ac_fn_c_check_header_compile "$LINENO" "getopt.h" "ac_cv_header_getopt_h" "$ac_includes_default" +if test "x$ac_cv_header_getopt_h" = xyes +then : + printf "%s\n" "#define HAVE_GETOPT_H 1" >>confdefs.h + +else $as_nop + gl_replace_getopt=yes +fi + +done + fi + + if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then + + for ac_func in getopt_long_only +do : + ac_fn_c_check_func "$LINENO" "getopt_long_only" "ac_cv_func_getopt_long_only" +if test "x$ac_cv_func_getopt_long_only" = xyes +then : + printf "%s\n" "#define HAVE_GETOPT_LONG_ONLY 1" >>confdefs.h + +else $as_nop + gl_replace_getopt=yes +fi + +done + fi + + if test -z "$gl_replace_getopt"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether getopt is POSIX compatible" >&5 +printf %s "checking whether getopt is POSIX compatible... " >&6; } +if test ${gl_cv_func_getopt_posix+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $cross_compiling = no; then + if test "$cross_compiling" = yes +then : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include + +int +main () +{ + static char program[] = "program"; + static char a[] = "-a"; + static char foo[] = "foo"; + static char bar[] = "bar"; + char *argv[] = { program, a, foo, bar, NULL }; + int c; + + c = getopt (4, argv, "ab"); + if (!(c == 'a')) + return 1; + c = getopt (4, argv, "ab"); + if (!(c == -1)) + return 2; + if (!(optind == 2)) + return 3; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_getopt_posix=maybe +else $as_nop + gl_cv_func_getopt_posix=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + if test $gl_cv_func_getopt_posix = maybe; then + if test "$cross_compiling" = yes +then : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include + +int +main () +{ + static char program[] = "program"; + static char donald[] = "donald"; + static char p[] = "-p"; + static char billy[] = "billy"; + static char duck[] = "duck"; + static char a[] = "-a"; + static char bar[] = "bar"; + char *argv[] = { program, donald, p, billy, duck, a, bar, NULL }; + int c; + + c = getopt (7, argv, "+abp:q:"); + if (!(c == -1)) + return 4; + if (!(strcmp (argv[0], "program") == 0)) + return 5; + if (!(strcmp (argv[1], "donald") == 0)) + return 6; + if (!(strcmp (argv[2], "-p") == 0)) + return 7; + if (!(strcmp (argv[3], "billy") == 0)) + return 8; + if (!(strcmp (argv[4], "duck") == 0)) + return 9; + if (!(strcmp (argv[5], "-a") == 0)) + return 10; + if (!(strcmp (argv[6], "bar") == 0)) + return 11; + if (!(optind == 1)) + return 12; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_getopt_posix=maybe +else $as_nop + gl_cv_func_getopt_posix=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + if test $gl_cv_func_getopt_posix = maybe; then + if test "$cross_compiling" = yes +then : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include + +int +main () +{ + static char program[] = "program"; + static char ab[] = "-ab"; + char *argv[3] = { program, ab, NULL }; + if (getopt (2, argv, "ab:") != 'a') + return 13; + if (getopt (2, argv, "ab:") != '?') + return 14; + if (optopt != 'b') + return 15; + if (optind != 2) + return 16; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_getopt_posix=yes +else $as_nop + gl_cv_func_getopt_posix=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + else + case "$host_os" in + darwin* | aix* | mingw*) gl_cv_func_getopt_posix="guessing no";; + *) gl_cv_func_getopt_posix="guessing yes";; + esac + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_posix" >&5 +printf "%s\n" "$gl_cv_func_getopt_posix" >&6; } + case "$gl_cv_func_getopt_posix" in + *no) gl_replace_getopt=yes ;; + esac + fi + + if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working GNU getopt function" >&5 +printf %s "checking for working GNU getopt function... " >&6; } +if test ${gl_cv_func_getopt_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Even with POSIXLY_CORRECT, the GNU extension of leading '-' in the + # optstring is necessary for programs like m4 that have POSIX-mandated + # semantics for supporting options interspersed with files. + # Also, since getopt_long is a GNU extension, we require optind=0. + # Bash ties 'set -o posix' to a non-exported POSIXLY_CORRECT; + # so take care to revert to the correct (non-)export state. + gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }' + case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include + +#include +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on Mac OS X. */ +#include +#include +#include +#include +#include +#include +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#elif defined _WIN32 && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include +#include +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} +#else +/* Avoid a crash on POSIX systems. */ +#include +#include +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + _exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif + + +int +main (void) +{ + + int result = 0; + + nocrash_init(); + + /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, + and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, + OSF/1 5.1, Solaris 10. */ + { + static char conftest[] = "conftest"; + static char plus[] = "-+"; + char *argv[3] = { conftest, plus, NULL }; + opterr = 0; + if (getopt (2, argv, "+a") != '?') + result |= 1; + } + /* This code succeeds on glibc 2.8, mingw, + and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, + IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ + { + static char program[] = "program"; + static char p[] = "-p"; + static char foo[] = "foo"; + static char bar[] = "bar"; + char *argv[] = { program, p, foo, bar, NULL }; + + optind = 1; + if (getopt (4, argv, "p::") != 'p') + result |= 2; + else if (optarg != NULL) + result |= 4; + else if (getopt (4, argv, "p::") != -1) + result |= 6; + else if (optind != 2) + result |= 8; + } + /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ + { + static char program[] = "program"; + static char foo[] = "foo"; + static char p[] = "-p"; + char *argv[] = { program, foo, p, NULL }; + optind = 0; + if (getopt (3, argv, "-p") != 1) + result |= 16; + else if (getopt (3, argv, "-p") != 'p') + result |= 16; + } + /* This code fails on glibc 2.11. */ + { + static char program[] = "program"; + static char b[] = "-b"; + static char a[] = "-a"; + char *argv[] = { program, b, a, NULL }; + optind = opterr = 0; + if (getopt (3, argv, "+:a:b") != 'b') + result |= 32; + else if (getopt (3, argv, "+:a:b") != ':') + result |= 32; + } + /* This code dumps core on glibc 2.14. */ + { + static char program[] = "program"; + static char w[] = "-W"; + static char dummy[] = "dummy"; + char *argv[] = { program, w, dummy, NULL }; + optind = opterr = 1; + if (getopt (3, argv, "W;") != 'W') + result |= 64; + } + return result; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_getopt_gnu=yes +else $as_nop + gl_cv_func_getopt_gnu=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + case $gl_had_POSIXLY_CORRECT in + exported) ;; + yes) { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;}; POSIXLY_CORRECT=1 ;; + *) { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;} ;; + esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_gnu" >&5 +printf "%s\n" "$gl_cv_func_getopt_gnu" >&6; } + if test "$gl_cv_func_getopt_gnu" != yes; then + gl_replace_getopt=yes + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working GNU getopt_long function" >&5 +printf %s "checking for working GNU getopt_long function... " >&6; } +if test ${gl_cv_func_getopt_long_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + openbsd*) gl_cv_func_getopt_long_gnu="guessing no";; + *) gl_cv_func_getopt_long_gnu="guessing yes";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include + +int +main (void) +{ +static const struct option long_options[] = + { + { "xtremely-",no_argument, NULL, 1003 }, + { "xtra", no_argument, NULL, 1001 }, + { "xtreme", no_argument, NULL, 1002 }, + { "xtremely", no_argument, NULL, 1003 }, + { NULL, 0, NULL, 0 } + }; + /* This code fails on OpenBSD 5.0. */ + { + static char program[] = "program"; + static char xtremel[] = "--xtremel"; + char *argv[] = { program, xtremel, NULL }; + int option_index; + optind = 1; opterr = 0; + if (getopt_long (2, argv, "", long_options, &option_index) != 1003) + return 1; + } + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_getopt_long_gnu=yes +else $as_nop + gl_cv_func_getopt_long_gnu=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_long_gnu" >&5 +printf "%s\n" "$gl_cv_func_getopt_long_gnu" >&6; } + case "$gl_cv_func_getopt_long_gnu" in + *yes) ;; + *) gl_replace_getopt=yes ;; + esac + fi + fi + + + + + + HAVE_GETRUSAGE=1; + + + + + GL_GNULIB_GETRUSAGE=0 + + + +: + + + HAVE_GETTIMEOFDAY=1; + HAVE_STRUCT_TIMEVAL=1; + HAVE_SYS_TIME_H=1; + REPLACE_GETTIMEOFDAY=0; + REPLACE_STRUCT_TIMEVAL=0; + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sys_time_h='<'sys/time.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_sys_time_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $ac_cv_header_sys_time_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'sys/time.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_sys_time_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_sys_time_h + gl_cv_next_sys_time_h='"'$gl_header'"' + else + gl_cv_next_sys_time_h='<'sys/time.h'>' + fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_time_h" >&5 +printf "%s\n" "$gl_cv_next_sys_time_h" >&6; } + fi + NEXT_SYS_TIME_H=$gl_cv_next_sys_time_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'sys/time.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_sys_time_h + fi + NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H=$gl_next_as_first_directive + + + + + + if test $ac_cv_header_sys_time_h != yes; then + HAVE_SYS_TIME_H=0 + fi + + + + + + if test $ac_cv_header_sys_socket_h != yes; then + ac_fn_c_check_header_compile "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" +if test "x$ac_cv_header_winsock2_h" = xyes +then : + printf "%s\n" "#define HAVE_WINSOCK2_H 1" >>confdefs.h + +fi + + fi + if test "$ac_cv_header_winsock2_h" = yes; then + HAVE_WINSOCK2_H=1 + UNISTD_H_HAVE_WINSOCK2_H=1 + SYS_IOCTL_H_HAVE_WINSOCK2_H=1 + else + HAVE_WINSOCK2_H=0 + fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timeval" >&5 +printf %s "checking for struct timeval... " >&6; } +if test ${gl_cv_sys_struct_timeval+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if HAVE_SYS_TIME_H + #include + #endif + #include + #if HAVE_WINSOCK2_H + # include + #endif + +int +main (void) +{ +static struct timeval x; x.tv_sec = x.tv_usec; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_sys_struct_timeval=yes +else $as_nop + gl_cv_sys_struct_timeval=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timeval" >&5 +printf "%s\n" "$gl_cv_sys_struct_timeval" >&6; } + if test $gl_cv_sys_struct_timeval != yes; then + HAVE_STRUCT_TIMEVAL=0 + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wide-enough struct timeval.tv_sec member" >&5 +printf %s "checking for wide-enough struct timeval.tv_sec member... " >&6; } +if test ${gl_cv_sys_struct_timeval_tv_sec+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if HAVE_SYS_TIME_H + #include + #endif + #include + #if HAVE_WINSOCK2_H + # include + #endif + +int +main (void) +{ +static struct timeval x; + typedef int verify_tv_sec_type[ + sizeof (time_t) <= sizeof x.tv_sec ? 1 : -1 + ]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_sys_struct_timeval_tv_sec=yes +else $as_nop + gl_cv_sys_struct_timeval_tv_sec=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timeval_tv_sec" >&5 +printf "%s\n" "$gl_cv_sys_struct_timeval_tv_sec" >&6; } + if test $gl_cv_sys_struct_timeval_tv_sec != yes; then + REPLACE_STRUCT_TIMEVAL=1 + fi + fi + + + + + + + + GL_GNULIB_GETTIMEOFDAY=0 + + + + + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libiconv-prefix was given. +if test ${with_libiconv_prefix+y} +then : + withval=$with_libiconv_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + additional_libdir2="$withval/$acl_libdirstem2" + additional_libdir3="$withval/$acl_libdirstem3" + fi + fi + +fi + + if test "X$additional_libdir2" = "X$additional_libdir"; then + additional_libdir2= + fi + if test "X$additional_libdir3" = "X$additional_libdir"; then + additional_libdir3= + fi + LIBICONV= + LTLIBICONV= + INCICONV= + LIBICONV_PREFIX= + HAVE_LIBICONV= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='iconv ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do + if test "X$found_dir" = "X"; then + eval dir=\$$additional_libdir_variable + if test -n "$dir"; then + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + fi + done + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem3 | */$acl_libdirstem3/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then + haveit= + if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$dependency_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$dependency_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$dependency_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$dependency_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$dependency_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$dependency_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dep=`echo "X$dep" | sed -e 's/^X-l//'` + if test "X$dep" != Xc \ + || case $host_os in + linux* | gnu* | k*bsd*-gnu) false ;; + *) true ;; + esac; then + names_next_round="$names_next_round $dep" + fi + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" + ;; + esac + done + fi + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" + done + fi + + + + + + + + + ICONV_CONST=; + REPLACE_ICONV=0; + REPLACE_ICONV_OPEN=0; + REPLACE_ICONV_UTF=0; + ICONV_H=''; + if false; then + ICONV_H='iconv.h' + fi + + if test -n "$ICONV_H"; then + GL_GENERATE_ICONV_H_TRUE= + GL_GENERATE_ICONV_H_FALSE='#' +else + GL_GENERATE_ICONV_H_TRUE='#' + GL_GENERATE_ICONV_H_FALSE= +fi + + + + + + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 +printf %s "checking for iconv... " >&6; } +if test ${am_cv_func_iconv+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main (void) +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main (void) +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 +printf "%s\n" "$am_cv_func_iconv" >&6; } + if test "$am_cv_func_iconv" = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 +printf %s "checking for working iconv... " >&6; } +if test ${am_cv_func_iconv_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + am_cv_func_iconv_works=no + for ac_iconv_const in '' 'const'; do + if test "$cross_compiling" = yes +then : + case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +#ifndef ICONV_CONST +# define ICONV_CONST $ac_iconv_const +#endif + +int +main (void) +{ +int result = 0; + /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from + successful returns. This is even documented in + */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 1; + iconv_close (cd_utf8_to_88591); + } + } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\263"; + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 2; + iconv_close (cd_ascii_to_88591); + } + } + /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304"; + static char buf[2] = { (char)0xDE, (char)0xAD }; + ICONV_CONST char *inptr = input; + size_t inbytesleft = 1; + char *outptr = buf; + size_t outbytesleft = 1; + size_t res = iconv (cd_88591_to_utf8, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) + result |= 4; + iconv_close (cd_88591_to_utf8); + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + result |= 8; + iconv_close (cd_88591_to_utf8); + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + { + /* Try standardized names. */ + iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP"); + /* Try IRIX, OSF/1 names. */ + iconv_t cd2 = iconv_open ("UTF-8", "eucJP"); + /* Try AIX names. */ + iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP"); + /* Try HP-UX names. */ + iconv_t cd4 = iconv_open ("utf8", "eucJP"); + if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1) + && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1)) + result |= 16; + if (cd1 != (iconv_t)(-1)) + iconv_close (cd1); + if (cd2 != (iconv_t)(-1)) + iconv_close (cd2); + if (cd3 != (iconv_t)(-1)) + iconv_close (cd3); + if (cd4 != (iconv_t)(-1)) + iconv_close (cd4); + } + return result; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + am_cv_func_iconv_works=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + test "$am_cv_func_iconv_works" = no || break + done + LIBS="$am_save_LIBS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 +printf "%s\n" "$am_cv_func_iconv_works" >&6; } + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + +printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h + + fi + if test "$am_cv_lib_iconv" = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 +printf %s "checking how to link with libiconv... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 +printf "%s\n" "$LIBICONV" >&6; } + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + + + + if test "$am_cv_func_iconv" = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether iconv is compatible with its POSIX signature" >&5 +printf %s "checking whether iconv is compatible with its POSIX signature... " >&6; } +if test ${gl_cv_iconv_nonconst+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_iconv_nonconst=yes +else $as_nop + gl_cv_iconv_nonconst=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_iconv_nonconst" >&5 +printf "%s\n" "$gl_cv_iconv_nonconst" >&6; } + else + gl_cv_iconv_nonconst=yes + fi + if test $gl_cv_iconv_nonconst = yes; then + iconv_arg1="" + else + iconv_arg1="const" + fi + +printf "%s\n" "#define ICONV_CONST $iconv_arg1" >>confdefs.h + + + if test $gl_cv_iconv_nonconst != yes; then + ICONV_CONST="const" + fi + + + + + GL_GNULIB_ICONV=0 + + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_iconv_h='<'iconv.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_iconv_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $ac_cv_header_iconv_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'iconv.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_iconv_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_iconv_h + gl_cv_next_iconv_h='"'$gl_header'"' + else + gl_cv_next_iconv_h='<'iconv.h'>' + fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_iconv_h" >&5 +printf "%s\n" "$gl_cv_next_iconv_h" >&6; } + fi + NEXT_ICONV_H=$gl_cv_next_iconv_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'iconv.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_iconv_h + fi + NEXT_AS_FIRST_DIRECTIVE_ICONV_H=$gl_next_as_first_directive + + + + + + + + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_limits_h='<'limits.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_limits_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $ac_cv_header_limits_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'limits.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_limits_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_limits_h + gl_cv_next_limits_h='"'$gl_header'"' + else + gl_cv_next_limits_h='<'limits.h'>' + fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_limits_h" >&5 +printf "%s\n" "$gl_cv_next_limits_h" >&6; } + fi + NEXT_LIMITS_H=$gl_cv_next_limits_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'limits.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_limits_h + fi + NEXT_AS_FIRST_DIRECTIVE_LIMITS_H=$gl_next_as_first_directive + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether limits.h has WORD_BIT, BOOL_WIDTH etc." >&5 +printf %s "checking whether limits.h has WORD_BIT, BOOL_WIDTH etc.... " >&6; } +if test ${gl_cv_header_limits_width+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include + long long llm = LLONG_MAX; + int wb = WORD_BIT; + int ullw = ULLONG_WIDTH; + int bw = BOOL_WIDTH; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_header_limits_width=yes +else $as_nop + gl_cv_header_limits_width=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_limits_width" >&5 +printf "%s\n" "$gl_cv_header_limits_width" >&6; } + if test "$gl_cv_header_limits_width" = yes; then + LIMITS_H= + else + LIMITS_H=limits.h + fi + + if test -n "$LIMITS_H"; then + GL_GENERATE_LIMITS_H_TRUE= + GL_GENERATE_LIMITS_H_FALSE='#' +else + GL_GENERATE_LIMITS_H_TRUE='#' + GL_GENERATE_LIMITS_H_FALSE= +fi + + + + + + + + +printf "%s\n" "#define HAVE_LONG_LONG_INT 1" >>confdefs.h + + +printf "%s\n" "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h + + + + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + + + + if test $ac_cv_header_inttypes_h = yes; then + HAVE_INTTYPES_H=1 + else + HAVE_INTTYPES_H=0 + fi + + + + if test $ac_cv_header_sys_types_h = yes; then + HAVE_SYS_TYPES_H=1 + else + HAVE_SYS_TYPES_H=0 + fi + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stdint_h='<'stdint.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_stdint_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $ac_cv_header_stdint_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'stdint.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_stdint_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_stdint_h + gl_cv_next_stdint_h='"'$gl_header'"' + else + gl_cv_next_stdint_h='<'stdint.h'>' + fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdint_h" >&5 +printf "%s\n" "$gl_cv_next_stdint_h" >&6; } + fi + NEXT_STDINT_H=$gl_cv_next_stdint_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'stdint.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_stdint_h + fi + NEXT_AS_FIRST_DIRECTIVE_STDINT_H=$gl_next_as_first_directive + + + + + if test $ac_cv_header_stdint_h = yes; then + HAVE_STDINT_H=1 + else + HAVE_STDINT_H=0 + fi + + + if test $ac_cv_header_stdint_h = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stdint.h conforms to C99" >&5 +printf %s "checking whether stdint.h conforms to C99... " >&6; } +if test ${gl_cv_header_working_stdint_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_header_working_stdint_h=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#define __STDC_CONSTANT_MACROS 1 +#define __STDC_LIMIT_MACROS 1 +#include +/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ +#if !(defined WCHAR_MIN && defined WCHAR_MAX) +#error "WCHAR_MIN, WCHAR_MAX not defined in " +#endif + + + #include + #include + #if HAVE_WCHAR_H + # include + #endif + + +#ifdef INT8_MAX +int8_t a1 = INT8_MAX; +int8_t a1min = INT8_MIN; +#endif +#ifdef INT16_MAX +int16_t a2 = INT16_MAX; +int16_t a2min = INT16_MIN; +#endif +#ifdef INT32_MAX +int32_t a3 = INT32_MAX; +int32_t a3min = INT32_MIN; +#endif +#ifdef INT64_MAX +int64_t a4 = INT64_MAX; +int64_t a4min = INT64_MIN; +#endif +#ifdef UINT8_MAX +uint8_t b1 = UINT8_MAX; +#else +typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; +#endif +#ifdef UINT16_MAX +uint16_t b2 = UINT16_MAX; +#endif +#ifdef UINT32_MAX +uint32_t b3 = UINT32_MAX; +#endif +#ifdef UINT64_MAX +uint64_t b4 = UINT64_MAX; +#endif +int_least8_t c1 = INT8_C (0x7f); +int_least8_t c1max = INT_LEAST8_MAX; +int_least8_t c1min = INT_LEAST8_MIN; +int_least16_t c2 = INT16_C (0x7fff); +int_least16_t c2max = INT_LEAST16_MAX; +int_least16_t c2min = INT_LEAST16_MIN; +int_least32_t c3 = INT32_C (0x7fffffff); +int_least32_t c3max = INT_LEAST32_MAX; +int_least32_t c3min = INT_LEAST32_MIN; +int_least64_t c4 = INT64_C (0x7fffffffffffffff); +int_least64_t c4max = INT_LEAST64_MAX; +int_least64_t c4min = INT_LEAST64_MIN; +uint_least8_t d1 = UINT8_C (0xff); +uint_least8_t d1max = UINT_LEAST8_MAX; +uint_least16_t d2 = UINT16_C (0xffff); +uint_least16_t d2max = UINT_LEAST16_MAX; +uint_least32_t d3 = UINT32_C (0xffffffff); +uint_least32_t d3max = UINT_LEAST32_MAX; +uint_least64_t d4 = UINT64_C (0xffffffffffffffff); +uint_least64_t d4max = UINT_LEAST64_MAX; +int_fast8_t e1 = INT_FAST8_MAX; +int_fast8_t e1min = INT_FAST8_MIN; +int_fast16_t e2 = INT_FAST16_MAX; +int_fast16_t e2min = INT_FAST16_MIN; +int_fast32_t e3 = INT_FAST32_MAX; +int_fast32_t e3min = INT_FAST32_MIN; +int_fast64_t e4 = INT_FAST64_MAX; +int_fast64_t e4min = INT_FAST64_MIN; +uint_fast8_t f1 = UINT_FAST8_MAX; +uint_fast16_t f2 = UINT_FAST16_MAX; +uint_fast32_t f3 = UINT_FAST32_MAX; +uint_fast64_t f4 = UINT_FAST64_MAX; +#ifdef INTPTR_MAX +intptr_t g = INTPTR_MAX; +intptr_t gmin = INTPTR_MIN; +#endif +#ifdef UINTPTR_MAX +uintptr_t h = UINTPTR_MAX; +#endif +intmax_t i = INTMAX_MAX; +uintmax_t j = UINTMAX_MAX; + +/* Check that SIZE_MAX has the correct type, if possible. */ +#if 201112 <= __STDC_VERSION__ +int k = _Generic (SIZE_MAX, size_t: 0); +#elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ + || (0x5110 <= __SUNPRO_C && !__STDC__)) +extern size_t k; +extern __typeof__ (SIZE_MAX) k; +#endif + +#include /* for CHAR_BIT */ +#define TYPE_MINIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) +#define TYPE_MAXIMUM(t) \ + ((t) ((t) 0 < (t) -1 \ + ? (t) -1 \ + : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) +struct s { + int check_PTRDIFF: + PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) + && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) + ? 1 : -1; + /* Detect bug in FreeBSD 6.0/ia64 and FreeBSD 13.0/arm64. */ + int check_SIG_ATOMIC: + SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) + && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) + ? 1 : -1; + int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; + int check_WCHAR: + WCHAR_MIN == TYPE_MINIMUM (wchar_t) + && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) + ? 1 : -1; + /* Detect bug in mingw. */ + int check_WINT: + WINT_MIN == TYPE_MINIMUM (wint_t) + && WINT_MAX == TYPE_MAXIMUM (wint_t) + ? 1 : -1; + + /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ + int check_UINT8_C: + (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; + int check_UINT16_C: + (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; + + /* Detect bugs in OpenBSD 3.9 stdint.h. */ +#ifdef UINT8_MAX + int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; +#endif +#ifdef UINT16_MAX + int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; +#endif +#ifdef UINT32_MAX + int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; +#endif +#ifdef UINT64_MAX + int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; +#endif + int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; + int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; + int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; + int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; + int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; + int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; + int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; + int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; + int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; + int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; + int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; +}; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on native Windows. + mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; + # In general, assume it works. + *) gl_cv_header_working_stdint_h="guessing yes" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#define __STDC_CONSTANT_MACROS 1 +#define __STDC_LIMIT_MACROS 1 +#include + + + #include + #include + #if HAVE_WCHAR_H + # include + #endif + + +#include +#include +#define MVAL(macro) MVAL1(macro) +#define MVAL1(expression) #expression +static const char *macro_values[] = + { +#ifdef INT8_MAX + MVAL (INT8_MAX), +#endif +#ifdef INT16_MAX + MVAL (INT16_MAX), +#endif +#ifdef INT32_MAX + MVAL (INT32_MAX), +#endif +#ifdef INT64_MAX + MVAL (INT64_MAX), +#endif +#ifdef UINT8_MAX + MVAL (UINT8_MAX), +#endif +#ifdef UINT16_MAX + MVAL (UINT16_MAX), +#endif +#ifdef UINT32_MAX + MVAL (UINT32_MAX), +#endif +#ifdef UINT64_MAX + MVAL (UINT64_MAX), +#endif + NULL + }; + +int +main (void) +{ + + const char **mv; + for (mv = macro_values; *mv != NULL; mv++) + { + const char *value = *mv; + /* Test whether it looks like a cast expression. */ + if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 + || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 + || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 + || strncmp (value, "((int)"/*)*/, 6) == 0 + || strncmp (value, "((signed short)"/*)*/, 15) == 0 + || strncmp (value, "((signed char)"/*)*/, 14) == 0) + return mv - macro_values + 1; + } + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_header_working_stdint_h=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_stdint_h" >&5 +printf "%s\n" "$gl_cv_header_working_stdint_h" >&6; } + fi + + HAVE_C99_STDINT_H=0 + HAVE_SYS_BITYPES_H=0 + HAVE_SYS_INTTYPES_H=0 + STDINT_H=stdint.h + case "$gl_cv_header_working_stdint_h" in + *yes) + HAVE_C99_STDINT_H=1 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stdint.h works without ISO C predefines" >&5 +printf %s "checking whether stdint.h works without ISO C predefines... " >&6; } +if test ${gl_cv_header_stdint_without_STDC_macros+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_header_stdint_without_STDC_macros=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include + + + #include + #include + #if HAVE_WCHAR_H + # include + #endif + + +intmax_t im = INTMAX_MAX; +int32_t i32 = INT32_C (0x7fffffff); + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_header_stdint_without_STDC_macros=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_without_STDC_macros" >&5 +printf "%s\n" "$gl_cv_header_stdint_without_STDC_macros" >&6; } + + if test $gl_cv_header_stdint_without_STDC_macros = no; then + +printf "%s\n" "#define __STDC_CONSTANT_MACROS 1" >>confdefs.h + + +printf "%s\n" "#define __STDC_LIMIT_MACROS 1" >>confdefs.h + + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stdint.h has UINTMAX_WIDTH etc." >&5 +printf %s "checking whether stdint.h has UINTMAX_WIDTH etc.... " >&6; } +if test ${gl_cv_header_stdint_width+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_header_stdint_width=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 + #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include + + #include + #include + #if HAVE_WCHAR_H + # include + #endif + + int iw = UINTMAX_WIDTH; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_header_stdint_width=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_width" >&5 +printf "%s\n" "$gl_cv_header_stdint_width" >&6; } + if test "$gl_cv_header_stdint_width" = yes; then + STDINT_H= + fi + ;; + *) + ac_fn_c_check_header_compile "$LINENO" "sys/inttypes.h" "ac_cv_header_sys_inttypes_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_inttypes_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_INTTYPES_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/bitypes.h" "ac_cv_header_sys_bitypes_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_bitypes_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_BITYPES_H 1" >>confdefs.h + +fi + + if test $ac_cv_header_sys_inttypes_h = yes; then + HAVE_SYS_INTTYPES_H=1 + fi + if test $ac_cv_header_sys_bitypes_h = yes; then + HAVE_SYS_BITYPES_H=1 + fi + + + if test $APPLE_UNIVERSAL_BUILD = 0; then + + + for gltype in ptrdiff_t size_t ; do + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 +printf %s "checking for bit size of $gltype... " >&6; } +if eval test \${gl_cv_bitsizeof_${gltype}+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " + #include + #include + #if HAVE_WCHAR_H + # include + #endif + +#include " +then : + +else $as_nop + result=unknown +fi + + eval gl_cv_bitsizeof_${gltype}=\$result + +fi +eval ac_res=\$gl_cv_bitsizeof_${gltype} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + printf "%s\n" "#define BITSIZEOF_${GLTYPE} $result" >>confdefs.h + + eval BITSIZEOF_${GLTYPE}=\$result + done + + + fi + + + for gltype in sig_atomic_t wchar_t wint_t ; do + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 +printf %s "checking for bit size of $gltype... " >&6; } +if eval test \${gl_cv_bitsizeof_${gltype}+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " + #include + #include + #if HAVE_WCHAR_H + # include + #endif + +#include " +then : + +else $as_nop + result=unknown +fi + + eval gl_cv_bitsizeof_${gltype}=\$result + +fi +eval ac_res=\$gl_cv_bitsizeof_${gltype} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + printf "%s\n" "#define BITSIZEOF_${GLTYPE} $result" >>confdefs.h + + eval BITSIZEOF_${GLTYPE}=\$result + done + + + + + for gltype in sig_atomic_t wchar_t wint_t ; do + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $gltype is signed" >&5 +printf %s "checking whether $gltype is signed... " >&6; } +if eval test \${gl_cv_type_${gltype}_signed+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + #if HAVE_WCHAR_H + # include + #endif + + int verify[2 * (($gltype) -1 < ($gltype) 0) - 1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + result=yes +else $as_nop + result=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval gl_cv_type_${gltype}_signed=\$result + +fi +eval ac_res=\$gl_cv_type_${gltype}_signed + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval result=\$gl_cv_type_${gltype}_signed + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + if test "$result" = yes; then + printf "%s\n" "#define HAVE_SIGNED_${GLTYPE} 1" >>confdefs.h + + eval HAVE_SIGNED_${GLTYPE}=1 + else + eval HAVE_SIGNED_${GLTYPE}=0 + fi + done + + + gl_cv_type_ptrdiff_t_signed=yes + gl_cv_type_size_t_signed=no + if test $APPLE_UNIVERSAL_BUILD = 0; then + + + for gltype in ptrdiff_t size_t ; do + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 +printf %s "checking for $gltype integer literal suffix... " >&6; } +if eval test \${gl_cv_type_${gltype}_suffix+y} +then : + printf %s "(cached) " >&6 +else $as_nop + eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + #if HAVE_WCHAR_H + # include + #endif + + extern $gltype foo; + extern $gltype1 foo; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval gl_cv_type_${gltype}_suffix=\$glsuf +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done +fi +eval ac_res=\$gl_cv_type_${gltype}_suffix + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + printf "%s\n" "#define ${GLTYPE}_SUFFIX $result" >>confdefs.h + + done + + + fi + + + for gltype in sig_atomic_t wchar_t wint_t ; do + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 +printf %s "checking for $gltype integer literal suffix... " >&6; } +if eval test \${gl_cv_type_${gltype}_suffix+y} +then : + printf %s "(cached) " >&6 +else $as_nop + eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + #if HAVE_WCHAR_H + # include + #endif + + extern $gltype foo; + extern $gltype1 foo; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval gl_cv_type_${gltype}_suffix=\$glsuf +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done +fi +eval ac_res=\$gl_cv_type_${gltype}_suffix + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + printf "%s\n" "#define ${GLTYPE}_SUFFIX $result" >>confdefs.h + + done + + + + if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then + BITSIZEOF_WINT_T=32 + fi + + ;; + esac + + + + LIMITS_H='limits.h' + if test -n "$LIMITS_H"; then + GL_GENERATE_LIMITS_H_TRUE= + GL_GENERATE_LIMITS_H_FALSE='#' +else + GL_GENERATE_LIMITS_H_TRUE='#' + GL_GENERATE_LIMITS_H_FALSE= +fi + + + + + + + + if test -n "$STDINT_H"; then + GL_GENERATE_STDINT_H_TRUE= + GL_GENERATE_STDINT_H_FALSE='#' +else + GL_GENERATE_STDINT_H_TRUE='#' + GL_GENERATE_STDINT_H_FALSE= +fi + + + + HAVE_DECL_IMAXABS=1; + HAVE_DECL_IMAXDIV=1; + HAVE_DECL_STRTOIMAX=1; + HAVE_DECL_STRTOUMAX=1; + HAVE_IMAXDIV_T=1; + REPLACE_STRTOIMAX=0; + REPLACE_STRTOUMAX=0; + INT32_MAX_LT_INTMAX_MAX=1; + INT64_MAX_EQ_LONG_MAX='defined _LP64'; + PRIPTR_PREFIX=__PRIPTR_PREFIX; + UINT32_MAX_LT_UINTMAX_MAX=1; + UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_inttypes_h='<'inttypes.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_inttypes_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $ac_cv_header_inttypes_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'inttypes.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_inttypes_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_inttypes_h + gl_cv_next_inttypes_h='"'$gl_header'"' + else + gl_cv_next_inttypes_h='<'inttypes.h'>' + fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_inttypes_h" >&5 +printf "%s\n" "$gl_cv_next_inttypes_h" >&6; } + fi + NEXT_INTTYPES_H=$gl_cv_next_inttypes_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'inttypes.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_inttypes_h + fi + NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H=$gl_next_as_first_directive + + + + + + + + + + + + + + + + + PRIPTR_PREFIX= + if test -n "$STDINT_H"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #ifdef _WIN64 + LLP64 + #endif + +int +main (void) +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + PRIPTR_PREFIX='"l"' +else $as_nop + PRIPTR_PREFIX='"ll"' +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + else + for glpfx in '' l ll I64; do + case $glpfx in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + I64) gltype1='__int64';; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + extern intptr_t foo; + extern $gltype1 foo; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + PRIPTR_PREFIX='"'$glpfx'"' +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + test -n "$PRIPTR_PREFIX" && break + done + fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether INT32_MAX < INTMAX_MAX" >&5 +printf %s "checking whether INT32_MAX < INTMAX_MAX... " >&6; } +if test ${gl_cv_test_INT32_MAX_LT_INTMAX_MAX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Work also in C++ mode. */ + #define __STDC_LIMIT_MACROS 1 + + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H + + #include + #if HAVE_STDINT_H + #include + #endif + + #if defined INT32_MAX && defined INTMAX_MAX + #define CONDITION (INT32_MAX < INTMAX_MAX) + #else + #define CONDITION (sizeof (int) < sizeof (long long int)) + #endif + int test[CONDITION ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_test_INT32_MAX_LT_INTMAX_MAX=yes +else $as_nop + gl_cv_test_INT32_MAX_LT_INTMAX_MAX=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_test_INT32_MAX_LT_INTMAX_MAX" >&5 +printf "%s\n" "$gl_cv_test_INT32_MAX_LT_INTMAX_MAX" >&6; } + if test $gl_cv_test_INT32_MAX_LT_INTMAX_MAX = yes; then + INT32_MAX_LT_INTMAX_MAX=1; + else + INT32_MAX_LT_INTMAX_MAX=0; + fi + + + if test $APPLE_UNIVERSAL_BUILD = 0; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether INT64_MAX == LONG_MAX" >&5 +printf %s "checking whether INT64_MAX == LONG_MAX... " >&6; } +if test ${gl_cv_test_INT64_MAX_EQ_LONG_MAX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Work also in C++ mode. */ + #define __STDC_LIMIT_MACROS 1 + + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H + + #include + #if HAVE_STDINT_H + #include + #endif + + #if defined INT64_MAX + #define CONDITION (INT64_MAX == LONG_MAX) + #else + #define CONDITION (sizeof (long long int) == sizeof (long int)) + #endif + int test[CONDITION ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_test_INT64_MAX_EQ_LONG_MAX=yes +else $as_nop + gl_cv_test_INT64_MAX_EQ_LONG_MAX=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_test_INT64_MAX_EQ_LONG_MAX" >&5 +printf "%s\n" "$gl_cv_test_INT64_MAX_EQ_LONG_MAX" >&6; } + if test $gl_cv_test_INT64_MAX_EQ_LONG_MAX = yes; then + INT64_MAX_EQ_LONG_MAX=1; + else + INT64_MAX_EQ_LONG_MAX=0; + fi + + + else + INT64_MAX_EQ_LONG_MAX=-1 + fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether UINT32_MAX < UINTMAX_MAX" >&5 +printf %s "checking whether UINT32_MAX < UINTMAX_MAX... " >&6; } +if test ${gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Work also in C++ mode. */ + #define __STDC_LIMIT_MACROS 1 + + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H + + #include + #if HAVE_STDINT_H + #include + #endif + + #if defined UINT32_MAX && defined UINTMAX_MAX + #define CONDITION (UINT32_MAX < UINTMAX_MAX) + #else + #define CONDITION (sizeof (unsigned int) < sizeof (unsigned long long int)) + #endif + int test[CONDITION ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX=yes +else $as_nop + gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX" >&5 +printf "%s\n" "$gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX" >&6; } + if test $gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX = yes; then + UINT32_MAX_LT_UINTMAX_MAX=1; + else + UINT32_MAX_LT_UINTMAX_MAX=0; + fi + + + if test $APPLE_UNIVERSAL_BUILD = 0; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether UINT64_MAX == ULONG_MAX" >&5 +printf %s "checking whether UINT64_MAX == ULONG_MAX... " >&6; } +if test ${gl_cv_test_UINT64_MAX_EQ_ULONG_MAX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Work also in C++ mode. */ + #define __STDC_LIMIT_MACROS 1 + + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H + + #include + #if HAVE_STDINT_H + #include + #endif + + #if defined UINT64_MAX + #define CONDITION (UINT64_MAX == ULONG_MAX) + #else + #define CONDITION (sizeof (unsigned long long int) == sizeof (unsigned long int)) + #endif + int test[CONDITION ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_test_UINT64_MAX_EQ_ULONG_MAX=yes +else $as_nop + gl_cv_test_UINT64_MAX_EQ_ULONG_MAX=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_test_UINT64_MAX_EQ_ULONG_MAX" >&5 +printf "%s\n" "$gl_cv_test_UINT64_MAX_EQ_ULONG_MAX" >&6; } + if test $gl_cv_test_UINT64_MAX_EQ_ULONG_MAX = yes; then + UINT64_MAX_EQ_ULONG_MAX=1; + else + UINT64_MAX_EQ_ULONG_MAX=0; + fi + + + else + UINT64_MAX_EQ_ULONG_MAX=-1 + fi + + + + + GL_GNULIB_IMAXABS=0 + + + + GL_GNULIB_IMAXDIV=0 + + + + GL_GNULIB_STRTOIMAX=0 + + + + GL_GNULIB_STRTOUMAX=0 + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'float'" >&5 +printf %s "checking where to find the exponent in a 'float'... " >&6; } +if test ${gl_cv_cc_float_expbit0+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + gl_cv_cc_float_expbit0="word 0 bit 23" +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { float value; unsigned int word[NWORDS]; } memory_float; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (float x) +{ + memory_float m; + size_t i; + /* Clear it first, in case + sizeof (float) < sizeof (memory_float). */ + memset (&m, 0, sizeof (memory_float)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25f); + add_to_ored_words (0.5f); + add_to_ored_words (1.0f); + add_to_ored_words (2.0f); + add_to_ored_words (4.0f); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_cc_float_expbit0=`cat conftest.out` +else $as_nop + gl_cv_cc_float_expbit0="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -f conftest.out + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_float_expbit0" >&5 +printf "%s\n" "$gl_cv_cc_float_expbit0" >&6; } + case "$gl_cv_cc_float_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` + +printf "%s\n" "#define FLT_EXPBIT0_WORD $word" >>confdefs.h + + +printf "%s\n" "#define FLT_EXPBIT0_BIT $bit" >>confdefs.h + + ;; + esac + + + + ISNANF_LIBM= + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) can be used without linking with libm" >&5 +printf %s "checking whether isnan(float) can be used without linking with libm... " >&6; } +if test ${gl_cv_func_isnanf_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) + # undef isnanf + # define isnanf(x) __builtin_isnan ((float)(x)) + #elif defined isnan + # undef isnanf + # define isnanf(x) isnan ((float)(x)) + #endif + float x; +int +main (void) +{ +return isnanf (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_isnanf_no_libm=yes +else $as_nop + gl_cv_func_isnanf_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_no_libm" >&5 +printf "%s\n" "$gl_cv_func_isnanf_no_libm" >&6; } + + if test $gl_cv_func_isnanf_no_libm = no; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) can be used with libm" >&5 +printf %s "checking whether isnan(float) can be used with libm... " >&6; } +if test ${gl_cv_func_isnanf_in_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) + # undef isnanf + # define isnanf(x) __builtin_isnan ((float)(x)) + #elif defined isnan + # undef isnanf + # define isnanf(x) isnan ((float)(x)) + #endif + float x; +int +main (void) +{ +return isnanf (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_isnanf_in_libm=yes +else $as_nop + gl_cv_func_isnanf_in_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$save_LIBS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_in_libm" >&5 +printf "%s\n" "$gl_cv_func_isnanf_in_libm" >&6; } + + if test $gl_cv_func_isnanf_in_libm = yes; then + ISNANF_LIBM=-lm + fi + fi + if test $gl_cv_func_isnanf_no_libm = yes \ + || test $gl_cv_func_isnanf_in_libm = yes; then + save_LIBS="$LIBS" + LIBS="$LIBS $ISNANF_LIBM" + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) works" >&5 +printf %s "checking whether isnan(float) works... " >&6; } +if test ${gl_cv_func_isnanf_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + case "$host_os" in + irix* | solaris*) gl_cv_func_isnanf_works="guessing no" ;; + mingw*) # Guess yes on mingw, no on MSVC. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __MINGW32__ + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_func_isnanf_works="guessing yes" +else $as_nop + gl_cv_func_isnanf_works="guessing no" +fi +rm -rf conftest* + + ;; + *) gl_cv_func_isnanf_works="guessing yes" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#if (__GNUC__ >= 4) || (__clang_major__ >= 4) +# undef isnanf +# define isnanf(x) __builtin_isnan ((float)(x)) +#elif defined isnan +# undef isnanf +# define isnanf(x) isnan ((float)(x)) +#endif +/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ +#ifdef __DECC +static float +NaN () +{ + static float zero = 0.0f; + return zero / zero; +} +#else +# define NaN() (0.0f / 0.0f) +#endif +#define NWORDS \ + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { unsigned int word[NWORDS]; float value; } memory_float; +int main() +{ + int result = 0; + + if (isnanf (1.0f / 0.0f)) + result |= 1; + + if (!isnanf (NaN ())) + result |= 2; + +#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT + /* The isnanf function should be immune against changes in the sign bit and + in the mantissa bits. The xor operation twiddles a bit that can only be + a sign bit or a mantissa bit. */ + if (FLT_EXPBIT0_WORD == 0 && FLT_EXPBIT0_BIT > 0) + { + memory_float m; + + m.value = NaN (); + /* Set the bits below the exponent to 01111...111. */ + m.word[0] &= -1U << FLT_EXPBIT0_BIT; + m.word[0] |= (1U << (FLT_EXPBIT0_BIT - 1)) - 1; + if (!isnanf (m.value)) + result |= 4; + } +#endif + + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_isnanf_works=yes +else $as_nop + gl_cv_func_isnanf_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_works" >&5 +printf "%s\n" "$gl_cv_func_isnanf_works" >&6; } + + LIBS="$save_LIBS" + case "$gl_cv_func_isnanf_works" in + *yes) gl_func_isnanf=yes ;; + *) gl_func_isnanf=no; ISNANF_LIBM= ;; + esac + else + gl_func_isnanf=no + fi + if test $gl_func_isnanf != yes; then + HAVE_ISNANF=0 + fi + + + + + ISNAND_LIBM= + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(double) can be used without linking with libm" >&5 +printf %s "checking whether isnan(double) can be used without linking with libm... " >&6; } +if test ${gl_cv_func_isnand_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) + # undef isnand + # define isnand(x) __builtin_isnan ((double)(x)) + #else + # undef isnand + # define isnand(x) isnan ((double)(x)) + #endif + double x; +int +main (void) +{ +return isnand (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_isnand_no_libm=yes +else $as_nop + gl_cv_func_isnand_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnand_no_libm" >&5 +printf "%s\n" "$gl_cv_func_isnand_no_libm" >&6; } + + if test $gl_cv_func_isnand_no_libm = no; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(double) can be used with libm" >&5 +printf %s "checking whether isnan(double) can be used with libm... " >&6; } +if test ${gl_cv_func_isnand_in_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) + # undef isnand + # define isnand(x) __builtin_isnan ((double)(x)) + #elif defined isnan + # undef isnand + # define isnand(x) isnan ((double)(x)) + #endif + double x; +int +main (void) +{ +return isnand (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_isnand_in_libm=yes +else $as_nop + gl_cv_func_isnand_in_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$save_LIBS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnand_in_libm" >&5 +printf "%s\n" "$gl_cv_func_isnand_in_libm" >&6; } + + if test $gl_cv_func_isnand_in_libm = yes; then + ISNAND_LIBM=-lm + fi + fi + if test $gl_cv_func_isnand_no_libm = yes \ + || test $gl_cv_func_isnand_in_libm = yes; then + gl_func_isnand=yes + else + gl_func_isnand=no + HAVE_ISNAND=0 + fi + + + + + ISNANL_LIBM= + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(long double) can be used without linking with libm" >&5 +printf %s "checking whether isnan(long double) can be used without linking with libm... " >&6; } +if test ${gl_cv_func_isnanl_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) + # undef isnanl + # define isnanl(x) __builtin_isnan ((long double)(x)) + #elif defined isnan + # undef isnanl + # define isnanl(x) isnan ((long double)(x)) + #endif + long double x; +int +main (void) +{ +return isnanl (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_isnanl_no_libm=yes +else $as_nop + gl_cv_func_isnanl_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_no_libm" >&5 +printf "%s\n" "$gl_cv_func_isnanl_no_libm" >&6; } + + if test $gl_cv_func_isnanl_no_libm = no; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(long double) can be used with libm" >&5 +printf %s "checking whether isnan(long double) can be used with libm... " >&6; } +if test ${gl_cv_func_isnanl_in_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) + # undef isnanl + # define isnanl(x) __builtin_isnan ((long double)(x)) + #elif defined isnan + # undef isnanl + # define isnanl(x) isnan ((long double)(x)) + #endif + long double x; +int +main (void) +{ +return isnanl (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_isnanl_in_libm=yes +else $as_nop + gl_cv_func_isnanl_in_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$save_LIBS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_in_libm" >&5 +printf "%s\n" "$gl_cv_func_isnanl_in_libm" >&6; } + + if test $gl_cv_func_isnanl_in_libm = yes; then + ISNANL_LIBM=-lm + fi + fi + if test $gl_cv_func_isnanl_no_libm = yes \ + || test $gl_cv_func_isnanl_in_libm = yes; then + save_LIBS="$LIBS" + LIBS="$LIBS $ISNANL_LIBM" + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnanl works" >&5 +printf %s "checking whether isnanl works... " >&6; } +if test ${gl_cv_func_isnanl_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + case "$host_os" in + mingw*) # Guess yes on mingw, no on MSVC. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __MINGW32__ + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_func_isnanl_works="guessing yes" +else $as_nop + gl_cv_func_isnanl_works="guessing no" +fi +rm -rf conftest* + + ;; + *) gl_cv_func_isnanl_works="guessing yes" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +#if (__GNUC__ >= 4) || (__clang_major__ >= 4) +# undef isnanl +# define isnanl(x) __builtin_isnan ((long double)(x)) +#elif defined isnan +# undef isnanl +# define isnanl(x) isnan ((long double)(x)) +#endif +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { unsigned int word[NWORDS]; long double value; } + memory_long_double; +/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the + runtime type conversion. */ +#ifdef __sgi +static long double NaNl () +{ + double zero = 0.0; + return zero / zero; +} +#else +# define NaNl() (0.0L / 0.0L) +#endif +int main () +{ + int result = 0; + + if (!isnanl (NaNl ())) + result |= 1; + + { + memory_long_double m; + unsigned int i; + + /* The isnanl function should be immune against changes in the sign bit and + in the mantissa bits. The xor operation twiddles a bit that can only be + a sign bit or a mantissa bit (since the exponent never extends to + bit 31). */ + m.value = NaNl (); + m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); + for (i = 0; i < NWORDS; i++) + m.word[i] |= 1; + if (!isnanl (m.value)) + result |= 1; + } + +#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE +/* Representation of an 80-bit 'long double' as an initializer for a sequence + of 'unsigned int' words. */ +# ifdef WORDS_BIGENDIAN +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ + ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \ + (unsigned int) (mantlo) << 16 \ + } +# else +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { mantlo, manthi, exponent } +# endif + { /* Quiet NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + if (!isnanl (x.value)) + result |= 2; + } + { + /* Signalling NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + if (!isnanl (x.value)) + result |= 2; + } + /* isnanl should return something even for noncanonical values. */ + { /* Pseudo-NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 4; + } + { /* Pseudo-Infinity. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 8; + } + { /* Pseudo-Zero. */ + static memory_long_double x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 16; + } + { /* Unnormalized number. */ + static memory_long_double x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 32; + } + { /* Pseudo-Denormal. */ + static memory_long_double x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 64; + } +#endif + + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_isnanl_works=yes +else $as_nop + gl_cv_func_isnanl_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_works" >&5 +printf "%s\n" "$gl_cv_func_isnanl_works" >&6; } + + LIBS="$save_LIBS" + case "$gl_cv_func_isnanl_works" in + *yes) gl_func_isnanl=yes ;; + *) gl_func_isnanl=no; ISNANL_LIBM= ;; + esac + else + gl_func_isnanl=no + fi + if test $gl_func_isnanl != yes; then + HAVE_ISNANL=0 + fi + + + + HAVE_ISWBLANK=1; + HAVE_WCTYPE_T=1; + HAVE_WCTRANS_T=1; + REPLACE_ISWBLANK=0; + REPLACE_ISWDIGIT=0; + REPLACE_ISWXDIGIT=0; + + + + + + if test $ac_cv_header_crtdefs_h = yes; then + HAVE_CRTDEFS_H=1 + else + HAVE_CRTDEFS_H=0 + fi + + + + + + + + + if test $ac_cv_func_iswcntrl = yes; then + HAVE_ISWCNTRL=1 + else + HAVE_ISWCNTRL=0 + fi + + + + if test $gt_cv_c_wint_t = yes; then + HAVE_WINT_T=1 + else + HAVE_WINT_T=0 + fi + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_wctype_h='<'wctype.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_wctype_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $ac_cv_header_wctype_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'wctype.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_wctype_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_wctype_h + gl_cv_next_wctype_h='"'$gl_header'"' + else + gl_cv_next_wctype_h='<'wctype.h'>' + fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_wctype_h" >&5 +printf "%s\n" "$gl_cv_next_wctype_h" >&6; } + fi + NEXT_WCTYPE_H=$gl_cv_next_wctype_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'wctype.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_wctype_h + fi + NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H=$gl_next_as_first_directive + + + + + if test $ac_cv_header_wctype_h = yes; then + if test $ac_cv_func_iswcntrl = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether iswcntrl works" >&5 +printf %s "checking whether iswcntrl works... " >&6; } +if test ${gl_cv_func_iswcntrl_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #if __GNU_LIBRARY__ == 1 + Linux libc5 i18n is broken. + #endif +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_iswcntrl_works="guessing yes" +else $as_nop + gl_cv_func_iswcntrl_works="guessing no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + int main () { return iswprint ('x') == 0; } + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_iswcntrl_works=yes +else $as_nop + gl_cv_func_iswcntrl_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_iswcntrl_works" >&5 +printf "%s\n" "$gl_cv_func_iswcntrl_works" >&6; } + fi + HAVE_WCTYPE_H=1 + else + HAVE_WCTYPE_H=0 + fi + + + if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then + REPLACE_ISWCNTRL=1 + else + case "$gl_cv_func_iswcntrl_works" in + *yes) REPLACE_ISWCNTRL=0 ;; + *) REPLACE_ISWCNTRL=1 ;; + esac + fi + + + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + : + fi + + if test $REPLACE_ISWCNTRL = 1; then + REPLACE_TOWLOWER=1 + else + ac_fn_c_check_func "$LINENO" "towlower" "ac_cv_func_towlower" +if test "x$ac_cv_func_towlower" = xyes +then : + printf "%s\n" "#define HAVE_TOWLOWER 1" >>confdefs.h + +fi + + if test $ac_cv_func_towlower = yes; then + REPLACE_TOWLOWER=0 + else + ac_fn_check_decl "$LINENO" "towlower" "ac_cv_have_decl_towlower" "#include + #if HAVE_WCTYPE_H + # include + #endif + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_towlower" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_TOWLOWER $ac_have_decl" >>confdefs.h + + if test $ac_cv_have_decl_towlower = yes; then + REPLACE_TOWLOWER=1 + else + REPLACE_TOWLOWER=0 + fi + fi + fi + + + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_TOWLOWER = 1; then + : + fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wctype_t" >&5 +printf %s "checking for wctype_t... " >&6; } +if test ${gl_cv_type_wctype_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #if HAVE_WCTYPE_H + # include + #endif + wctype_t a; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_type_wctype_t=yes +else $as_nop + gl_cv_type_wctype_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wctype_t" >&5 +printf "%s\n" "$gl_cv_type_wctype_t" >&6; } + if test $gl_cv_type_wctype_t = no; then + HAVE_WCTYPE_T=0 + fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wctrans_t" >&5 +printf %s "checking for wctrans_t... " >&6; } +if test ${gl_cv_type_wctrans_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + wctrans_t a; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_type_wctrans_t=yes +else $as_nop + gl_cv_type_wctrans_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wctrans_t" >&5 +printf "%s\n" "$gl_cv_type_wctrans_t" >&6; } + if test $gl_cv_type_wctrans_t = no; then + HAVE_WCTRANS_T=0 + fi + + + + + + + + + GL_GNULIB_ISWBLANK=0 + + + + GL_GNULIB_ISWDIGIT=0 + + + + GL_GNULIB_ISWXDIGIT=0 + + + + GL_GNULIB_WCTYPE=0 + + + + GL_GNULIB_ISWCTYPE=0 + + + + GL_GNULIB_WCTRANS=0 + + + + GL_GNULIB_TOWCTRANS=0 + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5 +printf %s "checking for nl_langinfo and CODESET... " >&6; } +if test ${am_cv_langinfo_codeset+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +char* cs = nl_langinfo(CODESET); return !cs; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + am_cv_langinfo_codeset=yes +else $as_nop + am_cv_langinfo_codeset=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_langinfo_codeset" >&5 +printf "%s\n" "$am_cv_langinfo_codeset" >&6; } + if test $am_cv_langinfo_codeset = yes; then + +printf "%s\n" "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h + + fi + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional french locale" >&5 +printf %s "checking for a traditional french locale... " >&6; } +if test ${gt_cv_locale_fr+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#if HAVE_LANGINFO_CODESET +# include +#endif +#include +#include +struct tm t; +char buf[16]; +int main () { + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if defined __BEOS__ || defined __HAIKU__ + return 1; +#else + /* Check whether the given locale name is recognized by the system. */ +# if defined _WIN32 && !defined __CYGWIN__ + /* On native Windows, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +# else + if (setlocale (LC_ALL, "") == NULL) return 1; +# endif + /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". + On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) + is empty, and the behaviour of Tcl 8.4 in this locale is not useful. + On OpenBSD 4.0, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "646". In this situation, + some unit tests fail. + On MirBSD 10, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "UTF-8". */ +# if HAVE_LANGINFO_CODESET + { + const char *cs = nl_langinfo (CODESET); + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 + || strcmp (cs, "UTF-8") == 0) + return 1; + } +# endif +# ifdef __CYGWIN__ + /* On Cygwin, avoid locale names without encoding suffix, because the + locale_charset() function relies on the encoding suffix. Note that + LC_ALL is set on the command line. */ + if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; +# endif + /* Check whether in the abbreviation of the second month, the second + character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only + one byte long. This excludes the UTF-8 encoding. */ + t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; + if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; +# if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ + /* Check whether the decimal separator is a comma. + On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point + are nl_langinfo(RADIXCHAR) are both ".". */ + if (localeconv () ->decimal_point[0] != ',') return 1; +# endif + return 0; +#endif +} + +_ACEOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + case "$host_os" in + # Handle native Windows specially, because there setlocale() interprets + # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw*) + # Test for the native Windows locale name. + if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=French_France.1252 + else + # None found. + gt_cv_locale_fr=none + fi + ;; + *) + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. Likewise for + # LC_CTYPE, which is also set at the beginning of the configure script. + # Test for the usual locale name. + if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr_FR + else + # Test for the locale name with explicit encoding suffix. + if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr_FR.ISO-8859-1 + else + # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. + if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr_FR.ISO8859-1 + else + # Test for the HP-UX locale name. + if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr_FR.iso88591 + else + # Test for the Solaris 7 locale name. + if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr + else + # None found. + gt_cv_locale_fr=none + fi + fi + fi + fi + fi + ;; + esac + fi + rm -fr conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr" >&5 +printf "%s\n" "$gt_cv_locale_fr" >&6; } + LOCALE_FR=$gt_cv_locale_fr + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional japanese locale" >&5 +printf %s "checking for a traditional japanese locale... " >&6; } +if test ${gt_cv_locale_ja+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#if HAVE_LANGINFO_CODESET +# include +#endif +#include +#include +struct tm t; +char buf[16]; +int main () +{ + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if defined __BEOS__ || defined __HAIKU__ + return 1; +#else + /* Check whether the given locale name is recognized by the system. */ +# if defined _WIN32 && !defined __CYGWIN__ + /* On native Windows, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +# else + if (setlocale (LC_ALL, "") == NULL) return 1; +# endif + /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". + On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) + is empty, and the behaviour of Tcl 8.4 in this locale is not useful. + On OpenBSD 4.0, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "646". In this situation, + some unit tests fail. + On MirBSD 10, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "UTF-8". */ +# if HAVE_LANGINFO_CODESET + { + const char *cs = nl_langinfo (CODESET); + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 + || strcmp (cs, "UTF-8") == 0) + return 1; + } +# endif +# ifdef __CYGWIN__ + /* On Cygwin, avoid locale names without encoding suffix, because the + locale_charset() function relies on the encoding suffix. Note that + LC_ALL is set on the command line. */ + if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; +# endif + /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales + on Cygwin 1.5.x. */ + if (MB_CUR_MAX == 1) + return 1; + /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. + This excludes the UTF-8 encoding (except on MirBSD). */ + { + const char *p; + t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; + if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; + for (p = buf; *p != '\0'; p++) + if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) + return 1; + } + return 0; +#endif +} + +_ACEOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + case "$host_os" in + # Handle native Windows specially, because there setlocale() interprets + # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw*) + # Note that on native Windows, the Japanese locale is + # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we + # cannot use it here. + gt_cv_locale_ja=none + ;; + *) + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. Likewise for + # LC_CTYPE, which is also set at the beginning of the configure script. + # Test for the AIX locale name. + if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja_JP + else + # Test for the locale name with explicit encoding suffix. + if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja_JP.EUC-JP + else + # Test for the HP-UX, OSF/1, NetBSD locale name. + if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja_JP.eucJP + else + # Test for the IRIX, FreeBSD locale name. + if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja_JP.EUC + else + # Test for the Solaris 7 locale name. + if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja + else + # Special test for NetBSD 1.6. + if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then + gt_cv_locale_ja=ja_JP.eucJP + else + # None found. + gt_cv_locale_ja=none + fi + fi + fi + fi + fi + fi + ;; + esac + fi + rm -fr conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_ja" >&5 +printf "%s\n" "$gt_cv_locale_ja" >&6; } + LOCALE_JA=$gt_cv_locale_ja + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 +printf %s "checking for a french Unicode locale... " >&6; } +if test ${gt_cv_locale_fr_utf8+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#if HAVE_LANGINFO_CODESET +# include +#endif +#include +#include +struct tm t; +char buf[16]; +int main () { + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if !(defined __BEOS__ || defined __HAIKU__) + /* Check whether the given locale name is recognized by the system. */ +# if defined _WIN32 && !defined __CYGWIN__ + /* On native Windows, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +# else + if (setlocale (LC_ALL, "") == NULL) return 1; +# endif + /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". + On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) + is empty, and the behaviour of Tcl 8.4 in this locale is not useful. + On OpenBSD 4.0, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "646". In this situation, + some unit tests fail. */ +# if HAVE_LANGINFO_CODESET + { + const char *cs = nl_langinfo (CODESET); + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) + return 1; + } +# endif +# ifdef __CYGWIN__ + /* On Cygwin, avoid locale names without encoding suffix, because the + locale_charset() function relies on the encoding suffix. Note that + LC_ALL is set on the command line. */ + if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; +# endif + /* Check whether in the abbreviation of the second month, the second + character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is + two bytes long, with UTF-8 encoding. */ + t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; + if (strftime (buf, sizeof (buf), "%b", &t) < 4 + || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') + return 1; +#endif +#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ + /* Check whether the decimal separator is a comma. + On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point + are nl_langinfo(RADIXCHAR) are both ".". */ + if (localeconv () ->decimal_point[0] != ',') return 1; +#endif + return 0; +} + +_ACEOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + case "$host_os" in + # Handle native Windows specially, because there setlocale() interprets + # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw*) + # Test for the hypothetical native Windows locale name. + if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=French_France.65001 + else + # None found. + gt_cv_locale_fr_utf8=none + fi + ;; + *) + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. Likewise for + # LC_CTYPE, which is also set at the beginning of the configure script. + # Test for the usual locale name. + if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr_FR + else + # Test for the locale name with explicit encoding suffix. + if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr_FR.UTF-8 + else + # Test for the Solaris 7 locale name. + if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr.UTF-8 + else + # None found. + gt_cv_locale_fr_utf8=none + fi + fi + fi + ;; + esac + fi + rm -fr conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 +printf "%s\n" "$gt_cv_locale_fr_utf8" >&6; } + LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a transitional chinese locale" >&5 +printf %s "checking for a transitional chinese locale... " >&6; } +if test ${gt_cv_locale_zh_CN+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +#if HAVE_LANGINFO_CODESET +# include +#endif +#include +#include +struct tm t; +char buf[16]; +int main () +{ + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if defined __BEOS__ || defined __HAIKU__ + return 1; +#else + /* Check whether the given locale name is recognized by the system. */ +# if defined _WIN32 && !defined __CYGWIN__ + /* On native Windows, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +# else + if (setlocale (LC_ALL, "") == NULL) return 1; +# endif + /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". + On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) + is empty, and the behaviour of Tcl 8.4 in this locale is not useful. + On OpenBSD 4.0, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "646". In this situation, + some unit tests fail. + On MirBSD 10, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "UTF-8". */ +# if HAVE_LANGINFO_CODESET + { + const char *cs = nl_langinfo (CODESET); + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 + || strcmp (cs, "UTF-8") == 0) + return 1; + } +# endif +# ifdef __CYGWIN__ + /* On Cygwin, avoid locale names without encoding suffix, because the + locale_charset() function relies on the encoding suffix. Note that + LC_ALL is set on the command line. */ + if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; +# endif + /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. + This excludes the UTF-8 encoding (except on MirBSD). */ + { + const char *p; + t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; + if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; + for (p = buf; *p != '\0'; p++) + if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) + return 1; + } + /* Check whether a typical GB18030 multibyte sequence is recognized as a + single wide character. This excludes the GB2312 and GBK encodings. */ + if (mblen ("\203\062\332\066", 5) != 4) + return 1; + return 0; +#endif +} + +_ACEOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + case "$host_os" in + # Handle native Windows specially, because there setlocale() interprets + # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw*) + # Test for the hypothetical native Windows locale name. + if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_zh_CN=Chinese_China.54936 + else + # None found. + gt_cv_locale_zh_CN=none + fi + ;; + solaris2.8) + # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are + # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. + # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. + gt_cv_locale_zh_CN=none + ;; + *) + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. Likewise for + # LC_CTYPE, which is also set at the beginning of the configure script. + # Test for the locale name without encoding suffix. + if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_zh_CN=zh_CN + else + # Test for the locale name with explicit encoding suffix. + if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_zh_CN=zh_CN.GB18030 + else + # None found. + gt_cv_locale_zh_CN=none + fi + fi + ;; + esac + else + # If there was a link error, due to mblen(), the system is so old that + # it certainly doesn't have a chinese locale. + gt_cv_locale_zh_CN=none + fi + rm -fr conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_zh_CN" >&5 +printf "%s\n" "$gt_cv_locale_zh_CN" >&6; } + LOCALE_ZH_CN=$gt_cv_locale_zh_CN + + + + + case "$host_os" in + mingw*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit off_t" >&5 +printf %s "checking for 64-bit off_t... " >&6; } +if test ${gl_cv_type_off_t_64+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1]; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_type_off_t_64=yes +else $as_nop + gl_cv_type_off_t_64=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_off_t_64" >&5 +printf "%s\n" "$gl_cv_type_off_t_64" >&6; } + if test $gl_cv_type_off_t_64 = no; then + WINDOWS_64_BIT_OFF_T=1 + else + WINDOWS_64_BIT_OFF_T=0 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit st_size" >&5 +printf %s "checking for 64-bit st_size... " >&6; } +if test ${gl_cv_member_st_size_64+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + struct stat buf; + int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1]; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_member_st_size_64=yes +else $as_nop + gl_cv_member_st_size_64=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_member_st_size_64" >&5 +printf "%s\n" "$gl_cv_member_st_size_64" >&6; } + if test $gl_cv_member_st_size_64 = no; then + WINDOWS_64_BIT_ST_SIZE=1 + else + WINDOWS_64_BIT_ST_SIZE=0 + fi + ;; + *) + WINDOWS_64_BIT_OFF_T=0 + WINDOWS_64_BIT_ST_SIZE=0 + ;; + esac + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ldexp() can be used without linking with libm" >&5 +printf %s "checking whether ldexp() can be used without linking with libm... " >&6; } +if test ${gl_cv_func_ldexp_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __NO_MATH_INLINES + # define __NO_MATH_INLINES 1 /* for glibc */ + #endif + #include + double (*funcptr) (double, int) = ldexp; + double x; +int +main (void) +{ +return ldexp (x, -1) > 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_ldexp_no_libm=yes +else $as_nop + gl_cv_func_ldexp_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexp_no_libm" >&5 +printf "%s\n" "$gl_cv_func_ldexp_no_libm" >&6; } + + + + LDEXP_LIBM= + if test $gl_cv_func_ldexp_no_libm = no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ldexp() can be used with libm" >&5 +printf %s "checking whether ldexp() can be used with libm... " >&6; } +if test ${gl_cv_func_ldexp_in_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __NO_MATH_INLINES + # define __NO_MATH_INLINES 1 /* for glibc */ + #endif + #include + double (*funcptr) (double, int) = ldexp; + double x; +int +main (void) +{ +return ldexp (x, -1) > 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_ldexp_in_libm=yes +else $as_nop + gl_cv_func_ldexp_in_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$save_LIBS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexp_in_libm" >&5 +printf "%s\n" "$gl_cv_func_ldexp_in_libm" >&6; } + if test $gl_cv_func_ldexp_in_libm = yes; then + LDEXP_LIBM=-lm + fi + fi + + + + + + gl_threads_api=none + LIBTHREAD= + LTLIBTHREAD= + LIBMULTITHREAD= + LTLIBMULTITHREAD= + if test "$gl_use_threads" != no; then + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 +printf %s "checking whether imported symbols can be declared weak... " >&6; } +if test ${gl_cv_have_weak+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + cygwin*) + gl_cv_have_weak="guessing no" + ;; + *) + gl_cv_have_weak=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern void xyzzy (); +#pragma weak xyzzy +int +main (void) +{ +xyzzy(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_have_weak=maybe +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test $gl_cv_have_weak = maybe; then + if test "$cross_compiling" = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __ELF__ + Extensible Linking Format + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Extensible Linking Format" >/dev/null 2>&1 +then : + gl_cv_have_weak="guessing yes" +else $as_nop + gl_cv_have_weak="guessing no" +fi +rm -rf conftest* + + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#pragma weak fputs +int main () +{ + return (fputs == NULL); +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_have_weak=yes +else $as_nop + gl_cv_have_weak=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + ;; + esac + case " $LDFLAGS " in + *" -static "*) gl_cv_have_weak=no ;; + esac + case "$gl_cv_have_weak" in + *yes) + case "$host_os" in + freebsd* | dragonfly* | midnightbsd*) + : > conftest1.c + $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 + cat < conftest2.c +#include +#pragma weak pthread_mutexattr_gettype +int main () +{ + return (pthread_mutexattr_gettype != NULL); +} +EOF + $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ + || gl_cv_have_weak=no + rm -f conftest1.c libempty.so conftest2.c conftest + ;; + esac + ;; + esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 +printf "%s\n" "$gl_cv_have_weak" >&6; } + case "$gl_cv_have_weak" in + *yes) + +printf "%s\n" "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h + + ;; + esac + + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + + : + fi + if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then + + gl_have_isoc_threads="$ac_cv_header_threads_h" + fi + if test "$gl_use_threads" = yes \ + || test "$gl_use_threads" = posix \ + || test "$gl_use_threads" = isoc+posix; then + + + if test -z "$gl_pthreadlib_body_done"; then + gl_pthread_api=no + LIBPTHREAD= + LIBPMULTITHREAD= + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. + ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes +then : + gl_have_pthread_h=yes +else $as_nop + gl_have_pthread_h=no +fi + + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + # + # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 + # needs -pthread for some reason. See: + # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html + save_LIBS=$LIBS + for gl_pthread in '' '-pthread'; do + LIBS="$LIBS $gl_pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + pthread_mutex_t m; + pthread_mutexattr_t ma; + +int +main (void) +{ +pthread_mutex_lock (&m); + pthread_mutexattr_init (&ma); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_pthread_api=yes + LIBPTHREAD=$gl_pthread + LIBPMULTITHREAD=$gl_pthread +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$save_LIBS + test $gl_pthread_api = yes && break + done + echo "$as_me:25886: gl_pthread_api=$gl_pthread_api" >&5 + echo "$as_me:25887: LIBPTHREAD=$LIBPTHREAD" >&5 + + gl_pthread_in_glibc=no + # On Linux with glibc >= 2.34, libc contains the fully functional + # pthread functions. + case "$host_os" in + linux*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || (__GLIBC__ > 2) + Lucky user + #endif + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Lucky user" >/dev/null 2>&1 +then : + gl_pthread_in_glibc=yes +fi +rm -rf conftest* + + ;; + esac + echo "$as_me:25913: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5 + + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +printf %s "checking for pthread_kill in -lpthread... " >&6; } +if test ${ac_cv_lib_pthread_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthread_pthread_kill=yes +else $as_nop + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes +then : + if test $gl_pthread_in_glibc = yes; then + LIBPMULTITHREAD= + else + LIBPMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + # On Solaris 10 or newer, this test is no longer needed, because + # libc contains the fully functional pthread functions. + case "$host_os" in + solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) + +printf "%s\n" "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h + + esac + fi + +fi + + elif test $gl_pthread_api != yes; then + # Some library is needed. Try libpthread and libc_r. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +printf %s "checking for pthread_kill in -lpthread... " >&6; } +if test ${ac_cv_lib_pthread_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthread_pthread_kill=yes +else $as_nop + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes +then : + gl_pthread_api=yes + LIBPTHREAD=-lpthread + LIBPMULTITHREAD=-lpthread +fi + + if test $gl_pthread_api != yes; then + # For FreeBSD 4. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 +printf %s "checking for pthread_kill in -lc_r... " >&6; } +if test ${ac_cv_lib_c_r_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_c_r_pthread_kill=yes +else $as_nop + ac_cv_lib_c_r_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_c_r_pthread_kill" >&6; } +if test "x$ac_cv_lib_c_r_pthread_kill" = xyes +then : + gl_pthread_api=yes + LIBPTHREAD=-lc_r + LIBPMULTITHREAD=-lc_r +fi + + fi + fi + echo "$as_me:26067: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 +printf %s "checking whether POSIX threads API is available... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 +printf "%s\n" "$gl_pthread_api" >&6; } + + + if test $gl_pthread_api = yes; then + +printf "%s\n" "#define HAVE_PTHREAD_API 1" >>confdefs.h + + fi + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + LIB_SCHED_YIELD= + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 +printf %s "checking for sched_yield in -lrt... " >&6; } +if test ${ac_cv_lib_rt_sched_yield+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char sched_yield (); +int +main (void) +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_rt_sched_yield=yes +else $as_nop + ac_cv_lib_rt_sched_yield=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 +printf "%s\n" "$ac_cv_lib_rt_sched_yield" >&6; } +if test "x$ac_cv_lib_rt_sched_yield" = xyes +then : + LIB_SCHED_YIELD=-lrt +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 +printf %s "checking for sched_yield in -lposix4... " >&6; } +if test ${ac_cv_lib_posix4_sched_yield+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char sched_yield (); +int +main (void) +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_posix4_sched_yield=yes +else $as_nop + ac_cv_lib_posix4_sched_yield=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 +printf "%s\n" "$ac_cv_lib_posix4_sched_yield" >&6; } +if test "x$ac_cv_lib_posix4_sched_yield" = xyes +then : + LIB_SCHED_YIELD=-lposix4 +fi + +fi + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + + + gl_pthreadlib_body_done=done + fi + + LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD + LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD + if test $gl_pthread_api = yes; then + if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then + gl_threads_api='isoc+posix' + +printf "%s\n" "#define USE_ISOC_AND_POSIX_THREADS 1" >>confdefs.h + + LIBTHREAD= LTLIBTHREAD= + else + gl_threads_api=posix + +printf "%s\n" "#define USE_POSIX_THREADS 1" >>confdefs.h + + if test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"; then + +printf "%s\n" "#define USE_POSIX_THREADS_FROM_LIBC 1" >>confdefs.h + + else + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + +printf "%s\n" "#define USE_POSIX_THREADS_WEAK 1" >>confdefs.h + + LIBTHREAD= LTLIBTHREAD= + else + case "$host_os" in + freebsd* | dragonfly* | midnightbsd*) + if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then + +printf "%s\n" "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h + + fi + ;; + esac + fi + fi + fi + fi + fi + if test $gl_threads_api = none; then + if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then + + + + if test -z "$gl_stdthreadlib_body_done"; then + + + case "$host_os" in + mingw*) + LIBSTDTHREAD= + ;; + *) + + + if test -z "$gl_pthreadlib_body_done"; then + gl_pthread_api=no + LIBPTHREAD= + LIBPMULTITHREAD= + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. + ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes +then : + gl_have_pthread_h=yes +else $as_nop + gl_have_pthread_h=no +fi + + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + # + # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 + # needs -pthread for some reason. See: + # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html + save_LIBS=$LIBS + for gl_pthread in '' '-pthread'; do + LIBS="$LIBS $gl_pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + pthread_mutex_t m; + pthread_mutexattr_t ma; + +int +main (void) +{ +pthread_mutex_lock (&m); + pthread_mutexattr_init (&ma); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_pthread_api=yes + LIBPTHREAD=$gl_pthread + LIBPMULTITHREAD=$gl_pthread +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$save_LIBS + test $gl_pthread_api = yes && break + done + echo "$as_me:26295: gl_pthread_api=$gl_pthread_api" >&5 + echo "$as_me:26296: LIBPTHREAD=$LIBPTHREAD" >&5 + + gl_pthread_in_glibc=no + # On Linux with glibc >= 2.34, libc contains the fully functional + # pthread functions. + case "$host_os" in + linux*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || (__GLIBC__ > 2) + Lucky user + #endif + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Lucky user" >/dev/null 2>&1 +then : + gl_pthread_in_glibc=yes +fi +rm -rf conftest* + + ;; + esac + echo "$as_me:26322: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5 + + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +printf %s "checking for pthread_kill in -lpthread... " >&6; } +if test ${ac_cv_lib_pthread_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthread_pthread_kill=yes +else $as_nop + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes +then : + if test $gl_pthread_in_glibc = yes; then + LIBPMULTITHREAD= + else + LIBPMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + # On Solaris 10 or newer, this test is no longer needed, because + # libc contains the fully functional pthread functions. + case "$host_os" in + solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) + +printf "%s\n" "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h + + esac + fi + +fi + + elif test $gl_pthread_api != yes; then + # Some library is needed. Try libpthread and libc_r. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +printf %s "checking for pthread_kill in -lpthread... " >&6; } +if test ${ac_cv_lib_pthread_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthread_pthread_kill=yes +else $as_nop + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes +then : + gl_pthread_api=yes + LIBPTHREAD=-lpthread + LIBPMULTITHREAD=-lpthread +fi + + if test $gl_pthread_api != yes; then + # For FreeBSD 4. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 +printf %s "checking for pthread_kill in -lc_r... " >&6; } +if test ${ac_cv_lib_c_r_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_c_r_pthread_kill=yes +else $as_nop + ac_cv_lib_c_r_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_c_r_pthread_kill" >&6; } +if test "x$ac_cv_lib_c_r_pthread_kill" = xyes +then : + gl_pthread_api=yes + LIBPTHREAD=-lc_r + LIBPMULTITHREAD=-lc_r +fi + + fi + fi + echo "$as_me:26476: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 +printf %s "checking whether POSIX threads API is available... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 +printf "%s\n" "$gl_pthread_api" >&6; } + + + if test $gl_pthread_api = yes; then + +printf "%s\n" "#define HAVE_PTHREAD_API 1" >>confdefs.h + + fi + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + LIB_SCHED_YIELD= + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 +printf %s "checking for sched_yield in -lrt... " >&6; } +if test ${ac_cv_lib_rt_sched_yield+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char sched_yield (); +int +main (void) +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_rt_sched_yield=yes +else $as_nop + ac_cv_lib_rt_sched_yield=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 +printf "%s\n" "$ac_cv_lib_rt_sched_yield" >&6; } +if test "x$ac_cv_lib_rt_sched_yield" = xyes +then : + LIB_SCHED_YIELD=-lrt +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 +printf %s "checking for sched_yield in -lposix4... " >&6; } +if test ${ac_cv_lib_posix4_sched_yield+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char sched_yield (); +int +main (void) +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_posix4_sched_yield=yes +else $as_nop + ac_cv_lib_posix4_sched_yield=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 +printf "%s\n" "$ac_cv_lib_posix4_sched_yield" >&6; } +if test "x$ac_cv_lib_posix4_sched_yield" = xyes +then : + LIB_SCHED_YIELD=-lposix4 +fi + +fi + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + + + gl_pthreadlib_body_done=done + fi + + if test $ac_cv_header_threads_h = yes; then + ac_fn_c_check_func "$LINENO" "thrd_create" "ac_cv_func_thrd_create" +if test "x$ac_cv_func_thrd_create" = xyes +then : + printf "%s\n" "#define HAVE_THRD_CREATE 1" >>confdefs.h + +fi + + if test $ac_cv_func_thrd_create = yes; then + LIBSTDTHREAD= + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for thrd_create in -lstdthreads" >&5 +printf %s "checking for thrd_create in -lstdthreads... " >&6; } +if test ${ac_cv_lib_stdthreads_thrd_create+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lstdthreads $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char thrd_create (); +int +main (void) +{ +return thrd_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_stdthreads_thrd_create=yes +else $as_nop + ac_cv_lib_stdthreads_thrd_create=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_stdthreads_thrd_create" >&5 +printf "%s\n" "$ac_cv_lib_stdthreads_thrd_create" >&6; } +if test "x$ac_cv_lib_stdthreads_thrd_create" = xyes +then : + + LIBSTDTHREAD='-lstdthreads -lpthread' + +else $as_nop + + LIBSTDTHREAD="$LIBPMULTITHREAD" + +fi + + fi + else + LIBSTDTHREAD="$LIBPMULTITHREAD $LIB_SCHED_YIELD" + fi + ;; + esac + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ISO C threads API is available" >&5 +printf %s "checking whether ISO C threads API is available... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_threads_h" >&5 +printf "%s\n" "$ac_cv_header_threads_h" >&6; } + gl_stdthreadlib_body_done=done + fi + + LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD + LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD + gl_threads_api=isoc + +printf "%s\n" "#define USE_ISOC_THREADS 1" >>confdefs.h + + fi + fi + if test $gl_threads_api = none; then + case "$gl_use_threads" in + yes | windows | win32) # The 'win32' is for backward compatibility. + if { case "$host_os" in + mingw*) true;; + *) false;; + esac + }; then + gl_threads_api=windows + +printf "%s\n" "#define USE_WINDOWS_THREADS 1" >>confdefs.h + + fi + ;; + esac + fi + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for multithread API to use" >&5 +printf %s "checking for multithread API to use... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_threads_api" >&5 +printf "%s\n" "$gl_threads_api" >&6; } + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +printf %s "checking for a sed that does not truncate output... " >&6; } +if test ${ac_cv_path_SED+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in sed gsed + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +printf "%s\n" "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_math_h='<'math.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_math_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $ac_cv_header_math_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'math.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_math_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_math_h + gl_cv_next_math_h='"'$gl_header'"' + else + gl_cv_next_math_h='<'math.h'>' + fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_math_h" >&5 +printf "%s\n" "$gl_cv_next_math_h" >&6; } + fi + NEXT_MATH_H=$gl_cv_next_math_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'math.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_math_h + fi + NEXT_AS_FIRST_DIRECTIVE_MATH_H=$gl_next_as_first_directive + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether NAN macro works" >&5 +printf %s "checking whether NAN macro works... " >&6; } +if test ${gl_cv_header_math_nan_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +/* Solaris 10 has a broken definition of NAN. Other platforms + fail to provide NAN, or provide it only in C99 mode; this + test only needs to fail when NAN is provided but wrong. */ + float f = 1.0f; +#ifdef NAN + f = NAN; +#endif + return f == 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_header_math_nan_works=yes +else $as_nop + gl_cv_header_math_nan_works=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_math_nan_works" >&5 +printf "%s\n" "$gl_cv_header_math_nan_works" >&6; } + if test $gl_cv_header_math_nan_works = no; then + REPLACE_NAN=1 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether HUGE_VAL works" >&5 +printf %s "checking whether HUGE_VAL works... " >&6; } +if test ${gl_cv_header_math_huge_val_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +/* Solaris 10 has a broken definition of HUGE_VAL. */ + double d = HUGE_VAL; + return d == 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_header_math_huge_val_works=yes +else $as_nop + gl_cv_header_math_huge_val_works=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_math_huge_val_works" >&5 +printf "%s\n" "$gl_cv_header_math_huge_val_works" >&6; } + if test $gl_cv_header_math_huge_val_works = no; then + REPLACE_HUGE_VAL=1 + fi + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mbstate_t" >&5 +printf %s "checking for mbstate_t... " >&6; } +if test ${ac_cv_type_mbstate_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + #include +int +main (void) +{ +mbstate_t x; return sizeof x; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_type_mbstate_t=yes +else $as_nop + ac_cv_type_mbstate_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_mbstate_t" >&5 +printf "%s\n" "$ac_cv_type_mbstate_t" >&6; } + if test $ac_cv_type_mbstate_t = yes; then + +printf "%s\n" "#define HAVE_MBSTATE_T 1" >>confdefs.h + + else + +printf "%s\n" "#define mbstate_t int" >>confdefs.h + + fi + + + HAVE_BTOWC=1; + HAVE_MBSINIT=1; + HAVE_MBRTOWC=1; + HAVE_MBRLEN=1; + HAVE_MBSRTOWCS=1; + HAVE_MBSNRTOWCS=1; + HAVE_WCRTOMB=1; + HAVE_WCSRTOMBS=1; + HAVE_WCSNRTOMBS=1; + HAVE_WMEMCHR=1; + HAVE_WMEMCMP=1; + HAVE_WMEMCPY=1; + HAVE_WMEMMOVE=1; + HAVE_WMEMPCPY=1; + HAVE_WMEMSET=1; + HAVE_WCSLEN=1; + HAVE_WCSNLEN=1; + HAVE_WCSCPY=1; + HAVE_WCPCPY=1; + HAVE_WCSNCPY=1; + HAVE_WCPNCPY=1; + HAVE_WCSCAT=1; + HAVE_WCSNCAT=1; + HAVE_WCSCMP=1; + HAVE_WCSNCMP=1; + HAVE_WCSCASECMP=1; + HAVE_WCSNCASECMP=1; + HAVE_WCSCOLL=1; + HAVE_WCSXFRM=1; + HAVE_WCSDUP=1; + HAVE_WCSCHR=1; + HAVE_WCSRCHR=1; + HAVE_WCSCSPN=1; + HAVE_WCSSPN=1; + HAVE_WCSPBRK=1; + HAVE_WCSSTR=1; + HAVE_WCSTOK=1; + HAVE_WCSWIDTH=1; + HAVE_WCSFTIME=1; + HAVE_DECL_WCTOB=1; + HAVE_DECL_WCSDUP=1; + HAVE_DECL_WCWIDTH=1; + REPLACE_MBSTATE_T=0; + REPLACE_BTOWC=0; + REPLACE_WCTOB=0; + REPLACE_MBSINIT=0; + REPLACE_MBRTOWC=0; + REPLACE_MBRLEN=0; + REPLACE_MBSRTOWCS=0; + REPLACE_MBSNRTOWCS=0; + REPLACE_WCRTOMB=0; + REPLACE_WCSRTOMBS=0; + REPLACE_WCSNRTOMBS=0; + REPLACE_WCWIDTH=0; + REPLACE_WCSWIDTH=0; + REPLACE_WCSFTIME=0; + REPLACE_WCSTOK=0; + + + + + + if test -z "$gl_pthreadlib_body_done"; then + gl_pthread_api=no + LIBPTHREAD= + LIBPMULTITHREAD= + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. + ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes +then : + gl_have_pthread_h=yes +else $as_nop + gl_have_pthread_h=no +fi + + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + # + # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 + # needs -pthread for some reason. See: + # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html + save_LIBS=$LIBS + for gl_pthread in '' '-pthread'; do + LIBS="$LIBS $gl_pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + pthread_mutex_t m; + pthread_mutexattr_t ma; + +int +main (void) +{ +pthread_mutex_lock (&m); + pthread_mutexattr_init (&ma); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_pthread_api=yes + LIBPTHREAD=$gl_pthread + LIBPMULTITHREAD=$gl_pthread +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$save_LIBS + test $gl_pthread_api = yes && break + done + echo "$as_me:27095: gl_pthread_api=$gl_pthread_api" >&5 + echo "$as_me:27096: LIBPTHREAD=$LIBPTHREAD" >&5 + + gl_pthread_in_glibc=no + # On Linux with glibc >= 2.34, libc contains the fully functional + # pthread functions. + case "$host_os" in + linux*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || (__GLIBC__ > 2) + Lucky user + #endif + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Lucky user" >/dev/null 2>&1 +then : + gl_pthread_in_glibc=yes +fi +rm -rf conftest* + + ;; + esac + echo "$as_me:27122: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5 + + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +printf %s "checking for pthread_kill in -lpthread... " >&6; } +if test ${ac_cv_lib_pthread_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthread_pthread_kill=yes +else $as_nop + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes +then : + if test $gl_pthread_in_glibc = yes; then + LIBPMULTITHREAD= + else + LIBPMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + # On Solaris 10 or newer, this test is no longer needed, because + # libc contains the fully functional pthread functions. + case "$host_os" in + solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) + +printf "%s\n" "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h + + esac + fi + +fi + + elif test $gl_pthread_api != yes; then + # Some library is needed. Try libpthread and libc_r. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +printf %s "checking for pthread_kill in -lpthread... " >&6; } +if test ${ac_cv_lib_pthread_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthread_pthread_kill=yes +else $as_nop + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes +then : + gl_pthread_api=yes + LIBPTHREAD=-lpthread + LIBPMULTITHREAD=-lpthread +fi + + if test $gl_pthread_api != yes; then + # For FreeBSD 4. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 +printf %s "checking for pthread_kill in -lc_r... " >&6; } +if test ${ac_cv_lib_c_r_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_c_r_pthread_kill=yes +else $as_nop + ac_cv_lib_c_r_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_c_r_pthread_kill" >&6; } +if test "x$ac_cv_lib_c_r_pthread_kill" = xyes +then : + gl_pthread_api=yes + LIBPTHREAD=-lc_r + LIBPMULTITHREAD=-lc_r +fi + + fi + fi + echo "$as_me:27276: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 +printf %s "checking whether POSIX threads API is available... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 +printf "%s\n" "$gl_pthread_api" >&6; } + + + if test $gl_pthread_api = yes; then + +printf "%s\n" "#define HAVE_PTHREAD_API 1" >>confdefs.h + + fi + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + LIB_SCHED_YIELD= + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 +printf %s "checking for sched_yield in -lrt... " >&6; } +if test ${ac_cv_lib_rt_sched_yield+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char sched_yield (); +int +main (void) +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_rt_sched_yield=yes +else $as_nop + ac_cv_lib_rt_sched_yield=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 +printf "%s\n" "$ac_cv_lib_rt_sched_yield" >&6; } +if test "x$ac_cv_lib_rt_sched_yield" = xyes +then : + LIB_SCHED_YIELD=-lrt +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 +printf %s "checking for sched_yield in -lposix4... " >&6; } +if test ${ac_cv_lib_posix4_sched_yield+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char sched_yield (); +int +main (void) +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_posix4_sched_yield=yes +else $as_nop + ac_cv_lib_posix4_sched_yield=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 +printf "%s\n" "$ac_cv_lib_posix4_sched_yield" >&6; } +if test "x$ac_cv_lib_posix4_sched_yield" = xyes +then : + LIB_SCHED_YIELD=-lposix4 +fi + +fi + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + + + gl_pthreadlib_body_done=done + fi + GL_GNULIB_BTOWC=0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Java virtual machine" >&5 -$as_echo_n "checking for Java virtual machine... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + GL_GNULIB_WCTOB=0 -#if defined _WIN32 || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ - yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then : - CLASSPATH_SEPARATOR=';' -else - CLASSPATH_SEPARATOR=':' -fi -rm -f conftest* - CONF_JAVA= - HAVE_JAVA_ENVVAR= - HAVE_GIJ= - HAVE_JAVA= - HAVE_JRE= - HAVE_JVIEW= - HAVE_JAVAEXEC=1 - if test -n "$JAVA"; then - HAVE_JAVA_ENVVAR=1 - CONF_JAVA="$JAVA" - else - # Extract the first word of "gij", so it can be a program name with args. -set dummy gij; ac_word=$2 -: -if ${ac_cv_prog_HAVE_GIJ_IN_PATH+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$HAVE_GIJ_IN_PATH"; then - ac_cv_prog_HAVE_GIJ_IN_PATH="$HAVE_GIJ_IN_PATH" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_HAVE_GIJ_IN_PATH="yes" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + GL_GNULIB_MBSINIT=0 -fi -fi -HAVE_GIJ_IN_PATH=$ac_cv_prog_HAVE_GIJ_IN_PATH -if test -n "$HAVE_GIJ_IN_PATH"; then - : -else - : -fi - # Extract the first word of "java", so it can be a program name with args. -set dummy java; ac_word=$2 -: -if ${ac_cv_prog_HAVE_JAVA_IN_PATH+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$HAVE_JAVA_IN_PATH"; then - ac_cv_prog_HAVE_JAVA_IN_PATH="$HAVE_JAVA_IN_PATH" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_HAVE_JAVA_IN_PATH="yes" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + GL_GNULIB_MBRTOWC=0 -fi -fi -HAVE_JAVA_IN_PATH=$ac_cv_prog_HAVE_JAVA_IN_PATH -if test -n "$HAVE_JAVA_IN_PATH"; then - : -else - : -fi - # Extract the first word of "jre", so it can be a program name with args. -set dummy jre; ac_word=$2 -: -if ${ac_cv_prog_HAVE_JRE_IN_PATH+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$HAVE_JRE_IN_PATH"; then - ac_cv_prog_HAVE_JRE_IN_PATH="$HAVE_JRE_IN_PATH" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_HAVE_JRE_IN_PATH="yes" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + GL_GNULIB_MBRLEN=0 -fi -fi -HAVE_JRE_IN_PATH=$ac_cv_prog_HAVE_JRE_IN_PATH -if test -n "$HAVE_JRE_IN_PATH"; then - : -else - : -fi - # Extract the first word of "jview", so it can be a program name with args. -set dummy jview; ac_word=$2 -: -if ${ac_cv_prog_HAVE_JVIEW_IN_PATH+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$HAVE_JVIEW_IN_PATH"; then - ac_cv_prog_HAVE_JVIEW_IN_PATH="$HAVE_JVIEW_IN_PATH" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_HAVE_JVIEW_IN_PATH="yes" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + GL_GNULIB_MBSRTOWCS=0 -fi -fi -HAVE_JVIEW_IN_PATH=$ac_cv_prog_HAVE_JVIEW_IN_PATH -if test -n "$HAVE_JVIEW_IN_PATH"; then - : -else - : -fi + GL_GNULIB_MBSNRTOWCS=0 - export CLASSPATH - if test -n "$HAVE_GIJ_IN_PATH" \ - && gij --version >/dev/null 2>/dev/null \ - ; then - HAVE_GIJ=1 - CONF_JAVA="gij" - else - if test -n "$HAVE_JAVA_IN_PATH" \ - && java -version >/dev/null 2>/dev/null \ - ; then - HAVE_JAVA=1 - CONF_JAVA="java" - else - if test -n "$HAVE_JRE_IN_PATH" \ - && (jre >/dev/null 2>/dev/null || test $? = 1) \ - ; then - HAVE_JRE=1 - CONF_JAVA="jre" - else - if test -n "$HAVE_JVIEW_IN_PATH" \ - && (jview -? >/dev/null 2>/dev/null || test $? = 1) \ - ; then - HAVE_JVIEW=1 - CONF_JAVA="jview" - else - HAVE_JAVAEXEC= - fi - fi - fi - fi - fi - if test -n "$HAVE_JAVAEXEC"; then - ac_result="$CONF_JAVA" - else - ac_result="no" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_result" >&5 -$as_echo "$ac_result" >&6; } + GL_GNULIB_WCRTOMB=0 + GL_GNULIB_WCSRTOMBS=0 + GL_GNULIB_WCSNRTOMBS=0 - if test x"$CONF_JAVAC" != x && test x"$CONF_JAVA" != x; then - ENABLE_JAVA_TRUE= - ENABLE_JAVA_FALSE='#' -else - ENABLE_JAVA_TRUE='#' - ENABLE_JAVA_FALSE= -fi + GL_GNULIB_WCWIDTH=0 -# Check whether --enable-yacc was given. -if test "${enable_yacc+set}" = set; then : - enableval=$enable_yacc; -else - enable_yacc=yes -fi - if test "$enable_yacc" = yes; then - ENABLE_YACC_TRUE= - ENABLE_YACC_FALSE='#' -else - ENABLE_YACC_TRUE='#' - ENABLE_YACC_FALSE= -fi + GL_GNULIB_WMEMCHR=0 -ac_config_files="$ac_config_files src/yacc" -# Checks for programs. + GL_GNULIB_WMEMCMP=0 -DOT=${DOT-"${am_missing_run}dot"} -for ac_prog in flex lex -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LEX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LEX"; then - ac_cv_prog_LEX="$LEX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LEX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi -fi -LEX=$ac_cv_prog_LEX -if test -n "$LEX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 -$as_echo "$LEX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + GL_GNULIB_WMEMCPY=0 - test -n "$LEX" && break -done -test -n "$LEX" || LEX=":" -if test "x$LEX" != "x:"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lex is flex" >&5 -$as_echo_n "checking whether lex is flex... " >&6; } -if ${ac_cv_prog_lex_is_flex+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.l <<_ACEOF -%option debug nodefault noinput nounput noyywrap never-interactive -%x SC_CONF_TEST -%% -a { BEGIN SC_CONF_TEST; } -_ACEOF -if { { ac_try="$LEX conftest.l" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$LEX conftest.l") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - ac_cv_prog_lex_is_flex=yes -else - ac_cv_prog_lex_is_flex=no -fi + GL_GNULIB_WMEMMOVE=0 + + + + GL_GNULIB_WMEMPCPY=0 + + + + GL_GNULIB_WMEMSET=0 + + + + GL_GNULIB_WCSLEN=0 + + + + GL_GNULIB_WCSNLEN=0 + + + + GL_GNULIB_WCSCPY=0 + + + + GL_GNULIB_WCPCPY=0 + + + + GL_GNULIB_WCSNCPY=0 + + + + GL_GNULIB_WCPNCPY=0 + + + + GL_GNULIB_WCSCAT=0 + + + + GL_GNULIB_WCSNCAT=0 + + + + GL_GNULIB_WCSCMP=0 + + + + GL_GNULIB_WCSNCMP=0 + + + + GL_GNULIB_WCSCASECMP=0 + + + + GL_GNULIB_WCSNCASECMP=0 + + + + GL_GNULIB_WCSCOLL=0 + + + + GL_GNULIB_WCSXFRM=0 + + + + GL_GNULIB_WCSDUP=0 + + + + GL_GNULIB_WCSCHR=0 + + + GL_GNULIB_WCSRCHR=0 + + + + GL_GNULIB_WCSCSPN=0 + + + + GL_GNULIB_WCSSPN=0 + + + + GL_GNULIB_WCSPBRK=0 + + + + GL_GNULIB_WCSSTR=0 + + + + GL_GNULIB_WCSTOK=0 + + + + GL_GNULIB_WCSWIDTH=0 + + + + GL_GNULIB_WCSFTIME=0 + + + + GL_GNULIB_MDA_WCSDUP=1 + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = xyes +then : + gl_have_mmap=yes +else $as_nop + gl_have_mmap=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_is_flex" >&5 -$as_echo "$ac_cv_prog_lex_is_flex" >&6; } -cat >conftest.l <<_ACEOF -%% -a { ECHO; } -b { REJECT; } -c { yymore (); } -d { yyless (1); } -e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ - yyless ((input () != 0)); } -f { unput (yytext[0]); } -. { BEGIN INITIAL; } -%% -#ifdef YYTEXT_POINTER -extern char *yytext; + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +printf %s "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef MAP_ANONYMOUS + I cannot identify this map #endif -int -main (void) -{ - return ! yylex () + ! yywrap (); -} -_ACEOF -{ { ac_try="$LEX conftest.l" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$LEX conftest.l") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 -$as_echo_n "checking lex output file root... " >&6; } -if ${ac_cv_prog_lex_root+:} false; then : - $as_echo_n "(cached) " >&6 -else -if test -f lex.yy.c; then - ac_cv_prog_lex_root=lex.yy -elif test -f lexyy.c; then - ac_cv_prog_lex_root=lexyy -else - as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 -fi +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cannot identify this map" >/dev/null 2>&1 +then : + gl_have_mmap_anonymous=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 -$as_echo "$ac_cv_prog_lex_root" >&6; } -LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root - -if test -z "${LEXLIB+set}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 -$as_echo_n "checking lex library... " >&6; } -if ${ac_cv_lib_lex+:} false; then : - $as_echo_n "(cached) " >&6 -else +rm -rf conftest* - ac_save_LIBS=$LIBS - ac_cv_lib_lex='none needed' - for ac_lib in '' -lfl -ll; do - LIBS="$ac_lib $ac_save_LIBS" + if test $gl_have_mmap_anonymous != yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -`cat $LEX_OUTPUT_ROOT.c` + +#include +#ifdef MAP_ANON + I cannot identify this map +#endif + _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lex=$ac_lib -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - test "$ac_cv_lib_lex" != 'none needed' && break - done - LIBS=$ac_save_LIBS +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cannot identify this map" >/dev/null 2>&1 +then : +printf "%s\n" "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 -$as_echo "$ac_cv_lib_lex" >&6; } - test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex -fi +rm -rf conftest* + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +printf "%s\n" "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 -$as_echo_n "checking whether yytext is a pointer... " >&6; } -if ${ac_cv_prog_lex_yytext_pointer+:} false; then : - $as_echo_n "(cached) " >&6 -else - # POSIX says lex can declare yytext either as a pointer or an array; the -# default is implementation-dependent. Figure out which it is, since -# not all implementations provide the %pointer and %array declarations. -ac_cv_prog_lex_yytext_pointer=no -ac_save_LIBS=$LIBS -LIBS="$LEXLIB $ac_save_LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +printf "%s\n" "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + + # Detect platform-specific bugs in some versions of glibc: + # memchr should not dereference anything with length 0 + # https://bugzilla.redhat.com/show_bug.cgi?id=499689 + # memchr should not dereference overestimated length after a match + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 + # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 + # memchr should cast the second argument to 'unsigned char'. + # This bug exists in Android 4.3. + # Assume that memchr works on platforms that lack mprotect. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether memchr works" >&5 +printf %s "checking whether memchr works... " >&6; } +if test ${gl_cv_func_memchr_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess no on Android. + linux*-android*) gl_cv_func_memchr_works="guessing no" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_memchr_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #define YYTEXT_POINTER 1 -`cat $LEX_OUTPUT_ROOT.c` +#include +#if HAVE_SYS_MMAN_H +# include +# include +# include +# include +# ifndef MAP_FILE +# define MAP_FILE 0 +# endif +#endif + +int +main (void) +{ + + int result = 0; + char *fence = NULL; +#if HAVE_SYS_MMAN_H && HAVE_MPROTECT +# if HAVE_MAP_ANONYMOUS + const int flags = MAP_ANONYMOUS | MAP_PRIVATE; + const int fd = -1; +# else /* !HAVE_MAP_ANONYMOUS */ + const int flags = MAP_FILE | MAP_PRIVATE; + int fd = open ("/dev/zero", O_RDONLY, 0666); + if (fd >= 0) +# endif + { + int pagesize = getpagesize (); + char *two_pages = + (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, + flags, fd, 0); + if (two_pages != (char *)(-1) + && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) + fence = two_pages + pagesize; + } +#endif + if (fence) + { + /* Test against bugs on glibc systems. */ + if (memchr (fence, 0, 0)) + result |= 1; + strcpy (fence - 9, "12345678"); + if (memchr (fence - 9, 0, 79) != fence - 1) + result |= 2; + if (memchr (fence - 1, 0, 3) != fence - 1) + result |= 4; + /* Test against bug on AIX 7.2. */ + if (memchr (fence - 4, '6', 16) != fence - 4) + result |= 8; + } + /* Test against bug on Android 4.3. */ + { + char input[3]; + input[0] = 'a'; + input[1] = 'b'; + input[2] = 'c'; + if (memchr (input, 0x789abc00 | 'b', 3) != input + 1) + result |= 16; + } + return result; + + ; + return 0; +} _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_prog_lex_yytext_pointer=yes +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_memchr_works=yes +else $as_nop + gl_cv_func_memchr_works=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_save_LIBS - +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 -$as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } -if test $ac_cv_prog_lex_yytext_pointer = yes; then -$as_echo "#define YYTEXT_POINTER 1" >>confdefs.h fi -rm -f conftest.l $LEX_OUTPUT_ROOT.c +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_memchr_works" >&5 +printf "%s\n" "$gl_cv_func_memchr_works" >&6; } + case "$gl_cv_func_memchr_works" in + *yes) ;; + *) REPLACE_MEMCHR=1 ;; + esac -fi -LEX_IS_FLEX=`test "$ac_cv_prog_lex_is_flex" = yes && echo true || echo false` -if ! "$LEX_IS_FLEX" || test "X$LEX" = X:; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: bypassing lex because flex is required" >&5 -$as_echo "$as_me: WARNING: bypassing lex because flex is required" >&2;} - LEX=: -fi - if $LEX_IS_FLEX; then - FLEX_WORKS_TRUE= - FLEX_WORKS_FALSE='#' -else - FLEX_WORKS_TRUE='#' - FLEX_WORKS_FALSE= -fi - if $LEX_IS_FLEX && test $bison_cv_cxx_works = yes; then - FLEX_CXX_WORKS_TRUE= - FLEX_CXX_WORKS_FALSE='#' -else - FLEX_CXX_WORKS_TRUE='#' - FLEX_CXX_WORKS_FALSE= -fi -for ac_prog in 'bison -y' byacc -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_YACC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$YACC"; then - ac_cv_prog_YACC="$YACC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_YACC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether defines MIN and MAX" >&5 +printf %s "checking whether defines MIN and MAX... " >&6; } +if test ${gl_cv_minmax_in_limits_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + int x = MIN (42, 17); +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_minmax_in_limits_h=yes +else $as_nop + gl_cv_minmax_in_limits_h=no fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -YACC=$ac_cv_prog_YACC -if test -n "$YACC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 -$as_echo "$YACC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_minmax_in_limits_h" >&5 +printf "%s\n" "$gl_cv_minmax_in_limits_h" >&6; } + if test $gl_cv_minmax_in_limits_h = yes; then - test -n "$YACC" && break -done -test -n "$YACC" || YACC="yacc" +printf "%s\n" "#define HAVE_MINMAX_IN_LIMITS_H 1" >>confdefs.h -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 fi -done - done -IFS=$as_save_IFS -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU M4 that supports accurate traces" >&5 -$as_echo_n "checking for GNU M4 that supports accurate traces... " >&6; } -if ${ac_cv_path_M4+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f conftest.m4f -ac_had_posixly_correct=${POSIXLY_CORRECT:+yes} -{ POSIXLY_CORRECT=; unset POSIXLY_CORRECT;} -if test -z "$M4"; then - ac_path_M4_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in m4 gm4 gnum4; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_M4="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_M4" || continue - # Root out GNU M4 1.4.5, as well as non-GNU m4 that ignore -t, -F. - # Root out GNU M4 1.4.15 with buggy false negative replacement strstr. - # Root out Glibc 2.9 - 2.12 and GNU M4 1.4.11 - 1.4.15 with buggy - # false positive strstr. - ac_snippet=change'quote(<,>)in''dir(,mac,bug)' - ac_snippet=${ac_snippet}pat'subst(a,\(b\)\|\(a\),\1)d'nl - ac_snippet=${ac_snippet}${as_nl}if'else(in''dex(..wi.d.,.d.),-1,bug)' - ac_snippet=${ac_snippet}${as_nl}if'else(in''dex(;:11-:12-:12-:12-:12-:12-:12-:12-:12.:12.:12.:12.:12.:12.:12.:12.:12-,:12-:12-:12-:12-:12-:12-:12-:12-),-1,,strstr-bug2)' - test -z "`$ac_path_M4 -F conftest.m4f &1`" \ - && test -z "`$as_echo $ac_snippet | $ac_path_M4 --trace=mac 2>&1`" \ - && test -f conftest.m4f \ - && ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=: - rm -f conftest.m4f - $ac_path_M4_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_M4"; then - as_fn_error $? "no acceptable m4 could be found in \$PATH. -GNU M4 1.4.6 or later is required; 1.4.16 or newer is recommended. -GNU M4 1.4.15 uses a buggy replacement strstr on some systems. -Glibc 2.9 - 2.12 and GNU M4 1.4.11 - 1.4.15 have another strstr bug." "$LINENO" 5 - fi -else - ac_cv_path_M4=$M4 -fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether defines MIN and MAX" >&5 +printf %s "checking whether defines MIN and MAX... " >&6; } +if test ${gl_cv_minmax_in_sys_param_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + int x = MIN (42, 17); +int +main (void) +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_minmax_in_sys_param_h=yes +else $as_nop + gl_cv_minmax_in_sys_param_h=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_M4" >&5 -$as_echo "$ac_cv_path_M4" >&6; } - M4=$ac_cv_path_M4 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_cv_path_M4 accepts --gnu" >&5 -$as_echo_n "checking whether $ac_cv_path_M4 accepts --gnu... " >&6; } -if ${ac_cv_prog_gnu_m4_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - case `$M4 --help < /dev/null 2>&1` in - *--gnu*) ac_cv_prog_gnu_m4_gnu=yes ;; - *) ac_cv_prog_gnu_m4_gnu=no ;; - esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gnu_m4_gnu" >&5 -$as_echo "$ac_cv_prog_gnu_m4_gnu" >&6; } - if test "$ac_cv_prog_gnu_m4_gnu" = yes; then - M4_GNU=--gnu - else - M4_GNU= - fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_minmax_in_sys_param_h" >&5 +printf "%s\n" "$gl_cv_minmax_in_sys_param_h" >&6; } + if test $gl_cv_minmax_in_sys_param_h = yes; then - if test x$ac_had_posixly_correct = xyes; then - POSIXLY_CORRECT=: - if test $ac_cv_prog_gnu_m4_gnu = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: the version of M4 that was found does not support -g" >&5 -$as_echo "$as_me: WARNING: the version of M4 that was found does not support -g" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using it with POSIXLY_CORRECT set may cause problems" >&5 -$as_echo "$as_me: WARNING: using it with POSIXLY_CORRECT set may cause problems" >&2;} - fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how m4 supports trace files" >&5 -$as_echo_n "checking how m4 supports trace files... " >&6; } -if ${ac_cv_prog_gnu_m4_debugfile+:} false; then : - $as_echo_n "(cached) " >&6 -else - case `$M4 --help < /dev/null 2>&1` in - *debugfile*) ac_cv_prog_gnu_m4_debugfile=--debugfile ;; - *) ac_cv_prog_gnu_m4_debugfile=--error-output ;; - esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gnu_m4_debugfile" >&5 -$as_echo "$ac_cv_prog_gnu_m4_debugfile" >&6; } - M4_DEBUGFILE=$ac_cv_prog_gnu_m4_debugfile +printf "%s\n" "#define HAVE_MINMAX_IN_SYS_PARAM_H 1" >>confdefs.h + fi -cat >>confdefs.h <<_ACEOF -#define M4 "$M4" -_ACEOF -cat >>confdefs.h <<_ACEOF -#define M4_GNU_OPTION "$M4_GNU" -_ACEOF -# Extract the first word of "perl", so it can be a program name with args. -set dummy perl; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PERL+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PERL in - [\\/]* | ?:[\\/]*) - ac_cv_path_PERL="$PERL" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - ;; -esac -fi -PERL=$ac_cv_path_PERL -if test -n "$PERL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 -$as_echo "$PERL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi +ac_fn_check_decl "$LINENO" "obstack_printf" "ac_cv_have_decl_obstack_printf" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_obstack_printf" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_OBSTACK_PRINTF $ac_have_decl" >>confdefs.h -HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"} -# Extract the first word of "xsltproc", so it can be a program name with args. -set dummy xsltproc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_XSLTPROC+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $XSLTPROC in - [\\/]* | ?:[\\/]*) - ac_cv_path_XSLTPROC="$XSLTPROC" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for O_CLOEXEC" >&5 +printf %s "checking for O_CLOEXEC... " >&6; } +if test ${gl_cv_macro_O_CLOEXEC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #ifndef O_CLOEXEC + choke me; + #endif - ;; -esac +int +main (void) +{ +return O_CLOEXEC; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_macro_O_CLOEXEC=yes +else $as_nop + gl_cv_macro_O_CLOEXEC=no fi -XSLTPROC=$ac_cv_path_XSLTPROC -if test -n "$XSLTPROC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XSLTPROC" >&5 -$as_echo "$XSLTPROC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_macro_O_CLOEXEC" >&5 +printf "%s\n" "$gl_cv_macro_O_CLOEXEC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for promoted mode_t type" >&5 +printf %s "checking for promoted mode_t type... " >&6; } +if test ${gl_cv_promoted_mode_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop -# Checks for header files. - - - - for ac_header in $ac_header_list -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1]; + ; + return 0; +} _ACEOF - +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_promoted_mode_t='int' +else $as_nop + gl_cv_promoted_mode_t='mode_t' fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -done +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_promoted_mode_t" >&5 +printf "%s\n" "$gl_cv_promoted_mode_t" >&6; } +printf "%s\n" "#define PROMOTED_MODE_T $gl_cv_promoted_mode_t" >>confdefs.h + REPLACE_STRERROR_0=0 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strerror(0) succeeds" >&5 +printf %s "checking whether strerror(0) succeeds... " >&6; } +if test ${gl_cv_func_strerror_0_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_strerror_0_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_strerror_0_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; + esac -# Checks for compiler characteristics. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif +#include + #include +int +main (void) +{ +int result = 0; + char *str; + errno = 0; + str = strerror (0); + if (!*str) result |= 1; + if (errno) result |= 2; + if (strstr (str, "nknown") || strstr (str, "ndefined")) + result |= 4; + return result; + ; + return 0; +} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_inline=$ac_kw +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_strerror_0_works=yes +else $as_nop + gl_cv_func_strerror_0_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strerror_0_works" >&5 +printf "%s\n" "$gl_cv_func_strerror_0_works" >&6; } + case "$gl_cv_func_strerror_0_works" in + *yes) ;; + *) + REPLACE_STRERROR_0=1 -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac +printf "%s\n" "#define REPLACE_STRERROR_0 1" >>confdefs.h + ;; + esac -# Gnulib (later checks). Putting them here rather than right after -# gl_EARLY avoids some redundant checks. - # Check whether --enable-cross-guesses was given. -if test "${enable_cross_guesses+set}" = set; then : - enableval=$enable_cross_guesses; if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: invalid argument supplied to --enable-cross-guesses" >&5 -$as_echo "$as_me: WARNING: invalid argument supplied to --enable-cross-guesses" >&2;} - enableval=conservative - fi - gl_cross_guesses="$enableval" -else - gl_cross_guesses=conservative -fi - if test $gl_cross_guesses = risky; then - gl_cross_guess_normal="guessing yes" - gl_cross_guess_inverted="guessing no" - else - gl_cross_guess_normal="guessing no" - gl_cross_guess_inverted="guessing yes" - fi - LIBC_FATAL_STDERR_=1 - export LIBC_FATAL_STDERR_ -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : -else -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int + if test $ac_cv_func_strerror_r = yes; then + if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for strerror_r with POSIX signature" >&5 +printf %s "checking for strerror_r with POSIX signature... " >&6; } +if test ${gl_cv_func_strerror_r_posix_signature+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + int strerror_r (int, char *, size_t); + +int +main (void) +{ + + ; + return 0; +} _ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_strerror_r_posix_signature=yes +else $as_nop + gl_cv_func_strerror_r_posix_signature=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strerror_r_posix_signature" >&5 +printf "%s\n" "$gl_cv_func_strerror_r_posix_signature" >&6; } + if test $gl_cv_func_strerror_r_posix_signature = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strerror_r works" >&5 +printf %s "checking whether strerror_r works... " >&6; } +if test ${gl_cv_func_strerror_r_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : -# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works -# for constant arguments. Useless! -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 -$as_echo_n "checking for working alloca.h... " >&6; } -if ${ac_cv_working_alloca_h+:} false; then : - $as_echo_n "(cached) " >&6 -else + case "$host_os" in + # Guess no on AIX. + aix*) gl_cv_func_strerror_r_works="guessing no";; + # Guess no on HP-UX. + hpux*) gl_cv_func_strerror_r_works="guessing no";; + # Guess no on BSD variants. + *bsd*) gl_cv_func_strerror_r_works="guessing no";; + # Guess yes otherwise. + *) gl_cv_func_strerror_r_works="guessing yes";; + esac + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include + #include + int -main () +main (void) { -char *p = (char *) alloca (2 * sizeof (int)); - if (p) return 0; +int result = 0; + char buf[79]; + if (strerror_r (EACCES, buf, 0) < 0) + result |= 1; + errno = 0; + if (strerror_r (EACCES, buf, sizeof buf) != 0) + result |= 2; + strcpy (buf, "Unknown"); + if (strerror_r (0, buf, sizeof buf) != 0) + result |= 4; + if (errno) + result |= 8; + if (strstr (buf, "nknown") || strstr (buf, "ndefined")) + result |= 0x10; + errno = 0; + *buf = 0; + if (strerror_r (-3, buf, sizeof buf) < 0) + result |= 0x20; + if (errno) + result |= 0x40; + if (!*buf) + result |= 0x80; + return result; + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_working_alloca_h=yes -else - ac_cv_working_alloca_h=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_strerror_r_works=yes +else $as_nop + gl_cv_func_strerror_r_works=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 -$as_echo "$ac_cv_working_alloca_h" >&6; } -if test $ac_cv_working_alloca_h = yes; then -$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strerror_r_works" >&5 +printf "%s\n" "$gl_cv_func_strerror_r_works" >&6; } + else -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 -$as_echo_n "checking for alloca... " >&6; } -if ${ac_cv_func_alloca_works+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test $ac_cv_func___xpg_strerror_r = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether __xpg_strerror_r works" >&5 +printf %s "checking whether __xpg_strerror_r works... " >&6; } +if test ${gl_cv_func_strerror_r_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + gl_cv_func_strerror_r_works="$gl_cross_guess_normal" + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __GNUC__ -# define alloca __builtin_alloca -#else -# ifdef _MSC_VER -# include -# define alloca _alloca -# else -# ifdef HAVE_ALLOCA_H -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -void *alloca (size_t); -# endif -# endif -# endif -# endif -#endif +#include + #include + extern + #ifdef __cplusplus + "C" + #endif + int __xpg_strerror_r(int, char *, size_t); + +int +main (void) +{ +int result = 0; + char buf[256] = "^"; + char copy[256]; + char *str = strerror (-1); + strcpy (copy, str); + if (__xpg_strerror_r (-2, buf, 1) == 0) + result |= 1; + if (*buf) + result |= 2; + __xpg_strerror_r (-2, buf, 256); + if (strcmp (str, copy)) + result |= 4; + return result; -int -main () -{ -char *p = (char *) alloca (1); - if (p) return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_func_alloca_works=yes -else - ac_cv_func_alloca_works=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_strerror_r_works=yes +else $as_nop + gl_cv_func_strerror_r_works=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 -$as_echo "$ac_cv_func_alloca_works" >&6; } -if test $ac_cv_func_alloca_works = yes; then -$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strerror_r_works" >&5 +printf "%s\n" "$gl_cv_func_strerror_r_works" >&6; } + fi + fi + fi + fi -else - # The SVR3 libPW and SVR4 libucb both contain incompatible functions -# that cause trouble. Some versions do not even contain alloca or -# contain a buggy version. If you still want to use their alloca, -# use ar to extract alloca.o from them instead of compiling alloca.c. -ALLOCA=\${LIBOBJDIR}alloca.$ac_objext + if test $ac_cv_have_decl_strerror_r = no; then + HAVE_DECL_STRERROR_R=0 + fi -$as_echo "#define C_ALLOCA 1" >>confdefs.h + if test $ac_cv_func_strerror_r = yes; then + if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then + if test $gl_cv_func_strerror_r_posix_signature = yes; then + case "$gl_cv_func_strerror_r_works" in + *no) REPLACE_STRERROR_R=1 ;; + esac + else + REPLACE_STRERROR_R=1 + fi + else + REPLACE_STRERROR_R=1 + fi + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 -$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } -if ${ac_cv_os_cray+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined CRAY && ! defined CRAY2 -webecray -#else -wenotbecray -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "webecray" >/dev/null 2>&1; then : - ac_cv_os_cray=yes -else - ac_cv_os_cray=no -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 -$as_echo "$ac_cv_os_cray" >&6; } -if test $ac_cv_os_cray = yes; then - for ac_func in _getb67 GETB67 getb67; do - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + HAVE_POSIX_SPAWN=1; + HAVE_POSIX_SPAWNATTR_T=1; + HAVE_POSIX_SPAWN_FILE_ACTIONS_T=1; -cat >>confdefs.h <<_ACEOF -#define CRAY_STACKSEG_END $ac_func -_ACEOF + HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=1; - break -fi + HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR=1; - done -fi + REPLACE_POSIX_SPAWN=0; + REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=0; -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 -$as_echo_n "checking stack direction for C alloca... " >&6; } -if ${ac_cv_c_stack_direction+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_c_stack_direction=0 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -find_stack_direction (int *addr, int depth) -{ - int dir, dummy = 0; - if (! addr) - addr = &dummy; - *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; - dir = depth ? find_stack_direction (addr, depth - 1) : 0; - return dir + dummy; -} + REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=0; -int -main (int argc, char **argv) -{ - return find_stack_direction (0, argc + !argv + 20) < 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_stack_direction=1 -else - ac_cv_c_stack_direction=-1 -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2=0; -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 -$as_echo "$ac_cv_c_stack_direction" >&6; } -cat >>confdefs.h <<_ACEOF -#define STACK_DIRECTION $ac_cv_c_stack_direction -_ACEOF + REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR=0; + REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=0; -fi - GNULIB__EXIT=0; - GNULIB_ATOLL=0; - GNULIB_CALLOC_POSIX=0; - GNULIB_CANONICALIZE_FILE_NAME=0; - GNULIB_GETLOADAVG=0; - GNULIB_GETSUBOPT=0; - GNULIB_GRANTPT=0; - GNULIB_MALLOC_POSIX=0; - GNULIB_MBTOWC=0; - GNULIB_MKDTEMP=0; - GNULIB_MKOSTEMP=0; - GNULIB_MKOSTEMPS=0; - GNULIB_MKSTEMP=0; - GNULIB_MKSTEMPS=0; - GNULIB_POSIX_OPENPT=0; - GNULIB_PTSNAME=0; - GNULIB_PTSNAME_R=0; - GNULIB_PUTENV=0; - GNULIB_QSORT_R=0; - GNULIB_RANDOM=0; - GNULIB_RANDOM_R=0; - GNULIB_REALLOCARRAY=0; - GNULIB_REALLOC_POSIX=0; - GNULIB_REALPATH=0; - GNULIB_RPMATCH=0; - GNULIB_SECURE_GETENV=0; - GNULIB_SETENV=0; - GNULIB_STRTOD=0; - GNULIB_STRTOLD=0; - GNULIB_STRTOLL=0; - GNULIB_STRTOULL=0; - GNULIB_SYSTEM_POSIX=0; - GNULIB_UNLOCKPT=0; - GNULIB_UNSETENV=0; - GNULIB_WCTOMB=0; - HAVE__EXIT=1; - HAVE_ATOLL=1; - HAVE_CANONICALIZE_FILE_NAME=1; - HAVE_DECL_GETLOADAVG=1; - HAVE_GETSUBOPT=1; - HAVE_GRANTPT=1; - HAVE_INITSTATE=1; - HAVE_DECL_INITSTATE=1; - HAVE_MBTOWC=1; - HAVE_MKDTEMP=1; - HAVE_MKOSTEMP=1; - HAVE_MKOSTEMPS=1; - HAVE_MKSTEMP=1; - HAVE_MKSTEMPS=1; - HAVE_POSIX_OPENPT=1; - HAVE_PTSNAME=1; - HAVE_PTSNAME_R=1; - HAVE_QSORT_R=1; - HAVE_RANDOM=1; - HAVE_RANDOM_H=1; - HAVE_RANDOM_R=1; - HAVE_REALLOCARRAY=1; - HAVE_REALPATH=1; - HAVE_RPMATCH=1; - HAVE_SECURE_GETENV=1; - HAVE_SETENV=1; - HAVE_DECL_SETENV=1; - HAVE_SETSTATE=1; - HAVE_DECL_SETSTATE=1; - HAVE_STRTOD=1; - HAVE_STRTOLD=1; - HAVE_STRTOLL=1; - HAVE_STRTOULL=1; - HAVE_STRUCT_RANDOM_DATA=1; - HAVE_SYS_LOADAVG_H=0; - HAVE_UNLOCKPT=1; - HAVE_DECL_UNSETENV=1; - REPLACE_CALLOC=0; - REPLACE_CANONICALIZE_FILE_NAME=0; - REPLACE_INITSTATE=0; - REPLACE_MALLOC=0; - REPLACE_MBTOWC=0; - REPLACE_MKSTEMP=0; - REPLACE_PTSNAME=0; - REPLACE_PTSNAME_R=0; - REPLACE_PUTENV=0; - REPLACE_QSORT_R=0; - REPLACE_RANDOM=0; - REPLACE_RANDOM_R=0; - REPLACE_REALLOC=0; - REPLACE_REALPATH=0; - REPLACE_SETENV=0; - REPLACE_SETSTATE=0; - REPLACE_STRTOD=0; - REPLACE_STRTOLD=0; - REPLACE_UNSETENV=0; - REPLACE_WCTOMB=0; - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether malloc, realloc, calloc are POSIX compliant" >&5 -$as_echo_n "checking whether malloc, realloc, calloc are POSIX compliant... " >&6; } -if ${gl_cv_func_malloc_posix+:} false; then : - $as_echo_n "(cached) " >&6 -else + LIB_POSIX_SPAWN= - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + gl_saved_libs=$LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing posix_spawn" >&5 +printf %s "checking for library containing posix_spawn... " >&6; } +if test ${ac_cv_search_posix_spawn+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char posix_spawn (); int -main () +main (void) { -#if defined _WIN32 && ! defined __CYGWIN__ - choke me - #endif - +return posix_spawn (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_func_malloc_posix=yes -else - gl_cv_func_malloc_posix=no +for ac_lib in '' rt +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_posix_spawn=$ac_res fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_posix_spawn+y} +then : + break fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_malloc_posix" >&5 -$as_echo "$gl_cv_func_malloc_posix" >&6; } - - +done +if test ${ac_cv_search_posix_spawn+y} +then : +else $as_nop + ac_cv_search_posix_spawn=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_posix_spawn" >&5 +printf "%s\n" "$ac_cv_search_posix_spawn" >&6; } +ac_res=$ac_cv_search_posix_spawn +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + test "$ac_cv_search_posix_spawn" = "none required" || + LIB_POSIX_SPAWN=$ac_cv_search_posix_spawn +fi - for ac_func in $ac_func_list -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF + ac_fn_c_check_func "$LINENO" "posix_spawn" "ac_cv_func_posix_spawn" +if test "x$ac_cv_func_posix_spawn" = xyes +then : + printf "%s\n" "#define HAVE_POSIX_SPAWN 1" >>confdefs.h fi -done + LIBS=$gl_saved_libs + if test $ac_cv_func_posix_spawn != yes; then + HAVE_POSIX_SPAWN=0 + fi + ac_fn_check_decl "$LINENO" "posix_spawn" "ac_cv_have_decl_posix_spawn" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_posix_spawn" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_POSIX_SPAWN $ac_have_decl" >>confdefs.h + if test $ac_cv_func_posix_spawn = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether // is distinct from /" >&5 -$as_echo_n "checking whether // is distinct from /... " >&6; } -if ${gl_cv_double_slash_root+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test x"$cross_compiling" = xyes ; then - # When cross-compiling, there is no way to tell whether // is special - # short of a list of hosts. However, the only known hosts to date - # that have a distinct // are Apollo DomainOS (too old to port to), - # Cygwin, and z/OS. If anyone knows of another system for which // has - # special semantics and is distinct from /, please report it to - # . - case $host in - *-cygwin | i370-ibm-openedition) - gl_cv_double_slash_root=yes ;; - *) - # Be optimistic and assume that / and // are the same when we - # don't know. - gl_cv_double_slash_root='unknown, assuming no' ;; - esac - else - set x `ls -di / // 2>/dev/null` - if test "$2" = "$4" && wc //dev/null >/dev/null 2>&1; then - gl_cv_double_slash_root=no - else - gl_cv_double_slash_root=yes - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_double_slash_root" >&5 -$as_echo "$gl_cv_double_slash_root" >&6; } - if test "$gl_cv_double_slash_root" = yes; then + if test $ac_cv_func_posix_spawn_file_actions_addchdir_np = no; then + REPLACE_POSIX_SPAWN=1 + fi -$as_echo "#define DOUBLE_SLASH_IS_DISTINCT_ROOT 1" >>confdefs.h - fi + if test $REPLACE_POSIX_SPAWN = 0; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether posix_spawn works" >&5 +printf %s "checking whether posix_spawn works... " >&6; } +if test ${gl_cv_func_posix_spawn_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test $cross_compiling = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether realpath works" >&5 -$as_echo_n "checking whether realpath works... " >&6; } -if ${gl_cv_func_realpath_works+:} false; then : - $as_echo_n "(cached) " >&6 -else +$gl_mda_defines - touch conftest.a - mkdir conftest.d - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_realpath_works="guessing yes" ;; - # Guess yes on musl systems. - *-musl*) gl_cv_func_realpath_works="guessing yes" ;; - # Guess no on native Windows. - mingw*) gl_cv_func_realpath_works="guessing no" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_realpath_works="$gl_cross_guess_normal" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +extern char **environ; +#ifndef STDIN_FILENO +# define STDIN_FILENO 0 +#endif +#ifndef STDOUT_FILENO +# define STDOUT_FILENO 1 +#endif +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif +#ifndef WTERMSIG +# define WTERMSIG(x) ((x) & 0x7f) +#endif +#ifndef WIFEXITED +# define WIFEXITED(x) (WTERMSIG (x) == 0) +#endif +#ifndef WEXITSTATUS +# define WEXITSTATUS(x) (((x) >> 8) & 0xff) +#endif -#include -#if defined __MACH__ && defined __APPLE__ -/* Avoid a crash on Mac OS X. */ -#include -#include -#include -#include -#include -#include -/* The exception port on which our thread listens. */ -static mach_port_t our_exception_port; -/* The main function of the thread listening for exceptions of type - EXC_BAD_ACCESS. */ -static void * -mach_exception_thread (void *arg) -{ - /* Buffer for a message to be received. */ - struct { - mach_msg_header_t head; - mach_msg_body_t msgh_body; - char data[1024]; - } msg; - mach_msg_return_t retval; - /* Wait for a message on the exception port. */ - retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), - our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); - if (retval != MACH_MSG_SUCCESS) - abort (); - exit (1); -} -static void -nocrash_init (void) -{ - mach_port_t self = mach_task_self (); - /* Allocate a port on which the thread shall listen for exceptions. */ - if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) - == KERN_SUCCESS) { - /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ - if (mach_port_insert_right (self, our_exception_port, our_exception_port, - MACH_MSG_TYPE_MAKE_SEND) - == KERN_SUCCESS) { - /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting - for us. */ - exception_mask_t mask = EXC_MASK_BAD_ACCESS; - /* Create the thread listening on the exception port. */ - pthread_attr_t attr; - pthread_t thread; - if (pthread_attr_init (&attr) == 0 - && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 - && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { - pthread_attr_destroy (&attr); - /* Replace the exception port info for these exceptions with our own. - Note that we replace the exception port for the entire task, not only - for a particular thread. This has the effect that when our exception - port gets the message, the thread specific exception port has already - been asked, and we don't need to bother about it. - See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ - task_set_exception_ports (self, mask, our_exception_port, - EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); - } - } - } -} -#elif defined _WIN32 && ! defined __CYGWIN__ -/* Avoid a crash on native Windows. */ -#define WIN32_LEAN_AND_MEAN -#include -#include -static LONG WINAPI -exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +#define CHILD_PROGRAM_FILENAME "/non/exist/ent" + +static int +fd_safer (int fd) { - switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + if (0 <= fd && fd <= 2) { - case EXCEPTION_ACCESS_VIOLATION: - case EXCEPTION_IN_PAGE_ERROR: - case EXCEPTION_STACK_OVERFLOW: - case EXCEPTION_GUARD_PAGE: - case EXCEPTION_PRIV_INSTRUCTION: - case EXCEPTION_ILLEGAL_INSTRUCTION: - case EXCEPTION_DATATYPE_MISALIGNMENT: - case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - case EXCEPTION_NONCONTINUABLE_EXCEPTION: - exit (1); + int f = fd_safer (dup (fd)); + int e = errno; + close (fd); + errno = e; + fd = f; } - return EXCEPTION_CONTINUE_SEARCH; -} -static void -nocrash_init (void) -{ - SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); -} -#else -/* Avoid a crash on POSIX systems. */ -#include -#include -/* A POSIX signal handler. */ -static void -exception_handler (int sig) -{ - _exit (1); -} -static void -nocrash_init (void) -{ -#ifdef SIGSEGV - signal (SIGSEGV, exception_handler); -#endif -#ifdef SIGBUS - signal (SIGBUS, exception_handler); -#endif -} -#endif - #include - #include + return fd; +} int main () { + char *argv[2] = { CHILD_PROGRAM_FILENAME, NULL }; + int ofd[2]; + sigset_t blocked_signals; + sigset_t fatal_signal_set; + posix_spawn_file_actions_t actions; + bool actions_allocated; + posix_spawnattr_t attrs; + bool attrs_allocated; + int err; + pid_t child; + int status; + int exitstatus; - int result = 0; - { - char *name = realpath ("conftest.a", NULL); - if (!(name && *name == '/')) - result |= 1; - free (name); - } - { - char *name = realpath ("conftest.b/../conftest.a", NULL); - if (name != NULL) - result |= 2; - free (name); - } - { - char *name = realpath ("conftest.a/", NULL); - if (name != NULL) - result |= 4; - free (name); - } + setvbuf (stdout, NULL, _IOFBF, 0); + puts ("This should be seen only once."); + if (pipe (ofd) < 0 || (ofd[1] = fd_safer (ofd[1])) < 0) + { + perror ("cannot create pipe"); + exit (1); + } + sigprocmask (SIG_SETMASK, NULL, &blocked_signals); + sigemptyset (&fatal_signal_set); + sigaddset (&fatal_signal_set, SIGINT); + sigaddset (&fatal_signal_set, SIGTERM); + sigaddset (&fatal_signal_set, SIGHUP); + sigaddset (&fatal_signal_set, SIGPIPE); + sigprocmask (SIG_BLOCK, &fatal_signal_set, NULL); + actions_allocated = false; + attrs_allocated = false; + if ((err = posix_spawn_file_actions_init (&actions)) != 0 + || (actions_allocated = true, + (err = posix_spawn_file_actions_adddup2 (&actions, ofd[0], STDIN_FILENO)) != 0 + || (err = posix_spawn_file_actions_addclose (&actions, ofd[0])) != 0 + || (err = posix_spawn_file_actions_addclose (&actions, ofd[1])) != 0 + || (err = posix_spawnattr_init (&attrs)) != 0 + || (attrs_allocated = true, + (err = posix_spawnattr_setsigmask (&attrs, &blocked_signals)) != 0 + || (err = posix_spawnattr_setflags (&attrs, POSIX_SPAWN_SETSIGMASK)) != 0) + || (err = posix_spawnp (&child, CHILD_PROGRAM_FILENAME, &actions, &attrs, argv, environ)) != 0)) + { + if (actions_allocated) + posix_spawn_file_actions_destroy (&actions); + if (attrs_allocated) + posix_spawnattr_destroy (&attrs); + sigprocmask (SIG_UNBLOCK, &fatal_signal_set, NULL); + if (err == ENOENT) + return 0; + else { - char *name1 = realpath (".", NULL); - char *name2 = realpath ("conftest.d//./..", NULL); - if (! name1 || ! name2 || strcmp (name1, name2)) - result |= 8; - free (name1); - free (name2); + errno = err; + perror ("subprocess failed"); + exit (1); } - return result; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_realpath_works=yes -else - gl_cv_func_realpath_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - rm -rf conftest.a conftest.d + } + posix_spawn_file_actions_destroy (&actions); + posix_spawnattr_destroy (&attrs); + sigprocmask (SIG_UNBLOCK, &fatal_signal_set, NULL); + close (ofd[0]); + close (ofd[1]); + status = 0; + while (waitpid (child, &status, 0) != child) + ; + if (!WIFEXITED (status)) + { + fprintf (stderr, "subprocess terminated with unexpected wait status %d\n", status); + exit (1); + } + exitstatus = WEXITSTATUS (status); + if (exitstatus != 127) + { + fprintf (stderr, "subprocess terminated with unexpected exit status %d\n", exitstatus); + exit (1); + } + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + if test -s conftest$ac_exeext \ + && ./conftest$ac_exeext > conftest.out \ + && echo 'This should be seen only once.' > conftest.ok \ + && cmp conftest.out conftest.ok >/dev/null 2>&1; then + gl_cv_func_posix_spawn_works=yes + else + gl_cv_func_posix_spawn_works=no + fi +else $as_nop + gl_cv_func_posix_spawn_works=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_realpath_works" >&5 -$as_echo "$gl_cv_func_realpath_works" >&6; } - case "$gl_cv_func_realpath_works" in - *yes) - -$as_echo "#define FUNC_REALPATH_WORKS 1" >>confdefs.h - - ;; - esac - +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test $gl_cv_func_posix_spawn_works = yes; then + if test "$cross_compiling" = yes +then : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Test whether posix_spawn_file_actions_addopen supports filename arguments + that contain special characters such as '*'. */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +$gl_mda_defines +extern char **environ; +#ifndef STDIN_FILENO +# define STDIN_FILENO 0 +#endif +#ifndef STDOUT_FILENO +# define STDOUT_FILENO 1 +#endif +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif +#ifndef WTERMSIG +# define WTERMSIG(x) ((x) & 0x7f) +#endif +#ifndef WIFEXITED +# define WIFEXITED(x) (WTERMSIG (x) == 0) +#endif +#ifndef WEXITSTATUS +# define WEXITSTATUS(x) (((x) >> 8) & 0xff) +#endif +#define CHILD_PROGRAM_FILENAME "conftest" +#define DATA_FILENAME "conftest%=*#?" +static int +parent_main (void) +{ + FILE *fp; + char *argv[3] = { CHILD_PROGRAM_FILENAME, "-child", NULL }; + posix_spawn_file_actions_t actions; + bool actions_allocated; + int err; + pid_t child; + int status; + int exitstatus; + /* Create a data file with specific contents. */ + fp = fopen (DATA_FILENAME, "wb"); + if (fp == NULL) + { + perror ("cannot create data file"); + return 1; + } + fwrite ("Halle Potta", 1, 11, fp); + if (fflush (fp) || fclose (fp)) + { + perror ("cannot prepare data file"); + return 2; + } - GNULIB_ACCESS=0; - GNULIB_CHDIR=0; - GNULIB_CHOWN=0; - GNULIB_CLOSE=0; - GNULIB_COPY_FILE_RANGE=0; - GNULIB_DUP=0; - GNULIB_DUP2=0; - GNULIB_DUP3=0; - GNULIB_ENVIRON=0; - GNULIB_EUIDACCESS=0; - GNULIB_FACCESSAT=0; - GNULIB_FCHDIR=0; - GNULIB_FCHOWNAT=0; - GNULIB_FDATASYNC=0; - GNULIB_FSYNC=0; - GNULIB_FTRUNCATE=0; - GNULIB_GETCWD=0; - GNULIB_GETDOMAINNAME=0; - GNULIB_GETDTABLESIZE=0; - GNULIB_GETGROUPS=0; - GNULIB_GETHOSTNAME=0; - GNULIB_GETLOGIN=0; - GNULIB_GETLOGIN_R=0; - GNULIB_GETOPT_POSIX=0; - GNULIB_GETPAGESIZE=0; - GNULIB_GETPASS=0; - GNULIB_GETUSERSHELL=0; - GNULIB_GROUP_MEMBER=0; - GNULIB_ISATTY=0; - GNULIB_LCHOWN=0; - GNULIB_LINK=0; - GNULIB_LINKAT=0; - GNULIB_LSEEK=0; - GNULIB_PIPE=0; - GNULIB_PIPE2=0; - GNULIB_PREAD=0; - GNULIB_PWRITE=0; - GNULIB_READ=0; - GNULIB_READLINK=0; - GNULIB_READLINKAT=0; - GNULIB_RMDIR=0; - GNULIB_SETHOSTNAME=0; - GNULIB_SLEEP=0; - GNULIB_SYMLINK=0; - GNULIB_SYMLINKAT=0; - GNULIB_TRUNCATE=0; - GNULIB_TTYNAME_R=0; - GNULIB_UNISTD_H_NONBLOCKING=0; - GNULIB_UNISTD_H_SIGPIPE=0; - GNULIB_UNLINK=0; - GNULIB_UNLINKAT=0; - GNULIB_USLEEP=0; - GNULIB_WRITE=0; - HAVE_CHOWN=1; - HAVE_COPY_FILE_RANGE=1; - HAVE_DUP2=1; - HAVE_DUP3=1; - HAVE_EUIDACCESS=1; - HAVE_FACCESSAT=1; - HAVE_FCHDIR=1; - HAVE_FCHOWNAT=1; - HAVE_FDATASYNC=1; - HAVE_FSYNC=1; - HAVE_FTRUNCATE=1; - HAVE_GETDTABLESIZE=1; - HAVE_GETGROUPS=1; - HAVE_GETHOSTNAME=1; - HAVE_GETLOGIN=1; - HAVE_GETPAGESIZE=1; - HAVE_GETPASS=1; - HAVE_GROUP_MEMBER=1; - HAVE_LCHOWN=1; - HAVE_LINK=1; - HAVE_LINKAT=1; - HAVE_PIPE=1; - HAVE_PIPE2=1; - HAVE_PREAD=1; - HAVE_PWRITE=1; - HAVE_READLINK=1; - HAVE_READLINKAT=1; - HAVE_SETHOSTNAME=1; - HAVE_SLEEP=1; - HAVE_SYMLINK=1; - HAVE_SYMLINKAT=1; - HAVE_UNLINKAT=1; - HAVE_USLEEP=1; - HAVE_DECL_ENVIRON=1; - HAVE_DECL_FCHDIR=1; - HAVE_DECL_FDATASYNC=1; - HAVE_DECL_GETDOMAINNAME=1; - HAVE_DECL_GETLOGIN=1; - HAVE_DECL_GETLOGIN_R=1; - HAVE_DECL_GETPAGESIZE=1; - HAVE_DECL_GETUSERSHELL=1; - HAVE_DECL_SETHOSTNAME=1; - HAVE_DECL_TRUNCATE=1; - HAVE_DECL_TTYNAME_R=1; - HAVE_OS_H=0; - HAVE_SYS_PARAM_H=0; - REPLACE_ACCESS=0; - REPLACE_CHOWN=0; - REPLACE_CLOSE=0; - REPLACE_DUP=0; - REPLACE_DUP2=0; - REPLACE_FACCESSAT=0; - REPLACE_FCHOWNAT=0; - REPLACE_FTRUNCATE=0; - REPLACE_GETCWD=0; - REPLACE_GETDOMAINNAME=0; - REPLACE_GETDTABLESIZE=0; - REPLACE_GETLOGIN_R=0; - REPLACE_GETGROUPS=0; - REPLACE_GETPAGESIZE=0; - REPLACE_GETPASS=0; - REPLACE_ISATTY=0; - REPLACE_LCHOWN=0; - REPLACE_LINK=0; - REPLACE_LINKAT=0; - REPLACE_LSEEK=0; - REPLACE_PREAD=0; - REPLACE_PWRITE=0; - REPLACE_READ=0; - REPLACE_READLINK=0; - REPLACE_READLINKAT=0; - REPLACE_RMDIR=0; - REPLACE_SLEEP=0; - REPLACE_SYMLINK=0; - REPLACE_SYMLINKAT=0; - REPLACE_TRUNCATE=0; - REPLACE_TTYNAME_R=0; - REPLACE_UNLINK=0; - REPLACE_UNLINKAT=0; - REPLACE_USLEEP=0; - REPLACE_WRITE=0; - UNISTD_H_HAVE_WINSOCK2_H=0; - UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; + /* Avoid reading from our stdin, as it could block. */ + freopen ("/dev/null", "rb", stdin); + /* Test whether posix_spawn_file_actions_addopen with this file name + actually works, but spawning a child that reads from this file. */ + actions_allocated = false; + if ((err = posix_spawn_file_actions_init (&actions)) != 0 + || (actions_allocated = true, + (err = posix_spawn_file_actions_addopen (&actions, STDIN_FILENO, DATA_FILENAME, O_RDONLY, 0600)) != 0 + || (err = posix_spawn (&child, CHILD_PROGRAM_FILENAME, &actions, NULL, argv, environ)) != 0)) + { + if (actions_allocated) + posix_spawn_file_actions_destroy (&actions); + errno = err; + perror ("subprocess failed"); + return 3; + } + posix_spawn_file_actions_destroy (&actions); + status = 0; + while (waitpid (child, &status, 0) != child) + ; + if (!WIFEXITED (status)) + { + fprintf (stderr, "subprocess terminated with unexpected wait status %d\n", status); + return 4; + } + exitstatus = WEXITSTATUS (status); + if (exitstatus != 0) + { + fprintf (stderr, "subprocess terminated with unexpected exit status %d\n", exitstatus); + return 5; + } + return 0; +} +static int +child_main (void) +{ + char buf[1024]; + /* See if reading from STDIN_FILENO yields the expected contents. */ + if (fread (buf, 1, sizeof (buf), stdin) == 11 + && memcmp (buf, "Halle Potta", 11) == 0) + return 0; + else + return 8; +} +static void +cleanup_then_die (int sig) +{ + /* Clean up data file. */ + unlink (DATA_FILENAME); + /* Re-raise the signal and die from it. */ + signal (sig, SIG_DFL); + raise (sig); +} - if test $ac_cv_func__set_invalid_parameter_handler = yes; then - HAVE_MSVC_INVALID_PARAMETER_HANDLER=1 +int +main (int argc, char *argv[]) +{ + int exitstatus; -$as_echo "#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1" >>confdefs.h + if (!(argc > 1 && strcmp (argv[1], "-child") == 0)) + { + /* This is the parent process. */ + signal (SIGINT, cleanup_then_die); + signal (SIGTERM, cleanup_then_die); + #ifdef SIGHUP + signal (SIGHUP, cleanup_then_die); + #endif + exitstatus = parent_main (); + } else - HAVE_MSVC_INVALID_PARAMETER_HANDLER=0 - fi - - - + { + /* This is the child process. */ + exitstatus = child_main (); + } + unlink (DATA_FILENAME); + return exitstatus; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : +else $as_nop + gl_cv_func_posix_spawn_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + fi + else + case "$host_os" in + aix*) gl_cv_func_posix_spawn_works="guessing no";; + *) gl_cv_func_posix_spawn_works="guessing yes";; + esac + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_posix_spawn_works" >&5 +printf "%s\n" "$gl_cv_func_posix_spawn_works" >&6; } + case "$gl_cv_func_posix_spawn_works" in + *yes) ;; + *) REPLACE_POSIX_SPAWN=1 ;; + esac + fi + if test $REPLACE_POSIX_SPAWN = 0; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether posix_spawn rejects scripts without shebang" >&5 +printf %s "checking whether posix_spawn rejects scripts without shebang... " >&6; } +if test ${gl_cv_func_posix_spawn_secure_exec+y} +then : + printf %s "(cached) " >&6 +else $as_nop + echo ':' > conftest.scr + chmod a+x conftest.scr + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess no on GNU/Hurd. + gnu*) + gl_cv_func_posix_spawn_secure_exec="guessing no" ;; + # Guess yes on all other platforms. + *) + gl_cv_func_posix_spawn_secure_exec="guessing yes" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include + #include + #include + #include + #include + int + main () + { + const char *prog_path = "./conftest.scr"; + const char *prog_argv[2] = { prog_path, NULL }; + const char *environment[2] = { "PATH=.", NULL }; + pid_t child; + int status; + int err = posix_spawn (&child, prog_path, NULL, NULL, + (char **) prog_argv, (char **) environment); + if (err == ENOEXEC) + return 0; + if (err != 0) + return 1; + status = 0; + while (waitpid (child, &status, 0) != child) + ; + if (!WIFEXITED (status)) + return 2; + if (WEXITSTATUS (status) != 127) + return 3; + return 0; + } +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_posix_spawn_secure_exec=yes +else $as_nop + gl_cv_func_posix_spawn_secure_exec=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + rm -f conftest.scr +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_posix_spawn_secure_exec" >&5 +printf "%s\n" "$gl_cv_func_posix_spawn_secure_exec" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether posix_spawnp rejects scripts without shebang" >&5 +printf %s "checking whether posix_spawnp rejects scripts without shebang... " >&6; } +if test ${gl_cv_func_posix_spawnp_secure_exec+y} +then : + printf %s "(cached) " >&6 +else $as_nop + echo ':' > conftest.scr + chmod a+x conftest.scr + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems (glibc >= 2.15 actually) except GNU/Hurd, + # musl libc, NetBSD. + *-gnu* | *-musl* | netbsd*) + gl_cv_func_posix_spawnp_secure_exec="guessing yes" ;; + # Guess no on GNU/Hurd, macOS, FreeBSD, OpenBSD, AIX, Solaris, Cygwin. + gnu* | darwin* | freebsd* | dragonfly* | midnightbsd* | openbsd* | \ + aix* | solaris* | cygwin*) + gl_cv_func_posix_spawnp_secure_exec="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_posix_spawnp_secure_exec="$gl_cross_guess_normal" ;; + esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if environ is properly declared" >&5 -$as_echo_n "checking if environ is properly declared... " >&6; } -if ${gt_cv_var_environ_declaration+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if HAVE_UNISTD_H - #include - #endif - /* mingw, BeOS, Haiku declare environ in , not in . */ - #include - extern struct { int foo; } environ; -int -main () -{ -environ.foo = 1; - ; - return 0; -} + #include + #include + #include + #include + #include + int + main () + { + const char *prog_path = "./conftest.scr"; + const char *prog_argv[2] = { prog_path, NULL }; + const char *environment[2] = { "PATH=.", NULL }; + pid_t child; + int status; + int err = posix_spawnp (&child, prog_path, NULL, NULL, + (char **) prog_argv, (char **) environment); + if (err == ENOEXEC) + return 0; + if (err != 0) + return 1; + status = 0; + while (waitpid (child, &status, 0) != child) + ; + if (!WIFEXITED (status)) + return 2; + if (WEXITSTATUS (status) != 127) + return 3; + return 0; + } + _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gt_cv_var_environ_declaration=no -else - gt_cv_var_environ_declaration=yes +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_posix_spawnp_secure_exec=yes +else $as_nop + gl_cv_func_posix_spawnp_secure_exec=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_var_environ_declaration" >&5 -$as_echo "$gt_cv_var_environ_declaration" >&6; } - if test $gt_cv_var_environ_declaration = yes; then - -$as_echo "#define HAVE_ENVIRON_DECL 1" >>confdefs.h - - fi + rm -f conftest.scr - if test $gt_cv_var_environ_declaration != yes; then - HAVE_DECL_ENVIRON=0 - fi - +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_posix_spawnp_secure_exec" >&5 +printf "%s\n" "$gl_cv_func_posix_spawnp_secure_exec" >&6; } + case "$gl_cv_func_posix_spawn_secure_exec" in + *yes) ;; + *) REPLACE_POSIX_SPAWN=1 ;; + esac + case "$gl_cv_func_posix_spawnp_secure_exec" in + *yes) ;; + *) REPLACE_POSIX_SPAWN=1 ;; + esac + fi + if test $REPLACE_POSIX_SPAWN = 0; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether posix_spawnattr_setschedpolicy is supported" >&5 +printf %s "checking whether posix_spawnattr_setschedpolicy is supported... " >&6; } +if test ${gl_cv_func_spawnattr_setschedpolicy+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the preprocessor supports include_next" >&5 -$as_echo_n "checking whether the preprocessor supports include_next... " >&6; } -if ${gl_cv_have_include_next+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -rf conftestd1a conftestd1b conftestd2 - mkdir conftestd1a conftestd1b conftestd2 - cat < conftestd1a/conftest.h -#define DEFINED_IN_CONFTESTD1 -#include_next -#ifdef DEFINED_IN_CONFTESTD2 -int foo; -#else -#error "include_next doesn't work" -#endif -EOF - cat < conftestd1b/conftest.h -#define DEFINED_IN_CONFTESTD1 -#include -#include_next -#ifdef DEFINED_IN_CONFTESTD2 -int foo; -#else -#error "include_next doesn't work" -#endif -EOF - cat < conftestd2/conftest.h -#ifndef DEFINED_IN_CONFTESTD1 -#error "include_next test doesn't work" +#include +#if POSIX_SPAWN_SETSCHEDULER + POSIX scheduling supported #endif -#define DEFINED_IN_CONFTESTD2 -EOF - gl_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_have_include_next=yes -else - CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include + _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_have_include_next=buggy -else - gl_cv_have_include_next=no +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "POSIX scheduling supported" >/dev/null 2>&1 +then : + gl_cv_func_spawnattr_setschedpolicy=yes +else $as_nop + gl_cv_func_spawnattr_setschedpolicy=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -rf conftest* -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$gl_save_CPPFLAGS" - rm -rf conftestd1a conftestd1b conftestd2 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_include_next" >&5 -$as_echo "$gl_cv_have_include_next" >&6; } - PRAGMA_SYSTEM_HEADER= - if test $gl_cv_have_include_next = yes; then - INCLUDE_NEXT=include_next - INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next - if test -n "$GCC"; then - PRAGMA_SYSTEM_HEADER='#pragma GCC system_header' - fi - else - if test $gl_cv_have_include_next = buggy; then - INCLUDE_NEXT=include - INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next - else - INCLUDE_NEXT=include - INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include - fi - fi - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether system header files limit the line length" >&5 -$as_echo_n "checking whether system header files limit the line length... " >&6; } -if ${gl_cv_pragma_columns+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_spawnattr_setschedpolicy" >&5 +printf "%s\n" "$gl_cv_func_spawnattr_setschedpolicy" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether posix_spawnattr_setschedparam is supported" >&5 +printf %s "checking whether posix_spawnattr_setschedparam is supported... " >&6; } +if test ${gl_cv_func_spawnattr_setschedparam+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __TANDEM -choke me +#include +#if POSIX_SPAWN_SETSCHEDPARAM + POSIX scheduling supported #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "choke me" >/dev/null 2>&1; then : - gl_cv_pragma_columns=yes -else - gl_cv_pragma_columns=no + $EGREP "POSIX scheduling supported" >/dev/null 2>&1 +then : + gl_cv_func_spawnattr_setschedparam=yes +else $as_nop + gl_cv_func_spawnattr_setschedparam=no fi -rm -f conftest* +rm -rf conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_pragma_columns" >&5 -$as_echo "$gl_cv_pragma_columns" >&6; } - if test $gl_cv_pragma_columns = yes; then - PRAGMA_COLUMNS="#pragma COLUMNS 10000" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_spawnattr_setschedparam" >&5 +printf "%s\n" "$gl_cv_func_spawnattr_setschedparam" >&6; } + fi else - PRAGMA_COLUMNS= + if test $ac_cv_have_decl_posix_spawn = yes; then + REPLACE_POSIX_SPAWN=1 + fi fi + if test $ac_cv_func_posix_spawn != yes || test $REPLACE_POSIX_SPAWN = 1; then +printf "%s\n" "#define REPLACE_POSIX_SPAWN 1" >>confdefs.h + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for complete errno.h" >&5 -$as_echo_n "checking for complete errno.h... " >&6; } -if ${gl_cv_header_errno_h_complete+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#if !defined ETXTBSY -booboo -#endif -#if !defined ENOMSG -booboo -#endif -#if !defined EIDRM -booboo -#endif -#if !defined ENOLINK -booboo -#endif -#if !defined EPROTO -booboo -#endif -#if !defined EMULTIHOP -booboo -#endif -#if !defined EBADMSG -booboo -#endif -#if !defined EOVERFLOW -booboo -#endif -#if !defined ENOTSUP -booboo -#endif -#if !defined ENETRESET -booboo -#endif -#if !defined ECONNABORTED -booboo -#endif -#if !defined ESTALE -booboo -#endif -#if !defined EDQUOT -booboo -#endif -#if !defined ECANCELED -booboo -#endif -#if !defined EOWNERDEAD -booboo -#endif -#if !defined ENOTRECOVERABLE -booboo -#endif -#if !defined EILSEQ -booboo -#endif + GL_GNULIB_POSIX_SPAWN=0 -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "booboo" >/dev/null 2>&1; then : - gl_cv_header_errno_h_complete=no -else - gl_cv_header_errno_h_complete=yes -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_complete" >&5 -$as_echo "$gl_cv_header_errno_h_complete" >&6; } - if test $gl_cv_header_errno_h_complete = yes; then - ERRNO_H='' - else + GL_GNULIB_POSIX_SPAWNP=0 + GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT=0 + GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=0 - if test $gl_cv_have_include_next = yes; then - gl_cv_next_errno_h='<'errno.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_errno_h+:} false; then : - $as_echo_n "(cached) " >&6 -else + GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=0 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'errno.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' + GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2=0 - gl_cv_absolute_errno_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_errno_h - gl_cv_next_errno_h='"'$gl_header'"' + GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR=0 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_errno_h" >&5 -$as_echo "$gl_cv_next_errno_h" >&6; } - fi - NEXT_ERRNO_H=$gl_cv_next_errno_h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'errno.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_errno_h - fi - NEXT_AS_FIRST_DIRECTIVE_ERRNO_H=$gl_next_as_first_directive + GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=0 - ERRNO_H='errno.h' - fi + GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY=0 - if test -n "$ERRNO_H"; then - GL_GENERATE_ERRNO_H_TRUE= - GL_GENERATE_ERRNO_H_FALSE='#' -else - GL_GENERATE_ERRNO_H_TRUE='#' - GL_GENERATE_ERRNO_H_FALSE= -fi - if test -n "$ERRNO_H"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EMULTIHOP value" >&5 -$as_echo_n "checking for EMULTIHOP value... " >&6; } -if ${gl_cv_header_errno_h_EMULTIHOP+:} false; then : - $as_echo_n "(cached) " >&6 -else + GL_GNULIB_POSIX_SPAWNATTR_INIT=0 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#ifdef EMULTIHOP -yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then : - gl_cv_header_errno_h_EMULTIHOP=yes -else - gl_cv_header_errno_h_EMULTIHOP=no -fi -rm -f conftest* + GL_GNULIB_POSIX_SPAWNATTR_GETFLAGS=0 - if test $gl_cv_header_errno_h_EMULTIHOP = no; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define _XOPEN_SOURCE_EXTENDED 1 -#include -#ifdef EMULTIHOP -yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then : - gl_cv_header_errno_h_EMULTIHOP=hidden -fi -rm -f conftest* + GL_GNULIB_POSIX_SPAWNATTR_SETFLAGS=0 - if test $gl_cv_header_errno_h_EMULTIHOP = hidden; then - if ac_fn_c_compute_int "$LINENO" "EMULTIHOP" "gl_cv_header_errno_h_EMULTIHOP" " -#define _XOPEN_SOURCE_EXTENDED 1 -#include -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include -#include -"; then : -fi - fi - fi + GL_GNULIB_POSIX_SPAWNATTR_GETPGROUP=0 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_EMULTIHOP" >&5 -$as_echo "$gl_cv_header_errno_h_EMULTIHOP" >&6; } - case $gl_cv_header_errno_h_EMULTIHOP in - yes | no) - EMULTIHOP_HIDDEN=0; EMULTIHOP_VALUE= - ;; - *) - EMULTIHOP_HIDDEN=1; EMULTIHOP_VALUE="$gl_cv_header_errno_h_EMULTIHOP" - ;; - esac - fi + GL_GNULIB_POSIX_SPAWNATTR_SETPGROUP=0 - if test -n "$ERRNO_H"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ENOLINK value" >&5 -$as_echo_n "checking for ENOLINK value... " >&6; } -if ${gl_cv_header_errno_h_ENOLINK+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + GL_GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM=0 -#include -#ifdef ENOLINK -yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then : - gl_cv_header_errno_h_ENOLINK=yes -else - gl_cv_header_errno_h_ENOLINK=no -fi -rm -f conftest* - if test $gl_cv_header_errno_h_ENOLINK = no; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + GL_GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM=0 -#define _XOPEN_SOURCE_EXTENDED 1 -#include -#ifdef ENOLINK -yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then : - gl_cv_header_errno_h_ENOLINK=hidden -fi -rm -f conftest* - if test $gl_cv_header_errno_h_ENOLINK = hidden; then - if ac_fn_c_compute_int "$LINENO" "ENOLINK" "gl_cv_header_errno_h_ENOLINK" " -#define _XOPEN_SOURCE_EXTENDED 1 -#include -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include -#include -"; then : + GL_GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY=0 -fi - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_ENOLINK" >&5 -$as_echo "$gl_cv_header_errno_h_ENOLINK" >&6; } - case $gl_cv_header_errno_h_ENOLINK in - yes | no) - ENOLINK_HIDDEN=0; ENOLINK_VALUE= - ;; - *) - ENOLINK_HIDDEN=1; ENOLINK_VALUE="$gl_cv_header_errno_h_ENOLINK" - ;; - esac + GL_GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY=0 - fi + GL_GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT=0 - if test -n "$ERRNO_H"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EOVERFLOW value" >&5 -$as_echo_n "checking for EOVERFLOW value... " >&6; } -if ${gl_cv_header_errno_h_EOVERFLOW+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#ifdef EOVERFLOW -yes -#endif + GL_GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT=0 -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then : - gl_cv_header_errno_h_EOVERFLOW=yes -else - gl_cv_header_errno_h_EOVERFLOW=no -fi -rm -f conftest* - if test $gl_cv_header_errno_h_EOVERFLOW = no; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define _XOPEN_SOURCE_EXTENDED 1 -#include -#ifdef EOVERFLOW -yes -#endif + GL_GNULIB_POSIX_SPAWNATTR_GETSIGMASK=0 -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then : - gl_cv_header_errno_h_EOVERFLOW=hidden -fi -rm -f conftest* - if test $gl_cv_header_errno_h_EOVERFLOW = hidden; then - if ac_fn_c_compute_int "$LINENO" "EOVERFLOW" "gl_cv_header_errno_h_EOVERFLOW" " -#define _XOPEN_SOURCE_EXTENDED 1 -#include -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include -#include -"; then : -fi + GL_GNULIB_POSIX_SPAWNATTR_SETSIGMASK=0 - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_EOVERFLOW" >&5 -$as_echo "$gl_cv_header_errno_h_EOVERFLOW" >&6; } - case $gl_cv_header_errno_h_EOVERFLOW in - yes | no) - EOVERFLOW_HIDDEN=0; EOVERFLOW_VALUE= - ;; - *) - EOVERFLOW_HIDDEN=1; EOVERFLOW_VALUE="$gl_cv_header_errno_h_EOVERFLOW" - ;; - esac + GL_GNULIB_POSIX_SPAWNATTR_DESTROY=0 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler is clang" >&5 -$as_echo_n "checking whether the compiler is clang... " >&6; } -if ${gl_cv_compiler_clang+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __clang__ -barfbarf -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "barfbarf" >/dev/null 2>&1; then : - gl_cv_compiler_clang=yes -else - gl_cv_compiler_clang=no -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_compiler_clang" >&5 -$as_echo "$gl_cv_compiler_clang" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler option needed when checking for declarations" >&5 -$as_echo_n "checking for compiler option needed when checking for declarations... " >&6; } -if ${gl_cv_compiler_check_decl_option+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test $gl_cv_compiler_clang = yes; then - save_ac_compile="$ac_compile" - ac_compile="$ac_compile -Werror=implicit-function-declaration" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration' -else - gl_cv_compiler_check_decl_option=none -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_compile="$save_ac_compile" - else - gl_cv_compiler_check_decl_option=none - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_compiler_check_decl_option" >&5 -$as_echo "$gl_cv_compiler_check_decl_option" >&6; } - if test "x$gl_cv_compiler_check_decl_option" != xnone; then - ac_compile_for_check_decl="$ac_compile $gl_cv_compiler_check_decl_option" - else - ac_compile_for_check_decl="$ac_compile" - fi -ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" -if test "x$ac_cv_have_decl_strerror_r" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRERROR_R $ac_have_decl -_ACEOF -for ac_func in strerror_r -do : - ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r" -if test "x$ac_cv_func_strerror_r" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRERROR_R 1 -_ACEOF + gl_cv_func_vfprintf_posix=no + case "$gl_cv_func_printf_sizes_c99" in + *yes) + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + case "$gl_cv_func_printf_directive_a" in + *yes) + case "$gl_cv_func_printf_directive_f" in + *yes) + case "$gl_cv_func_printf_directive_n" in + *yes) + case "$gl_cv_func_printf_directive_ls" in + *yes) + case "$gl_cv_func_printf_positions" in + *yes) + case "$gl_cv_func_printf_flag_grouping" in + *yes) + case "$gl_cv_func_printf_flag_leftadjust" in + *yes) + case "$gl_cv_func_printf_flag_zero" in + *yes) + case "$gl_cv_func_printf_precision" in + *yes) + case "$gl_cv_func_printf_enomem" in + *yes) + # vfprintf exists and is + # already POSIX compliant. + gl_cv_func_vfprintf_posix=yes + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + if test $gl_cv_func_vfprintf_posix = no; then -fi -done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 -$as_echo_n "checking whether strerror_r returns char *... " >&6; } -if ${ac_cv_func_strerror_r_char_p+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_func_strerror_r_char_p=no - if test $ac_cv_have_decl_strerror_r = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ + case "$gl_cv_func_printf_infinite" in + *yes) + ;; + *) - char buf[100]; - char x = *strerror_r (0, buf, sizeof buf); - char *p = strerror_r (0, buf, sizeof buf); - return !p || x; +printf "%s\n" "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_func_strerror_r_char_p=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - else - # strerror_r is not declared. Choose between - # systems that have relatively inaccessible declarations for the - # function. BeOS and DEC UNIX 4.0 fall in this category, but the - # former has a strerror_r that returns char*, while the latter - # has a strerror_r that returns `int'. - # This test should segfault on the DEC system. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default - extern char *strerror_r (); -int -main () -{ -char buf[100]; - char x = *strerror_r (0, buf, sizeof buf); - return ! isalpha (x); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_strerror_r_char_p=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + ;; + esac - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 -$as_echo "$ac_cv_func_strerror_r_char_p" >&6; } -if test $ac_cv_func_strerror_r_char_p = yes; then -$as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h + + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + ;; + *) + +printf "%s\n" "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h + + ;; + esac + ;; + esac + + + + case "$gl_cv_func_printf_directive_a" in + *yes) + ;; + *) + +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h + + ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" +if test "x$ac_cv_func_nl_langinfo" = xyes +then : + printf "%s\n" "#define HAVE_NL_LANGINFO 1" >>confdefs.h fi + ;; + esac - XGETTEXT_EXTRA_OPTIONS= + case "$gl_cv_func_printf_directive_f" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h + ;; + esac - ac_fn_c_check_type "$LINENO" "sig_atomic_t" "ac_cv_type_sig_atomic_t" "#include -" -if test "x$ac_cv_type_sig_atomic_t" = xyes; then : -cat >>confdefs.h <<_ACEOF -#define HAVE_SIG_ATOMIC_T 1 -_ACEOF + case "$gl_cv_func_printf_directive_ls" in + *yes) + ;; + *) -else +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h -$as_echo "#define sig_atomic_t int" >>confdefs.h + ;; + esac -fi + case "$gl_cv_func_printf_flag_grouping" in + *yes) + ;; + *) - GNULIB_CREAT=0; - GNULIB_FCNTL=0; - GNULIB_NONBLOCKING=0; - GNULIB_OPEN=0; - GNULIB_OPENAT=0; - HAVE_FCNTL=1; - HAVE_OPENAT=1; - REPLACE_CREAT=0; - REPLACE_FCNTL=0; - REPLACE_OPEN=0; - REPLACE_OPENAT=0; +printf "%s\n" "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h + ;; + esac + case "$gl_cv_func_printf_flag_leftadjust" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h + ;; + esac + case "$gl_cv_func_printf_flag_zero" in + *yes) + ;; + *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fcntl.h" >&5 -$as_echo_n "checking for working fcntl.h... " >&6; } -if ${gl_cv_header_working_fcntl_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess 'no' on native Windows. - mingw*) gl_cv_header_working_fcntl_h='no' ;; - *) gl_cv_header_working_fcntl_h=cross-compiling ;; - esac +printf "%s\n" "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - #if HAVE_UNISTD_H - # include - #else /* on Windows with MSVC */ - # include - # include - # defined sleep(n) _sleep ((n) * 1000) - #endif - #include - #ifndef O_NOATIME - #define O_NOATIME 0 - #endif - #ifndef O_NOFOLLOW - #define O_NOFOLLOW 0 - #endif - static int const constants[] = - { - O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, - O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY - }; + ;; + esac -int -main () -{ - int result = !constants; - #if HAVE_SYMLINK - { - static char const sym[] = "conftest.sym"; - if (symlink ("/dev/null", sym) != 0) - result |= 2; - else - { - int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); - if (fd >= 0) - { - close (fd); - result |= 4; - } - } - if (unlink (sym) != 0 || symlink (".", sym) != 0) - result |= 2; - else - { - int fd = open (sym, O_RDONLY | O_NOFOLLOW); - if (fd >= 0) - { - close (fd); - result |= 4; - } - } - unlink (sym); - } - #endif - { - static char const file[] = "confdefs.h"; - int fd = open (file, O_RDONLY | O_NOATIME); - if (fd < 0) - result |= 8; - else - { - struct stat st0; - if (fstat (fd, &st0) != 0) - result |= 16; - else - { - char c; - sleep (1); - if (read (fd, &c, 1) != 1) - result |= 24; - else - { - if (close (fd) != 0) - result |= 32; - else - { - struct stat st1; - if (stat (file, &st1) != 0) - result |= 40; - else - if (st0.st_atime != st1.st_atime) - result |= 64; - } - } - } - } - } - return result; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_header_working_fcntl_h=yes -else - case $? in #( - 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( - 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( - 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( - *) gl_cv_header_working_fcntl_h='no';; - esac -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + case "$gl_cv_func_printf_precision" in + *yes) + ;; + *) + +printf "%s\n" "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h + + +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h + + +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h + + ;; + esac + + + + case "$gl_cv_func_printf_enomem" in + *yes) + ;; + *) + +printf "%s\n" "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_fcntl_h" >&5 -$as_echo "$gl_cv_header_working_fcntl_h" >&6; } - case $gl_cv_header_working_fcntl_h in #( - *O_NOATIME* | no | cross-compiling) ac_val=0;; #( - *) ac_val=1;; - esac +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define HAVE_WORKING_O_NOATIME $ac_val -_ACEOF +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h - case $gl_cv_header_working_fcntl_h in #( - *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( - *) ac_val=1;; + ;; esac -cat >>confdefs.h <<_ACEOF -#define HAVE_WORKING_O_NOFOLLOW $ac_val -_ACEOF -ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = xyes; then : -else -cat >>confdefs.h <<_ACEOF -#define pid_t int -_ACEOF -fi -ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" -if test "x$ac_cv_type_mode_t" = xyes; then : -else -cat >>confdefs.h <<_ACEOF -#define mode_t int -_ACEOF -fi + gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext" - GNULIB_DPRINTF=0; - GNULIB_FCLOSE=0; - GNULIB_FDOPEN=0; - GNULIB_FFLUSH=0; - GNULIB_FGETC=0; - GNULIB_FGETS=0; - GNULIB_FOPEN=0; - GNULIB_FPRINTF=0; - GNULIB_FPRINTF_POSIX=0; - GNULIB_FPURGE=0; - GNULIB_FPUTC=0; - GNULIB_FPUTS=0; - GNULIB_FREAD=0; - GNULIB_FREOPEN=0; - GNULIB_FSCANF=0; - GNULIB_FSEEK=0; - GNULIB_FSEEKO=0; - GNULIB_FTELL=0; - GNULIB_FTELLO=0; - GNULIB_FWRITE=0; - GNULIB_GETC=0; - GNULIB_GETCHAR=0; - GNULIB_GETDELIM=0; - GNULIB_GETLINE=0; - GNULIB_OBSTACK_PRINTF=0; - GNULIB_OBSTACK_PRINTF_POSIX=0; - GNULIB_PCLOSE=0; - GNULIB_PERROR=0; - GNULIB_POPEN=0; - GNULIB_PRINTF=0; - GNULIB_PRINTF_POSIX=0; - GNULIB_PUTC=0; - GNULIB_PUTCHAR=0; - GNULIB_PUTS=0; - GNULIB_REMOVE=0; - GNULIB_RENAME=0; - GNULIB_RENAMEAT=0; - GNULIB_SCANF=0; - GNULIB_SNPRINTF=0; - GNULIB_SPRINTF_POSIX=0; - GNULIB_STDIO_H_NONBLOCKING=0; - GNULIB_STDIO_H_SIGPIPE=0; - GNULIB_TMPFILE=0; - GNULIB_VASPRINTF=0; - GNULIB_VFSCANF=0; - GNULIB_VSCANF=0; - GNULIB_VDPRINTF=0; - GNULIB_VFPRINTF=0; - GNULIB_VFPRINTF_POSIX=0; - GNULIB_VPRINTF=0; - GNULIB_VPRINTF_POSIX=0; - GNULIB_VSNPRINTF=0; - GNULIB_VSPRINTF_POSIX=0; - HAVE_DECL_FPURGE=1; - HAVE_DECL_FSEEKO=1; - HAVE_DECL_FTELLO=1; - HAVE_DECL_GETDELIM=1; - HAVE_DECL_GETLINE=1; - HAVE_DECL_OBSTACK_PRINTF=1; - HAVE_DECL_SNPRINTF=1; - HAVE_DECL_VSNPRINTF=1; - HAVE_DPRINTF=1; - HAVE_FSEEKO=1; - HAVE_FTELLO=1; - HAVE_PCLOSE=1; - HAVE_POPEN=1; - HAVE_RENAMEAT=1; - HAVE_VASPRINTF=1; - HAVE_VDPRINTF=1; - REPLACE_DPRINTF=0; - REPLACE_FCLOSE=0; - REPLACE_FDOPEN=0; - REPLACE_FFLUSH=0; - REPLACE_FOPEN=0; - REPLACE_FPRINTF=0; - REPLACE_FPURGE=0; - REPLACE_FREOPEN=0; - REPLACE_FSEEK=0; - REPLACE_FSEEKO=0; - REPLACE_FTELL=0; - REPLACE_FTELLO=0; - REPLACE_GETDELIM=0; - REPLACE_GETLINE=0; - REPLACE_OBSTACK_PRINTF=0; - REPLACE_PERROR=0; - REPLACE_POPEN=0; - REPLACE_PRINTF=0; - REPLACE_REMOVE=0; - REPLACE_RENAME=0; - REPLACE_RENAMEAT=0; - REPLACE_SNPRINTF=0; - REPLACE_SPRINTF=0; - REPLACE_STDIO_READ_FUNCS=0; - REPLACE_STDIO_WRITE_FUNCS=0; - REPLACE_TMPFILE=0; - REPLACE_VASPRINTF=0; - REPLACE_VDPRINTF=0; - REPLACE_VFPRINTF=0; - REPLACE_VPRINTF=0; - REPLACE_VSNPRINTF=0; - REPLACE_VSPRINTF=0; - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdint.h" >&5 -$as_echo_n "checking for stdint.h... " >&6; } -if ${gl_cv_header_stdint_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include -int -main () -{ -uintmax_t i = (uintmax_t) -1; return !i; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_stdint_h=yes -else - gl_cv_header_stdint_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_h" >&5 -$as_echo "$gl_cv_header_stdint_h" >&6; } - if test $gl_cv_header_stdint_h = yes; then -cat >>confdefs.h <<_ACEOF -#define HAVE_STDINT_H_WITH_UINTMAX 1 -_ACEOF - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inttypes.h" >&5 -$as_echo_n "checking for inttypes.h... " >&6; } -if ${gl_cv_header_inttypes_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext" -#include -#include -int -main () -{ -uintmax_t i = (uintmax_t) -1; return !i; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_inttypes_h=yes -else - gl_cv_header_inttypes_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_inttypes_h" >&5 -$as_echo "$gl_cv_header_inttypes_h" >&6; } - if test $gl_cv_header_inttypes_h = yes; then -cat >>confdefs.h <<_ACEOF -#define HAVE_INTTYPES_H_WITH_UINTMAX 1 -_ACEOF + + + + + + + gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext" + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext" + + if test $ac_cv_func_vasnprintf = yes; then + +printf "%s\n" "#define REPLACE_VASNPRINTF 1" >>confdefs.h fi @@ -13573,1048 +29255,417 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports size specifiers as in C99" >&5 -$as_echo_n "checking whether printf supports size specifiers as in C99... " >&6; } -if ${gl_cv_func_printf_sizes_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; - darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on OpenBSD >= 3.9. - openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) - gl_cv_func_printf_sizes_c99="guessing no";; - openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on Solaris >= 2.10. - solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; - solaris*) gl_cv_func_printf_sizes_c99="guessing no";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_printf_sizes_c99="guessing no";; - netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on MSVC, no on mingw. - mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef _MSC_VER - Known -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_printf_sizes_c99="guessing yes" -else - gl_cv_func_printf_sizes_c99="guessing no" -fi -rm -f conftest* + ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" +if test "x$ac_cv_type_ptrdiff_t" = xyes +then : - ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_sizes_c99="$gl_cross_guess_normal";; - esac +else $as_nop + +printf "%s\n" "#define ptrdiff_t long" >>confdefs.h -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -#if HAVE_STDINT_H_WITH_UINTMAX -# include -#endif -#if HAVE_INTTYPES_H_WITH_UINTMAX -# include -#endif -static char buf[100]; -int main () -{ - int result = 0; -#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX - buf[0] = '\0'; - if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 - || strcmp (buf, "12345671 33") != 0) - result |= 1; -#else - result |= 1; -#endif - buf[0] = '\0'; - if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 - || strcmp (buf, "12345672 33") != 0) - result |= 2; - buf[0] = '\0'; - if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 - || strcmp (buf, "12345673 33") != 0) - result |= 4; - buf[0] = '\0'; - if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 - || strcmp (buf, "1.5 33") != 0) - result |= 8; - return result; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_sizes_c99=yes -else - gl_cv_func_printf_sizes_c99=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_sizes_c99" >&5 -$as_echo "$gl_cv_func_printf_sizes_c99" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports 'long double' arguments" >&5 -$as_echo_n "checking whether printf supports 'long double' arguments... " >&6; } -if ${gl_cv_func_printf_long_double+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess no on BeOS. - beos*) gl_cv_func_printf_long_double="guessing no";; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_long_double="guessing yes";; - # Guess yes on MSVC, no on mingw. - mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef _MSC_VER - Known -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_printf_long_double="guessing yes" -else - gl_cv_func_printf_long_double="guessing no" -fi -rm -f conftest* - ;; - *) gl_cv_func_printf_long_double="guessing yes";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -static char buf[10000]; -int main () -{ - int result = 0; - buf[0] = '\0'; - if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 - || strcmp (buf, "1.750000 33") != 0) - result |= 1; - buf[0] = '\0'; - if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 - || strcmp (buf, "1.750000e+00 33") != 0) - result |= 2; - buf[0] = '\0'; - if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 - || strcmp (buf, "1.75 33") != 0) - result |= 4; - return result; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_long_double=yes -else - gl_cv_func_printf_long_double=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_long_double" >&5 -$as_echo "$gl_cv_func_printf_long_double" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports infinite 'double' arguments" >&5 -$as_echo_n "checking whether printf supports infinite 'double' arguments... " >&6; } -if ${gl_cv_func_printf_infinite+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : + gl_LIBOBJS="$gl_LIBOBJS vfprintf.$ac_objext" - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; - darwin*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on HP-UX >= 11. - hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; - hpux*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_printf_infinite="guessing no";; - netbsd*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_infinite="guessing yes";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_infinite="guessing no";; - # Guess yes on MSVC, no on mingw. - mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + REPLACE_VFPRINTF=1 + +printf "%s\n" "#define REPLACE_VFPRINTF_POSIX 1" >>confdefs.h + + : + + fi + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _MSC_VER - Known +MicrosoftCompiler #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_printf_infinite="guessing yes" -else - gl_cv_func_printf_infinite="guessing no" + $EGREP "MicrosoftCompiler" >/dev/null 2>&1 +then : + rm -f conftest* + echo 'int dummy;' > conftest.c + { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } >/dev/null 2>&1 + if test -f conftest.o; then + gl_asmext='s' + gl_c_asm_opt='-S' + else + gl_asmext='asm' + gl_c_asm_opt='-c -Fa' + fi + rm -f conftest* + +else $as_nop + gl_asmext='s' + gl_c_asm_opt='-S' + fi -rm -f conftest* +rm -rf conftest* + - ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_infinite="$gl_cross_guess_normal";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -static int -strisnan (const char *string, size_t start_index, size_t end_index) -{ - if (start_index < end_index) - { - if (string[start_index] == '-') - start_index++; - if (start_index + 3 <= end_index - && memcmp (string + start_index, "nan", 3) == 0) - { - start_index += 3; - if (start_index == end_index - || (string[start_index] == '(' && string[end_index - 1] == ')')) - return 1; - } - } - return 0; -} -static int -have_minus_zero () -{ - static double plus_zero = 0.0; - double minus_zero = - plus_zero; - return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0; -} -static char buf[10000]; -static double zero = 0.0; -int main () -{ - int result = 0; - if (sprintf (buf, "%f", 1.0 / zero) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 1; - if (sprintf (buf, "%f", -1.0 / zero) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 1; - if (sprintf (buf, "%f", zero / zero) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%e", 1.0 / zero) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 4; - if (sprintf (buf, "%e", -1.0 / zero) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 4; - if (sprintf (buf, "%e", zero / zero) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 8; - if (sprintf (buf, "%g", 1.0 / zero) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 16; - if (sprintf (buf, "%g", -1.0 / zero) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 16; - if (sprintf (buf, "%g", zero / zero) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 32; - /* This test fails on HP-UX 10.20. */ - if (have_minus_zero ()) - if (sprintf (buf, "%g", - zero) < 0 - || strcmp (buf, "-0") != 0) - result |= 64; - return result; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_infinite=yes -else - gl_cv_func_printf_infinite=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C symbols are prefixed with underscore at the linker level" >&5 +printf %s "checking whether C symbols are prefixed with underscore at the linker level... " >&6; } +if test ${gl_cv_prog_as_underscore+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } >/dev/null 2>&1 + if LC_ALL=C $EGREP '(^|[^a-zA-Z0-9_])_foo([^a-zA-Z0-9_]|$)' conftest.$gl_asmext >/dev/null; then + gl_cv_prog_as_underscore=yes + else + gl_cv_prog_as_underscore=no + fi + rm -f conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_infinite" >&5 -$as_echo "$gl_cv_func_printf_infinite" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_prog_as_underscore" >&5 +printf "%s\n" "$gl_cv_prog_as_underscore" >&6; } + if test $gl_cv_prog_as_underscore = yes; then + USER_LABEL_PREFIX=_ + else + USER_LABEL_PREFIX= + fi +printf "%s\n" "#define USER_LABEL_PREFIX $USER_LABEL_PREFIX" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_bigendian=unknown - # See if we're dealing with a universal compiler. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; + ASM_SYMBOL_PREFIX='"'${USER_LABEL_PREFIX}'"' -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # Check for potential -arch flags. It is not universal unless - # there are at least two -arch flags with different values. - ac_arch= - ac_prev= - for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do - if test -n "$ac_prev"; then - case $ac_word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then - ac_arch=$ac_word - else - ac_cv_c_bigendian=universal - break - fi - ;; - esac - ac_prev= - elif test "x$ac_word" = "x-arch"; then - ac_prev=arch - fi - done + + HAVE_POSIX_SIGNALBLOCKING=1; + HAVE_PTHREAD_SIGMASK=1; + HAVE_RAISE=1; + HAVE_SIGSET_T=1; + HAVE_SIGINFO_T=1; + HAVE_SIGACTION=1; + HAVE_STRUCT_SIGACTION_SA_SIGACTION=1; + + HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1; + + HAVE_SIGHANDLER_T=1; + REPLACE_PTHREAD_SIGMASK=0; + REPLACE_RAISE=0; + + + ac_fn_c_check_type "$LINENO" "sigset_t" "ac_cv_type_sigset_t" " + #include + /* Mingw defines sigset_t not in , but in . */ + #include + +" +if test "x$ac_cv_type_sigset_t" = xyes +then : + +printf "%s\n" "#define HAVE_SIGSET_T 1" >>confdefs.h + +gl_cv_type_sigset_t=yes +else $as_nop + gl_cv_type_sigset_t=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ac_cv_c_bigendian = unknown; then - # See if sys/param.h defines the BYTE_ORDER macro. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ - && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ - && LITTLE_ENDIAN) - bogus endian macros - #endif + if test $gl_cv_type_sigset_t != yes; then + HAVE_SIGSET_T=0 + fi + + + + GL_GNULIB_PTHREAD_SIGMASK=0 + + + + GL_GNULIB_RAISE=0 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include + GL_GNULIB_SIGNAL_H_SIGPIPE=0 -int -main () -{ -#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) - bogus endian macros - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to _BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -#ifndef _BIG_ENDIAN - not big endian - #endif + GL_GNULIB_SIGPROCMASK=0 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # Compile a test program. - if test "$cross_compiling" = yes; then : - # Try to guess by grepping values from an object file. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -short int ascii_mm[] = - { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = - { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; - int use_ascii (int i) { - return ascii_mm[i] + ascii_ii[i]; - } - short int ebcdic_ii[] = - { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = - { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; - int use_ebcdic (int i) { - return ebcdic_mm[i] + ebcdic_ii[i]; - } - extern int foo; -int -main () -{ -return use_ascii (foo) == use_ebcdic (foo); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then - ac_cv_c_bigendian=yes - fi - if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi - fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; + GL_GNULIB_SIGACTION=0 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_bigendian=no -else - ac_cv_c_bigendian=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } - case $ac_cv_c_bigendian in #( - yes) - $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h -;; #( - no) - ;; #( - universal) -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h - ;; #( - *) - as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether long double and double are the same" >&5 -$as_echo_n "checking whether long double and double are the same... " >&6; } -if ${gl_cv_long_double_equals_double+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -typedef int check[sizeof (long double) == sizeof (double) - && LDBL_MANT_DIG == DBL_MANT_DIG - && LDBL_MAX_EXP == DBL_MAX_EXP - && LDBL_MIN_EXP == DBL_MIN_EXP - ? 1 : -1]; + if test $REPLACE_MALLOC = 1; then + REPLACE_REALLOC=1 + fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shared library path variable" >&5 +printf %s "checking for shared library path variable... " >&6; } +if test ${acl_cv_libpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + LD="$LD" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.libpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_libpath=${acl_cv_shlibpath_var:-none} - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_long_double_equals_double=yes -else - gl_cv_long_double_equals_double=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $acl_cv_libpath" >&5 +printf "%s\n" "$acl_cv_libpath" >&6; } + shlibpath_var="$acl_cv_shlibpath_var" + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to activate relocatable installation" >&5 +printf %s "checking whether to activate relocatable installation... " >&6; } + # Check whether --enable-relocatable was given. +if test ${enable_relocatable+y} +then : + enableval=$enable_relocatable; if test "$enableval" != no; then + RELOCATABLE=yes + else + RELOCATABLE=no + fi +else $as_nop + RELOCATABLE=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_long_double_equals_double" >&5 -$as_echo "$gl_cv_long_double_equals_double" >&6; } - if test $gl_cv_long_double_equals_double = yes; then -$as_echo "#define HAVE_SAME_LONG_DOUBLE_AS_DOUBLE 1" >>confdefs.h - HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=1 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RELOCATABLE" >&5 +printf "%s\n" "$RELOCATABLE" >&6; } + + + + if test "X$prefix" = "XNONE"; then + reloc_final_prefix="$ac_default_prefix" else - HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=0 + reloc_final_prefix="$prefix" fi +printf "%s\n" "#define INSTALLPREFIX \"${reloc_final_prefix}\"" >>confdefs.h + if test $RELOCATABLE = yes; then +printf "%s\n" "#define ENABLE_RELOCATABLE 1" >>confdefs.h + fi - if test -n "$gl_printf_safe"; then - -$as_echo "#define CHECK_PRINTF_SAFE 1" >>confdefs.h - fi - case "$gl_cv_func_printf_long_double" in - *yes) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports infinite 'long double' arguments" >&5 -$as_echo_n "checking whether printf supports infinite 'long double' arguments... " >&6; } -if ${gl_cv_func_printf_infinite_long_double+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_cpu" in - # Guess no on ia64, x86_64, i386. - ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; - *) - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on HP-UX >= 11. - hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; - hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; - # Guess yes on MSVC, no on mingw. - mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef _MSC_VER - Known -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_printf_infinite_long_double="guessing yes" -else - gl_cv_func_printf_infinite_long_double="guessing no" -fi -rm -f conftest* - ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_infinite_long_double="$gl_cross_guess_normal";; - esac - ;; - esac + is_noop=no + use_elf_origin_trick=no + use_macos_tools=no + use_wrapper=no + if test $RELOCATABLE = yes; then + # --enable-relocatable implies --disable-rpath + enable_rpath=no + ac_fn_c_check_header_compile "$LINENO" "mach-o/dyld.h" "ac_cv_header_mach_o_dyld_h" "$ac_includes_default" +if test "x$ac_cv_header_mach_o_dyld_h" = xyes +then : + printf "%s\n" "#define HAVE_MACH_O_DYLD_H 1" >>confdefs.h -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +fi + ac_fn_c_check_func "$LINENO" "_NSGetExecutablePath" "ac_cv_func__NSGetExecutablePath" +if test "x$ac_cv_func__NSGetExecutablePath" = xyes +then : + printf "%s\n" "#define HAVE__NSGETEXECUTABLEPATH 1" >>confdefs.h -#include -#if defined __MACH__ && defined __APPLE__ -/* Avoid a crash on Mac OS X. */ -#include -#include -#include -#include -#include -#include -/* The exception port on which our thread listens. */ -static mach_port_t our_exception_port; -/* The main function of the thread listening for exceptions of type - EXC_BAD_ACCESS. */ -static void * -mach_exception_thread (void *arg) -{ - /* Buffer for a message to be received. */ - struct { - mach_msg_header_t head; - mach_msg_body_t msgh_body; - char data[1024]; - } msg; - mach_msg_return_t retval; - /* Wait for a message on the exception port. */ - retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), - our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); - if (retval != MACH_MSG_SUCCESS) - abort (); - exit (1); -} -static void -nocrash_init (void) -{ - mach_port_t self = mach_task_self (); - /* Allocate a port on which the thread shall listen for exceptions. */ - if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) - == KERN_SUCCESS) { - /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ - if (mach_port_insert_right (self, our_exception_port, our_exception_port, - MACH_MSG_TYPE_MAKE_SEND) - == KERN_SUCCESS) { - /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting - for us. */ - exception_mask_t mask = EXC_MASK_BAD_ACCESS; - /* Create the thread listening on the exception port. */ - pthread_attr_t attr; - pthread_t thread; - if (pthread_attr_init (&attr) == 0 - && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 - && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { - pthread_attr_destroy (&attr); - /* Replace the exception port info for these exceptions with our own. - Note that we replace the exception port for the entire task, not only - for a particular thread. This has the effect that when our exception - port gets the message, the thread specific exception port has already - been asked, and we don't need to bother about it. - See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ - task_set_exception_ports (self, mask, our_exception_port, - EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); - } - } - } -} -#elif defined _WIN32 && ! defined __CYGWIN__ -/* Avoid a crash on native Windows. */ -#define WIN32_LEAN_AND_MEAN -#include -#include -static LONG WINAPI -exception_filter (EXCEPTION_POINTERS *ExceptionInfo) -{ - switch (ExceptionInfo->ExceptionRecord->ExceptionCode) - { - case EXCEPTION_ACCESS_VIOLATION: - case EXCEPTION_IN_PAGE_ERROR: - case EXCEPTION_STACK_OVERFLOW: - case EXCEPTION_GUARD_PAGE: - case EXCEPTION_PRIV_INSTRUCTION: - case EXCEPTION_ILLEGAL_INSTRUCTION: - case EXCEPTION_DATATYPE_MISALIGNMENT: - case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - case EXCEPTION_NONCONTINUABLE_EXCEPTION: - exit (1); - } - return EXCEPTION_CONTINUE_SEARCH; -} -static void -nocrash_init (void) -{ - SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); -} -#else -/* Avoid a crash on POSIX systems. */ -#include -#include -/* A POSIX signal handler. */ -static void -exception_handler (int sig) -{ - _exit (1); -} -static void -nocrash_init (void) -{ -#ifdef SIGSEGV - signal (SIGSEGV, exception_handler); -#endif -#ifdef SIGBUS - signal (SIGBUS, exception_handler); -#endif -} -#endif +fi -#include -#include -#include -static int -strisnan (const char *string, size_t start_index, size_t end_index) -{ - if (start_index < end_index) - { - if (string[start_index] == '-') - start_index++; - if (start_index + 3 <= end_index - && memcmp (string + start_index, "nan", 3) == 0) - { - start_index += 3; - if (start_index == end_index - || (string[start_index] == '(' && string[end_index - 1] == ')')) - return 1; - } - } - return 0; -} -static char buf[10000]; -static long double zeroL = 0.0L; -int main () -{ - int result = 0; - nocrash_init(); - if (sprintf (buf, "%Lf", 1.0L / zeroL) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Lf", -1.0L / zeroL) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 1; - if (sprintf (buf, "%Le", 1.0L / zeroL) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Le", -1.0L / zeroL) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Le", zeroL / zeroL) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 1; - if (sprintf (buf, "%Lg", 1.0L / zeroL) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Lg", -1.0L / zeroL) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 1; -#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE -/* Representation of an 80-bit 'long double' as an initializer for a sequence - of 'unsigned int' words. */ -# ifdef WORDS_BIGENDIAN -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ - ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \ - (unsigned int) (mantlo) << 16 \ - } -# else -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { mantlo, manthi, exponent } -# endif - { /* Quiet NaN. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - } - { - /* Signalling NaN. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - } - { /* Pseudo-NaN. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) <= 0) - result |= 4; - if (sprintf (buf, "%Le", x.value) <= 0) - result |= 4; - if (sprintf (buf, "%Lg", x.value) <= 0) - result |= 4; - } - { /* Pseudo-Infinity. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) <= 0) - result |= 8; - if (sprintf (buf, "%Le", x.value) <= 0) - result |= 8; - if (sprintf (buf, "%Lg", x.value) <= 0) - result |= 8; - } - { /* Pseudo-Zero. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) <= 0) - result |= 16; - if (sprintf (buf, "%Le", x.value) <= 0) - result |= 16; - if (sprintf (buf, "%Lg", x.value) <= 0) - result |= 16; - } - { /* Unnormalized number. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) <= 0) - result |= 32; - if (sprintf (buf, "%Le", x.value) <= 0) - result |= 32; - if (sprintf (buf, "%Lg", x.value) <= 0) - result |= 32; - } - { /* Pseudo-Denormal. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) <= 0) - result |= 64; - if (sprintf (buf, "%Le", x.value) <= 0) - result |= 64; - if (sprintf (buf, "%Lg", x.value) <= 0) - result |= 64; - } -#endif - return result; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_infinite_long_double=yes + case "$host_os" in + mingw*) is_noop=yes ;; + # For the platforms that support $ORIGIN, see + # . + # glibc systems, Linux with musl libc: yes. Android: no. + linux*-android*) ;; + linux* | kfreebsd*) use_elf_origin_trick=yes ;; + # Hurd: + # only after the glibc commit from 2018-01-08 + # + gnu*) + # Test for a glibc version >= 2.27. + ac_fn_c_check_func "$LINENO" "copy_file_range" "ac_cv_func_copy_file_range" +if test "x$ac_cv_func_copy_file_range" = xyes +then : + printf "%s\n" "#define HAVE_COPY_FILE_RANGE 1" >>confdefs.h + +fi + + if test $ac_cv_func_copy_file_range = yes; then + use_elf_origin_trick=yes + fi + ;; + # FreeBSD >= 7.3, DragonFly >= 3.0, MidnightBSD >= 1.1: yes. + freebsd | freebsd[1-7] | freebsd[1-6].* | freebsd7.[0-2]) ;; + dragonfly | dragonfly[1-2] | dragonfly[1-2].*) ;; + midnightbsd | midnightbsd0* | midnightbsd1.0*) ;; + freebsd* | dragonfly* | midnightbsd*) use_elf_origin_trick=yes ;; + # NetBSD >= 8.0: yes. + netbsd | netbsd[1-7] | netbsd[1-7].*) ;; + netbsdelf | netbsdelf[1-7] | netbsdelf[1-7].*) ;; + netbsd*) use_elf_origin_trick=yes ;; + # OpenBSD >= 5.4: yes. + openbsd | openbsd[1-5] | openbsd[1-4].* | openbsd5.[0-3]) ;; + openbsd*) use_elf_origin_trick=yes ;; + # Solaris >= 10: yes. + solaris | solaris2.[1-9] | solaris2.[1-9].*) ;; + solaris*) use_elf_origin_trick=yes ;; + # Haiku: yes. + haiku*) use_elf_origin_trick=yes ;; + # On Mac OS X 10.4 or newer, use Mac OS X tools. See + # . + darwin | darwin[1-7].*) ;; + darwin*) use_macos_tools=yes ;; + esac + if test $is_noop = yes; then + RELOCATABLE_LDFLAGS=: + + else + if test $use_elf_origin_trick = yes || test $use_macos_tools = yes; then + case "$ac_aux_dir" in + /*) reloc_ldflags="$ac_aux_dir/reloc-ldflags" ;; + *) reloc_ldflags="\$(top_builddir)/$ac_aux_dir/reloc-ldflags" ;; + esac + RELOCATABLE_LDFLAGS="\"$reloc_ldflags\" \"\$(host)\" \"\$(RELOCATABLE_LIBRARY_PATH)\"" + + if test $use_macos_tools = yes; then + case "$ac_aux_dir" in + /*) LIBTOOL="${CONFIG_SHELL-$SHELL} $ac_aux_dir/libtool-reloc $LIBTOOL" ;; + *) LIBTOOL="${CONFIG_SHELL-$SHELL} \$(top_builddir)/$ac_aux_dir/libtool-reloc $LIBTOOL" ;; + esac + fi + else + use_wrapper=yes + INSTALL_PROGRAM_ENV="RELOC_LIBRARY_PATH_VAR=\"$shlibpath_var\" RELOC_LIBRARY_PATH_VALUE=\"\$(RELOCATABLE_LIBRARY_PATH)\" RELOC_PREFIX=\"\$(prefix)\" RELOC_DESTDIR=\"\$(DESTDIR)\" RELOC_COMPILE_COMMAND=\"\$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(LDFLAGS)\" RELOC_SRCDIR=\"\$(RELOCATABLE_SRC_DIR)\" RELOC_BUILDDIR=\"\$(RELOCATABLE_BUILD_DIR)\" RELOC_CONFIG_H_DIR=\"\$(RELOCATABLE_CONFIG_H_DIR)\" RELOC_EXEEXT=\"\$(EXEEXT)\" RELOC_STRIP_PROG=\"\$(RELOCATABLE_STRIP)\" RELOC_INSTALL_PROG=\"$INSTALL_PROGRAM\"" + + case "$ac_aux_dir" in + /*) INSTALL_PROGRAM="$ac_aux_dir/install-reloc" ;; + *) INSTALL_PROGRAM="\$(top_builddir)/$ac_aux_dir/install-reloc" ;; + esac + fi + fi + fi + if test $is_noop = yes || test $use_elf_origin_trick = yes || test $use_macos_tools = yes; then + RELOCATABLE_VIA_LD_TRUE= + RELOCATABLE_VIA_LD_FALSE='#' else - gl_cv_func_printf_infinite_long_double=no + RELOCATABLE_VIA_LD_TRUE='#' + RELOCATABLE_VIA_LD_FALSE= fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + + if test $use_wrapper = yes; then + RELOCATABLE_VIA_WRAPPER_TRUE= + RELOCATABLE_VIA_WRAPPER_FALSE='#' +else + RELOCATABLE_VIA_WRAPPER_TRUE='#' + RELOCATABLE_VIA_WRAPPER_FALSE= fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_infinite_long_double" >&5 -$as_echo "$gl_cv_func_printf_infinite_long_double" >&6; } - ;; - *) - gl_cv_func_printf_infinite_long_double="irrelevant" - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'a' and 'A' directives" >&5 -$as_echo_n "checking whether printf supports the 'a' and 'A' directives... " >&6; } -if ${gl_cv_func_printf_directive_a+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc >= 2.5 systems. - *-gnu* | gnu*) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - #include - #ifdef __GNU_LIBRARY__ - #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__ - BZ2908 - #endif - #endif + RELOCATABLE_STRIP=':' -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "BZ2908" >/dev/null 2>&1; then : - gl_cv_func_printf_directive_a="guessing yes" -else - gl_cv_func_printf_directive_a="guessing no" -fi -rm -f conftest* - ;; - # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_directive_a="guessing yes";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_directive_a="guessing no";; - # Guess no on native Windows. - mingw*) gl_cv_func_printf_directive_a="guessing no";; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; - esac -else + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether malloc (0) returns nonnull" >&5 +printf %s "checking whether malloc (0) returns nonnull... " >&6; } +if test ${ac_cv_func_malloc_0_nonnull+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | gnu* | *-musl* | midnightbsd* \ + | hpux* | solaris* | cygwin* | mingw* | msys* ) + ac_cv_func_malloc_0_nonnull="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; + esac + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include -#include -#include -static char buf[100]; -static double zero = 0.0; -int main () +int +main (void) { - int result = 0; - if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 - || (strcmp (buf, "0x1.922p+1 33") != 0 - && strcmp (buf, "0x3.244p+0 33") != 0 - && strcmp (buf, "0x6.488p-1 33") != 0 - && strcmp (buf, "0xc.91p-2 33") != 0)) - result |= 1; - if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 - || (strcmp (buf, "-0X1.922P+1 33") != 0 - && strcmp (buf, "-0X3.244P+0 33") != 0 - && strcmp (buf, "-0X6.488P-1 33") != 0 - && strcmp (buf, "-0XC.91P-2 33") != 0)) - result |= 2; - /* This catches a FreeBSD 6.1 bug: it doesn't round. */ - if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 - || (strcmp (buf, "0x1.83p+0 33") != 0 - && strcmp (buf, "0x3.05p-1 33") != 0 - && strcmp (buf, "0x6.0ap-2 33") != 0 - && strcmp (buf, "0xc.14p-3 33") != 0)) - result |= 4; - /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */ - if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 - || (strcmp (buf, "0x2p+0 33") != 0 - && strcmp (buf, "0x3p-1 33") != 0 - && strcmp (buf, "0x6p-2 33") != 0 - && strcmp (buf, "0xcp-3 33") != 0)) - result |= 4; - /* This catches a FreeBSD 6.1 bug. See - */ - if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 - || buf[0] == '0') - result |= 8; - /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */ - if (sprintf (buf, "%.1a", 1.999) < 0 - || (strcmp (buf, "0x1.0p+1") != 0 - && strcmp (buf, "0x2.0p+0") != 0 - && strcmp (buf, "0x4.0p-1") != 0 - && strcmp (buf, "0x8.0p-2") != 0)) - result |= 16; - /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a - glibc 2.4 bug . */ - if (sprintf (buf, "%.1La", 1.999L) < 0 - || (strcmp (buf, "0x1.0p+1") != 0 - && strcmp (buf, "0x2.0p+0") != 0 - && strcmp (buf, "0x4.0p-1") != 0 - && strcmp (buf, "0x8.0p-2") != 0)) - result |= 32; - return result; +void *p = malloc (0); + int result = !p; + free (p); + return result; + ; + return 0; } + _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_directive_a=yes -else - gl_cv_func_printf_directive_a=no +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_func_malloc_0_nonnull=yes +else $as_nop + ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -14622,1852 +29673,965 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_a" >&5 -$as_echo "$gl_cv_func_printf_directive_a" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 +printf "%s\n" "$ac_cv_func_malloc_0_nonnull" >&6; } + case $ac_cv_func_malloc_0_nonnull in #( + *yes) : + gl_cv_func_malloc_0_nonnull=1 ;; #( + *) : + gl_cv_func_malloc_0_nonnull=0 ;; +esac +printf "%s\n" "#define MALLOC_0_IS_NONNULL $gl_cv_func_malloc_0_nonnull" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'F' directive" >&5 -$as_echo_n "checking whether printf supports the 'F' directive... " >&6; } -if ${gl_cv_func_printf_directive_f+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : +ac_fn_check_decl "$LINENO" "setenv" "ac_cv_have_decl_setenv" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_setenv" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_SETENV $ac_have_decl" >>confdefs.h - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; - darwin*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on Solaris >= 2.10. - solaris2.[1-9][0-9]*) gl_cv_func_printf_directive_f="guessing yes";; - solaris*) gl_cv_func_printf_directive_f="guessing no";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_directive_f="guessing no";; - # Guess yes on MSVC, no on mingw. - mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef _MSC_VER - Known -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_printf_directive_f="guessing yes" -else - gl_cv_func_printf_directive_f="guessing no" + + HAVE_SCHED_YIELD=1; + REPLACE_SCHED_YIELD=0; + + + + + + + + ac_fn_c_check_header_compile "$LINENO" "sched.h" "ac_cv_header_sched_h" "#if HAVE_SYS_CDEFS_H + #include + #endif + +" +if test "x$ac_cv_header_sched_h" = xyes +then : + printf "%s\n" "#define HAVE_SCHED_H 1" >>confdefs.h + fi -rm -f conftest* - ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_directive_f="$gl_cross_guess_normal";; - esac -else + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sched_h='<'sched.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_sched_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#include -#include -static char buf[100]; -static double zero = 0.0; -int main () -{ - int result = 0; - if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 - || strcmp (buf, "1234567.000000 33") != 0) - result |= 1; - if (sprintf (buf, "%F", 1.0 / zero) < 0 - || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) - result |= 2; - /* This catches a Cygwin 1.5.x bug. */ - if (sprintf (buf, "%.F", 1234.0) < 0 - || strcmp (buf, "1234") != 0) - result |= 4; - return result; -} +#include _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_directive_f=yes -else - gl_cv_func_printf_directive_f=no + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'sched.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_sched_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_sched_h + gl_cv_next_sched_h='"'$gl_header'"' + + fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sched_h" >&5 +printf "%s\n" "$gl_cv_next_sched_h" >&6; } + fi + NEXT_SCHED_H=$gl_cv_next_sched_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'sched.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_sched_h + fi + NEXT_AS_FIRST_DIRECTIVE_SCHED_H=$gl_next_as_first_directive + + + + + + if test "$ac_cv_header_sched_h" = yes; then + HAVE_SCHED_H=1 + else + HAVE_SCHED_H=0 + fi + + + if test "$HAVE_SCHED_H" = 1; then + ac_fn_c_check_type "$LINENO" "struct sched_param" "ac_cv_type_struct_sched_param" "#if HAVE_SYS_CDEFS_H + #include + #endif + #include + +" +if test "x$ac_cv_type_struct_sched_param" = xyes +then : + HAVE_STRUCT_SCHED_PARAM=1 +else $as_nop + HAVE_STRUCT_SCHED_PARAM=0 fi + else + HAVE_STRUCT_SCHED_PARAM=0 + case "$host_os" in + os2*) + ac_fn_c_check_type "$LINENO" "struct sched_param" "ac_cv_type_struct_sched_param" "#include +" +if test "x$ac_cv_type_struct_sched_param" = xyes +then : + HAVE_STRUCT_SCHED_PARAM=1 +fi + ;; + vms) + ac_fn_c_check_type "$LINENO" "struct sched_param" "ac_cv_type_struct_sched_param" "#include +" +if test "x$ac_cv_type_struct_sched_param" = xyes +then : + HAVE_STRUCT_SCHED_PARAM=1 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_f" >&5 -$as_echo "$gl_cv_func_printf_directive_f" >&6; } + ;; + esac + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'n' directive" >&5 -$as_echo_n "checking whether printf supports the 'n' directive... " >&6; } -if ${gl_cv_func_printf_directive_n+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test "$ac_cv_header_sys_cdefs_h" = yes; then + HAVE_SYS_CDEFS_H=1 + else + HAVE_SYS_CDEFS_H=0 + fi - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess no on Android. - linux*-android*) gl_cv_func_printf_directive_n="guessing no";; - # Guess no on native Windows. - mingw*) gl_cv_func_printf_directive_n="guessing no";; - *) gl_cv_func_printf_directive_n="guessing yes";; - esac -else + + + + + + + + + GL_GNULIB_SCHED_YIELD=0 + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 +printf %s "checking for uid_t in sys/types.h... " >&6; } +if test ${ac_cv_type_uid_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include -#include -#include -#include -#ifdef _MSC_VER -/* See page about "Parameter Validation" on msdn.microsoft.com. */ -static void cdecl -invalid_parameter_handler (const wchar_t *expression, - const wchar_t *function, - const wchar_t *file, unsigned int line, - uintptr_t dummy) -{ - exit (1); -} -#endif -static char fmtstring[10]; -static char buf[100]; -int main () -{ - int count = -1; -#ifdef _MSC_VER - _set_invalid_parameter_handler (invalid_parameter_handler); -#endif - /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) - support %n in format strings in read-only memory but not in writable - memory. */ - strcpy (fmtstring, "%d %n"); - if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0 - || strcmp (buf, "123 ") != 0 - || count != 4) - return 1; - return 0; -} _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_directive_n=yes -else - gl_cv_func_printf_directive_n=no +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "uid_t" >/dev/null 2>&1 +then : + ac_cv_type_uid_t=yes +else $as_nop + ac_cv_type_uid_t=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -rf conftest* + fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 +printf "%s\n" "$ac_cv_type_uid_t" >&6; } +if test $ac_cv_type_uid_t = no; then + +printf "%s\n" "#define uid_t int" >>confdefs.h +printf "%s\n" "#define gid_t int" >>confdefs.h + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_n" >&5 -$as_echo "$gl_cv_func_printf_directive_n" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'ls' directive" >&5 -$as_echo_n "checking whether printf supports the 'ls' directive... " >&6; } -if ${gl_cv_func_printf_directive_ls+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - openbsd*) gl_cv_func_printf_directive_ls="guessing no";; - irix*) gl_cv_func_printf_directive_ls="guessing no";; - solaris*) gl_cv_func_printf_directive_ls="guessing no";; - cygwin*) gl_cv_func_printf_directive_ls="guessing no";; - beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; - # Guess yes on native Windows. - mingw*) gl_cv_func_printf_directive_ls="guessing yes";; - *) gl_cv_func_printf_directive_ls="guessing yes";; - esac -else + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_signal_h='<'signal.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_signal_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -#include -int main () -{ - int result = 0; - char buf[100]; - /* Test whether %ls works at all. - This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on - Cygwin 1.5. */ - { - static const wchar_t wstring[] = { 'a', 'b', 'c', 0 }; - buf[0] = '\0'; - if (sprintf (buf, "%ls", wstring) < 0 - || strcmp (buf, "abc") != 0) - result |= 1; - } - /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an - assertion failure inside libc), but not on OpenBSD 4.0. */ - { - static const wchar_t wstring[] = { 'a', 0 }; - buf[0] = '\0'; - if (sprintf (buf, "%ls", wstring) < 0 - || strcmp (buf, "a") != 0) - result |= 2; - } - /* Test whether precisions in %ls are supported as specified in ISO C 99 - section 7.19.6.1: - "If a precision is specified, no more than that many bytes are written - (including shift sequences, if any), and the array shall contain a - null wide character if, to equal the multibyte character sequence - length given by the precision, the function would need to access a - wide character one past the end of the array." - This test fails on Solaris 10. */ - { - static const wchar_t wstring[] = { 'a', 'b', (wchar_t) 0xfdfdfdfd, 0 }; - buf[0] = '\0'; - if (sprintf (buf, "%.2ls", wstring) < 0 - || strcmp (buf, "ab") != 0) - result |= 8; - } - return result; -} +#include _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_directive_ls=yes -else - gl_cv_func_printf_directive_ls=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'signal.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + gl_cv_absolute_signal_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_ls" >&5 -$as_echo "$gl_cv_func_printf_directive_ls" >&6; } + gl_header=$gl_cv_absolute_signal_h + gl_cv_next_signal_h='"'$gl_header'"' +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_signal_h" >&5 +printf "%s\n" "$gl_cv_next_signal_h" >&6; } + fi + NEXT_SIGNAL_H=$gl_cv_next_signal_h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports POSIX/XSI format strings with positions" >&5 -$as_echo_n "checking whether printf supports POSIX/XSI format strings with positions... " >&6; } -if ${gl_cv_func_printf_positions+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'signal.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_signal_h + fi + NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H=$gl_next_as_first_directive - if test "$cross_compiling" = yes; then : - case "$host_os" in - netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) - gl_cv_func_printf_positions="guessing no";; - beos*) gl_cv_func_printf_positions="guessing no";; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_positions="guessing yes";; - # Guess no on native Windows. - mingw* | pw*) gl_cv_func_printf_positions="guessing no";; - *) gl_cv_func_printf_positions="guessing yes";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -/* The string "%2$d %1$d", with dollar characters protected from the shell's - dollar expansion (possibly an autoconf bug). */ -static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; -static char buf[100]; -int main () -{ - sprintf (buf, format, 33, 55); - return (strcmp (buf, "55 33") != 0); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_positions=yes -else - gl_cv_func_printf_positions=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi +# AIX declares sig_atomic_t to already include volatile, and C89 compilers +# then choke on 'volatile sig_atomic_t'. C99 requires that it compile. + ac_fn_c_check_type "$LINENO" "volatile sig_atomic_t" "ac_cv_type_volatile_sig_atomic_t" " +#include + +" +if test "x$ac_cv_type_volatile_sig_atomic_t" = xyes +then : +else $as_nop + HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_positions" >&5 -$as_echo "$gl_cv_func_printf_positions" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the grouping flag" >&5 -$as_echo_n "checking whether printf supports the grouping flag... " >&6; } -if ${gl_cv_func_printf_flag_grouping+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; - netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; - # Guess no on native Windows. - mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; - *) gl_cv_func_printf_flag_grouping="guessing yes";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -static char buf[100]; -int main () -{ - if (sprintf (buf, "%'d %d", 1234567, 99) < 0 - || buf[strlen (buf) - 1] != '9') - return 1; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_flag_grouping=yes -else - gl_cv_func_printf_flag_grouping=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + ac_fn_c_check_type "$LINENO" "sighandler_t" "ac_cv_type_sighandler_t" " +#include +" +if test "x$ac_cv_type_sighandler_t" = xyes +then : +else $as_nop + HAVE_SIGHANDLER_T=0 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_flag_grouping" >&5 -$as_echo "$gl_cv_func_printf_flag_grouping" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the left-adjust flag correctly" >&5 -$as_echo_n "checking whether printf supports the left-adjust flag correctly... " >&6; } -if ${gl_cv_func_printf_flag_leftadjust+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on HP-UX 11. - hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; - # Guess no on HP-UX 10 and older. - hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; - # Guess yes on native Windows. - mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";; - # Guess yes otherwise. - *) gl_cv_func_printf_flag_leftadjust="guessing yes";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -static char buf[100]; -int main () -{ - /* Check that a '-' flag is not annihilated by a negative width. */ - if (sprintf (buf, "a%-*sc", -3, "b") < 0 - || strcmp (buf, "ab c") != 0) - return 1; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_flag_leftadjust=yes -else - gl_cv_func_printf_flag_leftadjust=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi +ac_fn_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_snprintf" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_flag_leftadjust" >&5 -$as_echo "$gl_cv_func_printf_flag_leftadjust" >&6; } - +printf "%s\n" "#define HAVE_DECL_SNPRINTF $ac_have_decl" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the zero flag correctly" >&5 -$as_echo_n "checking whether printf supports the zero flag correctly... " >&6; } -if ${gl_cv_func_printf_flag_zero+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_flag_zero="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_flag_zero="guessing yes";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; - # Guess no on native Windows. - mingw*) gl_cv_func_printf_flag_zero="guessing no";; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -static char buf[100]; -static double zero = 0.0; -int main () -{ - if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0 - || (strcmp (buf, " inf") != 0 - && strcmp (buf, " infinity") != 0)) - return 1; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_flag_zero=yes -else - gl_cv_func_printf_flag_zero=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_flag_zero" >&5 -$as_echo "$gl_cv_func_printf_flag_zero" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports large precisions" >&5 -$as_echo_n "checking whether printf supports large precisions... " >&6; } -if ${gl_cv_func_printf_precision+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess no only on Solaris, native Windows, and BeOS systems. - solaris*) gl_cv_func_printf_precision="guessing no" ;; - mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; - beos*) gl_cv_func_printf_precision="guessing no" ;; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; - *) gl_cv_func_printf_precision="guessing yes" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + if test $gl_cv_have_include_next = yes; then + gl_cv_next_spawn_h='<'spawn.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_spawn_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop -#include -#include -static char buf[5000]; -int main () -{ - int result = 0; -#ifdef __BEOS__ - /* On BeOS, this would crash and show a dialog box. Avoid the crash. */ - return 1; -#endif - if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) - result |= 1; - if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5) - result |= 2; - if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5 - || buf[0] != '1') - result |= 4; - if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5 - || buf[0] != '1') - result |= 4; - return result; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_precision=yes -else - gl_cv_func_printf_precision=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + if test $ac_cv_header_spawn_h = yes; then -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_precision" >&5 -$as_echo "$gl_cv_func_printf_precision" >&6; } - gl_cv_c_multiarch=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; - +#include _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac - arch= - prev= - for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do - if test -n "$prev"; then - case $word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$arch" || test "$arch" = "$word"; then - arch="$word" - else - gl_cv_c_multiarch=yes + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'spawn.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_spawn_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_spawn_h + gl_cv_next_spawn_h='"'$gl_header'"' + else + gl_cv_next_spawn_h='<'spawn.h'>' fi - ;; - esac - prev= - else - if test "x$word" = "x-arch"; then - prev=arch - fi - fi - done + fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $gl_cv_c_multiarch = yes; then - APPLE_UNIVERSAL_BUILD=1 - else - APPLE_UNIVERSAL_BUILD=0 - fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_spawn_h" >&5 +printf "%s\n" "$gl_cv_next_spawn_h" >&6; } + fi + NEXT_SPAWN_H=$gl_cv_next_spawn_h + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'spawn.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_spawn_h + fi + NEXT_AS_FIRST_DIRECTIVE_SPAWN_H=$gl_next_as_first_directive - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf survives out-of-memory conditions" >&5 -$as_echo_n "checking whether printf survives out-of-memory conditions... " >&6; } -if ${gl_cv_func_printf_enomem+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_func_printf_enomem="guessing no" - if test "$cross_compiling" = no; then - if test $APPLE_UNIVERSAL_BUILD = 0; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + if test $ac_cv_header_spawn_h = yes; then + HAVE_SPAWN_H=1 + ac_fn_c_check_type "$LINENO" "posix_spawnattr_t" "ac_cv_type_posix_spawnattr_t" " +#include +" +if test "x$ac_cv_type_posix_spawnattr_t" = xyes +then : -#include -#if defined __MACH__ && defined __APPLE__ -/* Avoid a crash on Mac OS X. */ -#include -#include -#include -#include -#include -#include -/* The exception port on which our thread listens. */ -static mach_port_t our_exception_port; -/* The main function of the thread listening for exceptions of type - EXC_BAD_ACCESS. */ -static void * -mach_exception_thread (void *arg) -{ - /* Buffer for a message to be received. */ - struct { - mach_msg_header_t head; - mach_msg_body_t msgh_body; - char data1024; - } msg; - mach_msg_return_t retval; - /* Wait for a message on the exception port. */ - retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), - our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); - if (retval != MACH_MSG_SUCCESS) - abort (); - exit (1); -} -static void -nocrash_init (void) -{ - mach_port_t self = mach_task_self (); - /* Allocate a port on which the thread shall listen for exceptions. */ - if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) - == KERN_SUCCESS) { - /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ - if (mach_port_insert_right (self, our_exception_port, our_exception_port, - MACH_MSG_TYPE_MAKE_SEND) - == KERN_SUCCESS) { - /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting - for us. */ - exception_mask_t mask = EXC_MASK_BAD_ACCESS; - /* Create the thread listening on the exception port. */ - pthread_attr_t attr; - pthread_t thread; - if (pthread_attr_init (&attr) == 0 - && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 - && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { - pthread_attr_destroy (&attr); - /* Replace the exception port info for these exceptions with our own. - Note that we replace the exception port for the entire task, not only - for a particular thread. This has the effect that when our exception - port gets the message, the thread specific exception port has already - been asked, and we don't need to bother about it. - See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ - task_set_exception_ports (self, mask, our_exception_port, - EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); - } - } - } -} -#elif defined _WIN32 && ! defined __CYGWIN__ -/* Avoid a crash on native Windows. */ -#define WIN32_LEAN_AND_MEAN -#include -#include -static LONG WINAPI -exception_filter (EXCEPTION_POINTERS *ExceptionInfo) -{ - switch (ExceptionInfo->ExceptionRecord->ExceptionCode) - { - case EXCEPTION_ACCESS_VIOLATION: - case EXCEPTION_IN_PAGE_ERROR: - case EXCEPTION_STACK_OVERFLOW: - case EXCEPTION_GUARD_PAGE: - case EXCEPTION_PRIV_INSTRUCTION: - case EXCEPTION_ILLEGAL_INSTRUCTION: - case EXCEPTION_DATATYPE_MISALIGNMENT: - case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - case EXCEPTION_NONCONTINUABLE_EXCEPTION: - exit (1); - } - return EXCEPTION_CONTINUE_SEARCH; -} -static void -nocrash_init (void) -{ - SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); -} -#else -/* Avoid a crash on POSIX systems. */ -#include -#include -/* A POSIX signal handler. */ -static void -exception_handler (int sig) -{ - _exit (1); -} -static void -nocrash_init (void) -{ -#ifdef SIGSEGV - signal (SIGSEGV, exception_handler); -#endif -#ifdef SIGBUS - signal (SIGBUS, exception_handler); -#endif -} -#endif +printf "%s\n" "#define HAVE_POSIX_SPAWNATTR_T 1" >>confdefs.h -#include -#include -#include -#include -#include -int main() -{ - struct rlimit limit; - int ret; - nocrash_init (); - /* Some printf implementations allocate temporary space with malloc. */ - /* On BSD systems, malloc() is limited by RLIMIT_DATA. */ -#ifdef RLIMIT_DATA - if (getrlimit (RLIMIT_DATA, &limit) < 0) - return 77; - if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) - limit.rlim_max = 5000000; - limit.rlim_cur = limit.rlim_max; - if (setrlimit (RLIMIT_DATA, &limit) < 0) - return 77; -#endif - /* On Linux systems, malloc() is limited by RLIMIT_AS. */ -#ifdef RLIMIT_AS - if (getrlimit (RLIMIT_AS, &limit) < 0) - return 77; - if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) - limit.rlim_max = 5000000; - limit.rlim_cur = limit.rlim_max; - if (setrlimit (RLIMIT_AS, &limit) < 0) - return 77; -#endif - /* Some printf implementations allocate temporary space on the stack. */ -#ifdef RLIMIT_STACK - if (getrlimit (RLIMIT_STACK, &limit) < 0) - return 77; - if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) - limit.rlim_max = 5000000; - limit.rlim_cur = limit.rlim_max; - if (setrlimit (RLIMIT_STACK, &limit) < 0) - return 77; -#endif - ret = printf ("%.5000000f", 1.0); - return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); -} -_ACEOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest$ac_exeext; then - (./conftest 2>&5 - result=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $result" >&5 - if test $result != 0 && test $result != 77; then result=1; fi - exit $result - ) >/dev/null 2>/dev/null - case $? in - 0) gl_cv_func_printf_enomem="yes" ;; - 77) gl_cv_func_printf_enomem="guessing no" ;; - *) gl_cv_func_printf_enomem="no" ;; - esac - else - gl_cv_func_printf_enomem="guessing no" - fi - rm -fr conftest* - else - gl_cv_func_printf_enomem="guessing no" - fi - fi - if test "$gl_cv_func_printf_enomem" = "guessing no"; then - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on Solaris. - solaris*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on AIX. - aix*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on HP-UX/hppa. - hpux*) case "$host_cpu" in - hppa*) gl_cv_func_printf_enomem="guessing yes";; - *) gl_cv_func_printf_enomem="guessing no";; - esac - ;; - # Guess yes on IRIX. - irix*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on OSF/1. - osf*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on Haiku. - haiku*) gl_cv_func_printf_enomem="guessing yes";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_enomem="guessing no";; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_enomem="$gl_cross_guess_normal";; - esac - fi +else $as_nop + HAVE_POSIX_SPAWNATTR_T=0 +fi + ac_fn_c_check_type "$LINENO" "posix_spawn_file_actions_t" "ac_cv_type_posix_spawn_file_actions_t" " +#include + +" +if test "x$ac_cv_type_posix_spawn_file_actions_t" = xyes +then : + +printf "%s\n" "#define HAVE_POSIX_SPAWN_FILE_ACTIONS_T 1" >>confdefs.h + + +else $as_nop + HAVE_POSIX_SPAWN_FILE_ACTIONS_T=0 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_enomem" >&5 -$as_echo "$gl_cv_func_printf_enomem" >&6; } + else + HAVE_SPAWN_H=0 + HAVE_POSIX_SPAWNATTR_T=0 + HAVE_POSIX_SPAWN_FILE_ACTIONS_T=0 + fi - case "$gl_cv_func_printf_long_double" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wchar_t" >&5 -$as_echo_n "checking for wchar_t... " >&6; } -if ${gt_cv_c_wchar_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - wchar_t foo = (wchar_t)'\0'; -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gt_cv_c_wchar_t=yes -else - gt_cv_c_wchar_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_wchar_t" >&5 -$as_echo "$gt_cv_c_wchar_t" >&6; } - if test $gt_cv_c_wchar_t = yes; then -$as_echo "#define HAVE_WCHAR_T 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wint_t" >&5 -$as_echo_n "checking for wint_t... " >&6; } -if ${gt_cv_c_wint_t+:} false; then : - $as_echo_n "(cached) " >&6 -else + + + HAVE_FCHMODAT=1; + HAVE_FSTATAT=1; + HAVE_FUTIMENS=1; + HAVE_GETUMASK=1; + HAVE_LCHMOD=1; + HAVE_LSTAT=1; + HAVE_MKDIRAT=1; + HAVE_MKFIFO=1; + HAVE_MKFIFOAT=1; + HAVE_MKNOD=1; + HAVE_MKNODAT=1; + HAVE_UTIMENSAT=1; + REPLACE_FCHMODAT=0; + REPLACE_FSTAT=0; + REPLACE_FSTATAT=0; + REPLACE_FUTIMENS=0; + REPLACE_LSTAT=0; + REPLACE_MKDIR=0; + REPLACE_MKFIFO=0; + REPLACE_MKFIFOAT=0; + REPLACE_MKNOD=0; + REPLACE_MKNODAT=0; + REPLACE_STAT=0; + REPLACE_UTIMENSAT=0; + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 +printf %s "checking whether stat file-mode macros are broken... " >&6; } +if test ${ac_cv_header_stat_broken+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include +#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be included - before . */ -#include -#include -#include -#include - wint_t foo = (wchar_t)'\0'; -int -main () -{ +#if defined S_ISBLK && defined S_IFDIR +extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; +#endif + +#if defined S_ISBLK && defined S_IFCHR +extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; +#endif + +#if defined S_ISLNK && defined S_IFREG +extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; +#endif + +#if defined S_ISSOCK && defined S_IFREG +extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; +#endif - ; - return 0; -} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gt_cv_c_wint_t=yes -else - gt_cv_c_wint_t=no +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_header_stat_broken=no +else $as_nop + ac_cv_header_stat_broken=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_wint_t" >&5 -$as_echo "$gt_cv_c_wint_t" >&6; } - if test $gt_cv_c_wint_t = yes; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 +printf "%s\n" "$ac_cv_header_stat_broken" >&6; } +if test $ac_cv_header_stat_broken = yes; then -$as_echo "#define HAVE_WINT_T 1" >>confdefs.h +printf "%s\n" "#define STAT_MACROS_BROKEN 1" >>confdefs.h +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether wint_t is too small" >&5 -$as_echo_n "checking whether wint_t is too small... " >&6; } -if ${gl_cv_type_wint_t_too_small+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#if !(defined __GLIBC__ && !defined __UCLIBC__) -# include -# include -# include -#endif -#include - int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1]; -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_type_wint_t_too_small=no -else - gl_cv_type_wint_t_too_small=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wint_t_too_small" >&5 -$as_echo "$gl_cv_type_wint_t_too_small" >&6; } - if test $gl_cv_type_wint_t_too_small = yes; then - GNULIB_OVERRIDES_WINT_T=1 - else - GNULIB_OVERRIDES_WINT_T=0 - fi - else - GNULIB_OVERRIDES_WINT_T=0 - fi - if test $ac_cv_header_features_h = yes; then - HAVE_FEATURES_H=1 - else - HAVE_FEATURES_H=0 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for intmax_t" >&5 -$as_echo_n "checking for intmax_t... " >&6; } -if ${gt_cv_c_intmax_t+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sys_stat_h='<'sys/stat.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_sys_stat_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $ac_cv_header_sys_stat_h = yes; then + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'sys/stat.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_sys_stat_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_sys_stat_h + gl_cv_next_sys_stat_h='"'$gl_header'"' + else + gl_cv_next_sys_stat_h='<'sys/stat.h'>' + fi -#include -#include -#if HAVE_STDINT_H_WITH_UINTMAX -#include -#endif -#if HAVE_INTTYPES_H_WITH_UINTMAX -#include -#endif -int -main () -{ -intmax_t x = -1; return !x; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gt_cv_c_intmax_t=yes -else - gt_cv_c_intmax_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_intmax_t" >&5 -$as_echo "$gt_cv_c_intmax_t" >&6; } - if test $gt_cv_c_intmax_t = yes; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_stat_h" >&5 +printf "%s\n" "$gl_cv_next_sys_stat_h" >&6; } + fi + NEXT_SYS_STAT_H=$gl_cv_next_sys_stat_h -$as_echo "#define HAVE_INTMAX_T 1" >>confdefs.h + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'sys/stat.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_sys_stat_h + fi + NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H=$gl_next_as_first_directive - else -cat >>confdefs.h <<_ACEOF -#define intmax_t long long -_ACEOF - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'double'" >&5 -$as_echo_n "checking where to find the exponent in a 'double'... " >&6; } -if ${gl_cv_cc_double_expbit0+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined arm || defined __arm || defined __arm__ - mixed_endianness -#endif + WINDOWS_STAT_TIMESPEC=0 -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "mixed_endianness" >/dev/null 2>&1; then : - gl_cv_cc_double_expbit0="unknown" -else - : -if ${ac_cv_c_bigendian+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_bigendian=unknown - # See if we're dealing with a universal compiler. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # Check for potential -arch flags. It is not universal unless - # there are at least two -arch flags with different values. - ac_arch= - ac_prev= - for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do - if test -n "$ac_prev"; then - case $ac_word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then - ac_arch=$ac_word - else - ac_cv_c_bigendian=universal - break - fi - ;; - esac - ac_prev= - elif test "x$ac_word" = "x-arch"; then - ac_prev=arch - fi - done -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ac_cv_c_bigendian = unknown; then - # See if sys/param.h defines the BYTE_ORDER macro. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ - && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ - && LITTLE_ENDIAN) - bogus endian macros - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_fn_c_check_type "$LINENO" "nlink_t" "ac_cv_type_nlink_t" "#include + #include +" +if test "x$ac_cv_type_nlink_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define nlink_t int" >>confdefs.h + fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) - bogus endian macros - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to _BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -#ifndef _BIG_ENDIAN - not big endian - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # Compile a test program. - if test "$cross_compiling" = yes; then : - # Try to guess by grepping values from an object file. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -short int ascii_mm[] = - { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = - { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; - int use_ascii (int i) { - return ascii_mm[i] + ascii_ii[i]; - } - short int ebcdic_ii[] = - { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = - { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; - int use_ebcdic (int i) { - return ebcdic_mm[i] + ebcdic_ii[i]; - } - extern int foo; -int -main () -{ -return use_ascii (foo) == use_ebcdic (foo); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then - ac_cv_c_bigendian=yes - fi - if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi - fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_bigendian=no -else - ac_cv_c_bigendian=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - fi + + + case "$host_os" in + mingw*) + ac_fn_c_check_header_compile "$LINENO" "sdkddkver.h" "ac_cv_header_sdkddkver_h" "$ac_includes_default" +if test "x$ac_cv_header_sdkddkver_h" = xyes +then : + printf "%s\n" "#define HAVE_SDKDDKVER_H 1" >>confdefs.h + fi -: - case $ac_cv_c_bigendian in #( - yes) - gl_cv_cc_double_expbit0="word 0 bit 20";; #( - no) - gl_cv_cc_double_expbit0="word 1 bit 20" ;; #( - universal) -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + ;; + esac - ;; #( - *) - gl_cv_cc_double_expbit0="unknown" ;; - esac -fi -rm -f conftest* -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -#define NWORDS \ - ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { double value; unsigned int word[NWORDS]; } memory_double; -static unsigned int ored_words[NWORDS]; -static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (double x) -{ - memory_double m; - size_t i; - /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ - memset (&m, 0, sizeof (memory_double)); - m.value = x; - for (i = 0; i < NWORDS; i++) - { - ored_words[i] |= m.word[i]; - anded_words[i] &= m.word[i]; - } -} -int main () -{ - size_t j; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) - return 1; - for (j = 0; j < NWORDS; j++) - anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25); - add_to_ored_words (0.5); - add_to_ored_words (1.0); - add_to_ored_words (2.0); - add_to_ored_words (4.0); - /* Remove bits that are common (e.g. if representation of the first mantissa - bit is explicit). */ - for (j = 0; j < NWORDS; j++) - ored_words[j] &= ~anded_words[j]; - /* Now find the nonzero word. */ - for (j = 0; j < NWORDS; j++) - if (ored_words[j] != 0) - break; - if (j < NWORDS) - { - size_t i; - for (i = j + 1; i < NWORDS; i++) - if (ored_words[i] != 0) - { - fprintf (fp, "unknown"); - return (fclose (fp) != 0); - } - for (i = 0; ; i++) - if ((ored_words[j] >> i) & 1) - { - fprintf (fp, "word %d bit %d", (int) j, (int) i); - return (fclose (fp) != 0); - } - } - fprintf (fp, "unknown"); - return (fclose (fp) != 0); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_cc_double_expbit0=`cat conftest.out` -else - gl_cv_cc_double_expbit0="unknown" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + GL_GNULIB_FCHMODAT=0 - rm -f conftest.out -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_double_expbit0" >&5 -$as_echo "$gl_cv_cc_double_expbit0" >&6; } - case "$gl_cv_cc_double_expbit0" in - word*bit*) - word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` -cat >>confdefs.h <<_ACEOF -#define DBL_EXPBIT0_WORD $word -_ACEOF + GL_GNULIB_FSTAT=0 + + + + GL_GNULIB_FSTATAT=0 + + + + GL_GNULIB_FUTIMENS=0 + + + + GL_GNULIB_GETUMASK=0 + + + + GL_GNULIB_LCHMOD=0 + + + + GL_GNULIB_LSTAT=0 + + + + GL_GNULIB_MKDIR=0 + + + + GL_GNULIB_MKDIRAT=0 + + + + GL_GNULIB_MKFIFO=0 + + + + GL_GNULIB_MKFIFOAT=0 + + + + GL_GNULIB_MKNOD=0 + + + + GL_GNULIB_MKNODAT=0 + + + GL_GNULIB_STAT=0 -cat >>confdefs.h <<_ACEOF -#define DBL_EXPBIT0_BIT $bit -_ACEOF - ;; - esac + GL_GNULIB_UTIMENSAT=0 + GL_GNULIB_OVERRIDES_STRUCT_STAT=0 + GL_GNULIB_MDA_CHMOD=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether snprintf returns a byte count as in C99" >&5 -$as_echo_n "checking whether snprintf returns a byte count as in C99... " >&6; } -if ${gl_cv_func_snprintf_retval_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; - darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on OpenBSD >= 3.9. - openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) - gl_cv_func_snprintf_retval_c99="guessing no";; - openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on Solaris >= 2.10. - solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; - solaris*) gl_cv_func_printf_sizes_c99="guessing no";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; - aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_snprintf_retval_c99="guessing no";; - netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on Android. - linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on MSVC, no on mingw. - mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + GL_GNULIB_MDA_MKDIR=1 -#ifdef _MSC_VER - Known -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_snprintf_retval_c99="guessing yes" -else - gl_cv_func_snprintf_retval_c99="guessing no" -fi -rm -f conftest* - ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_snprintf_retval_c99="$gl_cross_guess_normal";; - esac + GL_GNULIB_MDA_UMASK=1 -else + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 +printf %s "checking for stdbool.h that conforms to C99... " >&6; } +if test ${ac_cv_header_stdbool_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#if HAVE_SNPRINTF -# define my_snprintf snprintf -#else -# include -static int my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} -#endif -static char buf[100]; -int main () -{ - strcpy (buf, "ABCDEF"); - if (my_snprintf (buf, 3, "%d %d", 4567, 89) != 7) - return 1; - if (my_snprintf (buf, 0, "%d %d", 4567, 89) != 7) - return 2; - if (my_snprintf (NULL, 0, "%d %d", 4567, 89) != 7) - return 3; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_snprintf_retval_c99=yes -else - gl_cv_func_snprintf_retval_c99=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + #include + #ifdef __cplusplus + typedef bool Bool; + #else + typedef _Bool Bool; + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif + #endif -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_retval_c99" >&5 -$as_echo "$gl_cv_func_snprintf_retval_c99" >&6; } + #ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" + #endif + struct s { Bool s: 1; Bool t; bool u: 1; bool v; } s; + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + /* See body of main program for 'e'. */ + char f[(Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ + Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + /* Catch a bug in an HP-UX C compiler. See + https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html + */ + Bool q = true; + Bool *pq = &q; + bool *qq = &q; +int +main (void) +{ + bool e = &s; + *pq |= q; *pq |= ! q; + *qq |= q; *qq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq + !qq); - for ac_func in snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 + ; + return 0; +} _ACEOF - +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_header_stdbool_h=yes +else $as_nop + ac_cv_header_stdbool_h=no fi -done +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 +printf "%s\n" "$ac_cv_header_stdbool_h" >&6; } + ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" +if test "x$ac_cv_type__Bool" = xyes +then : + +printf "%s\n" "#define HAVE__BOOL 1" >>confdefs.h + - ac_fn_c_check_decl "$LINENO" "_snprintf" "ac_cv_have_decl__snprintf" "#include -" -if test "x$ac_cv_have_decl__snprintf" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL__SNPRINTF $ac_have_decl -_ACEOF + REPLACE_NULL=0; + HAVE_MAX_ALIGN_T=1; + HAVE_WCHAR_T=1; - case "$gl_cv_func_snprintf_retval_c99" in - *yes) -$as_echo "#define HAVE_SNPRINTF_RETVAL_C99 1" >>confdefs.h - ;; - esac - GNULIB_ACOSF=0; - GNULIB_ACOSL=0; - GNULIB_ASINF=0; - GNULIB_ASINL=0; - GNULIB_ATANF=0; - GNULIB_ATANL=0; - GNULIB_ATAN2F=0; - GNULIB_CBRT=0; - GNULIB_CBRTF=0; - GNULIB_CBRTL=0; - GNULIB_CEIL=0; - GNULIB_CEILF=0; - GNULIB_CEILL=0; - GNULIB_COPYSIGN=0; - GNULIB_COPYSIGNF=0; - GNULIB_COPYSIGNL=0; - GNULIB_COSF=0; - GNULIB_COSL=0; - GNULIB_COSHF=0; - GNULIB_EXPF=0; - GNULIB_EXPL=0; - GNULIB_EXP2=0; - GNULIB_EXP2F=0; - GNULIB_EXP2L=0; - GNULIB_EXPM1=0; - GNULIB_EXPM1F=0; - GNULIB_EXPM1L=0; - GNULIB_FABSF=0; - GNULIB_FABSL=0; - GNULIB_FLOOR=0; - GNULIB_FLOORF=0; - GNULIB_FLOORL=0; - GNULIB_FMA=0; - GNULIB_FMAF=0; - GNULIB_FMAL=0; - GNULIB_FMOD=0; - GNULIB_FMODF=0; - GNULIB_FMODL=0; - GNULIB_FREXPF=0; - GNULIB_FREXP=0; - GNULIB_FREXPL=0; - GNULIB_HYPOT=0; - GNULIB_HYPOTF=0; - GNULIB_HYPOTL=0; - GNULIB_ILOGB=0; - GNULIB_ILOGBF=0; - GNULIB_ILOGBL=0; - GNULIB_ISFINITE=0; - GNULIB_ISINF=0; - GNULIB_ISNAN=0; - GNULIB_ISNANF=0; - GNULIB_ISNAND=0; - GNULIB_ISNANL=0; - GNULIB_LDEXPF=0; - GNULIB_LDEXPL=0; - GNULIB_LOG=0; - GNULIB_LOGF=0; - GNULIB_LOGL=0; - GNULIB_LOG10=0; - GNULIB_LOG10F=0; - GNULIB_LOG10L=0; - GNULIB_LOG1P=0; - GNULIB_LOG1PF=0; - GNULIB_LOG1PL=0; - GNULIB_LOG2=0; - GNULIB_LOG2F=0; - GNULIB_LOG2L=0; - GNULIB_LOGB=0; - GNULIB_LOGBF=0; - GNULIB_LOGBL=0; - GNULIB_MODF=0; - GNULIB_MODFF=0; - GNULIB_MODFL=0; - GNULIB_POWF=0; - GNULIB_REMAINDER=0; - GNULIB_REMAINDERF=0; - GNULIB_REMAINDERL=0; - GNULIB_RINT=0; - GNULIB_RINTF=0; - GNULIB_RINTL=0; - GNULIB_ROUND=0; - GNULIB_ROUNDF=0; - GNULIB_ROUNDL=0; - GNULIB_SIGNBIT=0; - GNULIB_SINF=0; - GNULIB_SINL=0; - GNULIB_SINHF=0; - GNULIB_SQRTF=0; - GNULIB_SQRTL=0; - GNULIB_TANF=0; - GNULIB_TANL=0; - GNULIB_TANHF=0; - GNULIB_TRUNC=0; - GNULIB_TRUNCF=0; - GNULIB_TRUNCL=0; - HAVE_ACOSF=1; - HAVE_ACOSL=1; - HAVE_ASINF=1; - HAVE_ASINL=1; - HAVE_ATANF=1; - HAVE_ATANL=1; - HAVE_ATAN2F=1; - HAVE_CBRT=1; - HAVE_CBRTF=1; - HAVE_CBRTL=1; - HAVE_COPYSIGN=1; - HAVE_COPYSIGNL=1; - HAVE_COSF=1; - HAVE_COSL=1; - HAVE_COSHF=1; - HAVE_EXPF=1; - HAVE_EXPL=1; - HAVE_EXPM1=1; - HAVE_EXPM1F=1; - HAVE_FABSF=1; - HAVE_FABSL=1; - HAVE_FMA=1; - HAVE_FMAF=1; - HAVE_FMAL=1; - HAVE_FMODF=1; - HAVE_FMODL=1; - HAVE_FREXPF=1; - HAVE_HYPOTF=1; - HAVE_HYPOTL=1; - HAVE_ILOGB=1; - HAVE_ILOGBF=1; - HAVE_ILOGBL=1; - HAVE_ISNANF=1; - HAVE_ISNAND=1; - HAVE_ISNANL=1; - HAVE_LDEXPF=1; - HAVE_LOGF=1; - HAVE_LOGL=1; - HAVE_LOG10F=1; - HAVE_LOG10L=1; - HAVE_LOG1P=1; - HAVE_LOG1PF=1; - HAVE_LOG1PL=1; - HAVE_LOGBF=1; - HAVE_LOGBL=1; - HAVE_MODFF=1; - HAVE_MODFL=1; - HAVE_POWF=1; - HAVE_REMAINDER=1; - HAVE_REMAINDERF=1; - HAVE_RINT=1; - HAVE_RINTL=1; - HAVE_SINF=1; - HAVE_SINL=1; - HAVE_SINHF=1; - HAVE_SQRTF=1; - HAVE_SQRTL=1; - HAVE_TANF=1; - HAVE_TANL=1; - HAVE_TANHF=1; - HAVE_DECL_ACOSL=1; - HAVE_DECL_ASINL=1; - HAVE_DECL_ATANL=1; - HAVE_DECL_CBRTF=1; - HAVE_DECL_CBRTL=1; - HAVE_DECL_CEILF=1; - HAVE_DECL_CEILL=1; - HAVE_DECL_COPYSIGNF=1; - HAVE_DECL_COSL=1; - HAVE_DECL_EXPL=1; - HAVE_DECL_EXP2=1; - HAVE_DECL_EXP2F=1; - HAVE_DECL_EXP2L=1; - HAVE_DECL_EXPM1L=1; - HAVE_DECL_FLOORF=1; - HAVE_DECL_FLOORL=1; - HAVE_DECL_FREXPL=1; - HAVE_DECL_LDEXPL=1; - HAVE_DECL_LOGL=1; - HAVE_DECL_LOG10L=1; - HAVE_DECL_LOG2=1; - HAVE_DECL_LOG2F=1; - HAVE_DECL_LOG2L=1; - HAVE_DECL_LOGB=1; - HAVE_DECL_REMAINDER=1; - HAVE_DECL_REMAINDERL=1; - HAVE_DECL_RINTF=1; - HAVE_DECL_ROUND=1; - HAVE_DECL_ROUNDF=1; - HAVE_DECL_ROUNDL=1; - HAVE_DECL_SINL=1; - HAVE_DECL_SQRTL=1; - HAVE_DECL_TANL=1; - HAVE_DECL_TRUNC=1; - HAVE_DECL_TRUNCF=1; - HAVE_DECL_TRUNCL=1; - REPLACE_ACOSF=0; - REPLACE_ASINF=0; - REPLACE_ATANF=0; - REPLACE_ATAN2F=0; - REPLACE_CBRTF=0; - REPLACE_CBRTL=0; - REPLACE_CEIL=0; - REPLACE_CEILF=0; - REPLACE_CEILL=0; - REPLACE_COSF=0; - REPLACE_COSHF=0; - REPLACE_EXPF=0; - REPLACE_EXPL=0; - REPLACE_EXPM1=0; - REPLACE_EXPM1F=0; - REPLACE_EXPM1L=0; - REPLACE_EXP2=0; - REPLACE_EXP2L=0; - REPLACE_FABSL=0; - REPLACE_FLOOR=0; - REPLACE_FLOORF=0; - REPLACE_FLOORL=0; - REPLACE_FMA=0; - REPLACE_FMAF=0; - REPLACE_FMAL=0; - REPLACE_FMOD=0; - REPLACE_FMODF=0; - REPLACE_FMODL=0; - REPLACE_FREXPF=0; - REPLACE_FREXP=0; - REPLACE_FREXPL=0; - REPLACE_HUGE_VAL=0; - REPLACE_HYPOT=0; - REPLACE_HYPOTF=0; - REPLACE_HYPOTL=0; - REPLACE_ILOGB=0; - REPLACE_ILOGBF=0; - REPLACE_ILOGBL=0; - REPLACE_ISFINITE=0; - REPLACE_ISINF=0; - REPLACE_ISNAN=0; - REPLACE_LDEXPL=0; - REPLACE_LOG=0; - REPLACE_LOGF=0; - REPLACE_LOGL=0; - REPLACE_LOG10=0; - REPLACE_LOG10F=0; - REPLACE_LOG10L=0; - REPLACE_LOG1P=0; - REPLACE_LOG1PF=0; - REPLACE_LOG1PL=0; - REPLACE_LOG2=0; - REPLACE_LOG2F=0; - REPLACE_LOG2L=0; - REPLACE_LOGB=0; - REPLACE_LOGBF=0; - REPLACE_LOGBL=0; - REPLACE_MODF=0; - REPLACE_MODFF=0; - REPLACE_MODFL=0; - REPLACE_NAN=0; - REPLACE_REMAINDER=0; - REPLACE_REMAINDERF=0; - REPLACE_REMAINDERL=0; - REPLACE_RINTL=0; - REPLACE_ROUND=0; - REPLACE_ROUNDF=0; - REPLACE_ROUNDL=0; - REPLACE_SIGNBIT=0; - REPLACE_SIGNBIT_USING_GCC=0; - REPLACE_SINF=0; - REPLACE_SINHF=0; - REPLACE_SQRTF=0; - REPLACE_SQRTL=0; - REPLACE_TANF=0; - REPLACE_TANHF=0; - REPLACE_TRUNC=0; - REPLACE_TRUNCF=0; - REPLACE_TRUNCL=0; - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexp() can be used without linking with libm" >&5 -$as_echo_n "checking whether frexp() can be used without linking with libm... " >&6; } -if ${gl_cv_func_frexp_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else + STDDEF_H= - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for good max_align_t" >&5 +printf %s "checking for good max_align_t... " >&6; } +if test ${gl_cv_type_max_align_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - double x; +#include + unsigned int s = sizeof (max_align_t); + #if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__ + int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1]; + int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1]; + #endif + typedef struct { char a; max_align_t b; } max_helper; + typedef struct { char a; long b; } long_helper; + typedef struct { char a; double b; } double_helper; + typedef struct { char a; long double b; } long_double_helper; + int check3[2 * (offsetof (long_helper, b) <= offsetof (max_helper, b)) - 1]; + int check4[2 * (offsetof (double_helper, b) <= offsetof (max_helper, b)) - 1]; + int check5[2 * (offsetof (long_double_helper, b) <= offsetof (max_helper, b)) - 1]; + int -main () +main (void) { -int e; return frexp (x, &e) > 0; + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_frexp_no_libm=yes -else - gl_cv_func_frexp_no_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_type_max_align_t=yes +else $as_nop + gl_cv_type_max_align_t=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexp_no_libm" >&5 -$as_echo "$gl_cv_func_frexp_no_libm" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -ac_fn_c_check_decl "$LINENO" "alarm" "ac_cv_have_decl_alarm" "$ac_includes_default" -if test "x$ac_cv_have_decl_alarm" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_max_align_t" >&5 +printf "%s\n" "$gl_cv_type_max_align_t" >&6; } + if test $gl_cv_type_max_align_t = no; then + HAVE_MAX_ALIGN_T=0 + STDDEF_H=stddef.h + fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ALARM $ac_have_decl -_ACEOF - - - - + if test $gt_cv_c_wchar_t = no; then + HAVE_WCHAR_T=0 + STDDEF_H=stddef.h + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for arithmetic hrtime_t" >&5 -$as_echo_n "checking for arithmetic hrtime_t... " >&6; } -if ${gl_cv_arithmetic_hrtime_t+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether NULL can be used in arbitrary expressions" >&5 +printf %s "checking whether NULL can be used in arbitrary expressions... " >&6; } +if test ${gl_cv_decl_null_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include + int test[2 * (sizeof NULL == sizeof (void *)) -1]; + int -main () +main (void) { -hrtime_t x = 0; return x/x; + ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_arithmetic_hrtime_t=yes -else - gl_cv_arithmetic_hrtime_t=no +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_decl_null_works=yes +else $as_nop + gl_cv_decl_null_works=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_arithmetic_hrtime_t" >&5 -$as_echo "$gl_cv_arithmetic_hrtime_t" >&6; } - if test $gl_cv_arithmetic_hrtime_t = yes; then - -$as_echo "#define HAVE_ARITHMETIC_HRTIME_T 1" >>confdefs.h - +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_null_works" >&5 +printf "%s\n" "$gl_cv_decl_null_works" >&6; } + if test $gl_cv_decl_null_works = no; then + REPLACE_NULL=1 + STDDEF_H=stddef.h fi - : - - - - - - - - - - - + if test -n "$STDDEF_H"; then + GL_GENERATE_STDDEF_H_TRUE= + GL_GENERATE_STDDEF_H_FALSE='#' +else + GL_GENERATE_STDDEF_H_TRUE='#' + GL_GENERATE_STDDEF_H_FALSE= +fi + if test -n "$STDDEF_H"; then @@ -16477,22 +30641,20 @@ if test $gl_cv_have_include_next = yes; then - gl_cv_next_getopt_h='<'getopt.h'>' + gl_cv_next_stddef_h='<'stddef.h'>' else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_getopt_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test $ac_cv_header_getopt_h = yes; then - + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_stddef_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; @@ -16508,7 +30670,7 @@ ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'getopt.h' \ + gl_header_literal_regex=`echo 'stddef.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ @@ -16517,629 +30679,321 @@ q }' - gl_cv_absolute_getopt_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + gl_cv_absolute_stddef_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_getopt_h - gl_cv_next_getopt_h='"'$gl_header'"' - else - gl_cv_next_getopt_h='<'getopt.h'>' - fi + gl_header=$gl_cv_absolute_stddef_h + gl_cv_next_stddef_h='"'$gl_header'"' fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_getopt_h" >&5 -$as_echo "$gl_cv_next_getopt_h" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stddef_h" >&5 +printf "%s\n" "$gl_cv_next_stddef_h" >&6; } fi - NEXT_GETOPT_H=$gl_cv_next_getopt_h + NEXT_STDDEF_H=$gl_cv_next_stddef_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'getopt.h'>' + gl_next_as_first_directive='<'stddef.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_getopt_h + gl_next_as_first_directive=$gl_cv_next_stddef_h fi - NEXT_AS_FIRST_DIRECTIVE_GETOPT_H=$gl_next_as_first_directive + NEXT_AS_FIRST_DIRECTIVE_STDDEF_H=$gl_next_as_first_directive - if test $ac_cv_header_getopt_h = yes; then - HAVE_GETOPT_H=1 - else - HAVE_GETOPT_H=0 fi - gl_replace_getopt= - - if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then - for ac_header in getopt.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "getopt.h" "ac_cv_header_getopt_h" "$ac_includes_default" -if test "x$ac_cv_header_getopt_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETOPT_H 1 -_ACEOF -else - gl_replace_getopt=yes +ac_fn_check_decl "$LINENO" "fcloseall" "ac_cv_have_decl_fcloseall" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_fcloseall" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi +printf "%s\n" "#define HAVE_DECL_FCLOSEALL $ac_have_decl" >>confdefs.h -done - fi - if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then - for ac_func in getopt_long_only -do : - ac_fn_c_check_func "$LINENO" "getopt_long_only" "ac_cv_func_getopt_long_only" -if test "x$ac_cv_func_getopt_long_only" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETOPT_LONG_ONLY 1 + + printf "%s\n" "#define __USE_MINGW_ANSI_STDIO 1" >>confdefs.h + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stdio_h='<'stdio.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_stdio_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include _ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'stdio.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_stdio_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` -else - gl_replace_getopt=yes -fi -done + gl_header=$gl_cv_absolute_stdio_h + gl_cv_next_stdio_h='"'$gl_header'"' - fi - if test -z "$gl_replace_getopt"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getopt is POSIX compatible" >&5 -$as_echo_n "checking whether getopt is POSIX compatible... " >&6; } -if ${gl_cv_func_getopt_posix+:} false; then : - $as_echo_n "(cached) " >&6 -else +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdio_h" >&5 +printf "%s\n" "$gl_cv_next_stdio_h" >&6; } + fi + NEXT_STDIO_H=$gl_cv_next_stdio_h - if test $cross_compiling = no; then - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'stdio.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_stdio_h + fi + NEXT_AS_FIRST_DIRECTIVE_STDIO_H=$gl_next_as_first_directive -#include -#include -#include -int -main () -{ - static char program[] = "program"; - static char a[] = "-a"; - static char foo[] = "foo"; - static char bar[] = "bar"; - char *argv[] = { program, a, foo, bar, NULL }; - int c; - c = getopt (4, argv, "ab"); - if (!(c == 'a')) - return 1; - c = getopt (4, argv, "ab"); - if (!(c == -1)) - return 2; - if (!(optind == 2)) - return 3; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_getopt_posix=maybe -else - gl_cv_func_getopt_posix=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - if test $gl_cv_func_getopt_posix = maybe; then - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which flavor of printf attribute matches inttypes macros" >&5 +printf %s "checking which flavor of printf attribute matches inttypes macros... " >&6; } +if test ${gl_cv_func_printf_attribute_flavor+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include + #define __STDC_FORMAT_MACROS 1 + #include + #include + /* For non-mingw systems, compilation will trivially succeed. + For mingw, compilation will succeed for older mingw (system + printf, "I64d") and fail for newer mingw (gnu printf, "lld"). */ + #if (defined _WIN32 && ! defined __CYGWIN__) && \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) + extern char PRIdMAX_probe[sizeof PRIdMAX == sizeof "I64d" ? 1 : -1]; + #endif int -main () +main (void) { - static char program[] = "program"; - static char donald[] = "donald"; - static char p[] = "-p"; - static char billy[] = "billy"; - static char duck[] = "duck"; - static char a[] = "-a"; - static char bar[] = "bar"; - char *argv[] = { program, donald, p, billy, duck, a, bar, NULL }; - int c; - c = getopt (7, argv, "+abp:q:"); - if (!(c == -1)) - return 4; - if (!(strcmp (argv[0], "program") == 0)) - return 5; - if (!(strcmp (argv[1], "donald") == 0)) - return 6; - if (!(strcmp (argv[2], "-p") == 0)) - return 7; - if (!(strcmp (argv[3], "billy") == 0)) - return 8; - if (!(strcmp (argv[4], "duck") == 0)) - return 9; - if (!(strcmp (argv[5], "-a") == 0)) - return 10; - if (!(strcmp (argv[6], "bar") == 0)) - return 11; - if (!(optind == 1)) - return 12; + ; return 0; } - _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_getopt_posix=maybe -else - gl_cv_func_getopt_posix=no +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_printf_attribute_flavor=system +else $as_nop + gl_cv_func_printf_attribute_flavor=gnu fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_attribute_flavor" >&5 +printf "%s\n" "$gl_cv_func_printf_attribute_flavor" >&6; } + if test "$gl_cv_func_printf_attribute_flavor" = gnu; then - fi - if test $gl_cv_func_getopt_posix = maybe; then - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +printf "%s\n" "#define GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU 1" >>confdefs.h -#include -#include -#include + fi -int -main () -{ - static char program[] = "program"; - static char ab[] = "-ab"; - char *argv[3] = { program, ab, NULL }; - if (getopt (2, argv, "ab:") != 'a') - return 13; - if (getopt (2, argv, "ab:") != '?') - return 14; - if (optopt != 'b') - return 15; - if (optind != 2) - return 16; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_getopt_posix=yes -else - gl_cv_func_getopt_posix=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - fi - else - case "$host_os" in - darwin* | aix* | mingw*) gl_cv_func_getopt_posix="guessing no";; - *) gl_cv_func_getopt_posix="guessing yes";; - esac - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_posix" >&5 -$as_echo "$gl_cv_func_getopt_posix" >&6; } - case "$gl_cv_func_getopt_posix" in - *no) gl_replace_getopt=yes ;; - esac - fi - if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working GNU getopt function" >&5 -$as_echo_n "checking for working GNU getopt function... " >&6; } -if ${gl_cv_func_getopt_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Even with POSIXLY_CORRECT, the GNU extension of leading '-' in the - # optstring is necessary for programs like m4 that have POSIX-mandated - # semantics for supporting options interspersed with files. - # Also, since getopt_long is a GNU extension, we require optind=0. - # Bash ties 'set -o posix' to a non-exported POSIXLY_CORRECT; - # so take care to revert to the correct (non-)export state. - gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }' - case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - #include -#include -#if defined __MACH__ && defined __APPLE__ -/* Avoid a crash on Mac OS X. */ -#include -#include -#include -#include -#include -#include -/* The exception port on which our thread listens. */ -static mach_port_t our_exception_port; -/* The main function of the thread listening for exceptions of type - EXC_BAD_ACCESS. */ -static void * -mach_exception_thread (void *arg) -{ - /* Buffer for a message to be received. */ - struct { - mach_msg_header_t head; - mach_msg_body_t msgh_body; - char data[1024]; - } msg; - mach_msg_return_t retval; - /* Wait for a message on the exception port. */ - retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), - our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); - if (retval != MACH_MSG_SUCCESS) - abort (); - exit (1); -} -static void -nocrash_init (void) -{ - mach_port_t self = mach_task_self (); - /* Allocate a port on which the thread shall listen for exceptions. */ - if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) - == KERN_SUCCESS) { - /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ - if (mach_port_insert_right (self, our_exception_port, our_exception_port, - MACH_MSG_TYPE_MAKE_SEND) - == KERN_SUCCESS) { - /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting - for us. */ - exception_mask_t mask = EXC_MASK_BAD_ACCESS; - /* Create the thread listening on the exception port. */ - pthread_attr_t attr; - pthread_t thread; - if (pthread_attr_init (&attr) == 0 - && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 - && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { - pthread_attr_destroy (&attr); - /* Replace the exception port info for these exceptions with our own. - Note that we replace the exception port for the entire task, not only - for a particular thread. This has the effect that when our exception - port gets the message, the thread specific exception port has already - been asked, and we don't need to bother about it. - See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ - task_set_exception_ports (self, mask, our_exception_port, - EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); - } - } - } -} -#elif defined _WIN32 && ! defined __CYGWIN__ -/* Avoid a crash on native Windows. */ -#define WIN32_LEAN_AND_MEAN -#include -#include -static LONG WINAPI -exception_filter (EXCEPTION_POINTERS *ExceptionInfo) -{ - switch (ExceptionInfo->ExceptionRecord->ExceptionCode) - { - case EXCEPTION_ACCESS_VIOLATION: - case EXCEPTION_IN_PAGE_ERROR: - case EXCEPTION_STACK_OVERFLOW: - case EXCEPTION_GUARD_PAGE: - case EXCEPTION_PRIV_INSTRUCTION: - case EXCEPTION_ILLEGAL_INSTRUCTION: - case EXCEPTION_DATATYPE_MISALIGNMENT: - case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - case EXCEPTION_NONCONTINUABLE_EXCEPTION: - exit (1); - } - return EXCEPTION_CONTINUE_SEARCH; -} -static void -nocrash_init (void) -{ - SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); -} -#else -/* Avoid a crash on POSIX systems. */ -#include -#include -/* A POSIX signal handler. */ -static void -exception_handler (int sig) -{ - _exit (1); -} -static void -nocrash_init (void) -{ -#ifdef SIGSEGV - signal (SIGSEGV, exception_handler); -#endif -#ifdef SIGBUS - signal (SIGBUS, exception_handler); -#endif -} -#endif -int -main () -{ - int result = 0; - nocrash_init(); - /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, - and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, - OSF/1 5.1, Solaris 10. */ - { - static char conftest[] = "conftest"; - static char plus[] = "-+"; - char *argv[3] = { conftest, plus, NULL }; - opterr = 0; - if (getopt (2, argv, "+a") != '?') - result |= 1; - } - /* This code succeeds on glibc 2.8, mingw, - and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, - IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ - { - static char program[] = "program"; - static char p[] = "-p"; - static char foo[] = "foo"; - static char bar[] = "bar"; - char *argv[] = { program, p, foo, bar, NULL }; - optind = 1; - if (getopt (4, argv, "p::") != 'p') - result |= 2; - else if (optarg != NULL) - result |= 4; - else if (getopt (4, argv, "p::") != -1) - result |= 6; - else if (optind != 2) - result |= 8; - } - /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ - { - static char program[] = "program"; - static char foo[] = "foo"; - static char p[] = "-p"; - char *argv[] = { program, foo, p, NULL }; - optind = 0; - if (getopt (3, argv, "-p") != 1) - result |= 16; - else if (getopt (3, argv, "-p") != 'p') - result |= 16; - } - /* This code fails on glibc 2.11. */ - { - static char program[] = "program"; - static char b[] = "-b"; - static char a[] = "-a"; - char *argv[] = { program, b, a, NULL }; - optind = opterr = 0; - if (getopt (3, argv, "+:a:b") != 'b') - result |= 32; - else if (getopt (3, argv, "+:a:b") != ':') - result |= 32; - } - /* This code dumps core on glibc 2.14. */ - { - static char program[] = "program"; - static char w[] = "-W"; - static char dummy[] = "dummy"; - char *argv[] = { program, w, dummy, NULL }; - optind = opterr = 1; - if (getopt (3, argv, "W;") != 'W') - result |= 64; - } - return result; + if test $ac_cv_have_decl_fcloseall = no; then + HAVE_DECL_FCLOSEALL=0 + fi - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_getopt_gnu=yes -else - gl_cv_func_getopt_gnu=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_fn_check_decl "$LINENO" "ecvt" "ac_cv_have_decl_ecvt" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_ecvt" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi +printf "%s\n" "#define HAVE_DECL_ECVT $ac_have_decl" >>confdefs.h - case $gl_had_POSIXLY_CORRECT in - exported) ;; - yes) { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;}; POSIXLY_CORRECT=1 ;; - *) { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;} ;; - esac +ac_fn_check_decl "$LINENO" "fcvt" "ac_cv_have_decl_fcvt" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_fcvt" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_FCVT $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "gcvt" "ac_cv_have_decl_gcvt" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_gcvt" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_gnu" >&5 -$as_echo "$gl_cv_func_getopt_gnu" >&6; } - if test "$gl_cv_func_getopt_gnu" != yes; then - gl_replace_getopt=yes - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working GNU getopt_long function" >&5 -$as_echo_n "checking for working GNU getopt_long function... " >&6; } -if ${gl_cv_func_getopt_long_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - openbsd*) gl_cv_func_getopt_long_gnu="guessing no";; - *) gl_cv_func_getopt_long_gnu="guessing yes";; - esac +printf "%s\n" "#define HAVE_DECL_GCVT $ac_have_decl" >>confdefs.h + -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - #include -int -main () -{ -static const struct option long_options[] = - { - { "xtremely-",no_argument, NULL, 1003 }, - { "xtra", no_argument, NULL, 1001 }, - { "xtreme", no_argument, NULL, 1002 }, - { "xtremely", no_argument, NULL, 1003 }, - { NULL, 0, NULL, 0 } - }; - /* This code fails on OpenBSD 5.0. */ - { - static char program[] = "program"; - static char xtremel[] = "--xtremel"; - char *argv[] = { program, xtremel, NULL }; - int option_index; - optind = 1; opterr = 0; - if (getopt_long (2, argv, "", long_options, &option_index) != 1003) - return 1; - } - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_getopt_long_gnu=yes -else - gl_cv_func_getopt_long_gnu=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_long_gnu" >&5 -$as_echo "$gl_cv_func_getopt_long_gnu" >&6; } - case "$gl_cv_func_getopt_long_gnu" in - *yes) ;; - *) gl_replace_getopt=yes ;; - esac - fi - fi + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stdlib_h='<'stdlib.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_stdlib_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop - GNULIB_GETRUSAGE=0; - HAVE_GETRUSAGE=1; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'stdlib.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + gl_cv_absolute_stdlib_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + gl_header=$gl_cv_absolute_stdlib_h + gl_cv_next_stdlib_h='"'$gl_header'"' -: +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdlib_h" >&5 +printf "%s\n" "$gl_cv_next_stdlib_h" >&6; } + fi + NEXT_STDLIB_H=$gl_cv_next_stdlib_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'stdlib.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_stdlib_h + fi + NEXT_AS_FIRST_DIRECTIVE_STDLIB_H=$gl_next_as_first_directive - GNULIB_GETTIMEOFDAY=0; - HAVE_GETTIMEOFDAY=1; - HAVE_STRUCT_TIMEVAL=1; - HAVE_SYS_TIME_H=1; - REPLACE_GETTIMEOFDAY=0; - REPLACE_STRUCT_TIMEVAL=0; -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 -$as_echo_n "checking for C/C++ restrict keyword... " >&6; } -if ${ac_cv_c_restrict+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_restrict=no - # The order here caters to the fact that C++ does not require restrict. - for ac_kw in __restrict __restrict__ _Restrict restrict; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -typedef int *int_ptr; - int foo (int_ptr $ac_kw ip) { return ip[0]; } - int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ - int bar (int ip[$ac_kw]) { return ip[0]; } -int -main () -{ -int s[1]; - int *$ac_kw t = s; - t[0] = 0; - return foo (t) + bar (t); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_restrict=$ac_kw -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_restrict" != no && break - done -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 -$as_echo "$ac_cv_c_restrict" >&6; } - case $ac_cv_c_restrict in - restrict) ;; - no) $as_echo "#define restrict /**/" >>confdefs.h - ;; - *) cat >>confdefs.h <<_ACEOF -#define restrict $ac_cv_c_restrict -_ACEOF - ;; - esac + if test $ac_cv_have_decl_ecvt = no; then + HAVE_DECL_ECVT=0 + fi + + if test $ac_cv_have_decl_fcvt = no; then + HAVE_DECL_FCVT=0 + fi + + if test $ac_cv_have_decl_gcvt = no; then + HAVE_DECL_GCVT=0 + fi + +ac_fn_check_decl "$LINENO" "stpncpy" "ac_cv_have_decl_stpncpy" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_stpncpy" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_STPNCPY $ac_have_decl" >>confdefs.h + + +ac_fn_check_decl "$LINENO" "strdup" "ac_cv_have_decl_strdup" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_strdup" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_STRDUP $ac_have_decl" >>confdefs.h @@ -17152,22 +31006,20 @@ if test $gl_cv_have_include_next = yes; then - gl_cv_next_sys_time_h='<'sys/time.h'>' + gl_cv_next_string_h='<'string.h'>' else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_sys_time_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test $ac_cv_header_sys_time_h = yes; then - + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_string_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; @@ -17183,7 +31035,7 @@ ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'sys/time.h' \ + gl_header_literal_regex=`echo 'string.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ @@ -17192,142 +31044,85 @@ q }' - gl_cv_absolute_sys_time_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + gl_cv_absolute_string_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_sys_time_h - gl_cv_next_sys_time_h='"'$gl_header'"' - else - gl_cv_next_sys_time_h='<'sys/time.h'>' - fi + gl_header=$gl_cv_absolute_string_h + gl_cv_next_string_h='"'$gl_header'"' fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_time_h" >&5 -$as_echo "$gl_cv_next_sys_time_h" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_string_h" >&5 +printf "%s\n" "$gl_cv_next_string_h" >&6; } fi - NEXT_SYS_TIME_H=$gl_cv_next_sys_time_h + NEXT_STRING_H=$gl_cv_next_string_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'sys/time.h'>' + gl_next_as_first_directive='<'string.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_sys_time_h + gl_next_as_first_directive=$gl_cv_next_string_h fi - NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H=$gl_next_as_first_directive + NEXT_AS_FIRST_DIRECTIVE_STRING_H=$gl_next_as_first_directive - if test $ac_cv_header_sys_time_h != yes; then - HAVE_SYS_TIME_H=0 - fi - if test $ac_cv_header_sys_socket_h != yes; then - for ac_header in winsock2.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" -if test "x$ac_cv_header_winsock2_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_WINSOCK2_H 1 -_ACEOF +ac_fn_check_decl "$LINENO" "strndup" "ac_cv_have_decl_strndup" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_strndup" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi +printf "%s\n" "#define HAVE_DECL_STRNDUP $ac_have_decl" >>confdefs.h -done - fi - if test "$ac_cv_header_winsock2_h" = yes; then - HAVE_WINSOCK2_H=1 - UNISTD_H_HAVE_WINSOCK2_H=1 - SYS_IOCTL_H_HAVE_WINSOCK2_H=1 - else - HAVE_WINSOCK2_H=0 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timeval" >&5 -$as_echo_n "checking for struct timeval... " >&6; } -if ${gl_cv_sys_struct_timeval+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if HAVE_SYS_TIME_H - #include - #endif - #include - #if HAVE_WINSOCK2_H - # include - #endif -int -main () -{ -static struct timeval x; x.tv_sec = x.tv_usec; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_sys_struct_timeval=yes -else - gl_cv_sys_struct_timeval=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timeval" >&5 -$as_echo "$gl_cv_sys_struct_timeval" >&6; } - if test $gl_cv_sys_struct_timeval != yes; then - HAVE_STRUCT_TIMEVAL=0 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wide-enough struct timeval.tv_sec member" >&5 -$as_echo_n "checking for wide-enough struct timeval.tv_sec member... " >&6; } -if ${gl_cv_sys_struct_timeval_tv_sec+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if HAVE_SYS_TIME_H - #include - #endif - #include - #if HAVE_WINSOCK2_H - # include - #endif + if test $ac_cv_header_sys_ioctl_h = yes; then + HAVE_SYS_IOCTL_H=1 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether declares ioctl" >&5 +printf %s "checking whether declares ioctl... " >&6; } +if test ${gl_cv_decl_ioctl_in_sys_ioctl_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include int -main () +main (void) { -static struct timeval x; - typedef int verify_tv_sec_type[ - sizeof (time_t) <= sizeof x.tv_sec ? 1 : -1 - ]; - +(void) ioctl; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_sys_struct_timeval_tv_sec=yes -else - gl_cv_sys_struct_timeval_tv_sec=no +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_decl_ioctl_in_sys_ioctl_h=yes +else $as_nop + gl_cv_decl_ioctl_in_sys_ioctl_h=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timeval_tv_sec" >&5 -$as_echo "$gl_cv_sys_struct_timeval_tv_sec" >&6; } - if test $gl_cv_sys_struct_timeval_tv_sec != yes; then - REPLACE_STRUCT_TIMEVAL=1 - fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_ioctl_in_sys_ioctl_h" >&5 +printf "%s\n" "$gl_cv_decl_ioctl_in_sys_ioctl_h" >&6; } + else + HAVE_SYS_IOCTL_H=0 fi @@ -17338,66 +31133,25 @@ - NEED_LOCALTIME_BUFFER=0 - - - GNULIB_CTIME=0; - GNULIB_MKTIME=0; - GNULIB_LOCALTIME=0; - GNULIB_NANOSLEEP=0; - GNULIB_STRFTIME=0; - GNULIB_STRPTIME=0; - GNULIB_TIMEGM=0; - GNULIB_TIME_R=0; - GNULIB_TIME_RZ=0; - GNULIB_TZSET=0; - HAVE_DECL_LOCALTIME_R=1; - HAVE_NANOSLEEP=1; - HAVE_STRPTIME=1; - HAVE_TIMEGM=1; - HAVE_TZSET=1; - HAVE_TIMEZONE_T=0; - REPLACE_CTIME=GNULIB_PORTCHECK; - REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; - REPLACE_MKTIME=GNULIB_PORTCHECK; - REPLACE_NANOSLEEP=GNULIB_PORTCHECK; - REPLACE_STRFTIME=GNULIB_PORTCHECK; - REPLACE_TIMEGM=GNULIB_PORTCHECK; - REPLACE_TZSET=GNULIB_PORTCHECK; - - : ${GNULIB_GETTIMEOFDAY=0}; - REPLACE_GMTIME=0; - REPLACE_LOCALTIME=0; - - - - - - - - - - - - if test $gl_cv_have_include_next = yes; then - gl_cv_next_limits_h='<'limits.h'>' + gl_cv_next_sys_ioctl_h='<'sys/ioctl.h'>' else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_limits_h+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_sys_ioctl_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop - if test $ac_cv_header_limits_h = yes; then + if test $ac_cv_header_sys_ioctl_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; @@ -17413,7 +31167,7 @@ ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'limits.h' \ + gl_header_literal_regex=`echo 'sys/ioctl.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ @@ -17422,85 +31176,30 @@ q }' - gl_cv_absolute_limits_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + gl_cv_absolute_sys_ioctl_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_limits_h - gl_cv_next_limits_h='"'$gl_header'"' + gl_header=$gl_cv_absolute_sys_ioctl_h + gl_cv_next_sys_ioctl_h='"'$gl_header'"' else - gl_cv_next_limits_h='<'limits.h'>' + gl_cv_next_sys_ioctl_h='<'sys/ioctl.h'>' fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_limits_h" >&5 -$as_echo "$gl_cv_next_limits_h" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_ioctl_h" >&5 +printf "%s\n" "$gl_cv_next_sys_ioctl_h" >&6; } fi - NEXT_LIMITS_H=$gl_cv_next_limits_h + NEXT_SYS_IOCTL_H=$gl_cv_next_sys_ioctl_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'limits.h'>' + gl_next_as_first_directive='<'sys/ioctl.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_limits_h + gl_next_as_first_directive=$gl_cv_next_sys_ioctl_h fi - NEXT_AS_FIRST_DIRECTIVE_LIMITS_H=$gl_next_as_first_directive - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc." >&5 -$as_echo_n "checking whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc.... " >&6; } -if ${gl_cv_header_limits_width+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ - #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 - #endif - #include - long long llm = LLONG_MAX; - int wb = WORD_BIT; - int ullw = ULLONG_WIDTH; - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_limits_width=yes -else - gl_cv_header_limits_width=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_limits_width" >&5 -$as_echo "$gl_cv_header_limits_width" >&6; } - if test "$gl_cv_header_limits_width" = yes; then - LIMITS_H= - else - LIMITS_H=limits.h - fi - - if test -n "$LIMITS_H"; then - GL_GENERATE_LIMITS_H_TRUE= - GL_GENERATE_LIMITS_H_FALSE='#' -else - GL_GENERATE_LIMITS_H_TRUE='#' - GL_GENERATE_LIMITS_H_FALSE= -fi - - - - - + NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H=$gl_next_as_first_directive @@ -17508,32 +31207,15 @@ -$as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h -$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h - - if test $ac_cv_header_wchar_h = yes; then - HAVE_WCHAR_H=1 - else - HAVE_WCHAR_H=0 - fi + GL_GNULIB_IOCTL=0 - if test $ac_cv_header_inttypes_h = yes; then - HAVE_INTTYPES_H=1 - else - HAVE_INTTYPES_H=0 - fi - if test $ac_cv_header_sys_types_h = yes; then - HAVE_SYS_TYPES_H=1 - else - HAVE_SYS_TYPES_H=0 - fi @@ -17546,22 +31228,23 @@ if test $gl_cv_have_include_next = yes; then - gl_cv_next_stdint_h='<'stdint.h'>' + gl_cv_next_sys_resource_h='<'sys/resource.h'>' else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_stdint_h+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_sys_resource_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop - if test $ac_cv_header_stdint_h = yes; then + if test $ac_cv_header_sys_resource_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; @@ -17577,7 +31260,7 @@ ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'stdint.h' \ + gl_header_literal_regex=`echo 'sys/resource.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ @@ -17586,763 +31269,247 @@ q }' - gl_cv_absolute_stdint_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + gl_cv_absolute_sys_resource_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_stdint_h - gl_cv_next_stdint_h='"'$gl_header'"' + gl_header=$gl_cv_absolute_sys_resource_h + gl_cv_next_sys_resource_h='"'$gl_header'"' else - gl_cv_next_stdint_h='<'stdint.h'>' + gl_cv_next_sys_resource_h='<'sys/resource.h'>' fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdint_h" >&5 -$as_echo "$gl_cv_next_stdint_h" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_resource_h" >&5 +printf "%s\n" "$gl_cv_next_sys_resource_h" >&6; } fi - NEXT_STDINT_H=$gl_cv_next_stdint_h + NEXT_SYS_RESOURCE_H=$gl_cv_next_sys_resource_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'stdint.h'>' + gl_next_as_first_directive='<'sys/resource.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_stdint_h + gl_next_as_first_directive=$gl_cv_next_sys_resource_h fi - NEXT_AS_FIRST_DIRECTIVE_STDINT_H=$gl_next_as_first_directive + NEXT_AS_FIRST_DIRECTIVE_SYS_RESOURCE_H=$gl_next_as_first_directive - if test $ac_cv_header_stdint_h = yes; then - HAVE_STDINT_H=1 + if test $ac_cv_header_sys_resource_h = yes; then + HAVE_SYS_RESOURCE_H=1 else - HAVE_STDINT_H=0 + HAVE_SYS_RESOURCE_H=0 fi - if test $ac_cv_header_stdint_h = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h conforms to C99" >&5 -$as_echo_n "checking whether stdint.h conforms to C99... " >&6; } -if ${gl_cv_header_working_stdint_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_header_working_stdint_h=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ -#define __STDC_CONSTANT_MACROS 1 -#define __STDC_LIMIT_MACROS 1 -#include -/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ -#if !(defined WCHAR_MIN && defined WCHAR_MAX) -#error "WCHAR_MIN, WCHAR_MAX not defined in " -#endif - - - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif - - -#ifdef INT8_MAX -int8_t a1 = INT8_MAX; -int8_t a1min = INT8_MIN; -#endif -#ifdef INT16_MAX -int16_t a2 = INT16_MAX; -int16_t a2min = INT16_MIN; -#endif -#ifdef INT32_MAX -int32_t a3 = INT32_MAX; -int32_t a3min = INT32_MIN; -#endif -#ifdef INT64_MAX -int64_t a4 = INT64_MAX; -int64_t a4min = INT64_MIN; -#endif -#ifdef UINT8_MAX -uint8_t b1 = UINT8_MAX; -#else -typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; -#endif -#ifdef UINT16_MAX -uint16_t b2 = UINT16_MAX; -#endif -#ifdef UINT32_MAX -uint32_t b3 = UINT32_MAX; -#endif -#ifdef UINT64_MAX -uint64_t b4 = UINT64_MAX; -#endif -int_least8_t c1 = INT8_C (0x7f); -int_least8_t c1max = INT_LEAST8_MAX; -int_least8_t c1min = INT_LEAST8_MIN; -int_least16_t c2 = INT16_C (0x7fff); -int_least16_t c2max = INT_LEAST16_MAX; -int_least16_t c2min = INT_LEAST16_MIN; -int_least32_t c3 = INT32_C (0x7fffffff); -int_least32_t c3max = INT_LEAST32_MAX; -int_least32_t c3min = INT_LEAST32_MIN; -int_least64_t c4 = INT64_C (0x7fffffffffffffff); -int_least64_t c4max = INT_LEAST64_MAX; -int_least64_t c4min = INT_LEAST64_MIN; -uint_least8_t d1 = UINT8_C (0xff); -uint_least8_t d1max = UINT_LEAST8_MAX; -uint_least16_t d2 = UINT16_C (0xffff); -uint_least16_t d2max = UINT_LEAST16_MAX; -uint_least32_t d3 = UINT32_C (0xffffffff); -uint_least32_t d3max = UINT_LEAST32_MAX; -uint_least64_t d4 = UINT64_C (0xffffffffffffffff); -uint_least64_t d4max = UINT_LEAST64_MAX; -int_fast8_t e1 = INT_FAST8_MAX; -int_fast8_t e1min = INT_FAST8_MIN; -int_fast16_t e2 = INT_FAST16_MAX; -int_fast16_t e2min = INT_FAST16_MIN; -int_fast32_t e3 = INT_FAST32_MAX; -int_fast32_t e3min = INT_FAST32_MIN; -int_fast64_t e4 = INT_FAST64_MAX; -int_fast64_t e4min = INT_FAST64_MIN; -uint_fast8_t f1 = UINT_FAST8_MAX; -uint_fast16_t f2 = UINT_FAST16_MAX; -uint_fast32_t f3 = UINT_FAST32_MAX; -uint_fast64_t f4 = UINT_FAST64_MAX; -#ifdef INTPTR_MAX -intptr_t g = INTPTR_MAX; -intptr_t gmin = INTPTR_MIN; -#endif -#ifdef UINTPTR_MAX -uintptr_t h = UINTPTR_MAX; -#endif -intmax_t i = INTMAX_MAX; -uintmax_t j = UINTMAX_MAX; - -/* Check that SIZE_MAX has the correct type, if possible. */ -#if 201112 <= __STDC_VERSION__ -int k = _Generic (SIZE_MAX, size_t: 0); -#elif (2 <= __GNUC__ || defined __IBM__TYPEOF__ \ - || (0x5110 <= __SUNPRO_C && !__STDC__)) -extern size_t k; -extern __typeof__ (SIZE_MAX) k; -#endif - -#include /* for CHAR_BIT */ -#define TYPE_MINIMUM(t) \ - ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) -#define TYPE_MAXIMUM(t) \ - ((t) ((t) 0 < (t) -1 \ - ? (t) -1 \ - : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) -struct s { - int check_PTRDIFF: - PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) - && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) - ? 1 : -1; - /* Detect bug in FreeBSD 6.0 / ia64. */ - int check_SIG_ATOMIC: - SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) - && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) - ? 1 : -1; - int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; - int check_WCHAR: - WCHAR_MIN == TYPE_MINIMUM (wchar_t) - && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) - ? 1 : -1; - /* Detect bug in mingw. */ - int check_WINT: - WINT_MIN == TYPE_MINIMUM (wint_t) - && WINT_MAX == TYPE_MAXIMUM (wint_t) - ? 1 : -1; - - /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ - int check_UINT8_C: - (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; - int check_UINT16_C: - (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; - - /* Detect bugs in OpenBSD 3.9 stdint.h. */ -#ifdef UINT8_MAX - int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; -#endif -#ifdef UINT16_MAX - int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; -#endif -#ifdef UINT32_MAX - int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; -#endif -#ifdef UINT64_MAX - int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; -#endif - int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; - int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; - int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; - int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; - int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; - int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; - int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; - int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; - int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; - int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; - int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; -}; - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on native Windows. - mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; - # In general, assume it works. - *) gl_cv_header_working_stdint_h="guessing yes" ;; - esac - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ -#define __STDC_CONSTANT_MACROS 1 -#define __STDC_LIMIT_MACROS 1 -#include - - - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif - - -#include -#include -#define MVAL(macro) MVAL1(macro) -#define MVAL1(expression) #expression -static const char *macro_values[] = - { -#ifdef INT8_MAX - MVAL (INT8_MAX), -#endif -#ifdef INT16_MAX - MVAL (INT16_MAX), -#endif -#ifdef INT32_MAX - MVAL (INT32_MAX), -#endif -#ifdef INT64_MAX - MVAL (INT64_MAX), -#endif -#ifdef UINT8_MAX - MVAL (UINT8_MAX), -#endif -#ifdef UINT16_MAX - MVAL (UINT16_MAX), -#endif -#ifdef UINT32_MAX - MVAL (UINT32_MAX), -#endif -#ifdef UINT64_MAX - MVAL (UINT64_MAX), -#endif - NULL - }; - -int -main () -{ - const char **mv; - for (mv = macro_values; *mv != NULL; mv++) - { - const char *value = *mv; - /* Test whether it looks like a cast expression. */ - if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 - || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 - || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 - || strncmp (value, "((int)"/*)*/, 6) == 0 - || strncmp (value, "((signed short)"/*)*/, 15) == 0 - || strncmp (value, "((signed char)"/*)*/, 14) == 0) - return mv - macro_values + 1; - } - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_header_working_stdint_h=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_stdint_h" >&5 -$as_echo "$gl_cv_header_working_stdint_h" >&6; } - fi + HAVE_STRUCT_TMS=1; + HAVE_TIMES=1; - HAVE_C99_STDINT_H=0 - HAVE_SYS_BITYPES_H=0 - HAVE_SYS_INTTYPES_H=0 - STDINT_H=stdint.h - case "$gl_cv_header_working_stdint_h" in - *yes) - HAVE_C99_STDINT_H=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h predates C++11" >&5 -$as_echo_n "checking whether stdint.h predates C++11... " >&6; } -if ${gl_cv_header_stdint_predates_cxx11_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_header_stdint_predates_cxx11_h=yes - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ -#include - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif -intmax_t im = INTMAX_MAX; -int32_t i32 = INT32_C (0x7fffffff); -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_stdint_predates_cxx11_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_predates_cxx11_h" >&5 -$as_echo "$gl_cv_header_stdint_predates_cxx11_h" >&6; } - if test "$gl_cv_header_stdint_predates_cxx11_h" = yes; then -$as_echo "#define __STDC_CONSTANT_MACROS 1" >>confdefs.h -$as_echo "#define __STDC_LIMIT_MACROS 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h has UINTMAX_WIDTH etc." >&5 -$as_echo_n "checking whether stdint.h has UINTMAX_WIDTH etc.... " >&6; } -if ${gl_cv_header_stdint_width+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_header_stdint_width=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sys_times_h='<'sys/times.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_sys_times_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop - /* Work if build is not clean. */ - #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 - #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ - #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 - #endif - #include + if test $ac_cv_header_sys_times_h = yes; then - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif - int iw = UINTMAX_WIDTH; -int -main () -{ - ; - return 0; -} + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_stdint_width=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_width" >&5 -$as_echo "$gl_cv_header_stdint_width" >&6; } - if test "$gl_cv_header_stdint_width" = yes; then - STDINT_H= - fi + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' ;; *) - for ac_header in sys/inttypes.h sys/bitypes.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'sys/times.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' -fi + gl_cv_absolute_sys_times_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` -done + gl_header=$gl_cv_absolute_sys_times_h + gl_cv_next_sys_times_h='"'$gl_header'"' + else + gl_cv_next_sys_times_h='<'sys/times.h'>' + fi - if test $ac_cv_header_sys_inttypes_h = yes; then - HAVE_SYS_INTTYPES_H=1 - fi - if test $ac_cv_header_sys_bitypes_h = yes; then - HAVE_SYS_BITYPES_H=1 - fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_times_h" >&5 +printf "%s\n" "$gl_cv_next_sys_times_h" >&6; } + fi + NEXT_SYS_TIMES_H=$gl_cv_next_sys_times_h - if test $APPLE_UNIVERSAL_BUILD = 0; then + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'sys/times.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_sys_times_h + fi + NEXT_AS_FIRST_DIRECTIVE_SYS_TIMES_H=$gl_next_as_first_directive - for gltype in ptrdiff_t size_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 -$as_echo_n "checking for bit size of $gltype... " >&6; } -if eval \${gl_cv_bitsizeof_${gltype}+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif -#include "; then : -else - result=unknown -fi + if test $ac_cv_header_sys_times_h = yes; then + HAVE_SYS_TIMES_H=1 + ac_fn_c_check_type "$LINENO" "struct tms" "ac_cv_type_struct_tms" " +#include - eval gl_cv_bitsizeof_${gltype}=\$result +" +if test "x$ac_cv_type_struct_tms" = xyes +then : -fi -eval ac_res=\$gl_cv_bitsizeof_${gltype} - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval result=\$gl_cv_bitsizeof_${gltype} - if test $result = unknown; then - result=0 - fi - GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - cat >>confdefs.h <<_ACEOF -#define BITSIZEOF_${GLTYPE} $result -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_TMS 1" >>confdefs.h - eval BITSIZEOF_${GLTYPE}=\$result - done +else $as_nop + HAVE_STRUCT_TMS=0 +fi + else + HAVE_SYS_TIMES_H=0 + HAVE_STRUCT_TMS=0 fi - for gltype in sig_atomic_t wchar_t wint_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 -$as_echo_n "checking for bit size of $gltype... " >&6; } -if eval \${gl_cv_bitsizeof_${gltype}+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif -#include "; then : -else - result=unknown -fi - eval gl_cv_bitsizeof_${gltype}=\$result -fi -eval ac_res=\$gl_cv_bitsizeof_${gltype} - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval result=\$gl_cv_bitsizeof_${gltype} - if test $result = unknown; then - result=0 - fi - GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - cat >>confdefs.h <<_ACEOF -#define BITSIZEOF_${GLTYPE} $result -_ACEOF - eval BITSIZEOF_${GLTYPE}=\$result - done + GL_GNULIB_TIMES=0 - for gltype in sig_atomic_t wchar_t wint_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gltype is signed" >&5 -$as_echo_n "checking whether $gltype is signed... " >&6; } -if eval \${gl_cv_type_${gltype}_signed+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif - int verify[2 * (($gltype) -1 < ($gltype) 0) - 1]; -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - result=yes -else - result=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval gl_cv_type_${gltype}_signed=\$result -fi -eval ac_res=\$gl_cv_type_${gltype}_signed - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval result=\$gl_cv_type_${gltype}_signed - GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - if test "$result" = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_SIGNED_${GLTYPE} 1 -_ACEOF - eval HAVE_SIGNED_${GLTYPE}=1 - else - eval HAVE_SIGNED_${GLTYPE}=0 - fi - done - gl_cv_type_ptrdiff_t_signed=yes - gl_cv_type_size_t_signed=no - if test $APPLE_UNIVERSAL_BUILD = 0; then - for gltype in ptrdiff_t size_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 -$as_echo_n "checking for $gltype integer literal suffix... " >&6; } -if eval \${gl_cv_type_${gltype}_suffix+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval gl_cv_type_${gltype}_suffix=no - eval result=\$gl_cv_type_${gltype}_signed - if test "$result" = yes; then - glsufu= - else - glsufu=u - fi - for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do - case $glsuf in - '') gltype1='int';; - l) gltype1='long int';; - ll) gltype1='long long int';; - i64) gltype1='__int64';; - u) gltype1='unsigned int';; - ul) gltype1='unsigned long int';; - ull) gltype1='unsigned long long int';; - ui64)gltype1='unsigned __int64';; - esac - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif - extern $gltype foo; - extern $gltype1 foo; -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval gl_cv_type_${gltype}_suffix=\$glsuf -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" != no && break - done -fi -eval ac_res=\$gl_cv_type_${gltype}_suffix - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" = no && result= - eval ${GLTYPE}_SUFFIX=\$result - cat >>confdefs.h <<_ACEOF -#define ${GLTYPE}_SUFFIX $result -_ACEOF +printf "%s\n" "#define _USE_STD_STAT 1" >>confdefs.h - done - fi - for gltype in sig_atomic_t wchar_t wint_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 -$as_echo_n "checking for $gltype integer literal suffix... " >&6; } -if eval \${gl_cv_type_${gltype}_suffix+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval gl_cv_type_${gltype}_suffix=no - eval result=\$gl_cv_type_${gltype}_signed - if test "$result" = yes; then - glsufu= - else - glsufu=u - fi - for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do - case $glsuf in - '') gltype1='int';; - l) gltype1='long int';; - ll) gltype1='long long int';; - i64) gltype1='__int64';; - u) gltype1='unsigned int';; - ul) gltype1='unsigned long int';; - ull) gltype1='unsigned long long int';; - ui64)gltype1='unsigned __int64';; - esac - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif - extern $gltype foo; - extern $gltype1 foo; -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval gl_cv_type_${gltype}_suffix=\$glsuf -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" != no && break - done -fi -eval ac_res=\$gl_cv_type_${gltype}_suffix - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" = no && result= - eval ${GLTYPE}_SUFFIX=\$result - cat >>confdefs.h <<_ACEOF -#define ${GLTYPE}_SUFFIX $result -_ACEOF - done + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sys_types_h='<'sys/types.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_sys_types_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop - if test $GNULIB_OVERRIDES_WINT_T = 1; then - BITSIZEOF_WINT_T=32 - fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' ;; esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'sys/types.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + gl_cv_absolute_sys_types_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_sys_types_h + gl_cv_next_sys_types_h='"'$gl_header'"' - LIMITS_H='limits.h' - if test -n "$LIMITS_H"; then - GL_GENERATE_LIMITS_H_TRUE= - GL_GENERATE_LIMITS_H_FALSE='#' -else - GL_GENERATE_LIMITS_H_TRUE='#' - GL_GENERATE_LIMITS_H_FALSE= fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_types_h" >&5 +printf "%s\n" "$gl_cv_next_sys_types_h" >&6; } + fi + NEXT_SYS_TYPES_H=$gl_cv_next_sys_types_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'sys/types.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_sys_types_h + fi + NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H=$gl_next_as_first_directive @@ -18350,35 +31517,17 @@ - if test -n "$STDINT_H"; then - GL_GENERATE_STDINT_H_TRUE= - GL_GENERATE_STDINT_H_FALSE='#' -else - GL_GENERATE_STDINT_H_TRUE='#' - GL_GENERATE_STDINT_H_FALSE= -fi - GNULIB_IMAXABS=0; - GNULIB_IMAXDIV=0; - GNULIB_STRTOIMAX=0; - GNULIB_STRTOUMAX=0; - HAVE_DECL_IMAXABS=1; - HAVE_DECL_IMAXDIV=1; - HAVE_DECL_STRTOIMAX=1; - HAVE_DECL_STRTOUMAX=1; - HAVE_IMAXDIV_T=1; - REPLACE_STRTOIMAX=0; - REPLACE_STRTOUMAX=0; - INT32_MAX_LT_INTMAX_MAX=1; - INT64_MAX_EQ_LONG_MAX='defined _LP64'; - PRI_MACROS_BROKEN=0; - PRIPTR_PREFIX=__PRIPTR_PREFIX; - UINT32_MAX_LT_UINTMAX_MAX=1; - UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; + WINDOWS_STAT_INODES=0 + + + + + @@ -18395,22 +31544,23 @@ if test $gl_cv_have_include_next = yes; then - gl_cv_next_inttypes_h='<'inttypes.h'>' + gl_cv_next_sys_wait_h='<'sys/wait.h'>' else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_inttypes_h+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_sys_wait_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop - if test $ac_cv_header_inttypes_h = yes; then + if test $ac_cv_header_sys_wait_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; @@ -18426,7 +31576,7 @@ ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'inttypes.h' \ + gl_header_literal_regex=`echo 'sys/wait.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ @@ -18435,33 +31585,30 @@ q }' - gl_cv_absolute_inttypes_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + gl_cv_absolute_sys_wait_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_inttypes_h - gl_cv_next_inttypes_h='"'$gl_header'"' + gl_header=$gl_cv_absolute_sys_wait_h + gl_cv_next_sys_wait_h='"'$gl_header'"' else - gl_cv_next_inttypes_h='<'inttypes.h'>' + gl_cv_next_sys_wait_h='<'sys/wait.h'>' fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_inttypes_h" >&5 -$as_echo "$gl_cv_next_inttypes_h" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_wait_h" >&5 +printf "%s\n" "$gl_cv_next_sys_wait_h" >&6; } fi - NEXT_INTTYPES_H=$gl_cv_next_inttypes_h + NEXT_SYS_WAIT_H=$gl_cv_next_sys_wait_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'inttypes.h'>' + gl_next_as_first_directive='<'sys/wait.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_inttypes_h + gl_next_as_first_directive=$gl_cv_next_sys_wait_h fi - NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H=$gl_next_as_first_directive - - - + NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H=$gl_next_as_first_directive @@ -18471,785 +31618,455 @@ - for ac_header in inttypes.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default" -if test "x$ac_cv_header_inttypes_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_INTTYPES_H 1 -_ACEOF -fi -done - if test $ac_cv_header_inttypes_h = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the inttypes.h PRIxNN macros are broken" >&5 -$as_echo_n "checking whether the inttypes.h PRIxNN macros are broken... " >&6; } -if ${gt_cv_inttypes_pri_broken+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + GL_GNULIB_WAITPID=0 -#include -#ifdef PRId32 -char *p = PRId32; -#endif -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gt_cv_inttypes_pri_broken=no -else - gt_cv_inttypes_pri_broken=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_inttypes_pri_broken" >&5 -$as_echo "$gt_cv_inttypes_pri_broken" >&6; } - fi - if test "$gt_cv_inttypes_pri_broken" = yes; then + HAVE_DECL_TCGETSID=1; + HAVE_TERMIOS_H=1; -cat >>confdefs.h <<_ACEOF -#define PRI_MACROS_BROKEN 1 -_ACEOF - PRI_MACROS_BROKEN=1 - else - PRI_MACROS_BROKEN=0 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'float'" >&5 -$as_echo_n "checking where to find the exponent in a 'float'... " >&6; } -if ${gl_cv_cc_float_expbit0+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - gl_cv_cc_float_expbit0="word 0 bit 23" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -#define NWORDS \ - ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { float value; unsigned int word[NWORDS]; } memory_float; -static unsigned int ored_words[NWORDS]; -static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (float x) -{ - memory_float m; - size_t i; - /* Clear it first, in case - sizeof (float) < sizeof (memory_float). */ - memset (&m, 0, sizeof (memory_float)); - m.value = x; - for (i = 0; i < NWORDS; i++) - { - ored_words[i] |= m.word[i]; - anded_words[i] &= m.word[i]; - } -} -int main () -{ - size_t j; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) - return 1; - for (j = 0; j < NWORDS; j++) - anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25f); - add_to_ored_words (0.5f); - add_to_ored_words (1.0f); - add_to_ored_words (2.0f); - add_to_ored_words (4.0f); - /* Remove bits that are common (e.g. if representation of the first mantissa - bit is explicit). */ - for (j = 0; j < NWORDS; j++) - ored_words[j] &= ~anded_words[j]; - /* Now find the nonzero word. */ - for (j = 0; j < NWORDS; j++) - if (ored_words[j] != 0) - break; - if (j < NWORDS) - { - size_t i; - for (i = j + 1; i < NWORDS; i++) - if (ored_words[i] != 0) - { - fprintf (fp, "unknown"); - return (fclose (fp) != 0); - } - for (i = 0; ; i++) - if ((ored_words[j] >> i) & 1) - { - fprintf (fp, "word %d bit %d", (int) j, (int) i); - return (fclose (fp) != 0); - } - } - fprintf (fp, "unknown"); - return (fclose (fp) != 0); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_cc_float_expbit0=`cat conftest.out` -else - gl_cv_cc_float_expbit0="unknown" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - rm -f conftest.out -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_float_expbit0" >&5 -$as_echo "$gl_cv_cc_float_expbit0" >&6; } - case "$gl_cv_cc_float_expbit0" in - word*bit*) - word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` -cat >>confdefs.h <<_ACEOF -#define FLT_EXPBIT0_WORD $word -_ACEOF -cat >>confdefs.h <<_ACEOF -#define FLT_EXPBIT0_BIT $bit -_ACEOF - ;; - esac + if test $gl_cv_have_include_next = yes; then + gl_cv_next_termios_h='<'termios.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_termios_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test $ac_cv_header_termios_h = yes; then - ISNANF_LIBM= - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) can be used without linking with libm" >&5 -$as_echo_n "checking whether isnan(float) can be used without linking with libm... " >&6; } -if ${gl_cv_func_isnanf_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #if __GNUC__ >= 4 - # undef isnanf - # define isnanf(x) __builtin_isnanf ((float)(x)) - #elif defined isnan - # undef isnanf - # define isnanf(x) isnan ((float)(x)) - #endif - float x; -int -main () -{ -return isnanf (x); - ; - return 0; -} +#include _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_isnanf_no_libm=yes -else - gl_cv_func_isnanf_no_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_no_libm" >&5 -$as_echo "$gl_cv_func_isnanf_no_libm" >&6; } + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'termios.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' - if test $gl_cv_func_isnanf_no_libm = no; then + gl_cv_absolute_termios_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) can be used with libm" >&5 -$as_echo_n "checking whether isnan(float) can be used with libm... " >&6; } -if ${gl_cv_func_isnanf_in_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else + gl_header=$gl_cv_absolute_termios_h + gl_cv_next_termios_h='"'$gl_header'"' + else + gl_cv_next_termios_h='<'termios.h'>' + fi - save_LIBS="$LIBS" - LIBS="$LIBS -lm" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #if __GNUC__ >= 4 - # undef isnanf - # define isnanf(x) __builtin_isnanf ((float)(x)) - #elif defined isnan - # undef isnanf - # define isnanf(x) isnan ((float)(x)) - #endif - float x; -int -main () -{ -return isnanf (x); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_isnanf_in_libm=yes -else - gl_cv_func_isnanf_in_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$save_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_in_libm" >&5 -$as_echo "$gl_cv_func_isnanf_in_libm" >&6; } - - if test $gl_cv_func_isnanf_in_libm = yes; then - ISNANF_LIBM=-lm - fi - fi - if test $gl_cv_func_isnanf_no_libm = yes \ - || test $gl_cv_func_isnanf_in_libm = yes; then - save_LIBS="$LIBS" - LIBS="$LIBS $ISNANF_LIBM" - +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_termios_h" >&5 +printf "%s\n" "$gl_cv_next_termios_h" >&6; } + fi + NEXT_TERMIOS_H=$gl_cv_next_termios_h + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'termios.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_termios_h + fi + NEXT_AS_FIRST_DIRECTIVE_TERMIOS_H=$gl_next_as_first_directive - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) works" >&5 -$as_echo_n "checking whether isnan(float) works... " >&6; } -if ${gl_cv_func_isnanf_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - irix* | solaris*) gl_cv_func_isnanf_works="guessing no" ;; - mingw*) # Guess yes on mingw, no on MSVC. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __MINGW32__ - Known -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_isnanf_works="guessing yes" -else - gl_cv_func_isnanf_works="guessing no" -fi -rm -f conftest* + if test $ac_cv_header_termios_h != yes; then + HAVE_TERMIOS_H=0 + fi - ;; - *) gl_cv_func_isnanf_works="guessing yes" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#if __GNUC__ >= 4 -# undef isnanf -# define isnanf(x) __builtin_isnanf ((float)(x)) -#elif defined isnan -# undef isnanf -# define isnanf(x) isnan ((float)(x)) -#endif -/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ -#ifdef __DECC -static float -NaN () -{ - static float zero = 0.0f; - return zero / zero; -} -#else -# define NaN() (0.0f / 0.0f) -#endif -#define NWORDS \ - ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { unsigned int word[NWORDS]; float value; } memory_float; -int main() -{ - int result = 0; - if (isnanf (1.0f / 0.0f)) - result |= 1; - if (!isnanf (NaN ())) - result |= 2; -#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT - /* The isnanf function should be immune against changes in the sign bit and - in the mantissa bits. The xor operation twiddles a bit that can only be - a sign bit or a mantissa bit. */ - if (FLT_EXPBIT0_WORD == 0 && FLT_EXPBIT0_BIT > 0) - { - memory_float m; - m.value = NaN (); - /* Set the bits below the exponent to 01111...111. */ - m.word[0] &= -1U << FLT_EXPBIT0_BIT; - m.word[0] |= 1U << (FLT_EXPBIT0_BIT - 1) - 1; - if (!isnanf (m.value)) - result |= 4; - } -#endif - return result; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_isnanf_works=yes -else - gl_cv_func_isnanf_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + GL_GNULIB_TCGETSID=0 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_works" >&5 -$as_echo "$gl_cv_func_isnanf_works" >&6; } - LIBS="$save_LIBS" - case "$gl_cv_func_isnanf_works" in - *yes) gl_func_isnanf=yes ;; - *) gl_func_isnanf=no; ISNANF_LIBM= ;; - esac - else - gl_func_isnanf=no - fi - if test $gl_func_isnanf != yes; then - HAVE_ISNANF=0 - fi + HAVE_DECL_LOCALTIME_R=1; + HAVE_NANOSLEEP=1; + HAVE_STRPTIME=1; + HAVE_TIMEGM=1; + HAVE_TIMESPEC_GET=1; + HAVE_TIMEZONE_T=0; + REPLACE_CTIME=GNULIB_PORTCHECK; + REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; + REPLACE_MKTIME=GNULIB_PORTCHECK; + REPLACE_NANOSLEEP=GNULIB_PORTCHECK; + REPLACE_STRFTIME=GNULIB_PORTCHECK; + REPLACE_TIMEGM=GNULIB_PORTCHECK; + REPLACE_TZSET=GNULIB_PORTCHECK; + : ${GNULIB_GETTIMEOFDAY=0}; + REPLACE_GMTIME=0; + REPLACE_LOCALTIME=0; - ISNAND_LIBM= - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(double) can be used without linking with libm" >&5 -$as_echo_n "checking whether isnan(double) can be used without linking with libm... " >&6; } -if ${gl_cv_func_isnand_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timespec in " >&5 +printf %s "checking for struct timespec in ... " >&6; } +if test ${gl_cv_sys_struct_timespec_in_time_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #if __GNUC__ >= 4 - # undef isnand - # define isnand(x) __builtin_isnan ((double)(x)) - #else - # undef isnand - # define isnand(x) isnan ((double)(x)) - #endif - double x; +#include + int -main () +main (void) { -return isnand (x); +static struct timespec x; x.tv_sec = x.tv_nsec; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_isnand_no_libm=yes -else - gl_cv_func_isnand_no_libm=no +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_sys_struct_timespec_in_time_h=yes +else $as_nop + gl_cv_sys_struct_timespec_in_time_h=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnand_no_libm" >&5 -$as_echo "$gl_cv_func_isnand_no_libm" >&6; } - - if test $gl_cv_func_isnand_no_libm = no; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(double) can be used with libm" >&5 -$as_echo_n "checking whether isnan(double) can be used with libm... " >&6; } -if ${gl_cv_func_isnand_in_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_time_h" >&5 +printf "%s\n" "$gl_cv_sys_struct_timespec_in_time_h" >&6; } - save_LIBS="$LIBS" - LIBS="$LIBS -lm" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + TIME_H_DEFINES_STRUCT_TIMESPEC=0 + SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 + PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0 + UNISTD_H_DEFINES_STRUCT_TIMESPEC=0 + if test $gl_cv_sys_struct_timespec_in_time_h = yes; then + TIME_H_DEFINES_STRUCT_TIMESPEC=1 + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timespec in " >&5 +printf %s "checking for struct timespec in ... " >&6; } +if test ${gl_cv_sys_struct_timespec_in_sys_time_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #if __GNUC__ >= 4 - # undef isnand - # define isnand(x) __builtin_isnan ((double)(x)) - #elif defined isnan - # undef isnand - # define isnand(x) isnan ((double)(x)) - #endif - double x; +#include + int -main () +main (void) { -return isnand (x); +static struct timespec x; x.tv_sec = x.tv_nsec; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_isnand_in_libm=yes -else - gl_cv_func_isnand_in_libm=no +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_sys_struct_timespec_in_sys_time_h=yes +else $as_nop + gl_cv_sys_struct_timespec_in_sys_time_h=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$save_LIBS" - +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnand_in_libm" >&5 -$as_echo "$gl_cv_func_isnand_in_libm" >&6; } - - if test $gl_cv_func_isnand_in_libm = yes; then - ISNAND_LIBM=-lm - fi - fi - if test $gl_cv_func_isnand_no_libm = yes \ - || test $gl_cv_func_isnand_in_libm = yes; then - gl_func_isnand=yes - else - gl_func_isnand=no - HAVE_ISNAND=0 - fi - - - - - ISNANL_LIBM= - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(long double) can be used without linking with libm" >&5 -$as_echo_n "checking whether isnan(long double) can be used without linking with libm... " >&6; } -if ${gl_cv_func_isnanl_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_sys_time_h" >&5 +printf "%s\n" "$gl_cv_sys_struct_timespec_in_sys_time_h" >&6; } + if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then + SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1 + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timespec in " >&5 +printf %s "checking for struct timespec in ... " >&6; } +if test ${gl_cv_sys_struct_timespec_in_pthread_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #if __GNUC__ >= 4 - # undef isnanl - # define isnanl(x) __builtin_isnanl ((long double)(x)) - #elif defined isnan - # undef isnanl - # define isnanl(x) isnan ((long double)(x)) - #endif - long double x; +#include + int -main () +main (void) { -return isnanl (x); +static struct timespec x; x.tv_sec = x.tv_nsec; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_isnanl_no_libm=yes -else - gl_cv_func_isnanl_no_libm=no +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_sys_struct_timespec_in_pthread_h=yes +else $as_nop + gl_cv_sys_struct_timespec_in_pthread_h=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_no_libm" >&5 -$as_echo "$gl_cv_func_isnanl_no_libm" >&6; } - - if test $gl_cv_func_isnanl_no_libm = no; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(long double) can be used with libm" >&5 -$as_echo_n "checking whether isnan(long double) can be used with libm... " >&6; } -if ${gl_cv_func_isnanl_in_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - - save_LIBS="$LIBS" - LIBS="$LIBS -lm" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_pthread_h" >&5 +printf "%s\n" "$gl_cv_sys_struct_timespec_in_pthread_h" >&6; } + if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then + PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1 + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timespec in " >&5 +printf %s "checking for struct timespec in ... " >&6; } +if test ${gl_cv_sys_struct_timespec_in_unistd_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #if __GNUC__ >= 4 - # undef isnanl - # define isnanl(x) __builtin_isnanl ((long double)(x)) - #elif defined isnan - # undef isnanl - # define isnanl(x) isnan ((long double)(x)) - #endif - long double x; +#include + int -main () +main (void) { -return isnanl (x); +static struct timespec x; x.tv_sec = x.tv_nsec; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_isnanl_in_libm=yes -else - gl_cv_func_isnanl_in_libm=no +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_sys_struct_timespec_in_unistd_h=yes +else $as_nop + gl_cv_sys_struct_timespec_in_unistd_h=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$save_LIBS" - +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_in_libm" >&5 -$as_echo "$gl_cv_func_isnanl_in_libm" >&6; } - - if test $gl_cv_func_isnanl_in_libm = yes; then - ISNANL_LIBM=-lm +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_unistd_h" >&5 +printf "%s\n" "$gl_cv_sys_struct_timespec_in_unistd_h" >&6; } + if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then + UNISTD_H_DEFINES_STRUCT_TIMESPEC=1 + fi + fi fi fi - if test $gl_cv_func_isnanl_no_libm = yes \ - || test $gl_cv_func_isnanl_in_libm = yes; then - save_LIBS="$LIBS" - LIBS="$LIBS $ISNANL_LIBM" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnanl works" >&5 -$as_echo_n "checking whether isnanl works... " >&6; } -if ${gl_cv_func_isnanl_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - mingw*) # Guess yes on mingw, no on MSVC. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __MINGW32__ - Known -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_isnanl_works="guessing yes" -else - gl_cv_func_isnanl_works="guessing no" -fi -rm -f conftest* - ;; - *) gl_cv_func_isnanl_works="guessing yes" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#if __GNUC__ >= 4 -# undef isnanl -# define isnanl(x) __builtin_isnanl ((long double)(x)) -#elif defined isnan -# undef isnanl -# define isnanl(x) isnan ((long double)(x)) -#endif -#define NWORDS \ - ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { unsigned int word[NWORDS]; long double value; } - memory_long_double; -/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the - runtime type conversion. */ -#ifdef __sgi -static long double NaNl () -{ - double zero = 0.0; - return zero / zero; -} -#else -# define NaNl() (0.0L / 0.0L) -#endif -int main () -{ - int result = 0; - if (!isnanl (NaNl ())) - result |= 1; - { - memory_long_double m; - unsigned int i; - /* The isnanl function should be immune against changes in the sign bit and - in the mantissa bits. The xor operation twiddles a bit that can only be - a sign bit or a mantissa bit (since the exponent never extends to - bit 31). */ - m.value = NaNl (); - m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); - for (i = 0; i < NWORDS; i++) - m.word[i] |= 1; - if (!isnanl (m.value)) - result |= 1; - } -#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE -/* Representation of an 80-bit 'long double' as an initializer for a sequence - of 'unsigned int' words. */ -# ifdef WORDS_BIGENDIAN -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ - ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \ - (unsigned int) (mantlo) << 16 \ - } -# else -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { mantlo, manthi, exponent } -# endif - { /* Quiet NaN. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; - if (!isnanl (x.value)) - result |= 2; - } - { - /* Signalling NaN. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; - if (!isnanl (x.value)) - result |= 2; - } - /* isnanl should return something even for noncanonical values. */ - { /* Pseudo-NaN. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 4; - } - { /* Pseudo-Infinity. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 8; - } - { /* Pseudo-Zero. */ - static memory_long_double x = - { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 16; - } - { /* Unnormalized number. */ - static memory_long_double x = - { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 32; - } - { /* Pseudo-Denormal. */ - static memory_long_double x = - { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 64; - } -#endif - return result; + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_time_h='<'time.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_time_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'time.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_time_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_time_h + gl_cv_next_time_h='"'$gl_header'"' + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_time_h" >&5 +printf "%s\n" "$gl_cv_next_time_h" >&6; } + fi + NEXT_TIME_H=$gl_cv_next_time_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'time.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_time_h + fi + NEXT_AS_FIRST_DIRECTIVE_TIME_H=$gl_next_as_first_directive + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TIME_UTC in " >&5 +printf %s "checking for TIME_UTC in ... " >&6; } +if test ${gl_cv_time_h_has_TIME_UTC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +static int x = TIME_UTC; x++; + ; + return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_isnanl_works=yes -else - gl_cv_func_isnanl_works=no +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_time_h_has_TIME_UTC=yes +else $as_nop + gl_cv_time_h_has_TIME_UTC=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_time_h_has_TIME_UTC" >&5 +printf "%s\n" "$gl_cv_time_h_has_TIME_UTC" >&6; } + if test $gl_cv_time_h_has_TIME_UTC = yes; then + TIME_H_DEFINES_TIME_UTC=1 + else + TIME_H_DEFINES_TIME_UTC=0 + fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_works" >&5 -$as_echo "$gl_cv_func_isnanl_works" >&6; } - LIBS="$save_LIBS" - case "$gl_cv_func_isnanl_works" in - *yes) gl_func_isnanl=yes ;; - *) gl_func_isnanl=no; ISNANL_LIBM= ;; - esac - else - gl_func_isnanl=no - fi - if test $gl_func_isnanl != yes; then - HAVE_ISNANL=0 - fi + GL_GNULIB_CTIME=0 - GNULIB_ISWBLANK=0; - GNULIB_WCTYPE=0; - GNULIB_ISWCTYPE=0; - GNULIB_WCTRANS=0; - GNULIB_TOWCTRANS=0; - HAVE_ISWBLANK=1; - HAVE_WCTYPE_T=1; - HAVE_WCTRANS_T=1; - REPLACE_ISWBLANK=0; + GL_GNULIB_MKTIME=0 + GL_GNULIB_LOCALTIME=0 - if test $ac_cv_header_crtdefs_h = yes; then - HAVE_CRTDEFS_H=1 - else - HAVE_CRTDEFS_H=0 - fi + GL_GNULIB_NANOSLEEP=0 + GL_GNULIB_STRFTIME=0 + GL_GNULIB_STRPTIME=0 - if test $ac_cv_func_iswcntrl = yes; then - HAVE_ISWCNTRL=1 - else - HAVE_ISWCNTRL=0 - fi + GL_GNULIB_TIMEGM=0 - if test $gt_cv_c_wint_t = yes; then - HAVE_WINT_T=1 - else - HAVE_WINT_T=0 - fi + GL_GNULIB_TIMESPEC_GET=0 + + + + GL_GNULIB_TIME_R=0 + + + + GL_GNULIB_TIME_RZ=0 + + + + GL_GNULIB_TZSET=0 + + + + GL_GNULIB_MDA_TZSET=1 + + + + + + case "$host_os" in + *-musl*) +printf "%s\n" "#define MUSL_LIBC 1" >>confdefs.h + ;; + esac + +ac_fn_check_decl "$LINENO" "execvpe" "ac_cv_have_decl_execvpe" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_execvpe" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_EXECVPE $ac_have_decl" >>confdefs.h @@ -19264,22 +32081,23 @@ if test $gl_cv_have_include_next = yes; then - gl_cv_next_wctype_h='<'wctype.h'>' + gl_cv_next_unistd_h='<'unistd.h'>' else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_wctype_h+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_unistd_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop - if test $ac_cv_header_wctype_h = yes; then + if test $ac_cv_header_unistd_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; @@ -19295,7 +32113,7 @@ ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'wctype.h' \ + gl_header_literal_regex=`echo 'unistd.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ @@ -19304,247 +32122,290 @@ q }' - gl_cv_absolute_wctype_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + gl_cv_absolute_unistd_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_wctype_h - gl_cv_next_wctype_h='"'$gl_header'"' + gl_header=$gl_cv_absolute_unistd_h + gl_cv_next_unistd_h='"'$gl_header'"' else - gl_cv_next_wctype_h='<'wctype.h'>' + gl_cv_next_unistd_h='<'unistd.h'>' fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_wctype_h" >&5 -$as_echo "$gl_cv_next_wctype_h" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_unistd_h" >&5 +printf "%s\n" "$gl_cv_next_unistd_h" >&6; } fi - NEXT_WCTYPE_H=$gl_cv_next_wctype_h + NEXT_UNISTD_H=$gl_cv_next_unistd_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'wctype.h'>' + gl_next_as_first_directive='<'unistd.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_wctype_h + gl_next_as_first_directive=$gl_cv_next_unistd_h fi - NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H=$gl_next_as_first_directive + NEXT_AS_FIRST_DIRECTIVE_UNISTD_H=$gl_next_as_first_directive - if test $ac_cv_header_wctype_h = yes; then - if test $ac_cv_func_iswcntrl = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether iswcntrl works" >&5 -$as_echo_n "checking whether iswcntrl works... " >&6; } -if ${gl_cv_func_iswcntrl_works+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test $ac_cv_header_unistd_h = yes; then + HAVE_UNISTD_H=1 + else + HAVE_UNISTD_H=0 + fi - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #if __GNU_LIBRARY__ == 1 - Linux libc5 i18n is broken. - #endif -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_func_iswcntrl_works="guessing yes" -else - gl_cv_func_iswcntrl_works="guessing no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - /* Tru64 with Desktop Toolkit C has a bug: must be - included before . - BSD/OS 4.0.1 has a bug: , and - must be included before . */ - #include - #include - #include - #include - #include - int main () { return iswprint ('x') == 0; } -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_iswcntrl_works=yes -else - gl_cv_func_iswcntrl_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_iswcntrl_works" >&5 -$as_echo "$gl_cv_func_iswcntrl_works" >&6; } - fi - HAVE_WCTYPE_H=1 - else - HAVE_WCTYPE_H=0 - fi - if test $GNULIB_OVERRIDES_WINT_T = 1; then - REPLACE_ISWCNTRL=1 - else - case "$gl_cv_func_iswcntrl_works" in - *yes) REPLACE_ISWCNTRL=0 ;; - *) REPLACE_ISWCNTRL=1 ;; - esac + + + + + if test $ac_cv_have_decl_execvpe = no; then + HAVE_DECL_EXECVPE=0 fi - if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then - : + + + + + +gl_libunistring_sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' +gl_libunistring_sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' +gl_libunistring_sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' + + + if test "$HAVE_LIBUNISTRING" = yes; then + LIBUNISTRING_VERSION_MAJOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_major"` + LIBUNISTRING_VERSION_MINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_minor"` + LIBUNISTRING_VERSION_SUBMINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_subminor"` fi - if test $REPLACE_ISWCNTRL = 1; then - REPLACE_TOWLOWER=1 - else - for ac_func in towlower -do : - ac_fn_c_check_func "$LINENO" "towlower" "ac_cv_func_towlower" -if test "x$ac_cv_func_towlower" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_TOWLOWER 1 -_ACEOF +ac_fn_check_decl "$LINENO" "clearerr_unlocked" "ac_cv_have_decl_clearerr_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_clearerr_unlocked" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_CLEARERR_UNLOCKED $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "feof_unlocked" "ac_cv_have_decl_feof_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_feof_unlocked" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi -done +printf "%s\n" "#define HAVE_DECL_FEOF_UNLOCKED $ac_have_decl" >>confdefs.h - if test $ac_cv_func_towlower = yes; then - REPLACE_TOWLOWER=0 - else - ac_fn_c_check_decl "$LINENO" "towlower" "ac_cv_have_decl_towlower" "/* Tru64 with Desktop Toolkit C has a bug: must be - included before . - BSD/OS 4.0.1 has a bug: , and - must be included before . */ - #include - #include - #include - #include - #if HAVE_WCTYPE_H - # include - #endif +ac_fn_check_decl "$LINENO" "ferror_unlocked" "ac_cv_have_decl_ferror_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_ferror_unlocked" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_FERROR_UNLOCKED $ac_have_decl" >>confdefs.h -" -if test "x$ac_cv_have_decl_towlower" = xyes; then : +ac_fn_check_decl "$LINENO" "fflush_unlocked" "ac_cv_have_decl_fflush_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_fflush_unlocked" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi +printf "%s\n" "#define HAVE_DECL_FFLUSH_UNLOCKED $ac_have_decl" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_TOWLOWER $ac_have_decl -_ACEOF +ac_fn_check_decl "$LINENO" "fgets_unlocked" "ac_cv_have_decl_fgets_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_fgets_unlocked" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_FGETS_UNLOCKED $ac_have_decl" >>confdefs.h - if test $ac_cv_have_decl_towlower = yes; then - REPLACE_TOWLOWER=1 - else - REPLACE_TOWLOWER=0 - fi - fi - fi +ac_fn_check_decl "$LINENO" "fputc_unlocked" "ac_cv_have_decl_fputc_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_fputc_unlocked" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_FPUTC_UNLOCKED $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "fputs_unlocked" "ac_cv_have_decl_fputs_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_fputs_unlocked" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_FPUTS_UNLOCKED $ac_have_decl" >>confdefs.h - if test $HAVE_ISWCNTRL = 0 || test $REPLACE_TOWLOWER = 1; then - : - fi +ac_fn_check_decl "$LINENO" "fread_unlocked" "ac_cv_have_decl_fread_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_fread_unlocked" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_FREAD_UNLOCKED $ac_have_decl" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wctype_t" >&5 -$as_echo_n "checking for wctype_t... " >&6; } -if ${gl_cv_type_wctype_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Tru64 with Desktop Toolkit C has a bug: must be - included before . - BSD/OS 4.0.1 has a bug: , and - must be included before . */ - #include - #include - #include - #include - #if HAVE_WCTYPE_H - # include - #endif - wctype_t a; +ac_fn_check_decl "$LINENO" "fwrite_unlocked" "ac_cv_have_decl_fwrite_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_fwrite_unlocked" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_FWRITE_UNLOCKED $ac_have_decl" >>confdefs.h -int -main () -{ +ac_fn_check_decl "$LINENO" "getc_unlocked" "ac_cv_have_decl_getc_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_getc_unlocked" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_GETC_UNLOCKED $ac_have_decl" >>confdefs.h - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_type_wctype_t=yes -else - gl_cv_type_wctype_t=no +ac_fn_check_decl "$LINENO" "getchar_unlocked" "ac_cv_have_decl_getchar_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_getchar_unlocked" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +printf "%s\n" "#define HAVE_DECL_GETCHAR_UNLOCKED $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "putc_unlocked" "ac_cv_have_decl_putc_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_putc_unlocked" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wctype_t" >&5 -$as_echo "$gl_cv_type_wctype_t" >&6; } - if test $gl_cv_type_wctype_t = no; then - HAVE_WCTYPE_T=0 - fi +printf "%s\n" "#define HAVE_DECL_PUTC_UNLOCKED $ac_have_decl" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wctrans_t" >&5 -$as_echo_n "checking for wctrans_t... " >&6; } -if ${gl_cv_type_wctrans_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +ac_fn_check_decl "$LINENO" "putchar_unlocked" "ac_cv_have_decl_putchar_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_putchar_unlocked" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_PUTCHAR_UNLOCKED $ac_have_decl" >>confdefs.h + +ac_fn_check_decl "$LINENO" "unsetenv" "ac_cv_have_decl_unsetenv" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_unsetenv" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_UNSETENV $ac_have_decl" >>confdefs.h + +ac_fn_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_vsnprintf" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_VSNPRINTF $ac_have_decl" >>confdefs.h + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether uses 'inline' correctly" >&5 +printf %s "checking whether uses 'inline' correctly... " >&6; } +if test ${gl_cv_header_wchar_h_correct_inline+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_header_wchar_h_correct_inline=yes + case "$host_os" in + *-gnu* | gnu*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Tru64 with Desktop Toolkit C has a bug: must be - included before . - BSD/OS 4.0.1 has a bug: , and - must be included before . */ - #include - #include - #include - #include - #include - wctrans_t a; -int -main () -{ - ; - return 0; -} + #define wcstod renamed_wcstod + #include + extern int zero (void); + int main () { return zero(); } + _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_type_wctrans_t=yes -else - gl_cv_type_wctrans_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + save_ac_compile="$ac_compile" + ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` + if echo '#include "conftest.c"' >conftest1.c \ + && { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + #define wcstod renamed_wcstod + #include + int zero (void) { return 0; } + +_ACEOF + ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` + if echo '#include "conftest.c"' >conftest2.c \ + && { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&5 2>&1; then + : + else + gl_cv_header_wchar_h_correct_inline=no + fi + fi + fi + ac_compile="$save_ac_compile" + rm -f conftest12.c conftest12.$ac_objext conftest$ac_exeext + ;; + esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wctrans_t" >&5 -$as_echo "$gl_cv_type_wctrans_t" >&6; } - if test $gl_cv_type_wctrans_t = no; then - HAVE_WCTRANS_T=0 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_wchar_h_correct_inline" >&5 +printf "%s\n" "$gl_cv_header_wchar_h_correct_inline" >&6; } + if test $gl_cv_header_wchar_h_correct_inline = no; then + as_fn_error $? " cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). +This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in +C99 mode. You have four options: + - Add the flag -fgnu89-inline to CC and reconfigure, or + - Fix your include files, using parts of + , or + - Use a gcc version older than 4.3, or + - Don't use the flags -std=c99 or -std=gnu99. +Configuration aborted." "$LINENO" 5 fi @@ -19555,1723 +32416,1374 @@ - case "$host_os" in - mingw*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit off_t" >&5 -$as_echo_n "checking for 64-bit off_t... " >&6; } -if ${gl_cv_type_off_t_64+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1]; -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_type_off_t_64=yes -else - gl_cv_type_off_t_64=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_off_t_64" >&5 -$as_echo "$gl_cv_type_off_t_64" >&6; } - if test $gl_cv_type_off_t_64 = no; then - WINDOWS_64_BIT_OFF_T=1 - else - WINDOWS_64_BIT_OFF_T=0 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit st_size" >&5 -$as_echo_n "checking for 64-bit st_size... " >&6; } -if ${gl_cv_member_st_size_64+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - struct stat buf; - int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1]; -int -main () -{ + if test $gl_cv_have_include_next = yes; then + gl_cv_next_wchar_h='<'wchar.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_wchar_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop - ; - return 0; -} + if test $ac_cv_header_wchar_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_member_st_size_64=yes -else - gl_cv_member_st_size_64=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_member_st_size_64" >&5 -$as_echo "$gl_cv_member_st_size_64" >&6; } - if test $gl_cv_member_st_size_64 = no; then - WINDOWS_64_BIT_ST_SIZE=1 - else - WINDOWS_64_BIT_ST_SIZE=0 - fi + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' ;; *) - WINDOWS_64_BIT_OFF_T=0 - WINDOWS_64_BIT_ST_SIZE=0 + gl_dirsep_regex='\/' ;; esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'wchar.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + gl_cv_absolute_wchar_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ldexp() can be used without linking with libm" >&5 -$as_echo_n "checking whether ldexp() can be used without linking with libm... " >&6; } -if ${gl_cv_func_ldexp_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else + gl_header=$gl_cv_absolute_wchar_h + gl_cv_next_wchar_h='"'$gl_header'"' + else + gl_cv_next_wchar_h='<'wchar.h'>' + fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __NO_MATH_INLINES - # define __NO_MATH_INLINES 1 /* for glibc */ - #endif - #include - double (*funcptr) (double, int) = ldexp; - double x; -int -main () -{ -return ldexp (x, -1) > 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_ldexp_no_libm=yes -else - gl_cv_func_ldexp_no_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexp_no_libm" >&5 -$as_echo "$gl_cv_func_ldexp_no_libm" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_wchar_h" >&5 +printf "%s\n" "$gl_cv_next_wchar_h" >&6; } + fi + NEXT_WCHAR_H=$gl_cv_next_wchar_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'wchar.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_wchar_h + fi + NEXT_AS_FIRST_DIRECTIVE_WCHAR_H=$gl_next_as_first_directive - LDEXP_LIBM= - if test $gl_cv_func_ldexp_no_libm = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ldexp() can be used with libm" >&5 -$as_echo_n "checking whether ldexp() can be used with libm... " >&6; } -if ${gl_cv_func_ldexp_in_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LIBS="$LIBS" - LIBS="$LIBS -lm" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __NO_MATH_INLINES - # define __NO_MATH_INLINES 1 /* for glibc */ - #endif - #include - double (*funcptr) (double, int) = ldexp; - double x; + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + + + + + + if test $gt_cv_c_wint_t = yes; then + HAVE_WINT_T=1 + else + HAVE_WINT_T=0 + fi + + + + + + + + + + + ac_fn_check_decl "$LINENO" "wcsdup" "ac_cv_have_decl_wcsdup" " + #include + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_wcsdup" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_WCSDUP $ac_have_decl" >>confdefs.h + + if test $ac_cv_have_decl_wcsdup = no; then + HAVE_DECL_WCSDUP=0 + fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking POSIX termios" >&5 +printf %s "checking POSIX termios... " >&6; } +if test ${ac_cv_sys_posix_termios+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include + int -main () +main (void) { -return ldexp (x, -1) > 0; +/* SunOS 4.0.3 has termios.h but not the library calls. */ + tcgetattr(0, 0); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_ldexp_in_libm=yes -else - gl_cv_func_ldexp_in_libm=no +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_sys_posix_termios=yes +else $as_nop + ac_cv_sys_posix_termios=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - LIBS="$save_LIBS" - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexp_in_libm" >&5 -$as_echo "$gl_cv_func_ldexp_in_libm" >&6; } - if test $gl_cv_func_ldexp_in_libm = yes; then - LDEXP_LIBM=-lm - fi - fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_posix_termios" >&5 +printf "%s\n" "$ac_cv_sys_posix_termios" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether use of TIOCGWINSZ requires termios.h" >&5 +printf %s "checking whether use of TIOCGWINSZ requires termios.h... " >&6; } +if test ${gl_cv_sys_tiocgwinsz_needs_termios_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_sys_tiocgwinsz_needs_termios_h=no - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" + if test $ac_cv_sys_posix_termios = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +# include +# ifdef TIOCGWINSZ + yes +# endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_sys_tiocgwinsz_needs_termios_h=yes +fi +rm -rf conftest* + fi -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_tiocgwinsz_needs_termios_h" >&5 +printf "%s\n" "$gl_cv_sys_tiocgwinsz_needs_termios_h" >&6; } -# Prepare PATH_SEPARATOR. -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which - # contains only /bin. Note that ksh looks also at the FPATH variable, - # so we have to set that as well for the test. - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - || PATH_SEPARATOR=';' - } -fi -if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld" >&5 -$as_echo_n "checking for ld... " >&6; } -elif test "$GCC" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if test -n "$LD"; then - # Let the user override the test with a path. - : -else - if ${acl_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else + HAVE_OPENDIR=1; + HAVE_READDIR=1; + HAVE_REWINDDIR=1; + HAVE_CLOSEDIR=1; + HAVE_DECL_DIRFD=1; + HAVE_DECL_FDOPENDIR=1; + HAVE_FDOPENDIR=1; + HAVE_SCANDIR=1; + HAVE_ALPHASORT=1; + REPLACE_OPENDIR=0; + REPLACE_CLOSEDIR=0; + REPLACE_DIRFD=0; + REPLACE_FDOPENDIR=0; - acl_cv_path_LD= # Final result of this test - ac_prog=ld # Program to search in $PATH - if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - acl_output=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $acl_output in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` - while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do - acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` - done - # Got the pathname. No search in PATH is needed. - acl_cv_path_LD="$acl_output" - ac_prog= - ;; - "") - # If it fails, then pretend we aren't using GCC. - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac - fi - if test -n "$ac_prog"; then - # Search for $ac_prog in $PATH. - acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$acl_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 conftest.$ac_ext -/* end confdefs.h. */ -#if defined __powerpc64__ || defined _ARCH_PPC64 - int ok; - #else - error fail - #endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # The compiler produces 64-bit code. Add option '-b64' so that the - # linker groks 64-bit object files. - case "$acl_cv_path_LD " in - *" -b64 "*) ;; - *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;; - esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - sparc64-*-netbsd*) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined __sparcv9 || defined __arch64__ - int ok; - #else - error fail - #endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : -else - # The compiler produces 32-bit code. Add option '-m elf32_sparc' - # so that the linker groks 32-bit object files. - case "$acl_cv_path_LD " in - *" -m elf32_sparc "*) ;; - *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;; - esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - esac -fi + GL_GNULIB_OPENDIR=0 - LD="$acl_cv_path_LD" -fi -if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${acl_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$acl_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$acl_cv_prog_gnu_ld + GL_GNULIB_READDIR=0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 -$as_echo_n "checking for shared library run path origin... " >&6; } -if ${acl_cv_rpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done + GL_GNULIB_REWINDDIR=0 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 -$as_echo "$acl_cv_rpath" >&6; } - wl="$acl_cv_wl" - acl_libext="$acl_cv_libext" - acl_shlibext="$acl_cv_shlibext" - acl_libname_spec="$acl_cv_libname_spec" - acl_library_names_spec="$acl_cv_library_names_spec" - acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - acl_hardcode_direct="$acl_cv_hardcode_direct" - acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" - # Check whether --enable-rpath was given. -if test "${enable_rpath+set}" = set; then : - enableval=$enable_rpath; : -else - enable_rpath=yes -fi + GL_GNULIB_CLOSEDIR=0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking 32-bit host C ABI" >&5 -$as_echo_n "checking 32-bit host C ABI... " >&6; } -if ${gl_cv_host_cpu_c_abi_32bit+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$gl_cv_host_cpu_c_abi"; then - case "$gl_cv_host_cpu_c_abi" in - i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) - gl_cv_host_cpu_c_abi_32bit=yes ;; - x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 ) - gl_cv_host_cpu_c_abi_32bit=no ;; - *) - gl_cv_host_cpu_c_abi_32bit=unknown ;; - esac + + GL_GNULIB_DIRFD=0 + + + + GL_GNULIB_FDOPENDIR=0 + + + + GL_GNULIB_SCANDIR=0 + + + + GL_GNULIB_ALPHASORT=0 + + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_dirent_h='<'dirent.h'>' else - case "$host_cpu" in + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_dirent_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop - # CPUs that only support a 32-bit ABI. - arc \ - | bfin \ - | cris* \ - | csky \ - | epiphany \ - | ft32 \ - | h8300 \ - | m68k \ - | microblaze | microblazeel \ - | nds32 | nds32le | nds32be \ - | nios2 | nios2eb | nios2el \ - | or1k* \ - | or32 \ - | sh | sh1234 | sh1234elb \ - | tic6x \ - | xtensa* ) - gl_cv_host_cpu_c_abi_32bit=yes - ;; + if test $ac_cv_header_dirent_h = yes; then - # CPUs that only support a 64-bit ABI. - alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \ - | mmix ) - gl_cv_host_cpu_c_abi_32bit=no - ;; - i[34567]86 ) - gl_cv_host_cpu_c_abi_32bit=yes - ;; - x86_64 ) - # On x86_64 systems, the C compiler may be generating code in one of - # these ABIs: - # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. - # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 - # with native Windows (mingw, MSVC). - # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. - # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if (defined __x86_64__ || defined __amd64__ \ - || defined _M_X64 || defined _M_AMD64) \ - && !(defined __ILP32__ || defined _ILP32) - int ok; - #else - error fail - #endif + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac - arm* | aarch64 ) - # Assume arm with EABI. - # On arm64 systems, the C compiler may be generating code in one of - # these ABIs: - # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. - # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. - # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32) - int ok; - #else - error fail - #endif + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'dirent.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; + gl_cv_absolute_dirent_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_dirent_h + gl_cv_next_dirent_h='"'$gl_header'"' + else + gl_cv_next_dirent_h='<'dirent.h'>' + fi - hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) - # On hppa, the C compiler may be generating 32-bit code or 64-bit - # code. In the latter case, it defines _LP64 and __LP64__. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __LP64__ - int ok; - #else - error fail - #endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_dirent_h" >&5 +printf "%s\n" "$gl_cv_next_dirent_h" >&6; } + fi + NEXT_DIRENT_H=$gl_cv_next_dirent_h - ia64* ) - # On ia64 on HP-UX, the C compiler may be generating 64-bit code or - # 32-bit code. In the latter case, it defines _ILP32. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef _ILP32 - int ok; - #else - error fail - #endif + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'dirent.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_dirent_h + fi + NEXT_AS_FIRST_DIRECTIVE_DIRENT_H=$gl_next_as_first_directive -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=yes -else - gl_cv_host_cpu_c_abi_32bit=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - mips* ) - # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this - # at 32. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) - int ok; - #else - error fail - #endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - powerpc* ) - # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. - # No need to distinguish them here; the caller may distinguish - # them based on the OS. - # On powerpc64 systems, the C compiler may still be generating - # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may - # be generating 64-bit code. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined __powerpc64__ || defined _ARCH_PPC64 - int ok; - #else - error fail - #endif + if test $ac_cv_header_dirent_h = yes; then + HAVE_DIRENT_H=1 + else + HAVE_DIRENT_H=0 + fi -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes + + + + + +ac_fn_check_decl "$LINENO" "fchdir" "ac_cv_have_decl_fchdir" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_fchdir" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; +printf "%s\n" "#define HAVE_DECL_FCHDIR $ac_have_decl" >>confdefs.h - rs6000 ) - gl_cv_host_cpu_c_abi_32bit=yes - ;; - riscv32 | riscv64 ) - # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. - # Size of 'long' and 'void *': - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined __LP64__ - int ok; - #else - error fail - #endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes + HAVE_FFS=1; + HAVE_STRCASECMP=1; + HAVE_DECL_STRNCASECMP=1; + + + + GL_GNULIB_FFS=0 + + + + + + +ac_fn_check_decl "$LINENO" "getdelim" "ac_cv_have_decl_getdelim" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_getdelim" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; +printf "%s\n" "#define HAVE_DECL_GETDELIM $ac_have_decl" >>confdefs.h - s390* ) - # On s390x, the C compiler may be generating 64-bit (= s390x) code - # or 31-bit (= s390) code. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined __LP64__ || defined __s390x__ - int ok; - #else - error fail - #endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes + +ac_fn_check_decl "$LINENO" "getdtablesize" "ac_cv_have_decl_getdtablesize" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_getdtablesize" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; +printf "%s\n" "#define HAVE_DECL_GETDTABLESIZE $ac_have_decl" >>confdefs.h - sparc | sparc64 ) - # UltraSPARCs running Linux have `uname -m` = "sparc64", but the - # C compiler still generates 32-bit code. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined __sparcv9 || defined __arch64__ - int ok; - #else - error fail - #endif +ac_fn_check_decl "$LINENO" "getline" "ac_cv_have_decl_getline" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_getline" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_GETLINE $ac_have_decl" >>confdefs.h + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether setlocale (LC_ALL, NULL) is multithread-safe" >&5 +printf %s "checking whether setlocale (LC_ALL, NULL) is multithread-safe... " >&6; } +if test ${gl_cv_func_setlocale_null_all_mtsafe+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. + *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) + gl_cv_func_setlocale_null_all_mtsafe=no ;; + # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. + *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) + gl_cv_func_setlocale_null_all_mtsafe=yes ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_setlocale_null_all_mtsafe="$gl_cross_guess_normal" ;; + esac -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_all_mtsafe" >&5 +printf "%s\n" "$gl_cv_func_setlocale_null_all_mtsafe" >&6; } + case "$host_os" in + mingw*) ;; + *) + if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then + gl_cv_func_setlocale_null_all_mtsafe="trivially yes" + fi + ;; + esac + case "$gl_cv_func_setlocale_null_all_mtsafe" in + *yes) SETLOCALE_NULL_ALL_MTSAFE=1 ;; + *) SETLOCALE_NULL_ALL_MTSAFE=0 ;; + esac - *) - gl_cv_host_cpu_c_abi_32bit=unknown - ;; - esac - fi +printf "%s\n" "#define SETLOCALE_NULL_ALL_MTSAFE $SETLOCALE_NULL_ALL_MTSAFE" >>confdefs.h -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_host_cpu_c_abi_32bit" >&5 -$as_echo "$gl_cv_host_cpu_c_abi_32bit" >&6; } - HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether setlocale (category, NULL) is multithread-safe" >&5 +printf %s "checking whether setlocale (category, NULL) is multithread-safe... " >&6; } +if test ${gl_cv_func_setlocale_null_one_mtsafe+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + # Guess no on OpenBSD, AIX. + openbsd* | aix*) + gl_cv_func_setlocale_null_one_mtsafe=no ;; + # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. + *-gnu* | gnu* | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) + gl_cv_func_setlocale_null_one_mtsafe=yes ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_setlocale_null_one_mtsafe="$gl_cross_guess_normal" ;; + esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_one_mtsafe" >&5 +printf "%s\n" "$gl_cv_func_setlocale_null_one_mtsafe" >&6; } + case "$host_os" in + mingw*) ;; + *) + if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then + gl_cv_func_setlocale_null_one_mtsafe="trivially yes" + fi + ;; + esac + case "$gl_cv_func_setlocale_null_one_mtsafe" in + *yes) SETLOCALE_NULL_ONE_MTSAFE=1 ;; + *) SETLOCALE_NULL_ONE_MTSAFE=0 ;; + esac +printf "%s\n" "#define SETLOCALE_NULL_ONE_MTSAFE $SETLOCALE_NULL_ONE_MTSAFE" >>confdefs.h + if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then + case "$host_os" in + mingw*) LIB_SETLOCALE_NULL= ;; + *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF binary format" >&5 -$as_echo_n "checking for ELF binary format... " >&6; } -if ${gl_cv_elf+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 +printf %s "checking whether imported symbols can be declared weak... " >&6; } +if test ${gl_cv_have_weak+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + cygwin*) + gl_cv_have_weak="guessing no" + ;; + *) + gl_cv_have_weak=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern void xyzzy (); +#pragma weak xyzzy +int +main (void) +{ +xyzzy(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_have_weak=maybe +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test $gl_cv_have_weak = maybe; then + if test "$cross_compiling" = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ELF__ - Extensible Linking Format - #endif + Extensible Linking Format + #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Extensible Linking Format" >/dev/null 2>&1; then : - gl_cv_elf=yes -else - gl_cv_elf=no + $EGREP "Extensible Linking Format" >/dev/null 2>&1 +then : + gl_cv_have_weak="guessing yes" +else $as_nop + gl_cv_have_weak="guessing no" fi -rm -f conftest* +rm -rf conftest* +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#pragma weak fputs +int main () +{ + return (fputs == NULL); +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_have_weak=yes +else $as_nop + gl_cv_have_weak=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_elf" >&5 -$as_echo "$gl_cv_elf" >&6; } - if test $gl_cv_elf; then - # Extract the ELF class of a file (5th byte) in decimal. - # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header - if od -A x < /dev/null >/dev/null 2>/dev/null; then - # Use POSIX od. - func_elfclass () - { - od -A n -t d1 -j 4 -N 1 - } - else - # Use BSD hexdump. - func_elfclass () - { - dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "' - echo - } - fi - case $HOST_CPU_C_ABI_32BIT in - yes) - # 32-bit ABI. - acl_is_expected_elfclass () - { - test "`func_elfclass | sed -e 's/[ ]//g'`" = 1 - } - ;; - no) - # 64-bit ABI. - acl_is_expected_elfclass () - { - test "`func_elfclass | sed -e 's/[ ]//g'`" = 2 - } - ;; - *) - # Unknown. - acl_is_expected_elfclass () - { - : - } - ;; - esac - else - acl_is_expected_elfclass () - { - : - } - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the common suffixes of directories in the library search path" >&5 -$as_echo_n "checking for the common suffixes of directories in the library search path... " >&6; } -if ${acl_cv_libdirstems+:} false; then : - $as_echo_n "(cached) " >&6 -else - acl_libdirstem=lib - acl_libdirstem2= - acl_libdirstem3= - case "$host_os" in - solaris*) - if test $HOST_CPU_C_ABI_32BIT = no; then - acl_libdirstem2=lib/64 - case "$host_cpu" in - sparc*) acl_libdirstem3=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem3=lib/amd64 ;; - esac fi ;; - *) - searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \ - | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test $HOST_CPU_C_ABI_32BIT != no; then - # 32-bit or unknown ABI. - if test -d /usr/lib32; then - acl_libdirstem2=lib32 - fi - fi - if test $HOST_CPU_C_ABI_32BIT != yes; then - # 64-bit or unknown ABI. - if test -d /usr/lib64; then - acl_libdirstem3=lib64 - fi - fi - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;; - */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib32 ) acl_libdirstem2=lib32 ;; - */lib64 ) acl_libdirstem3=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_save_IFS" - if test $HOST_CPU_C_ABI_32BIT = yes; then - # 32-bit ABI. - acl_libdirstem3= - fi - if test $HOST_CPU_C_ABI_32BIT = no; then - # 64-bit ABI. - acl_libdirstem2= - fi - fi + esac + case " $LDFLAGS " in + *" -static "*) gl_cv_have_weak=no ;; + esac + case "$gl_cv_have_weak" in + *yes) + case "$host_os" in + freebsd* | dragonfly* | midnightbsd*) + : > conftest1.c + $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 + cat < conftest2.c +#include +#pragma weak pthread_mutexattr_gettype +int main () +{ + return (pthread_mutexattr_gettype != NULL); +} +EOF + $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ + || gl_cv_have_weak=no + rm -f conftest1.c libempty.so conftest2.c conftest + ;; + esac ;; esac - test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" - test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem" - acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_libdirstems" >&5 -$as_echo "$acl_cv_libdirstems" >&6; } - acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` - acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'` - acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 +printf "%s\n" "$gl_cv_have_weak" >&6; } + case "$gl_cv_have_weak" in + *yes) + +printf "%s\n" "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h + + ;; + esac + + case "$gl_cv_have_weak" in + *yes) LIB_SETLOCALE_NULL= ;; + *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; + esac + ;; + esac + else + LIB_SETLOCALE_NULL= + fi + + HAVE_NEWLOCALE=1; + HAVE_DUPLOCALE=1; + HAVE_FREELOCALE=1; + REPLACE_LOCALECONV=0; + REPLACE_SETLOCALE=0; + REPLACE_NEWLOCALE=0; + REPLACE_DUPLOCALE=0; + REPLACE_FREELOCALE=0; + REPLACE_STRUCT_LCONV=0; + LOCALENAME_ENHANCE_LOCALE_FUNCS=0; - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5 -$as_echo_n "checking for nl_langinfo and CODESET... " >&6; } -if ${am_cv_langinfo_codeset+:} false; then : - $as_echo_n "(cached) " >&6 -else + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether locale.h defines locale_t" >&5 +printf %s "checking whether locale.h defines locale_t... " >&6; } +if test ${gl_cv_header_locale_has_locale_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include + locale_t x; int -main () +main (void) { -char* cs = nl_langinfo(CODESET); return !cs; + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - am_cv_langinfo_codeset=yes -else - am_cv_langinfo_codeset=no +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_header_locale_has_locale_t=yes +else $as_nop + gl_cv_header_locale_has_locale_t=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_langinfo_codeset" >&5 -$as_echo "$am_cv_langinfo_codeset" >&6; } - if test $am_cv_langinfo_codeset = yes; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_locale_has_locale_t" >&5 +printf "%s\n" "$gl_cv_header_locale_has_locale_t" >&6; } -$as_echo "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h + if test $ac_cv_header_xlocale_h = yes; then + HAVE_XLOCALE_H=1 + if test $gl_cv_header_locale_has_locale_t = yes; then + gl_cv_header_locale_h_needs_xlocale_h=no + else + gl_cv_header_locale_h_needs_xlocale_h=yes + fi + HAVE_LOCALE_T=1 + else + HAVE_XLOCALE_H=0 + gl_cv_header_locale_h_needs_xlocale_h=no + if test $gl_cv_header_locale_has_locale_t = yes; then + HAVE_LOCALE_T=1 + else + HAVE_LOCALE_T=0 + fi fi - gl_threads_api=none - LIBTHREAD= - LTLIBTHREAD= - LIBMULTITHREAD= - LTLIBMULTITHREAD= - if test "$gl_use_threads" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 -$as_echo_n "checking whether imported symbols can be declared weak... " >&6; } -if ${gl_cv_have_weak+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_have_weak=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + + + + + + case "$host_os" in + solaris*) + +printf "%s\n" "#define _LCONV_C99 1" >>confdefs.h + + ;; + esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether locale.h conforms to POSIX:2001" >&5 +printf %s "checking whether locale.h conforms to POSIX:2001... " >&6; } +if test ${gl_cv_header_locale_h_posix2001+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern void xyzzy (); -#pragma weak xyzzy +#include + int x = LC_MESSAGES; + int y = sizeof (((struct lconv *) 0)->decimal_point); int -main () +main (void) { -xyzzy(); + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_have_weak=maybe +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_header_locale_h_posix2001=yes +else $as_nop + gl_cv_header_locale_h_posix2001=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test $gl_cv_have_weak = maybe; then - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_locale_h_posix2001" >&5 +printf "%s\n" "$gl_cv_header_locale_h_posix2001" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether struct lconv is properly defined" >&5 +printf %s "checking whether struct lconv is properly defined... " >&6; } +if test ${gl_cv_sys_struct_lconv_ok+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __ELF__ - Extensible Linking Format - #endif +#include + struct lconv l; + int x = sizeof (l.decimal_point); + int y = sizeof (l.int_p_cs_precedes); +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_sys_struct_lconv_ok=yes +else $as_nop + gl_cv_sys_struct_lconv_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_lconv_ok" >&5 +printf "%s\n" "$gl_cv_sys_struct_lconv_ok" >&6; } + if test $gl_cv_sys_struct_lconv_ok = no; then + case "$host_os" in + mingw*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Special +#endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Extensible Linking Format" >/dev/null 2>&1; then : - gl_cv_have_weak="guessing yes" -else - gl_cv_have_weak="guessing no" + $EGREP "Special" >/dev/null 2>&1 +then : + +else $as_nop + REPLACE_STRUCT_LCONV=1 fi -rm -f conftest* +rm -rf conftest* + + ;; + *) REPLACE_STRUCT_LCONV=1 ;; + esac + fi + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_locale_h='<'locale.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_locale_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + -else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#include -#pragma weak fputs -int main () -{ - return (fputs == NULL); -} +#include _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_have_weak=yes -else - gl_cv_have_weak=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'locale.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_locale_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_locale_h + gl_cv_next_locale_h='"'$gl_header'"' + + fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_locale_h" >&5 +printf "%s\n" "$gl_cv_next_locale_h" >&6; } + fi + NEXT_LOCALE_H=$gl_cv_next_locale_h + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'locale.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_locale_h fi - case " $LDFLAGS " in - *" -static "*) gl_cv_have_weak=no ;; - esac + NEXT_AS_FIRST_DIRECTIVE_LOCALE_H=$gl_next_as_first_directive + + + + + + + + + + + GL_GNULIB_LOCALECONV=0 + + + + GL_GNULIB_SETLOCALE=0 + + + + GL_GNULIB_SETLOCALE_NULL=0 + + + + GL_GNULIB_DUPLOCALE=0 + + + + GL_GNULIB_LOCALENAME=0 + + + +ac_fn_check_decl "$LINENO" "memrchr" "ac_cv_have_decl_memrchr" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_memrchr" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 -$as_echo "$gl_cv_have_weak" >&6; } - case "$gl_cv_have_weak" in - *yes) +printf "%s\n" "#define HAVE_DECL_MEMRCHR $ac_have_decl" >>confdefs.h -$as_echo "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h - ;; + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_strings_h='<'strings.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_strings_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $ac_cv_header_strings_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; esac - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'strings.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' - : - fi - if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then + gl_cv_absolute_strings_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` - gl_have_isoc_threads="$ac_cv_header_threads_h" - fi - if test "$gl_use_threads" = yes \ - || test "$gl_use_threads" = posix \ - || test "$gl_use_threads" = isoc+posix; then + gl_header=$gl_cv_absolute_strings_h + gl_cv_next_strings_h='"'$gl_header'"' + else + gl_cv_next_strings_h='<'strings.h'>' + fi - if test -z "$gl_pthreadlib_body_done"; then - gl_pthread_api=no - LIBPTHREAD= - LIBPMULTITHREAD= - # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that - # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. - ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = xyes; then : - gl_have_pthread_h=yes -else - gl_have_pthread_h=no fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_strings_h" >&5 +printf "%s\n" "$gl_cv_next_strings_h" >&6; } + fi + NEXT_STRINGS_H=$gl_cv_next_strings_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'strings.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_strings_h + fi + NEXT_AS_FIRST_DIRECTIVE_STRINGS_H=$gl_next_as_first_directive + + + + + if test $ac_cv_header_strings_h = yes; then + HAVE_STRINGS_H=1 + else + HAVE_STRINGS_H=0 + fi - if test "$gl_have_pthread_h" = yes; then - # Other possible tests: - # -lpthreads (FSU threads, PCthreads) - # -lgthreads - # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist - # in libc. IRIX 6.5 has the first one in both libc and libpthread, but - # the second one only in libpthread, and lock.c needs it. - # - # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 - # needs -pthread for some reason. See: - # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html - save_LIBS=$LIBS - for gl_pthread in '' '-pthread'; do - LIBS="$LIBS $gl_pthread" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - pthread_mutex_t m; - pthread_mutexattr_t ma; -int -main () -{ -pthread_mutex_lock (&m); - pthread_mutexattr_init (&ma); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_pthread_api=yes - LIBPTHREAD=$gl_pthread - LIBPMULTITHREAD=$gl_pthread + + + +ac_fn_check_decl "$LINENO" "strnlen" "ac_cv_have_decl_strnlen" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_strnlen" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$save_LIBS - test $gl_pthread_api = yes && break - done +printf "%s\n" "#define HAVE_DECL_STRNLEN $ac_have_decl" >>confdefs.h - # Test for libpthread by looking for pthread_kill. (Not pthread_self, - # since it is defined as a macro on OSF/1.) - if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then - # The program links fine without libpthread. But it may actually - # need to link with libpthread in order to create multiple threads. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 -$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_kill (); -int -main () -{ -return pthread_kill (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_kill=yes + if false; then + GL_COND_LIBTOOL_TRUE= + GL_COND_LIBTOOL_FALSE='#' else - ac_cv_lib_pthread_pthread_kill=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + GL_COND_LIBTOOL_TRUE='#' + GL_COND_LIBTOOL_FALSE= fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } -if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : - LIBPMULTITHREAD=-lpthread - # On Solaris and HP-UX, most pthread functions exist also in libc. - # Therefore pthread_in_use() needs to actually try to create a - # thread: pthread_create from libc will fail, whereas - # pthread_create will actually create a thread. - # On Solaris 10 or newer, this test is no longer needed, because - # libc contains the fully functional pthread functions. - case "$host_os" in - solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) -$as_echo "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h + gl_cond_libtool=false + gl_libdeps= + gl_ltlibdeps= + gl_m4_base='m4' - esac -fi - elif test $gl_pthread_api != yes; then - # Some library is needed. Try libpthread and libc_r. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 -$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_kill (); -int -main () -{ -return pthread_kill (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_kill=yes -else - ac_cv_lib_pthread_pthread_kill=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } -if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : - gl_pthread_api=yes - LIBPTHREAD=-lpthread - LIBPMULTITHREAD=-lpthread -fi - if test $gl_pthread_api != yes; then - # For FreeBSD 4. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 -$as_echo_n "checking for pthread_kill in -lc_r... " >&6; } -if ${ac_cv_lib_c_r_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc_r $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_kill (); -int -main () -{ -return pthread_kill (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_r_pthread_kill=yes -else - ac_cv_lib_c_r_pthread_kill=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 -$as_echo "$ac_cv_lib_c_r_pthread_kill" >&6; } -if test "x$ac_cv_lib_c_r_pthread_kill" = xyes; then : - gl_pthread_api=yes - LIBPTHREAD=-lc_r - LIBPMULTITHREAD=-lc_r -fi - fi - fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 -$as_echo_n "checking whether POSIX threads API is available... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 -$as_echo "$gl_pthread_api" >&6; } - if test $gl_pthread_api = yes; then -$as_echo "#define HAVE_PTHREAD_API 1" >>confdefs.h - fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -sched_yield (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - LIB_SCHED_YIELD= + gl_source_base='lib' -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 -$as_echo_n "checking for sched_yield in -lrt... " >&6; } -if ${ac_cv_lib_rt_sched_yield+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char sched_yield (); -int -main () -{ -return sched_yield (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_rt_sched_yield=yes -else - ac_cv_lib_rt_sched_yield=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 -$as_echo "$ac_cv_lib_rt_sched_yield" >&6; } -if test "x$ac_cv_lib_rt_sched_yield" = xyes; then : - LIB_SCHED_YIELD=-lrt -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 -$as_echo_n "checking for sched_yield in -lposix4... " >&6; } -if ${ac_cv_lib_posix4_sched_yield+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lposix4 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char sched_yield (); -int -main () -{ -return sched_yield (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_posix4_sched_yield=yes -else - ac_cv_lib_posix4_sched_yield=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 -$as_echo "$ac_cv_lib_posix4_sched_yield" >&6; } -if test "x$ac_cv_lib_posix4_sched_yield" = xyes; then : - LIB_SCHED_YIELD=-lposix4 -fi + case "$host_os" in + mingw*) REPLACE_ACCESS=1 ;; + esac -fi + if test $REPLACE_ACCESS = 1; then -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - gl_pthreadlib_body_done=done + + + + + gl_LIBOBJS="$gl_LIBOBJS access.$ac_objext" + fi - LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD - LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD - if test $gl_pthread_api = yes; then - if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then - gl_threads_api='isoc+posix' -$as_echo "#define USE_ISOC_AND_POSIX_THREADS 1" >>confdefs.h - LIBTHREAD= LTLIBTHREAD= - else - gl_threads_api=posix -$as_echo "#define USE_POSIX_THREADS 1" >>confdefs.h - if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then -$as_echo "#define USE_POSIX_THREADS_WEAK 1" >>confdefs.h - LIBTHREAD= LTLIBTHREAD= - fi - fi - fi - fi - fi - if test $gl_threads_api = none; then - if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then + GL_GNULIB_ACCESS=1 - if test -z "$gl_stdthreadlib_body_done"; then - case "$host_os" in - mingw*) - LIBSTDTHREAD= - ;; - *) - if test -z "$gl_pthreadlib_body_done"; then - gl_pthread_api=no - LIBPTHREAD= - LIBPMULTITHREAD= - # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that - # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. - ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = xyes; then : - gl_have_pthread_h=yes -else - gl_have_pthread_h=no -fi +printf "%s\n" "#define GNULIB_TEST_ACCESS 1" >>confdefs.h - if test "$gl_have_pthread_h" = yes; then - # Other possible tests: - # -lpthreads (FSU threads, PCthreads) - # -lgthreads - # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist - # in libc. IRIX 6.5 has the first one in both libc and libpthread, but - # the second one only in libpthread, and lock.c needs it. - # - # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 - # needs -pthread for some reason. See: - # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html - save_LIBS=$LIBS - for gl_pthread in '' '-pthread'; do - LIBS="$LIBS $gl_pthread" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - pthread_mutex_t m; - pthread_mutexattr_t ma; -int -main () -{ -pthread_mutex_lock (&m); - pthread_mutexattr_init (&ma); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_pthread_api=yes - LIBPTHREAD=$gl_pthread - LIBPMULTITHREAD=$gl_pthread -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$save_LIBS - test $gl_pthread_api = yes && break - done - # Test for libpthread by looking for pthread_kill. (Not pthread_self, - # since it is defined as a macro on OSF/1.) - if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then - # The program links fine without libpthread. But it may actually - # need to link with libpthread in order to create multiple threads. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 -$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + if test $ac_cv_func_alloca_works = no; then + : + fi + + # Define an additional variable used in the Makefile substitution. + if test $ac_cv_working_alloca_h = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca as a compiler built-in" >&5 +printf %s "checking for alloca as a compiler built-in... " >&6; } +if test ${gl_cv_rpl_alloca+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" +#if defined __GNUC__ || defined _AIX || defined _MSC_VER + Need own alloca #endif -char pthread_kill (); -int -main () -{ -return pthread_kill (); - ; - return 0; -} + _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_kill=yes -else - ac_cv_lib_pthread_pthread_kill=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Need own alloca" >/dev/null 2>&1 +then : + gl_cv_rpl_alloca=yes +else $as_nop + gl_cv_rpl_alloca=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } -if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : - LIBPMULTITHREAD=-lpthread - # On Solaris and HP-UX, most pthread functions exist also in libc. - # Therefore pthread_in_use() needs to actually try to create a - # thread: pthread_create from libc will fail, whereas - # pthread_create will actually create a thread. - # On Solaris 10 or newer, this test is no longer needed, because - # libc contains the fully functional pthread functions. - case "$host_os" in - solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) - -$as_echo "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h +rm -rf conftest* - esac fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_rpl_alloca" >&5 +printf "%s\n" "$gl_cv_rpl_alloca" >&6; } + if test $gl_cv_rpl_alloca = yes; then - elif test $gl_pthread_api != yes; then - # Some library is needed. Try libpthread and libc_r. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 -$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_kill (); -int -main () -{ -return pthread_kill (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_kill=yes + ALLOCA_H=alloca.h + else + ALLOCA_H= + fi + else + ALLOCA_H=alloca.h + fi + + if test -n "$ALLOCA_H"; then + GL_GENERATE_ALLOCA_H_TRUE= + GL_GENERATE_ALLOCA_H_FALSE='#' else - ac_cv_lib_pthread_pthread_kill=no + GL_GENERATE_ALLOCA_H_TRUE='#' + GL_GENERATE_ALLOCA_H_FALSE= fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + + + if test $ac_cv_working_alloca_h = yes; then + HAVE_ALLOCA_H=1 + else + HAVE_ALLOCA_H=0 + fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable assertions" >&5 +printf %s "checking whether to enable assertions... " >&6; } + # Check whether --enable-assert was given. +if test ${enable_assert+y} +then : + enableval=$enable_assert; if test "x$enableval" = xno +then : + +printf "%s\n" "#define NDEBUG 1" >>confdefs.h + +elif test "x$enableval" != xyes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: invalid argument supplied to --enable-assert" >&5 +printf "%s\n" "$as_me: WARNING: invalid argument supplied to --enable-assert" >&2;} + enable_assert=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } -if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : - gl_pthread_api=yes - LIBPTHREAD=-lpthread - LIBPMULTITHREAD=-lpthread +else $as_nop + enable_assert=yes fi - if test $gl_pthread_api != yes; then - # For FreeBSD 4. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 -$as_echo_n "checking for pthread_kill in -lc_r... " >&6; } -if ${ac_cv_lib_c_r_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc_r $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_assert" >&5 +printf "%s\n" "$enable_assert" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __builtin_expect" >&5 +printf %s "checking for __builtin_expect... " >&6; } +if test ${gl_cv___builtin_expect+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_kill (); -int -main () -{ -return pthread_kill (); - ; - return 0; -} + int + main (int argc, char **argv) + { + argc = __builtin_expect (argc, 100); + return argv[argc != 100][0]; + } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_r_pthread_kill=yes -else - ac_cv_lib_c_r_pthread_kill=no +if ac_fn_c_try_link "$LINENO" +then : + gl_cv___builtin_expect=yes +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + int + main (int argc, char **argv) + { + argc = __builtin_expect (argc, 100); + return argv[argc != 100][0]; + } +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv___builtin_expect="in " +else $as_nop + gl_cv___builtin_expect=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 -$as_echo "$ac_cv_lib_c_r_pthread_kill" >&6; } -if test "x$ac_cv_lib_c_r_pthread_kill" = xyes; then : - gl_pthread_api=yes - LIBPTHREAD=-lc_r - LIBPMULTITHREAD=-lc_r +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv___builtin_expect" >&5 +printf "%s\n" "$gl_cv___builtin_expect" >&6; } + if test "$gl_cv___builtin_expect" = yes; then + printf "%s\n" "#define HAVE___BUILTIN_EXPECT 1" >>confdefs.h - fi - fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 -$as_echo_n "checking whether POSIX threads API is available... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 -$as_echo "$gl_pthread_api" >&6; } + elif test "$gl_cv___builtin_expect" = "in "; then + printf "%s\n" "#define HAVE___BUILTIN_EXPECT 2" >>confdefs.h + fi - if test $gl_pthread_api = yes; then -$as_echo "#define HAVE_PTHREAD_API 1" >>confdefs.h - fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -sched_yield (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - LIB_SCHED_YIELD= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 -$as_echo_n "checking for sched_yield in -lrt... " >&6; } -if ${ac_cv_lib_rt_sched_yield+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + if test $REPLACE_CALLOC = 0; then -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char sched_yield (); -int -main () -{ -return sched_yield (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_rt_sched_yield=yes -else - ac_cv_lib_rt_sched_yield=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 -$as_echo "$ac_cv_lib_rt_sched_yield" >&6; } -if test "x$ac_cv_lib_rt_sched_yield" = xyes; then : - LIB_SCHED_YIELD=-lrt -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 -$as_echo_n "checking for sched_yield in -lposix4... " >&6; } -if ${ac_cv_lib_posix4_sched_yield+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lposix4 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether calloc (0, n) and calloc (n, 0) return nonnull" >&5 +printf %s "checking whether calloc (0, n) and calloc (n, 0) return nonnull... " >&6; } +if test ${ac_cv_func_calloc_0_nonnull+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test $cross_compiling != yes; then + ac_cv_func_calloc_0_nonnull=yes + if test "$cross_compiling" = yes +then : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char sched_yield (); +$ac_includes_default int -main () +main (void) { -return sched_yield (); +int result = 0; + char * volatile p = calloc (0, 0); + if (!p) + result |= 1; + free (p); + return result; + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_posix4_sched_yield=yes -else - ac_cv_lib_posix4_sched_yield=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +if ac_fn_c_try_run "$LINENO" +then : + +else $as_nop + ac_cv_func_calloc_0_nonnull=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 -$as_echo "$ac_cv_lib_posix4_sched_yield" >&6; } -if test "x$ac_cv_lib_posix4_sched_yield" = xyes; then : - LIB_SCHED_YIELD=-lposix4 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi + else + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; + # Guess yes on native Windows. + mingw*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;; + esac + fi + fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_calloc_0_nonnull" >&5 +printf "%s\n" "$ac_cv_func_calloc_0_nonnull" >&6; } + case $ac_cv_func_calloc_0_nonnull in #( + *yes) : + ;; #( + *) : + REPLACE_CALLOC=1 ;; +esac + fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + if test $REPLACE_CALLOC = 1; then - gl_pthreadlib_body_done=done + + + + + + + gl_LIBOBJS="$gl_LIBOBJS calloc.$ac_objext" + fi - if test $ac_cv_header_threads_h = yes; then - for ac_func in thrd_create -do : - ac_fn_c_check_func "$LINENO" "thrd_create" "ac_cv_func_thrd_create" -if test "x$ac_cv_func_thrd_create" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_THRD_CREATE 1 -_ACEOF -fi -done - if test $ac_cv_func_thrd_create = yes; then - LIBSTDTHREAD= - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thrd_create in -lstdthreads" >&5 -$as_echo_n "checking for thrd_create in -lstdthreads... " >&6; } -if ${ac_cv_lib_stdthreads_thrd_create+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lstdthreads $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + if test $REPLACE_MALLOC = 1; then + REPLACE_CALLOC=1 + fi -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char thrd_create (); -int -main () -{ -return thrd_create (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_stdthreads_thrd_create=yes -else - ac_cv_lib_stdthreads_thrd_create=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_stdthreads_thrd_create" >&5 -$as_echo "$ac_cv_lib_stdthreads_thrd_create" >&6; } -if test "x$ac_cv_lib_stdthreads_thrd_create" = xyes; then : + if test $REPLACE_CALLOC = 1; then - LIBSTDTHREAD='-lstdthreads -lpthread' -else - LIBSTDTHREAD="$LIBPMULTITHREAD" -fi - fi - else - LIBSTDTHREAD="$LIBPMULTITHREAD $LIB_SCHED_YIELD" - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ISO C threads API is available" >&5 -$as_echo_n "checking whether ISO C threads API is available... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_threads_h" >&5 -$as_echo "$ac_cv_header_threads_h" >&6; } - gl_stdthreadlib_body_done=done + + gl_LIBOBJS="$gl_LIBOBJS calloc.$ac_objext" + fi - LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD - LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD - gl_threads_api=isoc -$as_echo "#define USE_ISOC_THREADS 1" >>confdefs.h - fi - fi - if test $gl_threads_api = none; then - case "$gl_use_threads" in - yes | windows | win32) # The 'win32' is for backward compatibility. - if { case "$host_os" in - mingw*) true;; - *) false;; - esac - }; then - gl_threads_api=windows -$as_echo "#define USE_WINDOWS_THREADS 1" >>confdefs.h - fi - ;; + + + + + GL_GNULIB_CALLOC_POSIX=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_CALLOC_POSIX 1" >>confdefs.h + + + + + + + + + + if test $ac_cv_func_canonicalize_file_name = no; then + HAVE_CANONICALIZE_FILE_NAME=0 + else + case "$gl_cv_func_realpath_works" in + *yes) ;; + *) REPLACE_CANONICALIZE_FILE_NAME=1 ;; + esac + fi + + + +printf "%s\n" "#define GNULIB_CANONICALIZE 1" >>confdefs.h + + + + +printf "%s\n" "#define GNULIB_TEST_CANONICALIZE 1" >>confdefs.h + + + + + + + + + + + + GL_GNULIB_CANONICALIZE_FILE_NAME=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_CANONICALIZE_FILE_NAME 1" >>confdefs.h + + + + + + + if test $ac_cv_func_canonicalize_file_name = no; then + HAVE_CANONICALIZE_FILE_NAME=0 + if test $ac_cv_func_realpath = no; then + HAVE_REALPATH=0 + else + case "$gl_cv_func_realpath_works" in + *yes) ;; + *) REPLACE_REALPATH=1 ;; esac fi + else + case "$gl_cv_func_realpath_works" in + *yes) + ;; + *) + REPLACE_CANONICALIZE_FILE_NAME=1 + REPLACE_REALPATH=1 + ;; + esac fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for multithread API to use" >&5 -$as_echo_n "checking for multithread API to use... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_threads_api" >&5 -$as_echo "$gl_threads_api" >&6; } + if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then @@ -21280,965 +33792,428 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_SED" || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac + gl_LIBOBJS="$gl_LIBOBJS canonicalize-lgpl.$ac_objext" - $ac_path_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi -else - ac_cv_path_SED=$SED -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed +printf "%s\n" "#define GNULIB_CANONICALIZE_LGPL 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mbstate_t" >&5 -$as_echo_n "checking for mbstate_t... " >&6; } -if ${ac_cv_type_mbstate_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -int -main () -{ -mbstate_t x; return sizeof x; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_type_mbstate_t=yes -else - ac_cv_type_mbstate_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_mbstate_t" >&5 -$as_echo "$ac_cv_type_mbstate_t" >&6; } - if test $ac_cv_type_mbstate_t = yes; then -$as_echo "#define HAVE_MBSTATE_T 1" >>confdefs.h - else -$as_echo "#define mbstate_t int" >>confdefs.h - fi - GNULIB_BTOWC=0; - GNULIB_WCTOB=0; - GNULIB_MBSINIT=0; - GNULIB_MBRTOWC=0; - GNULIB_MBRLEN=0; - GNULIB_MBSRTOWCS=0; - GNULIB_MBSNRTOWCS=0; - GNULIB_WCRTOMB=0; - GNULIB_WCSRTOMBS=0; - GNULIB_WCSNRTOMBS=0; - GNULIB_WCWIDTH=0; - GNULIB_WMEMCHR=0; - GNULIB_WMEMCMP=0; - GNULIB_WMEMCPY=0; - GNULIB_WMEMMOVE=0; - GNULIB_WMEMSET=0; - GNULIB_WCSLEN=0; - GNULIB_WCSNLEN=0; - GNULIB_WCSCPY=0; - GNULIB_WCPCPY=0; - GNULIB_WCSNCPY=0; - GNULIB_WCPNCPY=0; - GNULIB_WCSCAT=0; - GNULIB_WCSNCAT=0; - GNULIB_WCSCMP=0; - GNULIB_WCSNCMP=0; - GNULIB_WCSCASECMP=0; - GNULIB_WCSNCASECMP=0; - GNULIB_WCSCOLL=0; - GNULIB_WCSXFRM=0; - GNULIB_WCSDUP=0; - GNULIB_WCSCHR=0; - GNULIB_WCSRCHR=0; - GNULIB_WCSCSPN=0; - GNULIB_WCSSPN=0; - GNULIB_WCSPBRK=0; - GNULIB_WCSSTR=0; - GNULIB_WCSTOK=0; - GNULIB_WCSWIDTH=0; - GNULIB_WCSFTIME=0; - HAVE_BTOWC=1; - HAVE_MBSINIT=1; - HAVE_MBRTOWC=1; - HAVE_MBRLEN=1; - HAVE_MBSRTOWCS=1; - HAVE_MBSNRTOWCS=1; - HAVE_WCRTOMB=1; - HAVE_WCSRTOMBS=1; - HAVE_WCSNRTOMBS=1; - HAVE_WMEMCHR=1; - HAVE_WMEMCMP=1; - HAVE_WMEMCPY=1; - HAVE_WMEMMOVE=1; - HAVE_WMEMSET=1; - HAVE_WCSLEN=1; - HAVE_WCSNLEN=1; - HAVE_WCSCPY=1; - HAVE_WCPCPY=1; - HAVE_WCSNCPY=1; - HAVE_WCPNCPY=1; - HAVE_WCSCAT=1; - HAVE_WCSNCAT=1; - HAVE_WCSCMP=1; - HAVE_WCSNCMP=1; - HAVE_WCSCASECMP=1; - HAVE_WCSNCASECMP=1; - HAVE_WCSCOLL=1; - HAVE_WCSXFRM=1; - HAVE_WCSDUP=1; - HAVE_WCSCHR=1; - HAVE_WCSRCHR=1; - HAVE_WCSCSPN=1; - HAVE_WCSSPN=1; - HAVE_WCSPBRK=1; - HAVE_WCSSTR=1; - HAVE_WCSTOK=1; - HAVE_WCSWIDTH=1; - HAVE_WCSFTIME=1; - HAVE_DECL_WCTOB=1; - HAVE_DECL_WCWIDTH=1; - REPLACE_MBSTATE_T=0; - REPLACE_BTOWC=0; - REPLACE_WCTOB=0; - REPLACE_MBSINIT=0; - REPLACE_MBRTOWC=0; - REPLACE_MBRLEN=0; - REPLACE_MBSRTOWCS=0; - REPLACE_MBSNRTOWCS=0; - REPLACE_WCRTOMB=0; - REPLACE_WCSRTOMBS=0; - REPLACE_WCSNRTOMBS=0; - REPLACE_WCWIDTH=0; - REPLACE_WCSWIDTH=0; - REPLACE_WCSFTIME=0; - REPLACE_WCSTOK=0; + GL_GNULIB_CANONICALIZE_FILE_NAME=1 - if test -z "$gl_pthreadlib_body_done"; then - gl_pthread_api=no - LIBPTHREAD= - LIBPMULTITHREAD= - # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that - # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. - ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = xyes; then : - gl_have_pthread_h=yes -else - gl_have_pthread_h=no -fi - if test "$gl_have_pthread_h" = yes; then - # Other possible tests: - # -lpthreads (FSU threads, PCthreads) - # -lgthreads - # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist - # in libc. IRIX 6.5 has the first one in both libc and libpthread, but - # the second one only in libpthread, and lock.c needs it. - # - # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 - # needs -pthread for some reason. See: - # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html - save_LIBS=$LIBS - for gl_pthread in '' '-pthread'; do - LIBS="$LIBS $gl_pthread" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - pthread_mutex_t m; - pthread_mutexattr_t ma; +printf "%s\n" "#define GNULIB_TEST_CANONICALIZE_FILE_NAME 1" >>confdefs.h -int -main () -{ -pthread_mutex_lock (&m); - pthread_mutexattr_init (&ma); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_pthread_api=yes - LIBPTHREAD=$gl_pthread - LIBPMULTITHREAD=$gl_pthread -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$save_LIBS - test $gl_pthread_api = yes && break - done - # Test for libpthread by looking for pthread_kill. (Not pthread_self, - # since it is defined as a macro on OSF/1.) - if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then - # The program links fine without libpthread. But it may actually - # need to link with libpthread in order to create multiple threads. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 -$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_kill (); -int -main () -{ -return pthread_kill (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_kill=yes -else - ac_cv_lib_pthread_pthread_kill=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } -if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : - LIBPMULTITHREAD=-lpthread - # On Solaris and HP-UX, most pthread functions exist also in libc. - # Therefore pthread_in_use() needs to actually try to create a - # thread: pthread_create from libc will fail, whereas - # pthread_create will actually create a thread. - # On Solaris 10 or newer, this test is no longer needed, because - # libc contains the fully functional pthread functions. - case "$host_os" in - solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) -$as_echo "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h - esac -fi - elif test $gl_pthread_api != yes; then - # Some library is needed. Try libpthread and libc_r. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 -$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_kill (); -int -main () -{ -return pthread_kill (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_kill=yes -else - ac_cv_lib_pthread_pthread_kill=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } -if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : - gl_pthread_api=yes - LIBPTHREAD=-lpthread - LIBPMULTITHREAD=-lpthread -fi - if test $gl_pthread_api != yes; then - # For FreeBSD 4. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 -$as_echo_n "checking for pthread_kill in -lc_r... " >&6; } -if ${ac_cv_lib_c_r_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc_r $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_kill (); -int -main () -{ -return pthread_kill (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_r_pthread_kill=yes -else - ac_cv_lib_c_r_pthread_kill=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 -$as_echo "$ac_cv_lib_c_r_pthread_kill" >&6; } -if test "x$ac_cv_lib_c_r_pthread_kill" = xyes; then : - gl_pthread_api=yes - LIBPTHREAD=-lc_r - LIBPMULTITHREAD=-lc_r -fi - fi - fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 -$as_echo_n "checking whether POSIX threads API is available... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 -$as_echo "$gl_pthread_api" >&6; } + GL_GNULIB_REALPATH=1 - if test $gl_pthread_api = yes; then -$as_echo "#define HAVE_PTHREAD_API 1" >>confdefs.h - fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -sched_yield (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - LIB_SCHED_YIELD= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 -$as_echo_n "checking for sched_yield in -lrt... " >&6; } -if ${ac_cv_lib_rt_sched_yield+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +printf "%s\n" "#define GNULIB_TEST_REALPATH 1" >>confdefs.h -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char sched_yield (); -int -main () -{ -return sched_yield (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_rt_sched_yield=yes -else - ac_cv_lib_rt_sched_yield=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 -$as_echo "$ac_cv_lib_rt_sched_yield" >&6; } -if test "x$ac_cv_lib_rt_sched_yield" = xyes; then : - LIB_SCHED_YIELD=-lrt -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 -$as_echo_n "checking for sched_yield in -lposix4... " >&6; } -if ${ac_cv_lib_posix4_sched_yield+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lposix4 $LIBS" + + + + + + + + # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function. + # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4. + + # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all* + # programs in the package would end up linked with that potentially-shared + # library, inducing unnecessary run-time overhead. + LIB_CLOCK_GETTIME= + + gl_saved_libs=$LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 +printf %s "checking for library containing clock_gettime... " >&6; } +if test ${ac_cv_search_clock_gettime+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char sched_yield (); +char clock_gettime (); int -main () +main (void) { -return sched_yield (); +return clock_gettime (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_posix4_sched_yield=yes -else - ac_cv_lib_posix4_sched_yield=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +for ac_lib in '' rt posix4 +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_clock_gettime=$ac_res fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 -$as_echo "$ac_cv_lib_posix4_sched_yield" >&6; } -if test "x$ac_cv_lib_posix4_sched_yield" = xyes; then : - LIB_SCHED_YIELD=-lposix4 +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_clock_gettime+y} +then : + break fi +done +if test ${ac_cv_search_clock_gettime+y} +then : +else $as_nop + ac_cv_search_clock_gettime=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 +printf "%s\n" "$ac_cv_search_clock_gettime" >&6; } +ac_res=$ac_cv_search_clock_gettime +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + test "$ac_cv_search_clock_gettime" = "none required" || + LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime fi + ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" +if test "x$ac_cv_func_clock_gettime" = xyes +then : + printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +ac_fn_c_check_func "$LINENO" "clock_settime" "ac_cv_func_clock_settime" +if test "x$ac_cv_func_clock_settime" = xyes +then : + printf "%s\n" "#define HAVE_CLOCK_SETTIME 1" >>confdefs.h +fi - gl_pthreadlib_body_done=done - fi + LIBS=$gl_saved_libs +printf "%s\n" "#define GNULIB_TEST_CLOEXEC 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a traditional japanese locale" >&5 -$as_echo_n "checking for a traditional japanese locale... " >&6; } -if ${gt_cv_locale_ja+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + REPLACE_CLOSE=1 + fi + - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if HAVE_LANGINFO_CODESET -# include -#endif -#include -#include -struct tm t; -char buf[16]; -int main () -{ - /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl - imitates locale dependent behaviour by looking at the environment - variables, and all locales use the UTF-8 encoding. */ -#if defined __BEOS__ || defined __HAIKU__ - return 1; -#else - /* Check whether the given locale name is recognized by the system. */ -# if defined _WIN32 && !defined __CYGWIN__ - /* On native Windows, setlocale(category, "") looks at the system settings, - not at the environment variables. Also, when an encoding suffix such - as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE - category of the locale to "C". */ - if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL - || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) - return 1; -# else - if (setlocale (LC_ALL, "") == NULL) return 1; -# endif - /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". - On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) - is empty, and the behaviour of Tcl 8.4 in this locale is not useful. - On OpenBSD 4.0, when an unsupported locale is specified, setlocale() - succeeds but then nl_langinfo(CODESET) is "646". In this situation, - some unit tests fail. - On MirBSD 10, when an unsupported locale is specified, setlocale() - succeeds but then nl_langinfo(CODESET) is "UTF-8". */ -# if HAVE_LANGINFO_CODESET - { - const char *cs = nl_langinfo (CODESET); - if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 - || strcmp (cs, "UTF-8") == 0) - return 1; - } -# endif -# ifdef __CYGWIN__ - /* On Cygwin, avoid locale names without encoding suffix, because the - locale_charset() function relies on the encoding suffix. Note that - LC_ALL is set on the command line. */ - if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; -# endif - /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales - on Cygwin 1.5.x. */ - if (MB_CUR_MAX == 1) - return 1; - /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. - This excludes the UTF-8 encoding (except on MirBSD). */ - { - const char *p; - t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; - if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; - for (p = buf; *p != '\0'; p++) - if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) - return 1; - } - return 0; -#endif -} -_ACEOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest$ac_exeext; then - case "$host_os" in - # Handle native Windows specially, because there setlocale() interprets - # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", - # "fr" or "fra" as "French" or "French_France.1252", - # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", - # and similar. - mingw*) - # Note that on native Windows, the Japanese locale is - # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we - # cannot use it here. - gt_cv_locale_ja=none - ;; - *) - # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because - # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the - # configure script would override the LC_ALL setting. Likewise for - # LC_CTYPE, which is also set at the beginning of the configure script. - # Test for the AIX locale name. - if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja_JP - else - # Test for the locale name with explicit encoding suffix. - if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja_JP.EUC-JP - else - # Test for the HP-UX, OSF/1, NetBSD locale name. - if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja_JP.eucJP - else - # Test for the IRIX, FreeBSD locale name. - if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja_JP.EUC - else - # Test for the Solaris 7 locale name. - if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja - else - # Special test for NetBSD 1.6. - if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then - gt_cv_locale_ja=ja_JP.eucJP - else - # None found. - gt_cv_locale_ja=none - fi - fi - fi - fi - fi - fi - ;; - esac - fi - rm -fr conftest* + + + if test $ac_cv_header_sys_socket_h != yes; then + ac_fn_c_check_header_compile "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" +if test "x$ac_cv_header_winsock2_h" = xyes +then : + printf "%s\n" "#define HAVE_WINSOCK2_H 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_ja" >&5 -$as_echo "$gt_cv_locale_ja" >&6; } - LOCALE_JA=$gt_cv_locale_ja + fi + if test "$ac_cv_header_winsock2_h" = yes; then + HAVE_WINSOCK2_H=1 + UNISTD_H_HAVE_WINSOCK2_H=1 + SYS_IOCTL_H_HAVE_WINSOCK2_H=1 + else + HAVE_WINSOCK2_H=0 + fi + if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then + REPLACE_CLOSE=1 + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 -$as_echo_n "checking for a french Unicode locale... " >&6; } -if ${gt_cv_locale_fr_utf8+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + if test $REPLACE_CLOSE = 0; then -#include -#include -#if HAVE_LANGINFO_CODESET -# include -#endif -#include -#include -struct tm t; -char buf[16]; -int main () { - /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl - imitates locale dependent behaviour by looking at the environment - variables, and all locales use the UTF-8 encoding. */ -#if !(defined __BEOS__ || defined __HAIKU__) - /* Check whether the given locale name is recognized by the system. */ -# if defined _WIN32 && !defined __CYGWIN__ - /* On native Windows, setlocale(category, "") looks at the system settings, - not at the environment variables. Also, when an encoding suffix such - as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE - category of the locale to "C". */ - if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL - || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) - return 1; -# else - if (setlocale (LC_ALL, "") == NULL) return 1; -# endif - /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". - On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) - is empty, and the behaviour of Tcl 8.4 in this locale is not useful. - On OpenBSD 4.0, when an unsupported locale is specified, setlocale() - succeeds but then nl_langinfo(CODESET) is "646". In this situation, - some unit tests fail. */ -# if HAVE_LANGINFO_CODESET - { - const char *cs = nl_langinfo (CODESET); - if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) - return 1; - } -# endif -# ifdef __CYGWIN__ - /* On Cygwin, avoid locale names without encoding suffix, because the - locale_charset() function relies on the encoding suffix. Note that - LC_ALL is set on the command line. */ - if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; -# endif - /* Check whether in the abbreviation of the second month, the second - character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is - two bytes long, with UTF-8 encoding. */ - t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; - if (strftime (buf, sizeof (buf), "%b", &t) < 4 - || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') - return 1; -#endif -#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ - /* Check whether the decimal separator is a comma. - On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point - are nl_langinfo(RADIXCHAR) are both ".". */ - if (localeconv () ->decimal_point[0] != ',') return 1; -#endif - return 0; -} -_ACEOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest$ac_exeext; then - case "$host_os" in - # Handle native Windows specially, because there setlocale() interprets - # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", - # "fr" or "fra" as "French" or "French_France.1252", - # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", - # and similar. - mingw*) - # Test for the hypothetical native Windows locale name. - if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=French_France.65001 - else - # None found. - gt_cv_locale_fr_utf8=none - fi - ;; - *) - # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because - # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the - # configure script would override the LC_ALL setting. Likewise for - # LC_CTYPE, which is also set at the beginning of the configure script. - # Test for the usual locale name. - if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr_FR - else - # Test for the locale name with explicit encoding suffix. - if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr_FR.UTF-8 - else - # Test for the Solaris 7 locale name. - if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr.UTF-8 - else - # None found. - gt_cv_locale_fr_utf8=none - fi - fi - fi - ;; - esac + + if test $ac_cv_func_fchdir = no; then + HAVE_FCHDIR=0 + fi + + if test $HAVE_FCHDIR = 0; then + REPLACE_CLOSE=1 + fi fi - rm -fr conftest* + + if test $REPLACE_CLOSE = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS close.$ac_objext" + + fi + + + + + + + + + + GL_GNULIB_CLOSE=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_CLOSE 1" >>confdefs.h + + + + + +printf "%s\n" "#define GNULIB_CLOSE_STREAM 1" >>confdefs.h + + + + + if test "x$lispdir" = x; then + lispdir='${datarootdir}/emacs/site-lisp' + + fi + if test "x$runstatedir" = x; then + runstatedir='${localstatedir}/run' + + fi + + pkglibexecdir='${libexecdir}/${PACKAGE}' + + + + +printf "%s\n" "#define GNULIB_DIRNAME 1" >>confdefs.h + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether // is distinct from /" >&5 +printf %s "checking whether // is distinct from /... " >&6; } +if test ${gl_cv_double_slash_root+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test x"$cross_compiling" = xyes ; then + # When cross-compiling, there is no way to tell whether // is special + # short of a list of hosts. However, the only known hosts to date + # that have a distinct // are Apollo DomainOS (too old to port to), + # Cygwin, and z/OS. If anyone knows of another system for which // has + # special semantics and is distinct from /, please report it to + # . + case $host in + *-cygwin | i370-ibm-openedition) + gl_cv_double_slash_root=yes ;; + *) + # Be optimistic and assume that / and // are the same when we + # don't know. + gl_cv_double_slash_root='unknown, assuming no' ;; + esac + else + set x `ls -di / // 2>/dev/null` + if test "$2" = "$4" && wc //dev/null >/dev/null 2>&1; then + gl_cv_double_slash_root=no + else + gl_cv_double_slash_root=yes + fi + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 -$as_echo "$gt_cv_locale_fr_utf8" >&6; } - LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_double_slash_root" >&5 +printf "%s\n" "$gl_cv_double_slash_root" >&6; } + if test "$gl_cv_double_slash_root" = yes; then +printf "%s\n" "#define DOUBLE_SLASH_IS_DISTINCT_ROOT 1" >>confdefs.h + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a transitional chinese locale" >&5 -$as_echo_n "checking for a transitional chinese locale... " >&6; } -if ${gt_cv_locale_zh_CN+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether dup2 works" >&5 +printf %s "checking whether dup2 works... " >&6; } +if test ${gl_cv_func_dup2_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + mingw*) # on this platform, dup2 always returns 0 for success + 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" ;; + aix* | freebsd*) + # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE, + # not EBADF. + gl_cv_func_dup2_works="guessing no" ;; + haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC. + gl_cv_func_dup2_works="guessing no" ;; + *-android*) # implemented using dup3(), which fails if oldfd == newfd + gl_cv_func_dup2_works="guessing no" ;; + os2*) # on OS/2 kLIBC, dup2() does not work on a directory fd. + gl_cv_func_dup2_works="guessing no" ;; + *) gl_cv_func_dup2_works="guessing yes" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include -#if HAVE_LANGINFO_CODESET -# include -#endif -#include -#include -struct tm t; -char buf[16]; -int main () + #include + #include + #include + #include + #include + + +$gl_mda_defines + + #ifndef RLIM_SAVED_CUR + # define RLIM_SAVED_CUR RLIM_INFINITY + #endif + #ifndef RLIM_SAVED_MAX + # define RLIM_SAVED_MAX RLIM_INFINITY + #endif + +int +main (void) { - /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl - imitates locale dependent behaviour by looking at the environment - variables, and all locales use the UTF-8 encoding. */ -#if defined __BEOS__ || defined __HAIKU__ - return 1; -#else - /* Check whether the given locale name is recognized by the system. */ -# if defined _WIN32 && !defined __CYGWIN__ - /* On native Windows, setlocale(category, "") looks at the system settings, - not at the environment variables. Also, when an encoding suffix such - as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE - category of the locale to "C". */ - if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL - || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) - return 1; -# else - if (setlocale (LC_ALL, "") == NULL) return 1; -# endif - /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". - On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) - is empty, and the behaviour of Tcl 8.4 in this locale is not useful. - On OpenBSD 4.0, when an unsupported locale is specified, setlocale() - succeeds but then nl_langinfo(CODESET) is "646". In this situation, - some unit tests fail. - On MirBSD 10, when an unsupported locale is specified, setlocale() - succeeds but then nl_langinfo(CODESET) is "UTF-8". */ -# if HAVE_LANGINFO_CODESET - { - const char *cs = nl_langinfo (CODESET); - if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 - || strcmp (cs, "UTF-8") == 0) - return 1; - } -# endif -# ifdef __CYGWIN__ - /* On Cygwin, avoid locale names without encoding suffix, because the - locale_charset() function relies on the encoding suffix. Note that - LC_ALL is set on the command line. */ - if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; -# endif - /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. - This excludes the UTF-8 encoding (except on MirBSD). */ - { - const char *p; - t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; - if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; - for (p = buf; *p != '\0'; p++) - if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) - return 1; - } - /* Check whether a typical GB18030 multibyte sequence is recognized as a - single wide character. This excludes the GB2312 and GBK encodings. */ - if (mblen ("\203\062\332\066", 5) != 4) - return 1; +int result = 0; + int bad_fd = INT_MAX; + struct rlimit rlim; + if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 + && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX + && rlim.rlim_cur != RLIM_INFINITY + && rlim.rlim_cur != RLIM_SAVED_MAX + && rlim.rlim_cur != RLIM_SAVED_CUR) + bad_fd = rlim.rlim_cur; + #ifdef FD_CLOEXEC + if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) + result |= 1; + #endif + if (dup2 (1, 1) != 1) + result |= 2; + #ifdef FD_CLOEXEC + if (fcntl (1, F_GETFD) != FD_CLOEXEC) + result |= 4; + #endif + close (0); + if (dup2 (0, 0) != -1) + result |= 8; + /* Many gnulib modules require POSIX conformance of EBADF. */ + if (dup2 (2, bad_fd) == -1 && errno != EBADF) + result |= 16; + /* Flush out some cygwin core dumps. */ + if (dup2 (2, -1) != -1 || errno != EBADF) + result |= 32; + dup2 (2, 255); + dup2 (2, 256); + /* On OS/2 kLIBC, dup2() does not work on a directory fd. */ + { + int fd = open (".", O_RDONLY); + if (fd == -1) + result |= 64; + else if (dup2 (fd, fd + 1) == -1) + result |= 128; + close (fd); + } + return result; + ; return 0; -#endif } -_ACEOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest$ac_exeext; then - case "$host_os" in - # Handle native Windows specially, because there setlocale() interprets - # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", - # "fr" or "fra" as "French" or "French_France.1252", - # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", - # and similar. - mingw*) - # Test for the hypothetical native Windows locale name. - if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_zh_CN=Chinese_China.54936 - else - # None found. - gt_cv_locale_zh_CN=none - fi - ;; - solaris2.8) - # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are - # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. - # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. - gt_cv_locale_zh_CN=none - ;; - *) - # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because - # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the - # configure script would override the LC_ALL setting. Likewise for - # LC_CTYPE, which is also set at the beginning of the configure script. - # Test for the locale name without encoding suffix. - if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_zh_CN=zh_CN - else - # Test for the locale name with explicit encoding suffix. - if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_zh_CN=zh_CN.GB18030 - else - # None found. - gt_cv_locale_zh_CN=none - fi - fi - ;; - esac - else - # If there was a link error, due to mblen(), the system is so old that - # it certainly doesn't have a chinese locale. - gt_cv_locale_zh_CN=none +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_dup2_works=yes +else $as_nop + gl_cv_func_dup2_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_dup2_works" >&5 +printf "%s\n" "$gl_cv_func_dup2_works" >&6; } + case "$gl_cv_func_dup2_works" in + *yes) ;; + *) + REPLACE_DUP2=1 + ac_fn_c_check_func "$LINENO" "setdtablesize" "ac_cv_func_setdtablesize" +if test "x$ac_cv_func_setdtablesize" = xyes +then : + printf "%s\n" "#define HAVE_SETDTABLESIZE 1" >>confdefs.h + +fi + + ;; + esac + + + + + if test $ac_cv_func_fchdir = no; then + HAVE_FCHDIR=0 + fi + + if test $HAVE_FCHDIR = 0; then + REPLACE_DUP2=1 fi - rm -fr conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_zh_CN" >&5 -$as_echo "$gt_cv_locale_zh_CN" >&6; } - LOCALE_ZH_CN=$gt_cv_locale_zh_CN + if test $REPLACE_DUP2 = 1; then @@ -22247,466 +34222,526 @@ - GNULIB_EXPLICIT_BZERO=0; - GNULIB_FFSL=0; - GNULIB_FFSLL=0; - GNULIB_MEMCHR=0; - GNULIB_MEMMEM=0; - GNULIB_MEMPCPY=0; - GNULIB_MEMRCHR=0; - GNULIB_RAWMEMCHR=0; - GNULIB_STPCPY=0; - GNULIB_STPNCPY=0; - GNULIB_STRCHRNUL=0; - GNULIB_STRDUP=0; - GNULIB_STRNCAT=0; - GNULIB_STRNDUP=0; - GNULIB_STRNLEN=0; - GNULIB_STRPBRK=0; - GNULIB_STRSEP=0; - GNULIB_STRSTR=0; - GNULIB_STRCASESTR=0; - GNULIB_STRTOK_R=0; - GNULIB_MBSLEN=0; - GNULIB_MBSNLEN=0; - GNULIB_MBSCHR=0; - GNULIB_MBSRCHR=0; - GNULIB_MBSSTR=0; - GNULIB_MBSCASECMP=0; - GNULIB_MBSNCASECMP=0; - GNULIB_MBSPCASECMP=0; - GNULIB_MBSCASESTR=0; - GNULIB_MBSCSPN=0; - GNULIB_MBSPBRK=0; - GNULIB_MBSSPN=0; - GNULIB_MBSSEP=0; - GNULIB_MBSTOK_R=0; - GNULIB_STRERROR=0; - GNULIB_STRERROR_R=0; - GNULIB_STRSIGNAL=0; - GNULIB_STRVERSCMP=0; - HAVE_MBSLEN=0; - HAVE_EXPLICIT_BZERO=1; - HAVE_FFSL=1; - HAVE_FFSLL=1; - HAVE_MEMCHR=1; - HAVE_DECL_MEMMEM=1; - HAVE_MEMPCPY=1; - HAVE_DECL_MEMRCHR=1; - HAVE_RAWMEMCHR=1; - HAVE_STPCPY=1; - HAVE_STPNCPY=1; - HAVE_STRCHRNUL=1; - HAVE_DECL_STRDUP=1; - HAVE_DECL_STRNDUP=1; - HAVE_DECL_STRNLEN=1; - HAVE_STRPBRK=1; - HAVE_STRSEP=1; - HAVE_STRCASESTR=1; - HAVE_DECL_STRTOK_R=1; - HAVE_DECL_STRERROR_R=1; - HAVE_DECL_STRSIGNAL=1; - HAVE_STRVERSCMP=1; - REPLACE_MEMCHR=0; - REPLACE_MEMMEM=0; - REPLACE_STPNCPY=0; - REPLACE_STRCHRNUL=0; - REPLACE_STRDUP=0; - REPLACE_STRNCAT=0; - REPLACE_STRNDUP=0; - REPLACE_STRNLEN=0; - REPLACE_STRSTR=0; - REPLACE_STRCASESTR=0; - REPLACE_STRTOK_R=0; - REPLACE_STRERROR=0; - REPLACE_STRERROR_R=0; - REPLACE_STRSIGNAL=0; - UNDEFINE_STRTOK_R=0; + gl_LIBOBJS="$gl_LIBOBJS dup2.$ac_objext" + fi - # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it - # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is - # irrelevant for anonymous mappings. - ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" -if test "x$ac_cv_func_mmap" = xyes; then : - gl_have_mmap=yes -else - gl_have_mmap=no -fi - # Try to allow MAP_ANONYMOUS. - gl_have_mmap_anonymous=no - if test $gl_have_mmap = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 -$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#ifdef MAP_ANONYMOUS - I cannot identify this map -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "I cannot identify this map" >/dev/null 2>&1; then : - gl_have_mmap_anonymous=yes -fi -rm -f conftest* - if test $gl_have_mmap_anonymous != yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + GL_GNULIB_DUP2=1 -#include -#ifdef MAP_ANON - I cannot identify this map -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "I cannot identify this map" >/dev/null 2>&1; then : -$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h - gl_have_mmap_anonymous=yes -fi -rm -f conftest* - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 -$as_echo "$gl_have_mmap_anonymous" >&6; } - if test $gl_have_mmap_anonymous = yes; then +printf "%s\n" "#define GNULIB_TEST_DUP2 1" >>confdefs.h -$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h - fi - fi - if test $HAVE_MEMCHR = 1; then - # Detect platform-specific bugs in some versions of glibc: - # memchr should not dereference anything with length 0 - # https://bugzilla.redhat.com/show_bug.cgi?id=499689 - # memchr should not dereference overestimated length after a match - # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 - # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 - # memchr should cast the second argument to 'unsigned char'. - # This bug exists in Android 4.3. - # Assume that memchr works on platforms that lack mprotect. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether memchr works" >&5 -$as_echo_n "checking whether memchr works... " >&6; } -if ${gl_cv_func_memchr_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess no on Android. - linux*-android*) gl_cv_func_memchr_works="guessing no" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_memchr_works="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#if HAVE_SYS_MMAN_H -# include -# include -# include -# include -# ifndef MAP_FILE -# define MAP_FILE 0 -# endif -#endif -int -main () -{ - int result = 0; - char *fence = NULL; -#if HAVE_SYS_MMAN_H && HAVE_MPROTECT -# if HAVE_MAP_ANONYMOUS - const int flags = MAP_ANONYMOUS | MAP_PRIVATE; - const int fd = -1; -# else /* !HAVE_MAP_ANONYMOUS */ - const int flags = MAP_FILE | MAP_PRIVATE; - int fd = open ("/dev/zero", O_RDONLY, 0666); - if (fd >= 0) -# endif - { - int pagesize = getpagesize (); - char *two_pages = - (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, - flags, fd, 0); - if (two_pages != (char *)(-1) - && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) - fence = two_pages + pagesize; - } -#endif - if (fence) - { - if (memchr (fence, 0, 0)) - result |= 1; - strcpy (fence - 9, "12345678"); - if (memchr (fence - 9, 0, 79) != fence - 1) - result |= 2; - if (memchr (fence - 1, 0, 3) != fence - 1) - result |= 4; - } - /* Test against bug on Android 4.3. */ - { - char input[3]; - input[0] = 'a'; - input[1] = 'b'; - input[2] = 'c'; - if (memchr (input, 0x789abc00 | 'b', 3) != input + 1) - result |= 8; - } - return result; + GL_GNULIB_ENVIRON=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_ENVIRON 1" >>confdefs.h + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5 +printf %s "checking for error_at_line... " >&6; } +if test ${ac_cv_lib_error_at_line+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +error_at_line (0, 0, "", 0, "an error occurred"); ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_memchr_works=yes -else - gl_cv_func_memchr_works=no +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_error_at_line=yes +else $as_nop + ac_cv_lib_error_at_line=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5 +printf "%s\n" "$ac_cv_lib_error_at_line" >&6; } + + if test "$ac_cv_lib_error_at_line" = no +then : + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS error.$ac_objext" + + + + + + : fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_memchr_works" >&5 -$as_echo "$gl_cv_func_memchr_works" >&6; } - case "$gl_cv_func_memchr_works" in - *yes) ;; - *) REPLACE_MEMCHR=1 ;; - esac - fi + + + XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=error:3:c-format" + XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=error_at_line:5:c-format" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether defines MIN and MAX" >&5 -$as_echo_n "checking whether defines MIN and MAX... " >&6; } -if ${gl_cv_minmax_in_limits_h+:} false; then : - $as_echo_n "(cached) " >&6 -else + + + + + + + : + + + + + + + if test $ac_cv_func_fcntl = no; then + + + + if test $ac_cv_func_fcntl = no; then + HAVE_FCNTL=0 + else + REPLACE_FCNTL=1 + fi + + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fcntl handles F_DUPFD correctly" >&5 +printf %s "checking whether fcntl handles F_DUPFD correctly... " >&6; } +if test ${gl_cv_func_fcntl_f_dupfd_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case $host_os in + aix* | cygwin* | haiku*) + gl_cv_func_fcntl_f_dupfd_works="guessing no" ;; + *) gl_cv_func_fcntl_f_dupfd_works="guessing yes" ;; + esac +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - int x = MIN (42, 17); +#include + #include + #include + #include + #include + + +$gl_mda_defines + + #ifndef RLIM_SAVED_CUR + # define RLIM_SAVED_CUR RLIM_INFINITY + #endif + #ifndef RLIM_SAVED_MAX + # define RLIM_SAVED_MAX RLIM_INFINITY + #endif + int -main () +main (void) { +int result = 0; + int bad_fd = INT_MAX; + struct rlimit rlim; + if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 + && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX + && rlim.rlim_cur != RLIM_INFINITY + && rlim.rlim_cur != RLIM_SAVED_MAX + && rlim.rlim_cur != RLIM_SAVED_CUR) + bad_fd = rlim.rlim_cur; + if (fcntl (0, F_DUPFD, -1) != -1) result |= 1; + if (errno != EINVAL) result |= 2; + if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4; + if (errno != EINVAL) result |= 8; + /* On OS/2 kLIBC, F_DUPFD does not work on a directory fd */ + { + int fd; + fd = open (".", O_RDONLY); + if (fd == -1) + result |= 16; + else if (fcntl (fd, F_DUPFD, STDERR_FILENO + 1) == -1) + result |= 32; + close (fd); + } + return result; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_minmax_in_limits_h=yes -else - gl_cv_minmax_in_limits_h=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_fcntl_f_dupfd_works=yes +else $as_nop + gl_cv_func_fcntl_f_dupfd_works=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_minmax_in_limits_h" >&5 -$as_echo "$gl_cv_minmax_in_limits_h" >&6; } - if test $gl_cv_minmax_in_limits_h = yes; then -$as_echo "#define HAVE_MINMAX_IN_LIMITS_H 1" >>confdefs.h +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fcntl_f_dupfd_works" >&5 +printf "%s\n" "$gl_cv_func_fcntl_f_dupfd_works" >&6; } + case $gl_cv_func_fcntl_f_dupfd_works in + *yes) ;; + *) + + if test $ac_cv_func_fcntl = no; then + HAVE_FCNTL=0 + else + REPLACE_FCNTL=1 fi +printf "%s\n" "#define FCNTL_DUPFD_BUGGY 1" >>confdefs.h + ;; + esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fcntl understands F_DUPFD_CLOEXEC" >&5 +printf %s "checking whether fcntl understands F_DUPFD_CLOEXEC... " >&6; } +if test ${gl_cv_func_fcntl_f_dupfd_cloexec+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess no on NetBSD. + netbsd*) gl_cv_func_fcntl_f_dupfd_cloexec="guessing no" ;; + *) gl_cv_func_fcntl_f_dupfd_cloexec="$gl_cross_guess_normal" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + int main (int argc, char *argv[]) + { + if (argc == 1) + /* parent process */ + { + if (fcntl (1, F_DUPFD_CLOEXEC, 10) < 0) + return 1; + return execl ("./conftest", "./conftest", "child", NULL); + } + else + /* child process */ + return (fcntl (10, F_GETFL) < 0 ? 0 : 42); + } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether defines MIN and MAX" >&5 -$as_echo_n "checking whether defines MIN and MAX... " >&6; } -if ${gl_cv_minmax_in_sys_param_h+:} false; then : - $as_echo_n "(cached) " >&6 -else +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - int x = MIN (42, 17); + +#ifdef __linux__ +/* The Linux kernel only added F_DUPFD_CLOEXEC in 2.6.24, so we always replace + it to support the semantics on older kernels that failed with EINVAL. */ +choke me +#endif + int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_minmax_in_sys_param_h=yes -else - gl_cv_minmax_in_sys_param_h=no +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_fcntl_f_dupfd_cloexec=yes +else $as_nop + gl_cv_func_fcntl_f_dupfd_cloexec="needs runtime check" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +else $as_nop + gl_cv_func_fcntl_f_dupfd_cloexec=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_minmax_in_sys_param_h" >&5 -$as_echo "$gl_cv_minmax_in_sys_param_h" >&6; } - if test $gl_cv_minmax_in_sys_param_h = yes; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fcntl_f_dupfd_cloexec" >&5 +printf "%s\n" "$gl_cv_func_fcntl_f_dupfd_cloexec" >&6; } + case "$gl_cv_func_fcntl_f_dupfd_cloexec" in + *yes) ;; + *) -$as_echo "#define HAVE_MINMAX_IN_SYS_PARAM_H 1" >>confdefs.h + if test $ac_cv_func_fcntl = no; then + HAVE_FCNTL=0 + else + REPLACE_FCNTL=1 fi + ;; + esac + fi + if test $ac_cv_func_fchdir = no; then + HAVE_FCHDIR=0 + fi + if test $HAVE_FCHDIR = 0; then -ac_fn_c_check_decl "$LINENO" "obstack_printf" "ac_cv_have_decl_obstack_printf" "$ac_includes_default" -if test "x$ac_cv_have_decl_obstack_printf" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi + if test $ac_cv_func_fcntl = no; then + HAVE_FCNTL=0 + else + REPLACE_FCNTL=1 + fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_OBSTACK_PRINTF $ac_have_decl -_ACEOF + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for O_CLOEXEC" >&5 -$as_echo_n "checking for O_CLOEXEC... " >&6; } -if ${gl_cv_macro_O_CLOEXEC+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #ifndef O_CLOEXEC - choke me; - #endif + if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then -int -main () -{ -return O_CLOEXEC; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_macro_O_CLOEXEC=yes -else - gl_cv_macro_O_CLOEXEC=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_macro_O_CLOEXEC" >&5 -$as_echo "$gl_cv_macro_O_CLOEXEC" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for promoted mode_t type" >&5 -$as_echo_n "checking for promoted mode_t type... " >&6; } -if ${gl_cv_promoted_mode_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + gl_LIBOBJS="$gl_LIBOBJS fcntl.$ac_objext" + + fi + + + + + + + + + + GL_GNULIB_FCNTL=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FCNTL 1" >>confdefs.h + + + + + + + + + + + +printf "%s\n" "#define GNULIB_FD_SAFER_FLAG 1" >>confdefs.h + + + + + + + + + if test $ac_cv_func_ffsl = no; then + HAVE_FFSL=0 + fi + + if test $HAVE_FFSL = 0; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS ffsl.$ac_objext" + + fi + + + + + + + + + + GL_GNULIB_FFSL=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FFSL 1" >>confdefs.h + + + + + + + + + + FLOAT_H= + REPLACE_FLOAT_LDBL=0 + case "$host_os" in + aix* | beos* | openbsd* | mirbsd* | irix*) + FLOAT_H=float.h + ;; + freebsd* | dragonfly*) + case "$host_cpu" in + i[34567]86 ) + FLOAT_H=float.h + ;; + x86_64 ) + # On x86_64 systems, the C compiler may still be generating + # 32-bit code. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -int -main () -{ -typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1]; - ; - return 0; -} +#if defined __LP64__ || defined __x86_64__ || defined __amd64__ + int ok; + #else + error fail + #endif + _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_promoted_mode_t='int' -else - gl_cv_promoted_mode_t='mode_t' -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +if ac_fn_c_try_compile "$LINENO" +then : +else $as_nop + FLOAT_H=float.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_promoted_mode_t" >&5 -$as_echo "$gl_cv_promoted_mode_t" >&6; } - -cat >>confdefs.h <<_ACEOF -#define PROMOTED_MODE_T $gl_cv_promoted_mode_t -_ACEOF +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + esac + ;; + linux*) + case "$host_cpu" in + powerpc*) + FLOAT_H=float.h + ;; + esac + ;; + esac + case "$host_os" in + aix* | freebsd* | dragonfly* | linux*) + if test -n "$FLOAT_H"; then + REPLACE_FLOAT_LDBL=1 + fi + ;; + esac + REPLACE_ITOLD=0 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether conversion from 'int' to 'long double' works" >&5 +printf %s "checking whether conversion from 'int' to 'long double' works... " >&6; } +if test ${gl_cv_func_itold_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host" in + sparc*-*-linux*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __LP64__ || defined __arch64__ + int ok; + #else + error fail + #endif - REPLACE_STRERROR_0=0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror(0) succeeds" >&5 -$as_echo_n "checking whether strerror(0) succeeds... " >&6; } -if ${gl_cv_func_strerror_0_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; - # Guess yes on musl systems. - *-musl*) gl_cv_func_strerror_0_works="guessing yes" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_strerror_0_works="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; - esac +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_itold_works="guessing no" +else $as_nop + gl_cv_func_itold_works="guessing yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_itold_works="guessing yes" ;; + *) gl_cv_func_itold_works="guessing yes" ;; + esac -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #include -int -main () +int i = -1; +volatile long double ld; +int main () { -int result = 0; - char *str; - errno = 0; - str = strerror (0); - if (!*str) result |= 1; - if (errno) result |= 2; - if (strstr (str, "nknown") || strstr (str, "ndefined")) - result |= 4; - return result; - ; + ld += i * 1.0L; + if (ld > 0) + return 1; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_strerror_0_works=yes -else - gl_cv_func_strerror_0_works=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_itold_works=yes +else $as_nop + gl_cv_func_itold_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -22714,18 +34749,16 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strerror_0_works" >&5 -$as_echo "$gl_cv_func_strerror_0_works" >&6; } - case "$gl_cv_func_strerror_0_works" in - *yes) ;; - *) - REPLACE_STRERROR_0=1 - -$as_echo "#define REPLACE_STRERROR_0 1" >>confdefs.h - +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_itold_works" >&5 +printf "%s\n" "$gl_cv_func_itold_works" >&6; } + case "$gl_cv_func_itold_works" in + *no) + REPLACE_ITOLD=1 + FLOAT_H=float.h ;; esac + if test -n "$FLOAT_H"; then @@ -22734,743 +34767,418 @@ + if test $gl_cv_have_include_next = yes; then + gl_cv_next_float_h='<'float.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_float_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop - if test $ac_cv_func_strerror_r = yes; then - if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strerror_r with POSIX signature" >&5 -$as_echo_n "checking for strerror_r with POSIX signature... " >&6; } -if ${gl_cv_func_strerror_r_posix_signature+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - int strerror_r (int, char *, size_t); - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_func_strerror_r_posix_signature=yes -else - gl_cv_func_strerror_r_posix_signature=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strerror_r_posix_signature" >&5 -$as_echo "$gl_cv_func_strerror_r_posix_signature" >&6; } - if test $gl_cv_func_strerror_r_posix_signature = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r works" >&5 -$as_echo_n "checking whether strerror_r works... " >&6; } -if ${gl_cv_func_strerror_r_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess no on AIX. - aix*) gl_cv_func_strerror_r_works="guessing no";; - # Guess no on HP-UX. - hpux*) gl_cv_func_strerror_r_works="guessing no";; - # Guess no on BSD variants. - *bsd*) gl_cv_func_strerror_r_works="guessing no";; - # Guess yes otherwise. - *) gl_cv_func_strerror_r_works="guessing yes";; - esac -else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #include +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac -int -main () -{ -int result = 0; - char buf[79]; - if (strerror_r (EACCES, buf, 0) < 0) - result |= 1; - errno = 0; - if (strerror_r (EACCES, buf, sizeof buf) != 0) - result |= 2; - strcpy (buf, "Unknown"); - if (strerror_r (0, buf, sizeof buf) != 0) - result |= 4; - if (errno) - result |= 8; - if (strstr (buf, "nknown") || strstr (buf, "ndefined")) - result |= 0x10; - errno = 0; - *buf = 0; - if (strerror_r (-3, buf, sizeof buf) < 0) - result |= 0x20; - if (errno) - result |= 0x40; - if (!*buf) - result |= 0x80; - return result; + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'float.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_strerror_r_works=yes -else - gl_cv_func_strerror_r_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + gl_cv_absolute_float_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + gl_header=$gl_cv_absolute_float_h + gl_cv_next_float_h='"'$gl_header'"' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strerror_r_works" >&5 -$as_echo "$gl_cv_func_strerror_r_works" >&6; } - else - if test $ac_cv_func___xpg_strerror_r = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __xpg_strerror_r works" >&5 -$as_echo_n "checking whether __xpg_strerror_r works... " >&6; } -if ${gl_cv_func_strerror_r_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - gl_cv_func_strerror_r_works="$gl_cross_guess_normal" +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_float_h" >&5 +printf "%s\n" "$gl_cv_next_float_h" >&6; } + fi + NEXT_FLOAT_H=$gl_cv_next_float_h -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - extern - #ifdef __cplusplus - "C" - #endif - int __xpg_strerror_r(int, char *, size_t); + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'float.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_float_h + fi + NEXT_AS_FIRST_DIRECTIVE_FLOAT_H=$gl_next_as_first_directive -int -main () -{ -int result = 0; - char buf[256] = "^"; - char copy[256]; - char *str = strerror (-1); - strcpy (copy, str); - if (__xpg_strerror_r (-2, buf, 1) == 0) - result |= 1; - if (*buf) - result |= 2; - __xpg_strerror_r (-2, buf, 256); - if (strcmp (str, copy)) - result |= 4; - return result; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_strerror_r_works=yes -else - gl_cv_func_strerror_r_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strerror_r_works" >&5 -$as_echo "$gl_cv_func_strerror_r_works" >&6; } - fi - fi - fi fi -ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" -if test "x$ac_cv_have_decl_strerror_r" = xyes; then : - ac_have_decl=1 + if test -n "$FLOAT_H"; then + GL_GENERATE_FLOAT_H_TRUE= + GL_GENERATE_FLOAT_H_FALSE='#' else - ac_have_decl=0 + GL_GENERATE_FLOAT_H_TRUE='#' + GL_GENERATE_FLOAT_H_FALSE= fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRERROR_R $ac_have_decl -_ACEOF + if test $REPLACE_FLOAT_LDBL = 1; then - if test $ac_cv_have_decl_strerror_r = no; then - HAVE_DECL_STRERROR_R=0 - fi - if test $ac_cv_func_strerror_r = yes; then - if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then - if test $gl_cv_func_strerror_r_posix_signature = yes; then - case "$gl_cv_func_strerror_r_works" in - *no) REPLACE_STRERROR_R=1 ;; - esac - else - REPLACE_STRERROR_R=1 - fi - else - REPLACE_STRERROR_R=1 - fi - fi + gl_LIBOBJS="$gl_LIBOBJS float.$ac_objext" + fi + if test $REPLACE_ITOLD = 1; then - GNULIB_POSIX_SPAWN=0; - GNULIB_POSIX_SPAWNP=0; - GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT=0; - GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=0; - GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=0; - GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2=0; - GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR=0; - GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=0; - GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY=0; - GNULIB_POSIX_SPAWNATTR_INIT=0; - GNULIB_POSIX_SPAWNATTR_GETFLAGS=0; - GNULIB_POSIX_SPAWNATTR_SETFLAGS=0; - GNULIB_POSIX_SPAWNATTR_GETPGROUP=0; - GNULIB_POSIX_SPAWNATTR_SETPGROUP=0; - GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM=0; - GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM=0; - GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY=0; - GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY=0; - GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT=0; - GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT=0; - GNULIB_POSIX_SPAWNATTR_GETSIGMASK=0; - GNULIB_POSIX_SPAWNATTR_SETSIGMASK=0; - GNULIB_POSIX_SPAWNATTR_DESTROY=0; - HAVE_POSIX_SPAWN=1; - HAVE_POSIX_SPAWNATTR_T=1; - HAVE_POSIX_SPAWN_FILE_ACTIONS_T=1; - HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=1; - HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR=1; - REPLACE_POSIX_SPAWN=0; - REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=0; - REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=0; - REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2=0; - REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR=0; + gl_LIBOBJS="$gl_LIBOBJS itold.$ac_objext" - REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=0; + fi + case "$host_os" in + mingw* | pw*) + REPLACE_FOPEN=1 + gl_cv_func_fopen_slash="guessing no" + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fopen recognizes a trailing slash" >&5 +printf %s "checking whether fopen recognizes a trailing slash... " >&6; } +if test ${gl_cv_func_fopen_slash+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : - LIB_POSIX_SPAWN= + case "$host_os" in + aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) + gl_cv_func_fopen_slash="guessing no" ;; + *) + gl_cv_func_fopen_slash="guessing yes" ;; + esac - gl_saved_libs=$LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing posix_spawn" >&5 -$as_echo_n "checking for library containing posix_spawn... " >&6; } -if ${ac_cv_search_posix_spawn+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char posix_spawn (); -int -main () +#include +#include +int main () { -return posix_spawn (); - ; - return 0; + FILE *fp = fopen ("conftest.sl/", "w"); + int result = (fp != NULL); + if (fp != NULL) + fclose (fp); + return result; } _ACEOF -for ac_lib in '' rt; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_posix_spawn=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_posix_spawn+:} false; then : - break -fi -done -if ${ac_cv_search_posix_spawn+:} false; then : - -else - ac_cv_search_posix_spawn=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_fopen_slash=yes +else $as_nop + gl_cv_func_fopen_slash=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_posix_spawn" >&5 -$as_echo "$ac_cv_search_posix_spawn" >&6; } -ac_res=$ac_cv_search_posix_spawn -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - test "$ac_cv_search_posix_spawn" = "none required" || - LIB_POSIX_SPAWN=$ac_cv_search_posix_spawn +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - for ac_func in posix_spawn -do : - ac_fn_c_check_func "$LINENO" "posix_spawn" "ac_cv_func_posix_spawn" -if test "x$ac_cv_func_posix_spawn" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_POSIX_SPAWN 1 -_ACEOF + rm -f conftest.sl fi -done - - LIBS=$gl_saved_libs - - if test $ac_cv_func_posix_spawn != yes; then - HAVE_POSIX_SPAWN=0 - fi - - - - - if test $ac_cv_func_posix_spawn = yes; then - +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fopen_slash" >&5 +printf "%s\n" "$gl_cv_func_fopen_slash" >&6; } + ;; + esac + case "$gl_cv_func_fopen_slash" in + *no) - if test $REPLACE_POSIX_SPAWN = 0; then +printf "%s\n" "#define FOPEN_TRAILING_SLASH_BUG 1" >>confdefs.h + REPLACE_FOPEN=1 + ;; + esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether posix_spawn works" >&5 -$as_echo_n "checking whether posix_spawn works... " >&6; } -if ${gl_cv_func_posix_spawn_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test $cross_compiling = no; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + if test $REPLACE_FOPEN = 1; then -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -extern char **environ; -#ifndef STDIN_FILENO -# define STDIN_FILENO 0 -#endif -#ifndef STDOUT_FILENO -# define STDOUT_FILENO 1 -#endif -#ifndef STDERR_FILENO -# define STDERR_FILENO 2 -#endif -#ifndef WTERMSIG -# define WTERMSIG(x) ((x) & 0x7f) -#endif -#ifndef WIFEXITED -# define WIFEXITED(x) (WTERMSIG (x) == 0) -#endif -#ifndef WEXITSTATUS -# define WEXITSTATUS(x) (((x) >> 8) & 0xff) -#endif -#define CHILD_PROGRAM_FILENAME "/non/exist/ent" -static int -fd_safer (int fd) -{ - if (0 <= fd && fd <= 2) - { - int f = fd_safer (dup (fd)); - int e = errno; - close (fd); - errno = e; - fd = f; - } - return fd; -} -int -main () -{ - char *argv[2] = { CHILD_PROGRAM_FILENAME, NULL }; - int ofd[2]; - sigset_t blocked_signals; - sigset_t fatal_signal_set; - posix_spawn_file_actions_t actions; - bool actions_allocated; - posix_spawnattr_t attrs; - bool attrs_allocated; - int err; - pid_t child; - int status; - int exitstatus; + gl_LIBOBJS="$gl_LIBOBJS fopen.$ac_objext" - setvbuf (stdout, NULL, _IOFBF, 0); - puts ("This should be seen only once."); - if (pipe (ofd) < 0 || (ofd[1] = fd_safer (ofd[1])) < 0) - { - perror ("cannot create pipe"); - exit (1); - } - sigprocmask (SIG_SETMASK, NULL, &blocked_signals); - sigemptyset (&fatal_signal_set); - sigaddset (&fatal_signal_set, SIGINT); - sigaddset (&fatal_signal_set, SIGTERM); - sigaddset (&fatal_signal_set, SIGHUP); - sigaddset (&fatal_signal_set, SIGPIPE); - sigprocmask (SIG_BLOCK, &fatal_signal_set, NULL); - actions_allocated = false; - attrs_allocated = false; - if ((err = posix_spawn_file_actions_init (&actions)) != 0 - || (actions_allocated = true, - (err = posix_spawn_file_actions_adddup2 (&actions, ofd[0], STDIN_FILENO)) != 0 - || (err = posix_spawn_file_actions_addclose (&actions, ofd[0])) != 0 - || (err = posix_spawn_file_actions_addclose (&actions, ofd[1])) != 0 - || (err = posix_spawnattr_init (&attrs)) != 0 - || (attrs_allocated = true, - (err = posix_spawnattr_setsigmask (&attrs, &blocked_signals)) != 0 - || (err = posix_spawnattr_setflags (&attrs, POSIX_SPAWN_SETSIGMASK)) != 0) - || (err = posix_spawnp (&child, CHILD_PROGRAM_FILENAME, &actions, &attrs, argv, environ)) != 0)) - { - if (actions_allocated) - posix_spawn_file_actions_destroy (&actions); - if (attrs_allocated) - posix_spawnattr_destroy (&attrs); - sigprocmask (SIG_UNBLOCK, &fatal_signal_set, NULL); - if (err == ENOENT) - return 0; - else - { - errno = err; - perror ("subprocess failed"); - exit (1); - } - } - posix_spawn_file_actions_destroy (&actions); - posix_spawnattr_destroy (&attrs); - sigprocmask (SIG_UNBLOCK, &fatal_signal_set, NULL); - close (ofd[0]); - close (ofd[1]); - status = 0; - while (waitpid (child, &status, 0) != child) - ; - if (!WIFEXITED (status)) - { - fprintf (stderr, "subprocess terminated with unexpected wait status %d\n", status); - exit (1); - } - exitstatus = WEXITSTATUS (status); - if (exitstatus != 127) - { - fprintf (stderr, "subprocess terminated with unexpected exit status %d\n", exitstatus); - exit (1); - } - return 0; -} + : + fi -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if test -s conftest$ac_exeext \ - && ./conftest$ac_exeext > conftest.out \ - && echo 'This should be seen only once.' > conftest.ok \ - && cmp conftest.out conftest.ok >/dev/null 2>&1; then - gl_cv_func_posix_spawn_works=yes - else - gl_cv_func_posix_spawn_works=no - fi -else - gl_cv_func_posix_spawn_works=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test $gl_cv_func_posix_spawn_works = yes; then - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Test whether posix_spawn_file_actions_addopen supports filename arguments - that contain special characters such as '*'. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -extern char **environ; -#ifndef STDIN_FILENO -# define STDIN_FILENO 0 -#endif -#ifndef STDOUT_FILENO -# define STDOUT_FILENO 1 -#endif -#ifndef STDERR_FILENO -# define STDERR_FILENO 2 -#endif -#ifndef WTERMSIG -# define WTERMSIG(x) ((x) & 0x7f) -#endif -#ifndef WIFEXITED -# define WIFEXITED(x) (WTERMSIG (x) == 0) -#endif -#ifndef WEXITSTATUS -# define WEXITSTATUS(x) (((x) >> 8) & 0xff) -#endif -#define CHILD_PROGRAM_FILENAME "conftest" -#define DATA_FILENAME "conftest%=*#?" -static int -parent_main (void) -{ - FILE *fp; - char *argv[3] = { CHILD_PROGRAM_FILENAME, "-child", NULL }; - posix_spawn_file_actions_t actions; - bool actions_allocated; - int err; - pid_t child; - int status; - int exitstatus; - /* Create a data file with specific contents. */ - fp = fopen (DATA_FILENAME, "wb"); - if (fp == NULL) - { - perror ("cannot create data file"); - return 1; - } - fwrite ("Halle Potta", 1, 11, fp); - if (fflush (fp) || fclose (fp)) - { - perror ("cannot prepare data file"); - return 2; - } + GL_GNULIB_FOPEN=1 - /* Avoid reading from our stdin, as it could block. */ - freopen ("/dev/null", "rb", stdin); - /* Test whether posix_spawn_file_actions_addopen with this file name - actually works, but spawning a child that reads from this file. */ - actions_allocated = false; - if ((err = posix_spawn_file_actions_init (&actions)) != 0 - || (actions_allocated = true, - (err = posix_spawn_file_actions_addopen (&actions, STDIN_FILENO, DATA_FILENAME, O_RDONLY, 0600)) != 0 - || (err = posix_spawn (&child, CHILD_PROGRAM_FILENAME, &actions, NULL, argv, environ)) != 0)) - { - if (actions_allocated) - posix_spawn_file_actions_destroy (&actions); - errno = err; - perror ("subprocess failed"); - return 3; - } - posix_spawn_file_actions_destroy (&actions); - status = 0; - while (waitpid (child, &status, 0) != child) - ; - if (!WIFEXITED (status)) - { - fprintf (stderr, "subprocess terminated with unexpected wait status %d\n", status); - return 4; - } - exitstatus = WEXITSTATUS (status); - if (exitstatus != 0) - { - fprintf (stderr, "subprocess terminated with unexpected exit status %d\n", exitstatus); - return 5; - } - return 0; -} -static int -child_main (void) -{ - char buf[1024]; - /* See if reading from STDIN_FILENO yields the expected contents. */ - if (fread (buf, 1, sizeof (buf), stdin) == 11 - && memcmp (buf, "Halle Potta", 11) == 0) - return 0; - else - return 8; -} -static void -cleanup_then_die (int sig) -{ - /* Clean up data file. */ - unlink (DATA_FILENAME); +printf "%s\n" "#define GNULIB_TEST_FOPEN 1" >>confdefs.h - /* Re-raise the signal and die from it. */ - signal (sig, SIG_DFL); - raise (sig); -} -int -main (int argc, char *argv[]) -{ - int exitstatus; - if (!(argc > 1 && strcmp (argv[1], "-child") == 0)) - { - /* This is the parent process. */ - signal (SIGINT, cleanup_then_die); - signal (SIGTERM, cleanup_then_die); - #ifdef SIGHUP - signal (SIGHUP, cleanup_then_die); - #endif - exitstatus = parent_main (); - } - else - { - /* This is the child process. */ - exitstatus = child_main (); - } - unlink (DATA_FILENAME); - return exitstatus; -} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fopen supports the mode character 'x'" >&5 +printf %s "checking whether fopen supports the mode character 'x'... " >&6; } +if test ${gl_cv_func_fopen_mode_x+y} +then : + printf %s "(cached) " >&6 +else $as_nop + rm -f conftest.x + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc and musl systems. + linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl*) + gl_cv_func_fopen_mode_x="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_fopen_mode_x="$gl_cross_guess_normal" ;; + esac -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -else - gl_cv_func_posix_spawn_works=no +#include +#include +int main () +{ + FILE *fp; + fp = fopen ("conftest.x", "w"); + fclose (fp); + fp = fopen ("conftest.x", "wx"); + if (fp != NULL) + /* 'x' ignored */ + return 1; + else if (errno == EEXIST) + return 0; + else + /* 'x' rejected */ + return 2; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_fopen_mode_x=yes +else $as_nop + gl_cv_func_fopen_mode_x=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi - else - case "$host_os" in - aix*) gl_cv_func_posix_spawn_works="guessing no";; - *) gl_cv_func_posix_spawn_works="guessing yes";; - esac - fi + rm -f conftest.x fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_posix_spawn_works" >&5 -$as_echo "$gl_cv_func_posix_spawn_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fopen_mode_x" >&5 +printf "%s\n" "$gl_cv_func_fopen_mode_x" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fopen supports the mode character 'e'" >&5 +printf %s "checking whether fopen supports the mode character 'e'... " >&6; } +if test ${gl_cv_func_fopen_mode_e+y} +then : + printf %s "(cached) " >&6 +else $as_nop + echo foo > conftest.x + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc and musl systems. + linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl*) + gl_cv_func_fopen_mode_e="guessing yes" ;; + # Guess no on native Windows. + mingw*) + gl_cv_func_fopen_mode_e="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_fopen_mode_e="$gl_cross_guess_normal" ;; + esac - case "$gl_cv_func_posix_spawn_works" in - *yes) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether posix_spawnattr_setschedpolicy is supported" >&5 -$as_echo_n "checking whether posix_spawnattr_setschedpolicy is supported... " >&6; } -if ${gl_cv_func_spawnattr_setschedpolicy+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#if POSIX_SPAWN_SETSCHEDULER - POSIX scheduling supported -#endif +#include +#include +#include + + +$gl_mda_defines +int main () +{ + FILE *fp = fopen ("conftest.x", "re"); + if (fp != NULL) + { + if (fcntl (fileno (fp), F_GETFD) & FD_CLOEXEC) + return 0; + else + /* 'e' ignored */ + return 1; + } + else + /* 'e' rejected */ + return 2; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "POSIX scheduling supported" >/dev/null 2>&1; then : - gl_cv_func_spawnattr_setschedpolicy=yes -else - gl_cv_func_spawnattr_setschedpolicy=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_fopen_mode_e=yes +else $as_nop + gl_cv_func_fopen_mode_e=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f conftest* + rm -f conftest.x fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_spawnattr_setschedpolicy" >&5 -$as_echo "$gl_cv_func_spawnattr_setschedpolicy" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether posix_spawnattr_setschedparam is supported" >&5 -$as_echo_n "checking whether posix_spawnattr_setschedparam is supported... " >&6; } -if ${gl_cv_func_spawnattr_setschedparam+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fopen_mode_e" >&5 +printf "%s\n" "$gl_cv_func_fopen_mode_e" >&6; } + case "$gl_cv_func_fopen_mode_x" in + *no) REPLACE_FOPEN=1 ;; + esac + case "$gl_cv_func_fopen_mode_e" in + *no) REPLACE_FOPEN=1 ;; + esac -#include -#if POSIX_SPAWN_SETSCHEDPARAM - POSIX scheduling supported -#endif + if test $REPLACE_FOPEN = 1; then + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS fopen.$ac_objext" + + : + fi + + +printf "%s\n" "#define GNULIB_FOPEN_GNU 1" >>confdefs.h + + + + +printf "%s\n" "#define GNULIB_FOPEN_SAFER 1" >>confdefs.h + + + + + fp_headers=' + #include + #if HAVE_STDIO_EXT_H + # include + #endif + ' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __fpending" >&5 +printf %s "checking for __fpending... " >&6; } +if test ${gl_cv_func___fpending+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$fp_headers +int +main (void) +{ +return ! __fpending (stdin); + ; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "POSIX scheduling supported" >/dev/null 2>&1; then : - gl_cv_func_spawnattr_setschedparam=yes -else - gl_cv_func_spawnattr_setschedparam=no +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func___fpending=yes +else $as_nop + gl_cv_func___fpending=no fi -rm -f conftest* - +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_spawnattr_setschedparam" >&5 -$as_echo "$gl_cv_func_spawnattr_setschedparam" >&6; } - ;; - *) REPLACE_POSIX_SPAWN=1 ;; - esac - fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func___fpending" >&5 +printf "%s\n" "$gl_cv_func___fpending" >&6; } + if test $gl_cv_func___fpending = yes; then + ac_fn_check_decl "$LINENO" "__fpending" "ac_cv_have_decl___fpending" "$fp_headers +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl___fpending" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL___FPENDING $ac_have_decl" >>confdefs.h + fi - if test $ac_cv_func_posix_spawn != yes || test $REPLACE_POSIX_SPAWN = 1; then -$as_echo "#define REPLACE_POSIX_SPAWN 1" >>confdefs.h + if test $gl_cv_func___fpending = no; then + + - fi + gl_LIBOBJS="$gl_LIBOBJS fpending.$ac_objext" + + fi @@ -23482,7 +35190,11 @@ - gl_cv_func_vfprintf_posix=no + + + + + gl_cv_func_fprintf_posix=no case "$gl_cv_func_printf_sizes_c99" in *yes) case "$gl_cv_func_printf_long_double" in @@ -23511,9 +35223,9 @@ *yes) case "$gl_cv_func_printf_enomem" in *yes) - # vfprintf exists and is + # fprintf exists and is # already POSIX compliant. - gl_cv_func_vfprintf_posix=yes + gl_cv_func_fprintf_posix=yes ;; esac ;; @@ -23542,7 +35254,7 @@ esac ;; esac - if test $gl_cv_func_vfprintf_posix = no; then + if test $gl_cv_func_fprintf_posix = no; then @@ -23551,7 +35263,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h ;; esac @@ -23566,7 +35278,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h ;; esac @@ -23580,18 +35292,14 @@ ;; *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h - for ac_func in nl_langinfo -do : - ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" -if test "x$ac_cv_func_nl_langinfo" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_NL_LANGINFO 1 -_ACEOF + ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" +if test "x$ac_cv_func_nl_langinfo" = xyes +then : + printf "%s\n" "#define HAVE_NL_LANGINFO 1" >>confdefs.h fi -done ;; esac @@ -23603,7 +35311,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h ;; esac @@ -23615,7 +35323,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h ;; esac @@ -23627,7 +35335,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h ;; esac @@ -23639,7 +35347,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h ;; esac @@ -23651,7 +35359,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h ;; esac @@ -23663,13 +35371,13 @@ ;; *) -$as_echo "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h ;; esac @@ -23681,13 +35389,13 @@ ;; *) -$as_echo "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h ;; esac @@ -23736,7 +35444,7 @@ if test $ac_cv_func_vasnprintf = yes; then -$as_echo "#define REPLACE_VASNPRINTF 1" >>confdefs.h +printf "%s\n" "#define REPLACE_VASNPRINTF 1" >>confdefs.h fi @@ -23749,203 +35457,17 @@ ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" -if test "x$ac_cv_type_ptrdiff_t" = xyes; then : - -else - -$as_echo "#define ptrdiff_t long" >>confdefs.h - - -fi - - - - - - - - - - - - - - - - - - gl_LIBOBJS="$gl_LIBOBJS vfprintf.$ac_objext" - - REPLACE_VFPRINTF=1 - -$as_echo "#define REPLACE_VFPRINTF_POSIX 1" >>confdefs.h - - : - - fi - - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef _MSC_VER -MicrosoftCompiler -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "MicrosoftCompiler" >/dev/null 2>&1; then : - gl_asmext='asm' - gl_c_asm_opt='-c -Fa' - -else - gl_asmext='s' - gl_c_asm_opt='-S' - -fi -rm -f conftest* - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C symbols are prefixed with underscore at the linker level" >&5 -$as_echo_n "checking whether C symbols are prefixed with underscore at the linker level... " >&6; } -if ${gl_cv_prog_as_underscore+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.c <&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } >/dev/null 2>&1 - if LC_ALL=C $EGREP '(^|[^a-zA-Z0-9_])_foo([^a-zA-Z0-9_]|$)' conftest.$gl_asmext >/dev/null; then - gl_cv_prog_as_underscore=yes - else - gl_cv_prog_as_underscore=no - fi - rm -f conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_prog_as_underscore" >&5 -$as_echo "$gl_cv_prog_as_underscore" >&6; } - if test $gl_cv_prog_as_underscore = yes; then - USER_LABEL_PREFIX=_ - else - USER_LABEL_PREFIX= - fi - -cat >>confdefs.h <<_ACEOF -#define USER_LABEL_PREFIX $USER_LABEL_PREFIX -_ACEOF +if test "x$ac_cv_type_ptrdiff_t" = xyes +then : - ASM_SYMBOL_PREFIX='"'${USER_LABEL_PREFIX}'"' - - - - GNULIB_PTHREAD_SIGMASK=0; - GNULIB_RAISE=0; - GNULIB_SIGNAL_H_SIGPIPE=0; - GNULIB_SIGPROCMASK=0; - GNULIB_SIGACTION=0; - HAVE_POSIX_SIGNALBLOCKING=1; - HAVE_PTHREAD_SIGMASK=1; - HAVE_RAISE=1; - HAVE_SIGSET_T=1; - HAVE_SIGINFO_T=1; - HAVE_SIGACTION=1; - HAVE_STRUCT_SIGACTION_SA_SIGACTION=1; - - HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1; - - HAVE_SIGHANDLER_T=1; - REPLACE_PTHREAD_SIGMASK=0; - REPLACE_RAISE=0; - - - ac_fn_c_check_type "$LINENO" "sigset_t" "ac_cv_type_sigset_t" " - #include - /* Mingw defines sigset_t not in , but in . */ - #include - -" -if test "x$ac_cv_type_sigset_t" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_SIGSET_T 1 -_ACEOF - -gl_cv_type_sigset_t=yes -else - gl_cv_type_sigset_t=no -fi - - if test $gl_cv_type_sigset_t != yes; then - HAVE_SIGSET_T=0 - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library path variable" >&5 -$as_echo_n "checking for shared library path variable... " >&6; } -if ${acl_cv_libpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - - LD="$LD" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.libpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_libpath=${acl_cv_shlibpath_var:-none} - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_libpath" >&5 -$as_echo "$acl_cv_libpath" >&6; } - shlibpath_var="$acl_cv_shlibpath_var" +else $as_nop +printf "%s\n" "#define ptrdiff_t long" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to activate relocatable installation" >&5 -$as_echo_n "checking whether to activate relocatable installation... " >&6; } - # Check whether --enable-relocatable was given. -if test "${enable_relocatable+set}" = set; then : - enableval=$enable_relocatable; if test "$enableval" != no; then - RELOCATABLE=yes - else - RELOCATABLE=no - fi -else - RELOCATABLE=no fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RELOCATABLE" >&5 -$as_echo "$RELOCATABLE" >&6; } - - - - if test "X$prefix" = "XNONE"; then - reloc_final_prefix="$ac_default_prefix" - else - reloc_final_prefix="$prefix" - fi - -cat >>confdefs.h <<_ACEOF -#define INSTALLPREFIX "${reloc_final_prefix}" -_ACEOF - - if test $RELOCATABLE = yes; then - -$as_echo "#define ENABLE_RELOCATABLE 1" >>confdefs.h - - fi @@ -23954,127 +35476,23 @@ - is_noop=no - use_elf_origin_trick=no - use_macos_tools=no - use_wrapper=no - if test $RELOCATABLE = yes; then - # --enable-relocatable implies --disable-rpath - enable_rpath=no - for ac_header in mach-o/dyld.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "mach-o/dyld.h" "ac_cv_header_mach_o_dyld_h" "$ac_includes_default" -if test "x$ac_cv_header_mach_o_dyld_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MACH_O_DYLD_H 1 -_ACEOF -fi -done - for ac_func in _NSGetExecutablePath -do : - ac_fn_c_check_func "$LINENO" "_NSGetExecutablePath" "ac_cv_func__NSGetExecutablePath" -if test "x$ac_cv_func__NSGetExecutablePath" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE__NSGETEXECUTABLEPATH 1 -_ACEOF -fi -done - case "$host_os" in - mingw*) is_noop=yes ;; - # For the platforms that support $ORIGIN, see - # . - # glibc systems, Linux with musl libc: yes. Android: no. - linux*-android*) ;; - linux* | kfreebsd*) use_elf_origin_trick=yes ;; - # Hurd: - # only after the glibc commit from 2018-01-08 - # - gnu*) - # Test for a glibc version >= 2.27. - for ac_func in copy_file_range -do : - ac_fn_c_check_func "$LINENO" "copy_file_range" "ac_cv_func_copy_file_range" -if test "x$ac_cv_func_copy_file_range" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_COPY_FILE_RANGE 1 -_ACEOF -fi -done - if test $ac_cv_func_copy_file_range = yes; then - use_elf_origin_trick=yes - fi - ;; - # FreeBSD >= 7.3, DragonFly >= 3.0: yes. - freebsd | freebsd[1-7] | freebsd[1-6].* | freebsd7.[0-2]) ;; - dragonfly | dragonfly[1-2] | dragonfly[1-2].*) ;; - freebsd* | dragonfly*) use_elf_origin_trick=yes ;; - # NetBSD >= 8.0: yes. - netbsd | netbsd[1-7] | netbsd[1-7].*) ;; - netbsdelf | netbsdelf[1-7] | netbsdelf[1-7].*) ;; - netbsd*) use_elf_origin_trick=yes ;; - # OpenBSD >= 5.4: yes. - openbsd | openbsd[1-5] | openbsd[1-4].* | openbsd5.[0-3]) ;; - openbsd*) use_elf_origin_trick=yes ;; - # Solaris >= 10: yes. - solaris | solaris2.[1-9] | solaris2.[1-9].*) ;; - solaris*) use_elf_origin_trick=yes ;; - # Haiku: yes. - haiku*) use_elf_origin_trick=yes ;; - # On Mac OS X 10.4 or newer, use Mac OS X tools. See - # . - darwin | darwin[1-7].*) ;; - darwin*) use_macos_tools=yes ;; - esac - if test $is_noop = yes; then - RELOCATABLE_LDFLAGS=: + gl_LIBOBJS="$gl_LIBOBJS fprintf.$ac_objext" - else - if test $use_elf_origin_trick = yes || test $use_macos_tools = yes; then - case "$ac_aux_dir" in - /*) reloc_ldflags="$ac_aux_dir/reloc-ldflags" ;; - *) reloc_ldflags="\$(top_builddir)/$ac_aux_dir/reloc-ldflags" ;; - esac - RELOCATABLE_LDFLAGS="\"$reloc_ldflags\" \"\$(host)\" \"\$(RELOCATABLE_LIBRARY_PATH)\"" + REPLACE_FPRINTF=1 - if test $use_macos_tools = yes; then - case "$ac_aux_dir" in - /*) LIBTOOL="${CONFIG_SHELL-$SHELL} $ac_aux_dir/libtool-reloc $LIBTOOL" ;; - *) LIBTOOL="${CONFIG_SHELL-$SHELL} \$(top_builddir)/$ac_aux_dir/libtool-reloc $LIBTOOL" ;; - esac - fi - else - use_wrapper=yes - INSTALL_PROGRAM_ENV="RELOC_LIBRARY_PATH_VAR=\"$shlibpath_var\" RELOC_LIBRARY_PATH_VALUE=\"\$(RELOCATABLE_LIBRARY_PATH)\" RELOC_PREFIX=\"\$(prefix)\" RELOC_DESTDIR=\"\$(DESTDIR)\" RELOC_COMPILE_COMMAND=\"\$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(LDFLAGS)\" RELOC_SRCDIR=\"\$(RELOCATABLE_SRC_DIR)\" RELOC_BUILDDIR=\"\$(RELOCATABLE_BUILD_DIR)\" RELOC_CONFIG_H_DIR=\"\$(RELOCATABLE_CONFIG_H_DIR)\" RELOC_EXEEXT=\"\$(EXEEXT)\" RELOC_STRIP_PROG=\"\$(RELOCATABLE_STRIP)\" RELOC_INSTALL_PROG=\"$INSTALL_PROGRAM\"" +printf "%s\n" "#define REPLACE_FPRINTF_POSIX 1" >>confdefs.h + + : - case "$ac_aux_dir" in - /*) INSTALL_PROGRAM="$ac_aux_dir/install-reloc" ;; - *) INSTALL_PROGRAM="\$(top_builddir)/$ac_aux_dir/install-reloc" ;; - esac - fi - fi fi - if test $is_noop = yes || test $use_elf_origin_trick = yes || test $use_macos_tools = yes; then - RELOCATABLE_VIA_LD_TRUE= - RELOCATABLE_VIA_LD_FALSE='#' -else - RELOCATABLE_VIA_LD_TRUE='#' - RELOCATABLE_VIA_LD_FALSE= -fi - if test $use_wrapper = yes; then - RELOCATABLE_VIA_WRAPPER_TRUE= - RELOCATABLE_VIA_WRAPPER_FALSE='#' -else - RELOCATABLE_VIA_WRAPPER_TRUE='#' - RELOCATABLE_VIA_WRAPPER_FALSE= -fi @@ -24083,339 +35501,459 @@ - RELOCATABLE_STRIP=':' + GL_GNULIB_FPRINTF_POSIX=1 - for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF -fi -done +printf "%s\n" "#define GNULIB_TEST_FPRINTF_POSIX 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 -$as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if ${ac_cv_func_malloc_0_nonnull+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on platforms where we know the result. - *-gnu* | gnu* | *-musl* | freebsd* | netbsd* | openbsd* \ - | hpux* | solaris* | cygwin* | mingw*) - ac_cv_func_malloc_0_nonnull="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; - esac -else + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether free is known to preserve errno" >&5 +printf %s "checking whether free is known to preserve errno... " >&6; } +if test ${gl_cv_func_free_preserves_errno+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H - # include - #else - char *malloc (); - #endif +#include int -main () +main (void) { -char *p = malloc (0); - int result = !p; - free (p); - return result; +#if 2 < __GLIBC__ + (33 <= __GLIBC_MINOR__) + #elif defined __OpenBSD__ + #elif defined __sun + #else + #error "'free' is not known to preserve errno" + #endif + ; return 0; } - _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_malloc_0_nonnull=yes -else - ac_cv_func_malloc_0_nonnull=no +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_free_preserves_errno=yes +else $as_nop + gl_cv_func_free_preserves_errno=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_free_preserves_errno" >&5 +printf "%s\n" "$gl_cv_func_free_preserves_errno" >&6; } + case $gl_cv_func_free_preserves_errno in + *yes) -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } - case "$ac_cv_func_malloc_0_nonnull" in - *yes) - gl_cv_func_malloc_0_nonnull=1 - ;; - *) - gl_cv_func_malloc_0_nonnull=0 - ;; +printf "%s\n" "#define HAVE_FREE_POSIX 1" >>confdefs.h + + ;; + *) REPLACE_FREE=1 ;; esac + if test $REPLACE_FREE = 1; then -cat >>confdefs.h <<_ACEOF -#define MALLOC_0_IS_NONNULL $gl_cv_func_malloc_0_nonnull -_ACEOF -ac_fn_c_check_decl "$LINENO" "setenv" "ac_cv_have_decl_setenv" "$ac_includes_default" -if test "x$ac_cv_have_decl_setenv" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SETENV $ac_have_decl -_ACEOF + gl_LIBOBJS="$gl_LIBOBJS free.$ac_objext" + : + fi - GNULIB_SCHED_YIELD=0; - HAVE_SCHED_YIELD=1; - REPLACE_SCHED_YIELD=0; -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 -$as_echo_n "checking for uid_t in sys/types.h... " >&6; } -if ${ac_cv_type_uid_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + + + + + GL_GNULIB_FREE_POSIX=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FREE_POSIX 1" >>confdefs.h + + + + + + + if test $gl_cv_func_frexp_no_libm = yes; then + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether frexp works" >&5 +printf %s "checking whether frexp works... " >&6; } +if test ${gl_cv_func_frexp_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + case "$host_os" in + netbsd* | irix*) gl_cv_func_frexp_works="guessing no" ;; + mingw*) # Guess yes with MSVC, no with mingw. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + +#ifdef _MSC_VER + Good +#endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "uid_t" >/dev/null 2>&1; then : - ac_cv_type_uid_t=yes -else - ac_cv_type_uid_t=no + $EGREP "Good" >/dev/null 2>&1 +then : + gl_cv_func_frexp_works="guessing yes" +else $as_nop + gl_cv_func_frexp_works="guessing no" fi -rm -f conftest* +rm -rf conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 -$as_echo "$ac_cv_type_uid_t" >&6; } -if test $ac_cv_type_uid_t = no; then + ;; + *) gl_cv_func_frexp_works="guessing yes" ;; + esac -$as_echo "#define uid_t int" >>confdefs.h +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#if HAVE_DECL_ALARM +# include +# include +#endif +/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. + ICC 10.0 has a bug when optimizing the expression -zero. + The expression -DBL_MIN * DBL_MIN does not work when cross-compiling + to PowerPC on Mac OS X 10.5. */ +#if defined __hpux || defined __sgi || defined __ICC +static double +compute_minus_zero (void) +{ + return -DBL_MIN * DBL_MIN; +} +# define minus_zero compute_minus_zero () +#else +double minus_zero = -0.0; +#endif +int main() +{ + int result = 0; + int i; + volatile double x; + double zero = 0.0; +#if HAVE_DECL_ALARM + /* NeXTstep 3.3 frexp() runs into an endless loop when called on an infinite + number. Let the test fail in this case. */ + signal (SIGALRM, SIG_DFL); + alarm (5); +#endif + /* Test on denormalized numbers. */ + for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) + ; + if (x > 0.0) + { + int exp; + double y = frexp (x, &exp); + /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022. + On NetBSD: y = 0.75. Correct: y = 0.5. */ + if (y != 0.5) + result |= 1; + } + /* Test on infinite numbers. */ + x = 1.0 / zero; + { + int exp; + double y = frexp (x, &exp); + if (y != x) + result |= 2; + } + /* Test on negative zero. */ + x = minus_zero; + { + int exp; + double y = frexp (x, &exp); + if (memcmp (&y, &x, sizeof x)) + result |= 4; + } + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_frexp_works=yes +else $as_nop + gl_cv_func_frexp_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi -$as_echo "#define gid_t int" >>confdefs.h fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexp_works" >&5 +printf "%s\n" "$gl_cv_func_frexp_works" >&6; } + case "$gl_cv_func_frexp_works" in + *yes) gl_func_frexp_no_libm=yes ;; + *) gl_func_frexp_no_libm=no; REPLACE_FREXP=1 ;; + esac + else + gl_func_frexp_no_libm=no + REPLACE_FREXP=1 + fi + if test $gl_func_frexp_no_libm = yes; then +printf "%s\n" "#define HAVE_FREXP_IN_LIBC 1" >>confdefs.h + fi + if test $gl_func_frexp_no_libm != yes; then -ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default" -if test "x$ac_cv_have_decl_snprintf" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SNPRINTF $ac_have_decl -_ACEOF -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 -$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } -if ${ac_cv_header_stdbool_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - #include - #ifdef __cplusplus - typedef bool Bool; - #else - typedef _Bool Bool; - #ifndef bool - "error: bool is not defined" - #endif - #ifndef false - "error: false is not defined" - #endif - #if false - "error: false is not 0" - #endif - #ifndef true - "error: true is not defined" - #endif - #if true != 1 - "error: true is not 1" - #endif - #endif - #ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" - #endif + gl_LIBOBJS="$gl_LIBOBJS frexp.$ac_objext" - struct s { Bool s: 1; Bool t; bool u: 1; bool v; } s; + fi - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) 0.5 == true ? 1 : -1]; - /* See body of main program for 'e'. */ - char f[(Bool) 0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (Bool)]; - char i[sizeof s.t]; - enum { j = false, k = true, l = false * true, m = true * 256 }; - /* The following fails for - HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ - Bool n[m]; - char o[sizeof n == m * sizeof n[0] ? 1 : -1]; - char p[-1 - (Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; - /* Catch a bug in an HP-UX C compiler. See - https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html - */ - Bool q = true; - Bool *pq = &q; - bool *qq = &q; -int -main () -{ - bool e = &s; - *pq |= q; *pq |= ! q; - *qq |= q; *qq |= ! q; - /* Refer to every declared value, to avoid compiler optimizations. */ - return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l - + !m + !n + !o + !p + !q + !pq + !qq); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdbool_h=yes -else - ac_cv_header_stdbool_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 -$as_echo "$ac_cv_header_stdbool_h" >&6; } - ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" -if test "x$ac_cv_type__Bool" = xyes; then : -cat >>confdefs.h <<_ACEOF -#define HAVE__BOOL 1 -_ACEOF -fi + GL_GNULIB_FREXP=1 - REPLACE_NULL=0; - HAVE_MAX_ALIGN_T=1; - HAVE_WCHAR_T=1; -ac_fn_c_check_decl "$LINENO" "strdup" "ac_cv_have_decl_strdup" "$ac_includes_default" -if test "x$ac_cv_have_decl_strdup" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRDUP $ac_have_decl -_ACEOF +printf "%s\n" "#define GNULIB_TEST_FREXP 1" >>confdefs.h + ac_fn_check_decl "$LINENO" "frexpl" "ac_cv_have_decl_frexpl" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_frexpl" = xyes +then : +else $as_nop + HAVE_DECL_FREXPL=0 +fi + if test $HAVE_DECL_FREXPL = 1; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether frexpl() can be used without linking with libm" >&5 +printf %s "checking whether frexpl() can be used without linking with libm... " >&6; } +if test ${gl_cv_func_frexpl_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + long double x; +int +main (void) +{ +int e; return frexpl (x, &e) > 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_frexpl_no_libm=yes +else $as_nop + gl_cv_func_frexpl_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_no_libm" >&5 +printf "%s\n" "$gl_cv_func_frexpl_no_libm" >&6; } + if test $gl_cv_func_frexpl_no_libm = yes; then - if test $gl_cv_have_include_next = yes; then - gl_cv_next_string_h='<'string.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_string_h+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether frexpl works" >&5 +printf %s "checking whether frexpl works... " >&6; } +if test ${gl_cv_func_frexpl_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + aix | aix[3-6]* | beos* | darwin* | irix* | mingw* | pw*) + gl_cv_func_frexpl_works="guessing no";; + *) gl_cv_func_frexpl_works="guessing yes";; + esac +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + +#include +#include +/* Override the values of , like done in float.in.h. */ +#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP (-16381) +#endif +#if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__) +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP (-16381) +#endif +#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__ +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP DBL_MIN_EXP +#endif +#if defined __sgi && (LDBL_MANT_DIG >= 106) +# if defined __GNUC__ +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP DBL_MIN_EXP +# endif +#endif +extern +#ifdef __cplusplus +"C" +#endif +long double frexpl (long double, int *); +long double zero = 0.0L; +int main() +{ + int result = 0; + volatile long double x; + /* Test on finite numbers that fails on AIX 5.1. */ + x = 16.0L; + { + int exp = -9999; + frexpl (x, &exp); + if (exp != 5) + result |= 1; + } + /* Test on finite numbers that fails on Mac OS X 10.4, because its frexpl + function returns an invalid (incorrectly normalized) value: it returns + y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } + but the correct result is + 0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 } */ + x = 1.01L; + { + int exp = -9999; + long double y = frexpl (x, &exp); + if (!(exp == 1 && y == 0.505L)) + result |= 2; + } + /* Test on large finite numbers. This fails on BeOS at i = 16322, while + LDBL_MAX_EXP = 16384. + In the loop end test, we test x against Infinity, rather than comparing + i with LDBL_MAX_EXP, because BeOS has a wrong LDBL_MAX_EXP. */ + { + int i; + for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L) + { + int exp = -9999; + frexpl (x, &exp); + if (exp != i) + { + result |= 4; + break; + } + } + } + /* Test on denormalized numbers. */ + { + int i; + for (i = 1, x = 1.0L; i >= LDBL_MIN_EXP; i--, x *= 0.5L) + ; + if (x > 0.0L) + { + int exp; + long double y = frexpl (x, &exp); + /* On machines with IEEE854 arithmetic: x = 1.68105e-4932, + exp = -16382, y = 0.5. On Mac OS X 10.5: exp = -16384, y = 0.5. */ + if (exp != LDBL_MIN_EXP - 1) + result |= 8; + } + } + /* Test on infinite numbers. */ + /* The Microsoft MSVC 14 compiler chokes on the expression 1.0 / 0.0. */ + x = 1.0L / zero; + { + int exp; + long double y = frexpl (x, &exp); + if (y != x) + result |= 16; + } + return result; +} _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_frexpl_works=yes +else $as_nop + gl_cv_func_frexpl_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'string.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - gl_cv_absolute_string_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_works" >&5 +printf "%s\n" "$gl_cv_func_frexpl_works" >&6; } - gl_header=$gl_cv_absolute_string_h - gl_cv_next_string_h='"'$gl_header'"' + case "$gl_cv_func_frexpl_works" in + *yes) gl_func_frexpl_no_libm=yes ;; + *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; + esac + else + gl_func_frexpl_no_libm=no + REPLACE_FREXPL=1 + fi + if test $gl_func_frexpl_no_libm = yes; then +printf "%s\n" "#define HAVE_FREXPL_IN_LIBC 1" >>confdefs.h -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_string_h" >&5 -$as_echo "$gl_cv_next_string_h" >&6; } - fi - NEXT_STRING_H=$gl_cv_next_string_h + fi + fi - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'string.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_string_h - fi - NEXT_AS_FIRST_DIRECTIVE_STRING_H=$gl_next_as_first_directive + if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no; then @@ -24424,754 +35962,679 @@ + gl_LIBOBJS="$gl_LIBOBJS frexpl.$ac_objext" -ac_fn_c_check_decl "$LINENO" "strndup" "ac_cv_have_decl_strndup" "$ac_includes_default" -if test "x$ac_cv_have_decl_strndup" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi + fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRNDUP $ac_have_decl -_ACEOF - GNULIB_TIMES=0; - HAVE_STRUCT_TMS=1; - HAVE_TIMES=1; + + + GL_GNULIB_FREXPL=1 + + +printf "%s\n" "#define GNULIB_TEST_FREXPL 1" >>confdefs.h + if test $ac_cv_func_fsync = no; then + HAVE_FSYNC=0 + fi + if test $HAVE_FSYNC = 0; then -$as_echo "#define _USE_STD_STAT 1" >>confdefs.h + gl_LIBOBJS="$gl_LIBOBJS fsync.$ac_objext" + : + fi - if test $gl_cv_have_include_next = yes; then - gl_cv_next_sys_types_h='<'sys/types.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_sys_types_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'sys/types.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' + GL_GNULIB_FSYNC=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FSYNC 1" >>confdefs.h - gl_cv_absolute_sys_types_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_sys_types_h - gl_cv_next_sys_types_h='"'$gl_header'"' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_types_h" >&5 -$as_echo "$gl_cv_next_sys_types_h" >&6; } - fi - NEXT_SYS_TYPES_H=$gl_cv_next_sys_types_h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'sys/types.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_sys_types_h - fi - NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H=$gl_next_as_first_directive + gl_abort_bug=no + case "$host_os" in + mingw*) + gl_cv_func_getcwd_path_max=yes + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether getcwd handles long file names properly" >&5 +printf %s "checking whether getcwd handles long file names properly... " >&6; } +if test ${gl_cv_func_getcwd_path_max+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Arrange for deletion of the temporary directory this test creates. + ac_clean_files="$ac_clean_files confdir3" + if test "$cross_compiling" = yes +then : + # Cross-compilation guesses: + case "$host_os" in + aix*) # On AIX, it has the AIX bug. + gl_cv_func_getcwd_path_max='guessing no, it has the AIX bug' ;; + gnu*) # On Hurd, it is 'yes'. + gl_cv_func_getcwd_path_max='guessing yes' ;; + linux* | kfreebsd*) + # On older Linux+glibc it's 'no, but it is partly working', + # on newer Linux+glibc it's 'yes'. + # On Linux+musl libc, it's 'no, but it is partly working'. + # On kFreeBSD+glibc, it's 'no, but it is partly working'. + gl_cv_func_getcwd_path_max='guessing no, but it is partly working' ;; + *) # If we don't know, obey --enable-cross-guesses. + gl_cv_func_getcwd_path_max="$gl_cross_guess_normal" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if HAVE_UNISTD_H +# include +#else +# include +#endif +#include +#include +#include +#include +#include - WINDOWS_STAT_INODES=0 +/* Arrange to define PATH_MAX, like "pathmax.h" does. */ +#if HAVE_UNISTD_H +# include +#endif +#include +#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN +# include +#endif +#if !defined PATH_MAX && defined MAXPATHLEN +# define PATH_MAX MAXPATHLEN +#endif +#ifdef __hpux +# undef PATH_MAX +# define PATH_MAX 1024 +#endif +#if defined _WIN32 && ! defined __CYGWIN__ +# undef PATH_MAX +# define PATH_MAX 260 +#endif +#ifndef AT_FDCWD +# define AT_FDCWD 0 +#endif +#ifdef ENAMETOOLONG +# define is_ENAMETOOLONG(x) ((x) == ENAMETOOLONG) +#else +# define is_ENAMETOOLONG(x) 0 +#endif +/* Use the getcwd function, not any macro. */ +#undef getcwd - GNULIB_WAITPID=0; +$gl_mda_defines +#ifndef S_IRWXU +# define S_IRWXU 0700 +#endif - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timespec in " >&5 -$as_echo_n "checking for struct timespec in ... " >&6; } -if ${gl_cv_sys_struct_timespec_in_time_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include +/* The length of this name must be 8. */ +#define DIR_NAME "confdir3" +#define DIR_NAME_LEN 8 +#define DIR_NAME_SIZE (DIR_NAME_LEN + 1) -int -main () -{ -static struct timespec x; x.tv_sec = x.tv_nsec; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_sys_struct_timespec_in_time_h=yes -else - gl_cv_sys_struct_timespec_in_time_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_time_h" >&5 -$as_echo "$gl_cv_sys_struct_timespec_in_time_h" >&6; } +/* The length of "../". */ +#define DOTDOTSLASH_LEN 3 - TIME_H_DEFINES_STRUCT_TIMESPEC=0 - SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 - PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0 - UNISTD_H_DEFINES_STRUCT_TIMESPEC=0 - if test $gl_cv_sys_struct_timespec_in_time_h = yes; then - TIME_H_DEFINES_STRUCT_TIMESPEC=1 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timespec in " >&5 -$as_echo_n "checking for struct timespec in ... " >&6; } -if ${gl_cv_sys_struct_timespec_in_sys_time_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include +/* Leftover bytes in the buffer, to work around library or OS bugs. */ +#define BUF_SLOP 20 int main () { -static struct timespec x; x.tv_sec = x.tv_nsec; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_sys_struct_timespec_in_sys_time_h=yes -else - gl_cv_sys_struct_timespec_in_sys_time_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_sys_time_h" >&5 -$as_echo "$gl_cv_sys_struct_timespec_in_sys_time_h" >&6; } - if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then - SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timespec in " >&5 -$as_echo_n "checking for struct timespec in ... " >&6; } -if ${gl_cv_sys_struct_timespec_in_pthread_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include +#ifndef PATH_MAX + /* The Hurd doesn't define this, so getcwd can't exhibit the bug -- + at least not on a local file system. And if we were to start worrying + about remote file systems, we'd have to enable the wrapper function + all of the time, just to be safe. That's not worth the cost. */ + exit (0); +#elif ((INT_MAX / (DIR_NAME_SIZE / DOTDOTSLASH_LEN + 1) \ + - DIR_NAME_SIZE - BUF_SLOP) \ + <= PATH_MAX) + /* FIXME: Assuming there's a system for which this is true, + this should be done in a compile test. */ + exit (0); +#else + char buf[PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN + 1) + + DIR_NAME_SIZE + BUF_SLOP]; + char *cwd = getcwd (buf, PATH_MAX); + size_t initial_cwd_len; + size_t cwd_len; + int fail = 0; + size_t n_chdirs = 0; -int -main () -{ -static struct timespec x; x.tv_sec = x.tv_nsec; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_sys_struct_timespec_in_pthread_h=yes -else - gl_cv_sys_struct_timespec_in_pthread_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_pthread_h" >&5 -$as_echo "$gl_cv_sys_struct_timespec_in_pthread_h" >&6; } - if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then - PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timespec in " >&5 -$as_echo_n "checking for struct timespec in ... " >&6; } -if ${gl_cv_sys_struct_timespec_in_unistd_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include + if (cwd == NULL) + exit (10); -int -main () -{ -static struct timespec x; x.tv_sec = x.tv_nsec; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_sys_struct_timespec_in_unistd_h=yes -else - gl_cv_sys_struct_timespec_in_unistd_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_unistd_h" >&5 -$as_echo "$gl_cv_sys_struct_timespec_in_unistd_h" >&6; } - if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then - UNISTD_H_DEFINES_STRUCT_TIMESPEC=1 - fi - fi - fi - fi + cwd_len = initial_cwd_len = strlen (cwd); + + while (1) + { + size_t dotdot_max = PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN); + char *c = NULL; + cwd_len += DIR_NAME_SIZE; + /* If mkdir or chdir fails, it could be that this system cannot create + any file with an absolute name longer than PATH_MAX, such as cygwin. + If so, leave fail as 0, because the current working directory can't + be too long for getcwd if it can't even be created. On Linux with + the 9p file system, mkdir fails with error EINVAL when cwd_len gets + too long; ignore this failure because the getcwd() system call + produces good results whereas the gnulib substitute calls getdents64 + which fails with error EPROTO. + For other errors, be pessimistic and consider that as a failure, + too. */ + if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0) + { + if (! (errno == ERANGE || is_ENAMETOOLONG (errno))) + #ifdef __linux__ + if (! (errno == EINVAL)) + #endif + fail = 20; + break; + } + if (PATH_MAX <= cwd_len && cwd_len < PATH_MAX + DIR_NAME_SIZE) + { + struct stat sb; + c = getcwd (buf, PATH_MAX); + if (!c && errno == ENOENT) + { + fail = 11; + break; + } + if (c) + { + fail = 31; + break; + } + if (! (errno == ERANGE || is_ENAMETOOLONG (errno))) + { + fail = 21; + break; + } + /* Our replacement needs to be able to stat() long ../../paths, + so generate a path larger than PATH_MAX to check, + avoiding the replacement if we can't stat(). */ + c = getcwd (buf, cwd_len + 1); + if (c && !AT_FDCWD && stat (c, &sb) != 0 && is_ENAMETOOLONG (errno)) + { + fail = 32; + break; + } + } + if (dotdot_max <= cwd_len - initial_cwd_len) + { + if (dotdot_max + DIR_NAME_SIZE < cwd_len - initial_cwd_len) + break; + c = getcwd (buf, cwd_len + 1); + if (!c) + { + if (! (errno == ERANGE || errno == ENOENT + || is_ENAMETOOLONG (errno))) + { + fail = 22; + break; + } + if (AT_FDCWD || errno == ERANGE || errno == ENOENT) + { + fail = 12; + break; + } + } + } + if (c && strlen (c) != cwd_len) + { + fail = 23; + break; + } + ++n_chdirs; + } + /* Leaving behind such a deep directory is not polite. + So clean up here, right away, even though the driving + shell script would also clean up. */ + { + size_t i; + /* Try rmdir first, in case the chdir failed. */ + rmdir (DIR_NAME); + for (i = 0; i <= n_chdirs; i++) + { + if (chdir ("..") < 0) + break; + if (rmdir (DIR_NAME) != 0) + break; + } + } + exit (fail); +#endif +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_getcwd_path_max=yes +else $as_nop + case $? in + 10|11|12) gl_cv_func_getcwd_path_max='no, but it is partly working';; + 31) gl_cv_func_getcwd_path_max='no, it has the AIX bug';; + 32) gl_cv_func_getcwd_path_max='yes, but with shorter paths';; + *) gl_cv_func_getcwd_path_max=no;; + esac +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getcwd_path_max" >&5 +printf "%s\n" "$gl_cv_func_getcwd_path_max" >&6; } + case "$gl_cv_func_getcwd_null" in + *yes) - if test $gl_cv_have_include_next = yes; then - gl_cv_next_time_h='<'time.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_time_h+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for getpagesize" >&5 +printf %s "checking for getpagesize... " >&6; } +if test ${gl_cv_func_getpagesize+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include +int +main (void) +{ +return getpagesize(); + ; + return 0; +} + _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_getpagesize=yes +else $as_nop + gl_cv_func_getpagesize=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'time.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getpagesize" >&5 +printf "%s\n" "$gl_cv_func_getpagesize" >&6; } - gl_cv_absolute_time_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` + if test $gl_cv_func_getpagesize = yes; then - gl_header=$gl_cv_absolute_time_h - gl_cv_next_time_h='"'$gl_header'"' +printf "%s\n" "#define HAVE_GETPAGESIZE 1" >>confdefs.h + fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_time_h" >&5 -$as_echo "$gl_cv_next_time_h" >&6; } - fi - NEXT_TIME_H=$gl_cv_next_time_h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether getcwd succeeds when 4k < cwd_length < 16k" >&5 +printf %s "checking whether getcwd succeeds when 4k < cwd_length < 16k... " >&6; } +if test ${gl_cv_func_getcwd_succeeds_beyond_4k+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Remove any remnants of a previous test. + rm -rf confdir-14B--- + # Arrange for deletion of the temporary directory this test creates. + ac_clean_files="$ac_clean_files confdir-14B---" + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess no otherwise, even on glibc systems and musl systems. + *) gl_cv_func_getcwd_succeeds_beyond_4k="guessing no" + esac - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'time.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_time_h - fi - NEXT_AS_FIRST_DIRECTIVE_TIME_H=$gl_next_as_first_directive +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if HAVE_UNISTD_H +# include +#else /* on Windows with MSVC */ +# include +#endif +#include +#include +/* Arrange to define PATH_MAX, like "pathmax.h" does. */ +#if HAVE_UNISTD_H +# include +#endif +#include +#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN +# include +#endif +#if !defined PATH_MAX && defined MAXPATHLEN +# define PATH_MAX MAXPATHLEN +#endif +#ifdef __hpux +# undef PATH_MAX +# define PATH_MAX 1024 +#endif +#if defined _WIN32 && ! defined __CYGWIN__ +# undef PATH_MAX +# define PATH_MAX 260 +#endif +$gl_mda_defines +#ifndef S_IRWXU +# define S_IRWXU 0700 +#endif +/* FIXME: skip the run-test altogether on systems without getpagesize. */ +#if ! HAVE_GETPAGESIZE +# define getpagesize() 0 +#endif +/* This size is chosen to be larger than PATH_MAX (4k), yet smaller than + the 16kB pagesize on ia64 linux. Those conditions make the code below + trigger a bug in glibc's getcwd implementation before 2.4.90-10. */ +#define TARGET_LEN (5 * 1024) +int +main () +{ + char *cwd; + size_t initial_cwd_len; + int fail = 0; + /* The bug is triggered when PATH_MAX < getpagesize (), so skip + this relatively expensive and invasive test if that's not true. */ +#ifdef PATH_MAX + int bug_possible = PATH_MAX < getpagesize (); +#else + int bug_possible = 0; +#endif + if (! bug_possible) + return 0; + cwd = getcwd (NULL, 0); + if (cwd == NULL) + return 2; -gl_libunistring_sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;} -i\ -0 -q -' -gl_libunistring_sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;} -i\ -0 -q -' -gl_libunistring_sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p;q;} -i\ -0 -q -' + initial_cwd_len = strlen (cwd); + free (cwd); + if (1) + { + static char const dir_name[] = "confdir-14B---"; + size_t desired_depth = ((TARGET_LEN - 1 - initial_cwd_len) + / sizeof dir_name); + size_t d; + for (d = 0; d < desired_depth; d++) + { + if (mkdir (dir_name, S_IRWXU) < 0 || chdir (dir_name) < 0) + { + if (! (errno == ERANGE || errno == ENAMETOOLONG + || errno == ENOENT)) + fail = 3; /* Unable to construct deep hierarchy. */ + break; + } + } - if test "$HAVE_LIBUNISTRING" = yes; then - LIBUNISTRING_VERSION_MAJOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_major"` - LIBUNISTRING_VERSION_MINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_minor"` - LIBUNISTRING_VERSION_SUBMINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_subminor"` - fi + /* If libc has the bug in question, this invocation of getcwd + results in a failed assertion. */ + cwd = getcwd (NULL, 0); + if (cwd == NULL) + fail = 4; /* getcwd didn't assert, but it failed for a long name + where the answer could have been learned. */ + free (cwd); + + /* Call rmdir first, in case the above chdir failed. */ + rmdir (dir_name); + while (0 < d--) + { + if (chdir ("..") < 0) + { + fail = 5; + break; + } + rmdir (dir_name); + } + } -ac_fn_c_check_decl "$LINENO" "clearerr_unlocked" "ac_cv_have_decl_clearerr_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_clearerr_unlocked" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi + return fail; +} -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_CLEARERR_UNLOCKED $ac_have_decl _ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_getcwd_succeeds_beyond_4k=yes +else $as_nop + ret=$? + if test $ret -ge 128 || test $ret = 4; then + gl_cv_func_getcwd_succeeds_beyond_4k=no + else + gl_cv_func_getcwd_succeeds_beyond_4k=yes + fi -ac_fn_c_check_decl "$LINENO" "feof_unlocked" "ac_cv_have_decl_feof_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_feof_unlocked" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FEOF_UNLOCKED $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "ferror_unlocked" "ac_cv_have_decl_ferror_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_ferror_unlocked" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getcwd_succeeds_beyond_4k" >&5 +printf "%s\n" "$gl_cv_func_getcwd_succeeds_beyond_4k" >&6; } + case "$gl_cv_func_getcwd_succeeds_beyond_4k" in + *no) + gl_abort_bug=yes + ;; + *) -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FERROR_UNLOCKED $ac_have_decl -_ACEOF + ;; + esac -ac_fn_c_check_decl "$LINENO" "fflush_unlocked" "ac_cv_have_decl_fflush_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_fflush_unlocked" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi + ;; + esac + ;; + esac + case "$gl_cv_func_getcwd_path_max" in + *"no" | *"no, it has the AIX bug") ;; + *) -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FFLUSH_UNLOCKED $ac_have_decl -_ACEOF +printf "%s\n" "#define HAVE_MINIMALLY_WORKING_GETCWD 1" >>confdefs.h -ac_fn_c_check_decl "$LINENO" "fgets_unlocked" "ac_cv_have_decl_fgets_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_fgets_unlocked" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi + ;; + esac + case "$gl_cv_func_getcwd_path_max" in + *"no, but it is partly working") -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FGETS_UNLOCKED $ac_have_decl -_ACEOF +printf "%s\n" "#define HAVE_PARTLY_WORKING_GETCWD 1" >>confdefs.h -ac_fn_c_check_decl "$LINENO" "fputc_unlocked" "ac_cv_have_decl_fputc_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_fputc_unlocked" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi + ;; + *"yes, but with shorter paths") -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FPUTC_UNLOCKED $ac_have_decl -_ACEOF +printf "%s\n" "#define HAVE_GETCWD_SHORTER 1" >>confdefs.h -ac_fn_c_check_decl "$LINENO" "fputs_unlocked" "ac_cv_have_decl_fputs_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_fputs_unlocked" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi + ;; + esac -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FPUTS_UNLOCKED $ac_have_decl -_ACEOF + if { case "$gl_cv_func_getcwd_null" in *yes) false;; *) true;; esac; } \ + || test $gl_cv_func_getcwd_posix_signature != yes \ + || { case "$gl_cv_func_getcwd_path_max" in *yes*) false;; *) true;; esac; } \ + || test $gl_abort_bug = yes; then + REPLACE_GETCWD=1 + fi -ac_fn_c_check_decl "$LINENO" "fread_unlocked" "ac_cv_have_decl_fread_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_fread_unlocked" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi + if test $REPLACE_GETCWD = 1; then -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FREAD_UNLOCKED $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "fwrite_unlocked" "ac_cv_have_decl_fwrite_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_fwrite_unlocked" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FWRITE_UNLOCKED $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "getc_unlocked" "ac_cv_have_decl_getc_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_getc_unlocked" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETC_UNLOCKED $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "getchar_unlocked" "ac_cv_have_decl_getchar_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_getchar_unlocked" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETCHAR_UNLOCKED $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "putc_unlocked" "ac_cv_have_decl_putc_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_putc_unlocked" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi + gl_LIBOBJS="$gl_LIBOBJS getcwd.$ac_objext" -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_PUTC_UNLOCKED $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "putchar_unlocked" "ac_cv_have_decl_putchar_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_putchar_unlocked" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_PUTCHAR_UNLOCKED $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "unsetenv" "ac_cv_have_decl_unsetenv" "$ac_includes_default" -if test "x$ac_cv_have_decl_unsetenv" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi + : -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_UNSETENV $ac_have_decl -_ACEOF + fi -ac_fn_c_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default" -if test "x$ac_cv_have_decl_vsnprintf" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_VSNPRINTF $ac_have_decl -_ACEOF +printf "%s\n" "#define GNULIB_GETCWD 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether uses 'inline' correctly" >&5 -$as_echo_n "checking whether uses 'inline' correctly... " >&6; } -if ${gl_cv_header_wchar_h_correct_inline+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_header_wchar_h_correct_inline=yes - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - #define wcstod renamed_wcstod -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -extern int zero (void); -int main () { return zero(); } -_ACEOF - save_ac_compile="$ac_compile" - ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` - if echo '#include "conftest.c"' >conftest1.c && - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - #define wcstod renamed_wcstod -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -int zero (void) { return 0; } -_ACEOF - ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` - if echo '#include "conftest.c"' >conftest2.c && - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&5 2>&1; then - : - else - gl_cv_header_wchar_h_correct_inline=no - fi - fi - fi - ac_compile="$save_ac_compile" - rm -f conftest12.c conftest12.$ac_objext conftest$ac_exeext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_wchar_h_correct_inline" >&5 -$as_echo "$gl_cv_header_wchar_h_correct_inline" >&6; } - if test $gl_cv_header_wchar_h_correct_inline = no; then - as_fn_error $? " cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). -This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in -C99 mode. You have four options: - - Add the flag -fgnu89-inline to CC and reconfigure, or - - Fix your include files, using parts of - , or - - Use a gcc version older than 4.3, or - - Don't use the flags -std=c99 or -std=gnu99. -Configuration aborted." "$LINENO" 5 - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking POSIX termios" >&5 -$as_echo_n "checking POSIX termios... " >&6; } -if ${ac_cv_sys_posix_termios+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -int -main () -{ -/* SunOS 4.0.3 has termios.h but not the library calls. */ - tcgetattr(0, 0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_sys_posix_termios=yes -else - ac_cv_sys_posix_termios=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_posix_termios" >&5 -$as_echo "$ac_cv_sys_posix_termios" >&6; } + GL_GNULIB_GETCWD=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether use of TIOCGWINSZ requires termios.h" >&5 -$as_echo_n "checking whether use of TIOCGWINSZ requires termios.h... " >&6; } -if ${gl_cv_sys_tiocgwinsz_needs_termios_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_sys_tiocgwinsz_needs_termios_h=no - if test $ac_cv_sys_posix_termios = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -# include -# ifdef TIOCGWINSZ - yes -# endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then : - gl_cv_sys_tiocgwinsz_needs_termios_h=yes -fi -rm -f conftest* - fi +printf "%s\n" "#define GNULIB_TEST_GETCWD 1" >>confdefs.h -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_tiocgwinsz_needs_termios_h" >&5 -$as_echo "$gl_cv_sys_tiocgwinsz_needs_termios_h" >&6; } - GNULIB_FCHMODAT=0; - GNULIB_FSTAT=0; - GNULIB_FSTATAT=0; - GNULIB_FUTIMENS=0; - GNULIB_LCHMOD=0; - GNULIB_LSTAT=0; - GNULIB_MKDIRAT=0; - GNULIB_MKFIFO=0; - GNULIB_MKFIFOAT=0; - GNULIB_MKNOD=0; - GNULIB_MKNODAT=0; - GNULIB_STAT=0; - GNULIB_UTIMENSAT=0; - GNULIB_OVERRIDES_STRUCT_STAT=0; - HAVE_FCHMODAT=1; - HAVE_FSTATAT=1; - HAVE_FUTIMENS=1; - HAVE_LCHMOD=1; - HAVE_LSTAT=1; - HAVE_MKDIRAT=1; - HAVE_MKFIFO=1; - HAVE_MKFIFOAT=1; - HAVE_MKNOD=1; - HAVE_MKNODAT=1; - HAVE_UTIMENSAT=1; - REPLACE_FSTAT=0; - REPLACE_FSTATAT=0; - REPLACE_FUTIMENS=0; - REPLACE_LSTAT=0; - REPLACE_MKDIR=0; - REPLACE_MKFIFO=0; - REPLACE_MKNOD=0; - REPLACE_STAT=0; - REPLACE_UTIMENSAT=0; -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 -$as_echo_n "checking whether stat file-mode macros are broken... " >&6; } -if ${ac_cv_header_stat_broken+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if defined S_ISBLK && defined S_IFDIR -extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; -#endif + ac_fn_check_decl "$LINENO" "gethrtime" "ac_cv_have_decl_gethrtime" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_gethrtime" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_GETHRTIME $ac_have_decl" >>confdefs.h + + LIB_GETHRXTIME= + if test $ac_cv_have_decl_gethrtime = no \ + || test $gl_cv_arithmetic_hrtime_t = no; then + -#if defined S_ISBLK && defined S_IFCHR -extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; -#endif -#if defined S_ISLNK && defined S_IFREG -extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; -#endif + if test $ac_cv_func_nanouptime != yes \ + && { test $ac_cv_have_decl_gethrtime = no \ + || test $gl_cv_arithmetic_hrtime_t = no; }; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether CLOCK_MONOTONIC or CLOCK_REALTIME is defined" >&5 +printf %s "checking whether CLOCK_MONOTONIC or CLOCK_REALTIME is defined... " >&6; } +if test ${gl_cv_have_clock_gettime_macro+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -#if defined S_ISSOCK && defined S_IFREG -extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; -#endif +# include +# if defined CLOCK_MONOTONIC || defined CLOCK_REALTIME + have_clock_gettime_macro +# endif _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stat_broken=no -else - ac_cv_header_stat_broken=yes +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "have_clock_gettime_macro" >/dev/null 2>&1 +then : + gl_cv_have_clock_gettime_macro=yes +else $as_nop + gl_cv_have_clock_gettime_macro=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -rf conftest* + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 -$as_echo "$ac_cv_header_stat_broken" >&6; } -if test $ac_cv_header_stat_broken = yes; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_clock_gettime_macro" >&5 +printf "%s\n" "$gl_cv_have_clock_gettime_macro" >&6; } + if test $gl_cv_have_clock_gettime_macro = yes; then + LIB_GETHRXTIME=$LIB_CLOCK_GETTIME + fi + fi + fi -$as_echo "#define STAT_MACROS_BROKEN 1" >>confdefs.h -fi @@ -25181,79 +36644,41 @@ + REPLACE_GETOPT=0 + if test -n "$gl_replace_getopt"; then + REPLACE_GETOPT=1 + fi + if test $REPLACE_GETOPT = 1; then + if test $ac_cv_header_sys_cdefs_h = yes; then + HAVE_SYS_CDEFS_H=1 + else + HAVE_SYS_CDEFS_H=0 + fi +printf "%s\n" "#define __GETOPT_PREFIX rpl_" >>confdefs.h + GETOPT_H=getopt.h + GETOPT_CDEFS_H=getopt-cdefs.h - if test $gl_cv_have_include_next = yes; then - gl_cv_next_sys_stat_h='<'sys/stat.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_sys_stat_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test $ac_cv_header_sys_stat_h = yes; then + fi + if test $REPLACE_GETOPT = 1; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'sys/stat.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - gl_cv_absolute_sys_stat_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_sys_stat_h - gl_cv_next_sys_stat_h='"'$gl_header'"' - else - gl_cv_next_sys_stat_h='<'sys/stat.h'>' - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_stat_h" >&5 -$as_echo "$gl_cv_next_sys_stat_h" >&6; } - fi - NEXT_SYS_STAT_H=$gl_cv_next_sys_stat_h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'sys/stat.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_sys_stat_h - fi - NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H=$gl_next_as_first_directive + gl_LIBOBJS="$gl_LIBOBJS getopt.$ac_objext" @@ -25262,8 +36687,8 @@ - WINDOWS_STAT_TIMESPEC=0 + gl_LIBOBJS="$gl_LIBOBJS getopt1.$ac_objext" @@ -25271,16 +36696,11 @@ - ac_fn_c_check_type "$LINENO" "nlink_t" "ac_cv_type_nlink_t" "#include - #include -" -if test "x$ac_cv_type_nlink_t" = xyes; then : + GL_GNULIB_UNISTD_H_GETOPT=1 -else -$as_echo "#define nlink_t int" >>confdefs.h + fi -fi @@ -25289,355 +36709,237 @@ -ac_fn_c_check_decl "$LINENO" "getdtablesize" "ac_cv_have_decl_getdtablesize" "$ac_includes_default" -if test "x$ac_cv_have_decl_getdtablesize" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi + GL_GNULIB_GETOPT_POSIX=1 -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETDTABLESIZE $ac_have_decl -_ACEOF +printf "%s\n" "#define GNULIB_TEST_GETOPT_POSIX 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setlocale (LC_ALL, NULL) is multithread-safe" >&5 -$as_echo_n "checking whether setlocale (LC_ALL, NULL) is multithread-safe... " >&6; } -if ${gl_cv_func_setlocale_null_all_mtsafe+:} false; then : - $as_echo_n "(cached) " >&6 -else - case "$host_os" in - # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. - *-musl* | darwin* | freebsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) - gl_cv_func_setlocale_null_all_mtsafe=no ;; - # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. - *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) - gl_cv_func_setlocale_null_all_mtsafe=yes ;; - # If we don't know, obey --enable-cross-guesses. - *) - gl_cv_func_setlocale_null_all_mtsafe="$gl_cross_guess_normal" ;; - esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_all_mtsafe" >&5 -$as_echo "$gl_cv_func_setlocale_null_all_mtsafe" >&6; } - case "$host_os" in - mingw*) ;; - *) - if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then - gl_cv_func_setlocale_null_all_mtsafe="trivially yes" - fi - ;; - esac - case "$gl_cv_func_setlocale_null_all_mtsafe" in - *yes) SETLOCALE_NULL_ALL_MTSAFE=1 ;; - *) SETLOCALE_NULL_ALL_MTSAFE=0 ;; - esac -cat >>confdefs.h <<_ACEOF -#define SETLOCALE_NULL_ALL_MTSAFE $SETLOCALE_NULL_ALL_MTSAFE -_ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setlocale (category, NULL) is multithread-safe" >&5 -$as_echo_n "checking whether setlocale (category, NULL) is multithread-safe... " >&6; } -if ${gl_cv_func_setlocale_null_one_mtsafe+:} false; then : - $as_echo_n "(cached) " >&6 -else - case "$host_os" in - # Guess no on OpenBSD, AIX. - openbsd* | aix*) - gl_cv_func_setlocale_null_one_mtsafe=no ;; - # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. - *-gnu* | gnu* | *-musl* | darwin* | freebsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) - gl_cv_func_setlocale_null_one_mtsafe=yes ;; - # If we don't know, obey --enable-cross-guesses. - *) - gl_cv_func_setlocale_null_one_mtsafe="$gl_cross_guess_normal" ;; - esac + ac_found=0 + ac_fn_check_decl "$LINENO" "program_invocation_name" "ac_cv_have_decl_program_invocation_name" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_program_invocation_name" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_PROGRAM_INVOCATION_NAME $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : + ac_found=1 +fi + ac_fn_check_decl "$LINENO" "program_invocation_short_name" "ac_cv_have_decl_program_invocation_short_name" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_program_invocation_short_name" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : + ac_found=1 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_one_mtsafe" >&5 -$as_echo "$gl_cv_func_setlocale_null_one_mtsafe" >&6; } - case "$host_os" in - mingw*) ;; - *) - if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then - gl_cv_func_setlocale_null_one_mtsafe="trivially yes" - fi - ;; - esac - case "$gl_cv_func_setlocale_null_one_mtsafe" in - *yes) SETLOCALE_NULL_ONE_MTSAFE=1 ;; - *) SETLOCALE_NULL_ONE_MTSAFE=0 ;; - esac -cat >>confdefs.h <<_ACEOF -#define SETLOCALE_NULL_ONE_MTSAFE $SETLOCALE_NULL_ONE_MTSAFE -_ACEOF + ac_fn_check_decl "$LINENO" "__argv" "ac_cv_have_decl___argv" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl___argv" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL___ARGV $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : + ac_found=1 +fi - if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then - case "$host_os" in - mingw*) LIB_SETLOCALE_NULL= ;; - *) + # Incur the cost of this test only if none of the above worked. + if test $ac_found = 0; then + # On OpenBSD 5.1, using the global __progname variable appears to be + # the only way to implement getprogname. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether __progname is defined in default libraries" >&5 +printf %s "checking whether __progname is defined in default libraries... " >&6; } +if test ${gl_cv_var___progname+y} +then : + printf %s "(cached) " >&6 +else $as_nop - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 -$as_echo_n "checking whether imported symbols can be declared weak... " >&6; } -if ${gl_cv_have_weak+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_have_weak=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + gl_cv_var___progname= + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern void xyzzy (); -#pragma weak xyzzy +extern char *__progname; int -main () +main (void) { -xyzzy(); +return *__progname; + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_have_weak=maybe +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_var___progname=yes + fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - if test $gl_cv_have_weak = maybe; then - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __ELF__ - Extensible Linking Format - #endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Extensible Linking Format" >/dev/null 2>&1; then : - gl_cv_have_weak="guessing yes" -else - gl_cv_have_weak="guessing no" + fi -rm -f conftest* +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_var___progname" >&5 +printf "%s\n" "$gl_cv_var___progname" >&6; } + if test "$gl_cv_var___progname" = yes; then +printf "%s\n" "#define HAVE_VAR___PROGNAME 1" >>confdefs.h -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + fi + fi -#include -#pragma weak fputs -int main () -{ - return (fputs == NULL); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_have_weak=yes -else - gl_cv_have_weak=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - fi - case " $LDFLAGS " in - *" -static "*) gl_cv_have_weak=no ;; - esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 -$as_echo "$gl_cv_have_weak" >&6; } - case "$gl_cv_have_weak" in - *yes) -$as_echo "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h + if test $ac_cv_func_getrusage = no; then + HAVE_GETRUSAGE=0 + fi - ;; - esac + if test $HAVE_GETRUSAGE = 0; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS getrusage.$ac_objext" - case "$gl_cv_have_weak" in - *yes) LIB_SETLOCALE_NULL= ;; - *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; - esac - ;; - esac - else - LIB_SETLOCALE_NULL= fi - GNULIB_LOCALECONV=0; - GNULIB_SETLOCALE=0; - GNULIB_SETLOCALE_NULL=0; - GNULIB_DUPLOCALE=0; - GNULIB_LOCALENAME=0; - HAVE_NEWLOCALE=1; - HAVE_DUPLOCALE=1; - HAVE_FREELOCALE=1; - REPLACE_LOCALECONV=0; - REPLACE_SETLOCALE=0; - REPLACE_NEWLOCALE=0; - REPLACE_DUPLOCALE=0; - REPLACE_FREELOCALE=0; - REPLACE_STRUCT_LCONV=0; - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether locale.h defines locale_t" >&5 -$as_echo_n "checking whether locale.h defines locale_t... " >&6; } -if ${gl_cv_header_locale_has_locale_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - locale_t x; -int -main () -{ + GL_GNULIB_GETRUSAGE=1 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_locale_has_locale_t=yes -else - gl_cv_header_locale_has_locale_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_locale_has_locale_t" >&5 -$as_echo "$gl_cv_header_locale_has_locale_t" >&6; } - if test $ac_cv_header_xlocale_h = yes; then - HAVE_XLOCALE_H=1 - if test $gl_cv_header_locale_has_locale_t = yes; then - gl_cv_header_locale_h_needs_xlocale_h=no - else - gl_cv_header_locale_h_needs_xlocale_h=yes - fi - HAVE_LOCALE_T=1 - else - HAVE_XLOCALE_H=0 - gl_cv_header_locale_h_needs_xlocale_h=no - if test $gl_cv_header_locale_has_locale_t = yes; then - HAVE_LOCALE_T=1 - else - HAVE_LOCALE_T=0 - fi - fi +printf "%s\n" "#define GNULIB_TEST_GETRUSAGE 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 -$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } -if ${gl_cv_func_lstat_dereferences_slashed_symlink+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f conftest.sym conftest.file - echo >conftest.file - if test "$cross_compiling" = yes; then : - case "$host_os" in - linux-* | linux) - # Guess yes on Linux systems. - gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; - *-gnu* | gnu*) - # Guess yes on glibc systems. - gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; - mingw*) - # Guess no on native Windows. - gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; - *) - # If we don't know, obey --enable-cross-guesses. - gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;; - esac -else + + + + + + + + + + + + + + + gl_gettimeofday_timezone=void + if test $ac_cv_func_gettimeofday != yes; then + HAVE_GETTIMEOFDAY=0 + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gettimeofday with POSIX signature" >&5 +printf %s "checking for gettimeofday with POSIX signature... " >&6; } +if test ${gl_cv_func_gettimeofday_posix_signature+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default +#include + struct timeval c; + int gettimeofday (struct timeval *restrict, void *restrict); + int -main () +main (void) { -struct stat sbuf; - if (symlink ("conftest.file", "conftest.sym") != 0) - return 1; - /* Linux will dereference the symlink and fail, as required by - POSIX. That is better in the sense that it means we will not - have to compile and use the lstat wrapper. */ - return lstat ("conftest.sym/", &sbuf) == 0; +/* glibc uses struct timezone * rather than the POSIX void * + if _GNU_SOURCE is defined. However, since the only portable + use of gettimeofday uses NULL as the second parameter, and + since the glibc definition is actually more typesafe, it is + not worth wrapping this to get a compliant signature. */ + int (*f) (struct timeval *restrict, void *restrict) + = gettimeofday; + int x = f (&c, 0); + return !(x | c.tv_sec | c.tv_usec); ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_lstat_dereferences_slashed_symlink=yes -else - gl_cv_func_lstat_dereferences_slashed_symlink=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - rm -f conftest.sym conftest.file +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_gettimeofday_posix_signature=yes +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int gettimeofday (struct timeval *restrict, struct timezone *restrict); -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_lstat_dereferences_slashed_symlink" >&5 -$as_echo "$gl_cv_func_lstat_dereferences_slashed_symlink" >&6; } - case "$gl_cv_func_lstat_dereferences_slashed_symlink" in - *yes) +int +main (void) +{ -cat >>confdefs.h <<_ACEOF -#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 + ; + return 0; +} _ACEOF - - ;; - esac - - - -ac_fn_c_check_decl "$LINENO" "strnlen" "ac_cv_have_decl_strnlen" "$ac_includes_default" -if test "x$ac_cv_have_decl_strnlen" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_gettimeofday_posix_signature=almost +else $as_nop + gl_cv_func_gettimeofday_posix_signature=no fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRNLEN $ac_have_decl -_ACEOF - - - if false; then - GL_COND_LIBTOOL_TRUE= - GL_COND_LIBTOOL_FALSE='#' -else - GL_COND_LIBTOOL_TRUE='#' - GL_COND_LIBTOOL_FALSE= +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_gettimeofday_posix_signature" >&5 +printf "%s\n" "$gl_cv_func_gettimeofday_posix_signature" >&6; } + if test $gl_cv_func_gettimeofday_posix_signature = almost; then + gl_gettimeofday_timezone='struct timezone' + elif test $gl_cv_func_gettimeofday_posix_signature != yes; then + REPLACE_GETTIMEOFDAY=1 + fi + if test $REPLACE_STRUCT_TIMEVAL = 1; then + REPLACE_GETTIMEOFDAY=1 + fi + case "$host_os" in + mingw*) REPLACE_GETTIMEOFDAY=1 ;; + esac + fi - gl_cond_libtool=false - gl_libdeps= - gl_ltlibdeps= - gl_m4_base='m4' +printf "%s\n" "#define GETTIMEOFDAY_TIMEZONE $gl_gettimeofday_timezone" >>confdefs.h + if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then @@ -25645,388 +36947,396 @@ - gl_source_base='lib' + gl_LIBOBJS="$gl_LIBOBJS gettimeofday.$ac_objext" - if test $ac_cv_func_alloca_works = no; then : fi - # Define an additional variable used in the Makefile substitution. - if test $ac_cv_working_alloca_h = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca as a compiler built-in" >&5 -$as_echo_n "checking for alloca as a compiler built-in... " >&6; } -if ${gl_cv_rpl_alloca+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined __GNUC__ || defined _AIX || defined _MSC_VER - Need own alloca -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Need own alloca" >/dev/null 2>&1; then : - gl_cv_rpl_alloca=yes -else - gl_cv_rpl_alloca=no -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_rpl_alloca" >&5 -$as_echo "$gl_cv_rpl_alloca" >&6; } - if test $gl_cv_rpl_alloca = yes; then -$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h - ALLOCA_H=alloca.h - else - ALLOCA_H= - fi - else - ALLOCA_H=alloca.h - fi - if test -n "$ALLOCA_H"; then - GL_GENERATE_ALLOCA_H_TRUE= - GL_GENERATE_ALLOCA_H_FALSE='#' -else - GL_GENERATE_ALLOCA_H_TRUE='#' - GL_GENERATE_ALLOCA_H_FALSE= -fi + GL_GNULIB_GETTIMEOFDAY=1 - if test $ac_cv_working_alloca_h = yes; then - HAVE_ALLOCA_H=1 - else - HAVE_ALLOCA_H=0 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable assertions" >&5 -$as_echo_n "checking whether to enable assertions... " >&6; } - # Check whether --enable-assert was given. -if test "${enable_assert+set}" = set; then : - enableval=$enable_assert; if test "x$enableval" = xno; then : +printf "%s\n" "#define GNULIB_TEST_GETTIMEOFDAY 1" >>confdefs.h -$as_echo "#define NDEBUG 1" >>confdefs.h -elif test "x$enableval" != xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: invalid argument supplied to --enable-assert" >&5 -$as_echo "$as_me: WARNING: invalid argument supplied to --enable-assert" >&2;} - enable_assert=yes -fi -else - enable_assert=yes -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_assert" >&5 -$as_echo "$enable_assert" >&6; } + # Autoconf 2.61a.99 and earlier don't support linking a file only + # in VPATH builds. But since GNUmakefile is for maintainer use + # only, it does not matter if we skip the link with older autoconf. + # Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH + # builds, so use a shell variable to bypass this. + GNUmakefile=GNUmakefile + ac_config_links="$ac_config_links $GNUmakefile:$GNUmakefile" - if test $gl_cv_func_malloc_posix = yes; then -$as_echo "#define HAVE_CALLOC_POSIX 1" >>confdefs.h - else - REPLACE_CALLOC=1 - fi - if test $REPLACE_CALLOC = 1; then + GL_GNULIB_ICONV=1 - gl_LIBOBJS="$gl_LIBOBJS calloc.$ac_objext" - fi - GNULIB_CALLOC_POSIX=1 -$as_echo "#define GNULIB_TEST_CALLOC_POSIX 1" >>confdefs.h + if test "$am_cv_func_iconv" = yes; then - if test $ac_cv_func_canonicalize_file_name = no; then - HAVE_CANONICALIZE_FILE_NAME=0 - if test $ac_cv_func_realpath = no; then - HAVE_REALPATH=0 - else - case "$gl_cv_func_realpath_works" in - *yes) ;; - *) REPLACE_REALPATH=1 ;; - esac - fi - else - case "$gl_cv_func_realpath_works" in - *yes) - ;; - *) - REPLACE_CANONICALIZE_FILE_NAME=1 - REPLACE_REALPATH=1 - ;; - esac - fi + ICONV_H='iconv.h' + if test -n "$ICONV_H"; then + GL_GENERATE_ICONV_H_TRUE= + GL_GENERATE_ICONV_H_FALSE='#' +else + GL_GENERATE_ICONV_H_TRUE='#' + GL_GENERATE_ICONV_H_FALSE= +fi - if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #if defined _LIBICONV_VERSION || (defined __GLIBC__ && !defined __UCLIBC__) + gnu_iconv + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gnu_iconv" >/dev/null 2>&1 +then : + gl_func_iconv_gnu=yes +else $as_nop + gl_func_iconv_gnu=no +fi +rm -rf conftest* + if test $gl_func_iconv_gnu = no; then + iconv_flavor= + case "$host_os" in + aix*) iconv_flavor=ICONV_FLAVOR_AIX ;; + irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;; + hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;; + osf*) iconv_flavor=ICONV_FLAVOR_OSF ;; + solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;; + openedition*) iconv_flavor=ICONV_FLAVOR_ZOS ;; + esac + if test -n "$iconv_flavor"; then +printf "%s\n" "#define ICONV_FLAVOR $iconv_flavor" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS canonicalize-lgpl.$ac_objext" - fi -cat >>confdefs.h <<_ACEOF -#define GNULIB_CANONICALIZE_LGPL 1 -_ACEOF + ICONV_H='iconv.h' + if test -n "$ICONV_H"; then + GL_GENERATE_ICONV_H_TRUE= + GL_GENERATE_ICONV_H_FALSE='#' +else + GL_GENERATE_ICONV_H_TRUE='#' + GL_GENERATE_ICONV_H_FALSE= +fi + REPLACE_ICONV_OPEN=1 + fi + fi + fi + if test $REPLACE_ICONV_OPEN = 1; then - GNULIB_CANONICALIZE_FILE_NAME=1 -$as_echo "#define GNULIB_TEST_CANONICALIZE_FILE_NAME 1" >>confdefs.h + gl_LIBOBJS="$gl_LIBOBJS iconv_open.$ac_objext" + fi + if test $REPLACE_ICONV = 1; then - GNULIB_REALPATH=1 + gl_LIBOBJS="$gl_LIBOBJS iconv.$ac_objext" -$as_echo "#define GNULIB_TEST_REALPATH 1" >>confdefs.h + gl_LIBOBJS="$gl_LIBOBJS iconv_close.$ac_objext" - # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function. - # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4. + fi - # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all* - # programs in the package would end up linked with that potentially-shared - # library, inducing unnecessary run-time overhead. - LIB_CLOCK_GETTIME= - gl_saved_libs=$LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 -$as_echo_n "checking for library containing clock_gettime... " >&6; } -if ${ac_cv_search_clock_gettime+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler generally respects inline" >&5 +printf %s "checking whether the compiler generally respects inline... " >&6; } +if test ${gl_cv_c_inline_effective+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test $ac_cv_c_inline = no; then + gl_cv_c_inline_effective=no + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char clock_gettime (); int -main () +main (void) { -return clock_gettime (); +#ifdef __NO_INLINE__ + #error "inline is not effective" + #endif ; return 0; } _ACEOF -for ac_lib in '' rt posix4; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_clock_gettime=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_clock_gettime+:} false; then : - break +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_c_inline_effective=yes +else $as_nop + gl_cv_c_inline_effective=no fi -done -if ${ac_cv_search_clock_gettime+:} false; then : +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi -else - ac_cv_search_clock_gettime=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 -$as_echo "$ac_cv_search_clock_gettime" >&6; } -ac_res=$ac_cv_search_clock_gettime -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - test "$ac_cv_search_clock_gettime" = "none required" || - LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c_inline_effective" >&5 +printf "%s\n" "$gl_cv_c_inline_effective" >&6; } + if test $gl_cv_c_inline_effective = yes; then - for ac_func in clock_gettime clock_settime -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +printf "%s\n" "#define HAVE_INLINE 1" >>confdefs.h -fi -done + fi - LIBS=$gl_saved_libs -$as_echo "#define GNULIB_TEST_CLOEXEC 1" >>confdefs.h - if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then - REPLACE_CLOSE=1 - fi + # If we replaced any of the underlying isnan* functions, replace + # the isnan macro; it undoubtedly suffers from the same flaws. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan macro works" >&5 +printf %s "checking whether isnan macro works... " >&6; } + if test $gl_func_isnanf = yes \ + && test $gl_func_isnand = yes \ + && test $gl_func_isnanl = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + ISNAN_LIBM= + case " $ISNAN_LIBM " in + *" $ISNANF_LIBM "*) ;; + *) ISNAN_LIBM="$ISNAN_LIBM $ISNANF_LIBM" ;; + esac + case " $ISNAN_LIBM " in + *" $ISNAND_LIBM "*) ;; + *) ISNAN_LIBM="$ISNAN_LIBM $ISNAND_LIBM" ;; + esac + case " $ISNAN_LIBM " in + *" $ISNANL_LIBM "*) ;; + *) ISNAN_LIBM="$ISNAN_LIBM $ISNANL_LIBM" ;; + esac + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + REPLACE_ISNAN=1 + ISNAN_LIBM= + fi - if test $ac_cv_header_sys_socket_h != yes; then - for ac_header in winsock2.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" -if test "x$ac_cv_header_winsock2_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_WINSOCK2_H 1 -_ACEOF -fi -done - fi - if test "$ac_cv_header_winsock2_h" = yes; then - HAVE_WINSOCK2_H=1 - UNISTD_H_HAVE_WINSOCK2_H=1 - SYS_IOCTL_H_HAVE_WINSOCK2_H=1 - else - HAVE_WINSOCK2_H=0 - fi - if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then - REPLACE_CLOSE=1 - fi - if test $REPLACE_CLOSE = 1; then + GL_GNULIB_ISNAN=1 +printf "%s\n" "#define GNULIB_TEST_ISNAN 1" >>confdefs.h + - gl_LIBOBJS="$gl_LIBOBJS close.$ac_objext" - fi + ISNAND_LIBM= + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(double) can be used without linking with libm" >&5 +printf %s "checking whether isnan(double) can be used without linking with libm... " >&6; } +if test ${gl_cv_func_isnand_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) + # undef isnand + # define isnand(x) __builtin_isnan ((double)(x)) + #else + # undef isnand + # define isnand(x) isnan ((double)(x)) + #endif + double x; +int +main (void) +{ +return isnand (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_isnand_no_libm=yes +else $as_nop + gl_cv_func_isnand_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext - GNULIB_CLOSE=1 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnand_no_libm" >&5 +printf "%s\n" "$gl_cv_func_isnand_no_libm" >&6; } + if test $gl_cv_func_isnand_no_libm = no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(double) can be used with libm" >&5 +printf %s "checking whether isnan(double) can be used with libm... " >&6; } +if test ${gl_cv_func_isnand_in_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) + # undef isnand + # define isnand(x) __builtin_isnan ((double)(x)) + #elif defined isnan + # undef isnand + # define isnand(x) isnan ((double)(x)) + #endif + double x; +int +main (void) +{ +return isnand (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_isnand_in_libm=yes +else $as_nop + gl_cv_func_isnand_in_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$save_LIBS" +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnand_in_libm" >&5 +printf "%s\n" "$gl_cv_func_isnand_in_libm" >&6; } -$as_echo "#define GNULIB_TEST_CLOSE 1" >>confdefs.h + if test $gl_cv_func_isnand_in_libm = yes; then + ISNAND_LIBM=-lm + fi + fi + if test $gl_cv_func_isnand_no_libm = yes \ + || test $gl_cv_func_isnand_in_libm = yes; then + gl_func_isnand=yes + else + gl_func_isnand=no + HAVE_ISNAND=0 + fi -cat >>confdefs.h <<_ACEOF -#define GNULIB_CLOSE_STREAM 1 -_ACEOF + if test $HAVE_ISNAND = 0 || test $REPLACE_ISNAN = 1; then - if test "x$lispdir" = x; then - lispdir='${datarootdir}/emacs/site-lisp' - fi - if test "x$runstatedir" = x; then - runstatedir='${localstatedir}/run' - fi - pkglibexecdir='${libexecdir}/${PACKAGE}' + gl_LIBOBJS="$gl_LIBOBJS isnand.$ac_objext" + fi -cat >>confdefs.h <<_ACEOF -#define GNULIB_DIRNAME 1 -_ACEOF @@ -26034,175 +37344,66 @@ + GL_GNULIB_ISNAND=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether // is distinct from /" >&5 -$as_echo_n "checking whether // is distinct from /... " >&6; } -if ${gl_cv_double_slash_root+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test x"$cross_compiling" = xyes ; then - # When cross-compiling, there is no way to tell whether // is special - # short of a list of hosts. However, the only known hosts to date - # that have a distinct // are Apollo DomainOS (too old to port to), - # Cygwin, and z/OS. If anyone knows of another system for which // has - # special semantics and is distinct from /, please report it to - # . - case $host in - *-cygwin | i370-ibm-openedition) - gl_cv_double_slash_root=yes ;; - *) - # Be optimistic and assume that / and // are the same when we - # don't know. - gl_cv_double_slash_root='unknown, assuming no' ;; - esac - else - set x `ls -di / // 2>/dev/null` - if test "$2" = "$4" && wc //dev/null >/dev/null 2>&1; then - gl_cv_double_slash_root=no - else - gl_cv_double_slash_root=yes - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_double_slash_root" >&5 -$as_echo "$gl_cv_double_slash_root" >&6; } - if test "$gl_cv_double_slash_root" = yes; then -$as_echo "#define DOUBLE_SLASH_IS_DISTINCT_ROOT 1" >>confdefs.h - fi +printf "%s\n" "#define GNULIB_TEST_ISNAND 1" >>confdefs.h -$as_echo "#define HAVE_DUP2 1" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(double) can be used without linking with libm" >&5 +printf %s "checking whether isnan(double) can be used without linking with libm... " >&6; } +if test ${gl_cv_func_isnand_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop - if test $HAVE_DUP2 = 1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether dup2 works" >&5 -$as_echo_n "checking whether dup2 works... " >&6; } -if ${gl_cv_func_dup2_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - mingw*) # on this platform, dup2 always returns 0 for success - 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" ;; - aix* | freebsd*) - # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE, - # not EBADF. - gl_cv_func_dup2_works="guessing no" ;; - haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC. - gl_cv_func_dup2_works="guessing no" ;; - *-android*) # implemented using dup3(), which fails if oldfd == newfd - gl_cv_func_dup2_works="guessing no" ;; - os2*) # on OS/2 kLIBC, dup2() does not work on a directory fd. - gl_cv_func_dup2_works="guessing no" ;; - *) gl_cv_func_dup2_works="guessing yes" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - - #include - #include - #include - #include - #include - #ifndef RLIM_SAVED_CUR - # define RLIM_SAVED_CUR RLIM_INFINITY - #endif - #ifndef RLIM_SAVED_MAX - # define RLIM_SAVED_MAX RLIM_INFINITY +#include + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) + # undef isnand + # define isnand(x) __builtin_isnan ((double)(x)) + #else + # undef isnand + # define isnand(x) isnan ((double)(x)) #endif - + double x; int -main () +main (void) { -int result = 0; - int bad_fd = INT_MAX; - struct rlimit rlim; - if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 - && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX - && rlim.rlim_cur != RLIM_INFINITY - && rlim.rlim_cur != RLIM_SAVED_MAX - && rlim.rlim_cur != RLIM_SAVED_CUR) - bad_fd = rlim.rlim_cur; - #ifdef FD_CLOEXEC - if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) - result |= 1; - #endif - if (dup2 (1, 1) != 1) - result |= 2; - #ifdef FD_CLOEXEC - if (fcntl (1, F_GETFD) != FD_CLOEXEC) - result |= 4; - #endif - close (0); - if (dup2 (0, 0) != -1) - result |= 8; - /* Many gnulib modules require POSIX conformance of EBADF. */ - if (dup2 (2, bad_fd) == -1 && errno != EBADF) - result |= 16; - /* Flush out some cygwin core dumps. */ - if (dup2 (2, -1) != -1 || errno != EBADF) - result |= 32; - dup2 (2, 255); - dup2 (2, 256); - /* On OS/2 kLIBC, dup2() does not work on a directory fd. */ - { - int fd = open (".", O_RDONLY); - if (fd == -1) - result |= 64; - else if (dup2 (fd, fd + 1) == -1) - result |= 128; - - close (fd); - } - return result; +return isnand (x); ; return 0; } - _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_dup2_works=yes -else - gl_cv_func_dup2_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_isnand_no_libm=yes +else $as_nop + gl_cv_func_isnand_no_libm=no fi - +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_dup2_works" >&5 -$as_echo "$gl_cv_func_dup2_works" >&6; } - case "$gl_cv_func_dup2_works" in - *yes) ;; - *) - REPLACE_DUP2=1 - for ac_func in setdtablesize -do : - ac_fn_c_check_func "$LINENO" "setdtablesize" "ac_cv_func_setdtablesize" -if test "x$ac_cv_func_setdtablesize" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SETDTABLESIZE 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnand_no_libm" >&5 +printf "%s\n" "$gl_cv_func_isnand_no_libm" >&6; } -fi -done + gl_func_isnand_no_libm=$gl_cv_func_isnand_no_libm + if test $gl_cv_func_isnand_no_libm = yes; then + +printf "%s\n" "#define HAVE_ISNAND_IN_LIBC 1" >>confdefs.h - ;; - esac fi + if test $gl_func_isnand_no_libm != yes; then - if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then @@ -26210,372 +37411,648 @@ + gl_LIBOBJS="$gl_LIBOBJS isnand.$ac_objext" - gl_LIBOBJS="$gl_LIBOBJS dup2.$ac_objext" + + fi + + + ISNANF_LIBM= + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) can be used without linking with libm" >&5 +printf %s "checking whether isnan(float) can be used without linking with libm... " >&6; } +if test ${gl_cv_func_isnanf_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) + # undef isnanf + # define isnanf(x) __builtin_isnan ((float)(x)) + #elif defined isnan + # undef isnanf + # define isnanf(x) isnan ((float)(x)) + #endif + float x; +int +main (void) +{ +return isnanf (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_isnanf_no_libm=yes +else $as_nop + gl_cv_func_isnanf_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_no_libm" >&5 +printf "%s\n" "$gl_cv_func_isnanf_no_libm" >&6; } + + if test $gl_cv_func_isnanf_no_libm = no; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) can be used with libm" >&5 +printf %s "checking whether isnan(float) can be used with libm... " >&6; } +if test ${gl_cv_func_isnanf_in_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) + # undef isnanf + # define isnanf(x) __builtin_isnan ((float)(x)) + #elif defined isnan + # undef isnanf + # define isnanf(x) isnan ((float)(x)) + #endif + float x; +int +main (void) +{ +return isnanf (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_isnanf_in_libm=yes +else $as_nop + gl_cv_func_isnanf_in_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$save_LIBS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_in_libm" >&5 +printf "%s\n" "$gl_cv_func_isnanf_in_libm" >&6; } + + if test $gl_cv_func_isnanf_in_libm = yes; then + ISNANF_LIBM=-lm + fi fi + if test $gl_cv_func_isnanf_no_libm = yes \ + || test $gl_cv_func_isnanf_in_libm = yes; then + save_LIBS="$LIBS" + LIBS="$LIBS $ISNANF_LIBM" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) works" >&5 +printf %s "checking whether isnan(float) works... " >&6; } +if test ${gl_cv_func_isnanf_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + case "$host_os" in + irix* | solaris*) gl_cv_func_isnanf_works="guessing no" ;; + mingw*) # Guess yes on mingw, no on MSVC. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __MINGW32__ + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_func_isnanf_works="guessing yes" +else $as_nop + gl_cv_func_isnanf_works="guessing no" +fi +rm -rf conftest* + + ;; + *) gl_cv_func_isnanf_works="guessing yes" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#if (__GNUC__ >= 4) || (__clang_major__ >= 4) +# undef isnanf +# define isnanf(x) __builtin_isnan ((float)(x)) +#elif defined isnan +# undef isnanf +# define isnanf(x) isnan ((float)(x)) +#endif +/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ +#ifdef __DECC +static float +NaN () +{ + static float zero = 0.0f; + return zero / zero; +} +#else +# define NaN() (0.0f / 0.0f) +#endif +#define NWORDS \ + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { unsigned int word[NWORDS]; float value; } memory_float; +int main() +{ + int result = 0; - GNULIB_DUP2=1 + if (isnanf (1.0f / 0.0f)) + result |= 1; + if (!isnanf (NaN ())) + result |= 2; +#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT + /* The isnanf function should be immune against changes in the sign bit and + in the mantissa bits. The xor operation twiddles a bit that can only be + a sign bit or a mantissa bit. */ + if (FLT_EXPBIT0_WORD == 0 && FLT_EXPBIT0_BIT > 0) + { + memory_float m; + m.value = NaN (); + /* Set the bits below the exponent to 01111...111. */ + m.word[0] &= -1U << FLT_EXPBIT0_BIT; + m.word[0] |= (1U << (FLT_EXPBIT0_BIT - 1)) - 1; + if (!isnanf (m.value)) + result |= 4; + } +#endif + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_isnanf_works=yes +else $as_nop + gl_cv_func_isnanf_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi -$as_echo "#define GNULIB_TEST_DUP2 1" >>confdefs.h +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_works" >&5 +printf "%s\n" "$gl_cv_func_isnanf_works" >&6; } + LIBS="$save_LIBS" + case "$gl_cv_func_isnanf_works" in + *yes) gl_func_isnanf=yes ;; + *) gl_func_isnanf=no; ISNANF_LIBM= ;; + esac + else + gl_func_isnanf=no + fi + if test $gl_func_isnanf != yes; then + HAVE_ISNANF=0 + fi + if test $HAVE_ISNANF = 0 || test $REPLACE_ISNAN = 1; then - GNULIB_ENVIRON=1 -$as_echo "#define GNULIB_TEST_ENVIRON 1" >>confdefs.h + gl_LIBOBJS="$gl_LIBOBJS isnanf.$ac_objext" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'float'" >&5 +printf %s "checking where to find the exponent in a 'float'... " >&6; } +if test ${gl_cv_cc_float_expbit0+y} +then : + printf %s "(cached) " >&6 +else $as_nop - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5 -$as_echo_n "checking for error_at_line... " >&6; } -if ${ac_cv_lib_error_at_line+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test "$cross_compiling" = yes +then : + gl_cv_cc_float_expbit0="word 0 bit 23" +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -int -main () + +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { float value; unsigned int word[NWORDS]; } memory_float; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (float x) { -error_at_line (0, 0, "", 0, "an error occurred"); - ; - return 0; + memory_float m; + size_t i; + /* Clear it first, in case + sizeof (float) < sizeof (memory_float). */ + memset (&m, 0, sizeof (memory_float)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25f); + add_to_ored_words (0.5f); + add_to_ored_words (1.0f); + add_to_ored_words (2.0f); + add_to_ored_words (4.0f); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); } + _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_error_at_line=yes -else - ac_cv_lib_error_at_line=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_cc_float_expbit0=`cat conftest.out` +else $as_nop + gl_cv_cc_float_expbit0="unknown" fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5 -$as_echo "$ac_cv_lib_error_at_line" >&6; } - - if test $ac_cv_lib_error_at_line = no; then - - - - + rm -f conftest.out +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_float_expbit0" >&5 +printf "%s\n" "$gl_cv_cc_float_expbit0" >&6; } + case "$gl_cv_cc_float_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` +printf "%s\n" "#define FLT_EXPBIT0_WORD $word" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS error.$ac_objext" +printf "%s\n" "#define FLT_EXPBIT0_BIT $bit" >>confdefs.h + ;; + esac - : fi - XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=error:3:c-format" - XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=error_at_line:5:c-format" + GL_GNULIB_ISNANF=1 - : +printf "%s\n" "#define GNULIB_TEST_ISNANF 1" >>confdefs.h - if test $ac_cv_func_fcntl = no; then - if test $ac_cv_func_fcntl = no; then - HAVE_FCNTL=0 - else - REPLACE_FCNTL=1 - fi + ISNANL_LIBM= - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fcntl handles F_DUPFD correctly" >&5 -$as_echo_n "checking whether fcntl handles F_DUPFD correctly... " >&6; } -if ${gl_cv_func_fcntl_f_dupfd_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case $host_os in - aix* | cygwin* | haiku*) - gl_cv_func_fcntl_f_dupfd_works="guessing no" ;; - *) gl_cv_func_fcntl_f_dupfd_works="guessing yes" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - #include - #include - #include - #ifndef RLIM_SAVED_CUR - # define RLIM_SAVED_CUR RLIM_INFINITY - #endif - #ifndef RLIM_SAVED_MAX - # define RLIM_SAVED_MAX RLIM_INFINITY - #endif + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(long double) can be used without linking with libm" >&5 +printf %s "checking whether isnan(long double) can be used without linking with libm... " >&6; } +if test ${gl_cv_func_isnanl_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) + # undef isnanl + # define isnanl(x) __builtin_isnan ((long double)(x)) + #elif defined isnan + # undef isnanl + # define isnanl(x) isnan ((long double)(x)) + #endif + long double x; int -main () +main (void) { -int result = 0; - int bad_fd = INT_MAX; - struct rlimit rlim; - if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 - && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX - && rlim.rlim_cur != RLIM_INFINITY - && rlim.rlim_cur != RLIM_SAVED_MAX - && rlim.rlim_cur != RLIM_SAVED_CUR) - bad_fd = rlim.rlim_cur; - if (fcntl (0, F_DUPFD, -1) != -1) result |= 1; - if (errno != EINVAL) result |= 2; - if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4; - if (errno != EINVAL) result |= 8; - /* On OS/2 kLIBC, F_DUPFD does not work on a directory fd */ - { - int fd; - fd = open (".", O_RDONLY); - if (fd == -1) - result |= 16; - else if (fcntl (fd, F_DUPFD, STDERR_FILENO + 1) == -1) - result |= 32; - - close (fd); - } - return result; +return isnanl (x); ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_fcntl_f_dupfd_works=yes -else - gl_cv_func_fcntl_f_dupfd_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_isnanl_no_libm=yes +else $as_nop + gl_cv_func_isnanl_no_libm=no fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fcntl_f_dupfd_works" >&5 -$as_echo "$gl_cv_func_fcntl_f_dupfd_works" >&6; } - case $gl_cv_func_fcntl_f_dupfd_works in - *yes) ;; - *) - - - if test $ac_cv_func_fcntl = no; then - HAVE_FCNTL=0 - else - REPLACE_FCNTL=1 - fi - - -$as_echo "#define FCNTL_DUPFD_BUGGY 1" >>confdefs.h - ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fcntl understands F_DUPFD_CLOEXEC" >&5 -$as_echo_n "checking whether fcntl understands F_DUPFD_CLOEXEC... " >&6; } -if ${gl_cv_func_fcntl_f_dupfd_cloexec+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_no_libm" >&5 +printf "%s\n" "$gl_cv_func_isnanl_no_libm" >&6; } -#include -#ifndef F_DUPFD_CLOEXEC -choke me -#endif + if test $gl_cv_func_isnanl_no_libm = no; then -int -main () -{ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(long double) can be used with libm" >&5 +printf %s "checking whether isnan(long double) can be used with libm... " >&6; } +if test ${gl_cv_func_isnanl_in_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#ifdef __linux__ -/* The Linux kernel only added F_DUPFD_CLOEXEC in 2.6.24, so we always replace - it to support the semantics on older kernels that failed with EINVAL. */ -choke me -#endif - +#include + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) + # undef isnanl + # define isnanl(x) __builtin_isnan ((long double)(x)) + #elif defined isnan + # undef isnanl + # define isnanl(x) isnan ((long double)(x)) + #endif + long double x; int -main () +main (void) { - +return isnanl (x); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_func_fcntl_f_dupfd_cloexec=yes -else - gl_cv_func_fcntl_f_dupfd_cloexec="needs runtime check" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - gl_cv_func_fcntl_f_dupfd_cloexec=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_isnanl_in_libm=yes +else $as_nop + gl_cv_func_isnanl_in_libm=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fcntl_f_dupfd_cloexec" >&5 -$as_echo "$gl_cv_func_fcntl_f_dupfd_cloexec" >&6; } - if test "$gl_cv_func_fcntl_f_dupfd_cloexec" != yes; then - - - - if test $ac_cv_func_fcntl = no; then - HAVE_FCNTL=0 - else - REPLACE_FCNTL=1 - fi - - fi - fi - - - if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then - - - - - - - +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$save_LIBS" - gl_LIBOBJS="$gl_LIBOBJS fcntl.$ac_objext" +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_in_libm" >&5 +printf "%s\n" "$gl_cv_func_isnanl_in_libm" >&6; } + if test $gl_cv_func_isnanl_in_libm = yes; then + ISNANL_LIBM=-lm + fi fi + if test $gl_cv_func_isnanl_no_libm = yes \ + || test $gl_cv_func_isnanl_in_libm = yes; then + save_LIBS="$LIBS" + LIBS="$LIBS $ISNANL_LIBM" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnanl works" >&5 +printf %s "checking whether isnanl works... " >&6; } +if test ${gl_cv_func_isnanl_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop - GNULIB_FCNTL=1 - - - - - -$as_echo "#define GNULIB_TEST_FCNTL 1" >>confdefs.h - - - - - - - + if test "$cross_compiling" = yes +then : + case "$host_os" in + mingw*) # Guess yes on mingw, no on MSVC. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __MINGW32__ + Known +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_func_isnanl_works="guessing yes" +else $as_nop + gl_cv_func_isnanl_works="guessing no" +fi +rm -rf conftest* + ;; + *) gl_cv_func_isnanl_works="guessing yes" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#if (__GNUC__ >= 4) || (__clang_major__ >= 4) +# undef isnanl +# define isnanl(x) __builtin_isnan ((long double)(x)) +#elif defined isnan +# undef isnanl +# define isnanl(x) isnan ((long double)(x)) +#endif +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { unsigned int word[NWORDS]; long double value; } + memory_long_double; +/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the + runtime type conversion. */ +#ifdef __sgi +static long double NaNl () +{ + double zero = 0.0; + return zero / zero; +} +#else +# define NaNl() (0.0L / 0.0L) +#endif +int main () +{ + int result = 0; + if (!isnanl (NaNl ())) + result |= 1; - if test $gl_cv_have_include_next = yes; then - gl_cv_next_fcntl_h='<'fcntl.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_fcntl_h+:} false; then : - $as_echo_n "(cached) " >&6 -else + { + memory_long_double m; + unsigned int i; + /* The isnanl function should be immune against changes in the sign bit and + in the mantissa bits. The xor operation twiddles a bit that can only be + a sign bit or a mantissa bit (since the exponent never extends to + bit 31). */ + m.value = NaNl (); + m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); + for (i = 0; i < NWORDS; i++) + m.word[i] |= 1; + if (!isnanl (m.value)) + result |= 1; + } +#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE +/* Representation of an 80-bit 'long double' as an initializer for a sequence + of 'unsigned int' words. */ +# ifdef WORDS_BIGENDIAN +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ + ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \ + (unsigned int) (mantlo) << 16 \ + } +# else +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { mantlo, manthi, exponent } +# endif + { /* Quiet NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + if (!isnanl (x.value)) + result |= 2; + } + { + /* Signalling NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + if (!isnanl (x.value)) + result |= 2; + } + /* isnanl should return something even for noncanonical values. */ + { /* Pseudo-NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 4; + } + { /* Pseudo-Infinity. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 8; + } + { /* Pseudo-Zero. */ + static memory_long_double x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 16; + } + { /* Unnormalized number. */ + static memory_long_double x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 32; + } + { /* Pseudo-Denormal. */ + static memory_long_double x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 64; + } +#endif - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include + return result; +} _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'fcntl.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - - gl_cv_absolute_fcntl_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - - gl_header=$gl_cv_absolute_fcntl_h - gl_cv_next_fcntl_h='"'$gl_header'"' +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_isnanl_works=yes +else $as_nop + gl_cv_func_isnanl_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_fcntl_h" >&5 -$as_echo "$gl_cv_next_fcntl_h" >&6; } - fi - NEXT_FCNTL_H=$gl_cv_next_fcntl_h - - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'fcntl.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_fcntl_h - fi - NEXT_AS_FIRST_DIRECTIVE_FCNTL_H=$gl_next_as_first_directive +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_works" >&5 +printf "%s\n" "$gl_cv_func_isnanl_works" >&6; } + LIBS="$save_LIBS" + case "$gl_cv_func_isnanl_works" in + *yes) gl_func_isnanl=yes ;; + *) gl_func_isnanl=no; ISNANL_LIBM= ;; + esac + else + gl_func_isnanl=no + fi + if test $gl_func_isnanl != yes; then + HAVE_ISNANL=0 + fi + if test $HAVE_ISNANL = 0 || test $REPLACE_ISNAN = 1; then @@ -26584,302 +38061,396 @@ + gl_LIBOBJS="$gl_LIBOBJS isnanl.$ac_objext" -cat >>confdefs.h <<_ACEOF -#define GNULIB_FD_SAFER_FLAG 1 -_ACEOF + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'long double'" >&5 +printf %s "checking where to find the exponent in a 'long double'... " >&6; } +if test ${gl_cv_cc_long_double_expbit0+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : - FLOAT_H= - REPLACE_FLOAT_LDBL=0 - case "$host_os" in - aix* | beos* | openbsd* | mirbsd* | irix*) - FLOAT_H=float.h - ;; - freebsd* | dragonfly*) - case "$host_cpu" in - i[34567]86 ) - FLOAT_H=float.h - ;; - x86_64 ) - # On x86_64 systems, the C compiler may still be generating - # 32-bit code. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + gl_cv_cc_long_double_expbit0="unknown" + case "$host_os" in + mingw*) # On native Windows (little-endian), we know the result + # in two cases: mingw, MSVC. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if defined __LP64__ || defined __x86_64__ || defined __amd64__ - int ok; - #else - error fail - #endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +#ifdef __MINGW32__ + Known +#endif -else - FLOAT_H=float.h +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_cc_long_double_expbit0="word 2 bit 0" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - esac - ;; - linux*) - case "$host_cpu" in - powerpc*) - FLOAT_H=float.h - ;; - esac - ;; - esac - case "$host_os" in - aix* | freebsd* | dragonfly* | linux*) - if test -n "$FLOAT_H"; then - REPLACE_FLOAT_LDBL=1 - fi - ;; - esac - - REPLACE_ITOLD=0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether conversion from 'int' to 'long double' works" >&5 -$as_echo_n "checking whether conversion from 'int' to 'long double' works... " >&6; } -if ${gl_cv_func_itold_works+:} false; then : - $as_echo_n "(cached) " >&6 -else +rm -rf conftest* - if test "$cross_compiling" = yes; then : - case "$host" in - sparc*-*-linux*) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if defined __LP64__ || defined __arch64__ - int ok; - #else - error fail - #endif + +#ifdef _MSC_VER + Known +#endif _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_func_itold_works="guessing no" -else - gl_cv_func_itold_works="guessing yes" +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_cc_long_double_expbit0="word 1 bit 20" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_itold_works="guessing yes" ;; - *) gl_cv_func_itold_works="guessing yes" ;; - esac +rm -rf conftest* -else + ;; + esac + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -int i = -1; -volatile long double ld; +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { long double value; unsigned int word[NWORDS]; } + memory_long_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (long double *x) +{ + memory_long_double m; + size_t i; + /* Clear it first, in case + sizeof (long double) < sizeof (memory_long_double). */ + memset (&m, 0, sizeof (memory_long_double)); + m.value = *x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} int main () { - ld += i * 1.0L; - if (ld > 0) + static long double samples[5] = { 0.25L, 0.5L, 1.0L, 2.0L, 4.0L }; + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) return 1; - return 0; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + for (j = 0; j < 5; j++) + add_to_ored_words (&samples[j]); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); } + _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_itold_works=yes -else - gl_cv_func_itold_works=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_cc_long_double_expbit0=`cat conftest.out` +else $as_nop + gl_cv_cc_long_double_expbit0="unknown" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + rm -f conftest.out fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_itold_works" >&5 -$as_echo "$gl_cv_func_itold_works" >&6; } - case "$gl_cv_func_itold_works" in - *no) - REPLACE_ITOLD=1 - FLOAT_H=float.h - ;; - esac - - if test -n "$FLOAT_H"; then - - - - - - - - - if test $gl_cv_have_include_next = yes; then - gl_cv_next_float_h='<'float.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_float_h+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_long_double_expbit0" >&5 +printf "%s\n" "$gl_cv_cc_long_double_expbit0" >&6; } + case "$gl_cv_cc_long_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'` +printf "%s\n" "#define LDBL_EXPBIT0_WORD $word" >>confdefs.h - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac +printf "%s\n" "#define LDBL_EXPBIT0_BIT $bit" >>confdefs.h - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' ;; esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'float.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - - gl_cv_absolute_float_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - - gl_header=$gl_cv_absolute_float_h - gl_cv_next_float_h='"'$gl_header'"' - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_float_h" >&5 -$as_echo "$gl_cv_next_float_h" >&6; } - fi - NEXT_FLOAT_H=$gl_cv_next_float_h - - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'float.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_float_h - fi - NEXT_AS_FIRST_DIRECTIVE_FLOAT_H=$gl_next_as_first_directive + fi - fi - if test -n "$FLOAT_H"; then - GL_GENERATE_FLOAT_H_TRUE= - GL_GENERATE_FLOAT_H_FALSE='#' -else - GL_GENERATE_FLOAT_H_TRUE='#' - GL_GENERATE_FLOAT_H_FALSE= -fi - if test $REPLACE_FLOAT_LDBL = 1; then + GL_GNULIB_ISNANL=1 - gl_LIBOBJS="$gl_LIBOBJS float.$ac_objext" +printf "%s\n" "#define GNULIB_TEST_ISNANL 1" >>confdefs.h - fi - if test $REPLACE_ITOLD = 1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(long double) can be used without linking with libm" >&5 +printf %s "checking whether isnan(long double) can be used without linking with libm... " >&6; } +if test ${gl_cv_func_isnanl_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) + # undef isnanl + # define isnanl(x) __builtin_isnan ((long double)(x)) + #elif defined isnan + # undef isnanl + # define isnanl(x) isnan ((long double)(x)) + #endif + long double x; +int +main (void) +{ +return isnanl (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_isnanl_no_libm=yes +else $as_nop + gl_cv_func_isnanl_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_no_libm" >&5 +printf "%s\n" "$gl_cv_func_isnanl_no_libm" >&6; } + gl_func_isnanl_no_libm=$gl_cv_func_isnanl_no_libm + if test $gl_func_isnanl_no_libm = yes; then - gl_LIBOBJS="$gl_LIBOBJS itold.$ac_objext" - fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnanl works" >&5 +printf %s "checking whether isnanl works... " >&6; } +if test ${gl_cv_func_isnanl_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : case "$host_os" in - mingw* | pw*) - REPLACE_FOPEN=1 - gl_cv_func_fopen_slash="guessing no" - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fopen recognizes a trailing slash" >&5 -$as_echo_n "checking whether fopen recognizes a trailing slash... " >&6; } -if ${gl_cv_func_fopen_slash+:} false; then : - $as_echo_n "(cached) " >&6 -else + mingw*) # Guess yes on mingw, no on MSVC. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - if test "$cross_compiling" = yes; then : +#ifdef __MINGW32__ + Known +#endif - case "$host_os" in - aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) - gl_cv_func_fopen_slash="guessing no" ;; - *) - gl_cv_func_fopen_slash="guessing yes" ;; - esac +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_func_isnanl_works="guessing yes" +else $as_nop + gl_cv_func_isnanl_works="guessing no" +fi +rm -rf conftest* -else + ;; + *) gl_cv_func_isnanl_works="guessing yes" ;; + esac + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include +#include +#include +#include +#if (__GNUC__ >= 4) || (__clang_major__ >= 4) +# undef isnanl +# define isnanl(x) __builtin_isnan ((long double)(x)) +#elif defined isnan +# undef isnanl +# define isnanl(x) isnan ((long double)(x)) +#endif +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { unsigned int word[NWORDS]; long double value; } + memory_long_double; +/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the + runtime type conversion. */ +#ifdef __sgi +static long double NaNl () +{ + double zero = 0.0; + return zero / zero; +} +#else +# define NaNl() (0.0L / 0.0L) +#endif int main () { - FILE *fp = fopen ("conftest.sl/", "w"); - int result = (fp != NULL); - if (fp != NULL) - fclose (fp); + int result = 0; + + if (!isnanl (NaNl ())) + result |= 1; + + { + memory_long_double m; + unsigned int i; + + /* The isnanl function should be immune against changes in the sign bit and + in the mantissa bits. The xor operation twiddles a bit that can only be + a sign bit or a mantissa bit (since the exponent never extends to + bit 31). */ + m.value = NaNl (); + m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); + for (i = 0; i < NWORDS; i++) + m.word[i] |= 1; + if (!isnanl (m.value)) + result |= 1; + } + +#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE +/* Representation of an 80-bit 'long double' as an initializer for a sequence + of 'unsigned int' words. */ +# ifdef WORDS_BIGENDIAN +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ + ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \ + (unsigned int) (mantlo) << 16 \ + } +# else +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { mantlo, manthi, exponent } +# endif + { /* Quiet NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + if (!isnanl (x.value)) + result |= 2; + } + { + /* Signalling NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + if (!isnanl (x.value)) + result |= 2; + } + /* isnanl should return something even for noncanonical values. */ + { /* Pseudo-NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 4; + } + { /* Pseudo-Infinity. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 8; + } + { /* Pseudo-Zero. */ + static memory_long_double x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 16; + } + { /* Unnormalized number. */ + static memory_long_double x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 32; + } + { /* Pseudo-Denormal. */ + static memory_long_double x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + if (isnanl (x.value) && !isnanl (x.value)) + result |= 64; + } +#endif + return result; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_fopen_slash=yes -else - gl_cv_func_fopen_slash=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_isnanl_works=yes +else $as_nop + gl_cv_func_isnanl_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - rm -f conftest.sl fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fopen_slash" >&5 -$as_echo "$gl_cv_func_fopen_slash" >&6; } - ;; - esac - case "$gl_cv_func_fopen_slash" in - *no) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_works" >&5 +printf "%s\n" "$gl_cv_func_isnanl_works" >&6; } -$as_echo "#define FOPEN_TRAILING_SLASH_BUG 1" >>confdefs.h + case "$gl_cv_func_isnanl_works" in + *yes) ;; + *) gl_func_isnanl_no_libm=no ;; + esac + fi + if test $gl_func_isnanl_no_libm = yes; then - REPLACE_FOPEN=1 - ;; - esac +printf "%s\n" "#define HAVE_ISNANL_IN_LIBC 1" >>confdefs.h - if test $REPLACE_FOPEN = 1; then + fi + if test $gl_func_isnanl_no_libm != yes; then @@ -26887,95 +38458,196 @@ - gl_LIBOBJS="$gl_LIBOBJS fopen.$ac_objext" - : - fi + gl_LIBOBJS="$gl_LIBOBJS isnanl.$ac_objext" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'long double'" >&5 +printf %s "checking where to find the exponent in a 'long double'... " >&6; } +if test ${gl_cv_cc_long_double_expbit0+y} +then : + printf %s "(cached) " >&6 +else $as_nop - GNULIB_FOPEN=1 + if test "$cross_compiling" = yes +then : + gl_cv_cc_long_double_expbit0="unknown" + case "$host_os" in + mingw*) # On native Windows (little-endian), we know the result + # in two cases: mingw, MSVC. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __MINGW32__ + Known +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_cc_long_double_expbit0="word 2 bit 0" +fi +rm -rf conftest* + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -$as_echo "#define GNULIB_TEST_FOPEN 1" >>confdefs.h +#ifdef _MSC_VER + Known +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1 +then : + gl_cv_cc_long_double_expbit0="word 1 bit 20" +fi +rm -rf conftest* + ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { long double value; unsigned int word[NWORDS]; } + memory_long_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (long double *x) +{ + memory_long_double m; + size_t i; + /* Clear it first, in case + sizeof (long double) < sizeof (memory_long_double). */ + memset (&m, 0, sizeof (memory_long_double)); + m.value = *x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + static long double samples[5] = { 0.25L, 0.5L, 1.0L, 2.0L, 4.0L }; + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + for (j = 0; j < 5; j++) + add_to_ored_words (&samples[j]); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} -cat >>confdefs.h <<_ACEOF -#define GNULIB_FOPEN_SAFER 1 _ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_cc_long_double_expbit0=`cat conftest.out` +else $as_nop + gl_cv_cc_long_double_expbit0="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + rm -f conftest.out +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_long_double_expbit0" >&5 +printf "%s\n" "$gl_cv_cc_long_double_expbit0" >&6; } + case "$gl_cv_cc_long_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'` +printf "%s\n" "#define LDBL_EXPBIT0_WORD $word" >>confdefs.h - fp_headers=' - #include - #if HAVE_STDIO_EXT_H - # include - #endif - ' - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __fpending" >&5 -$as_echo_n "checking for __fpending... " >&6; } -if ${gl_cv_func___fpending+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$fp_headers -int -main () -{ -return ! __fpending (stdin); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func___fpending=yes -else - gl_cv_func___fpending=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +printf "%s\n" "#define LDBL_EXPBIT0_BIT $bit" >>confdefs.h + + ;; + esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func___fpending" >&5 -$as_echo "$gl_cv_func___fpending" >&6; } - if test $gl_cv_func___fpending = yes; then - ac_fn_c_check_decl "$LINENO" "__fpending" "ac_cv_have_decl___fpending" "$fp_headers -" -if test "x$ac_cv_have_decl___fpending" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL___FPENDING $ac_have_decl -_ACEOF fi - if test $gl_cv_func___fpending = no; then + ac_fn_check_decl "$LINENO" "iswblank" "ac_cv_have_decl_iswblank" " + #include + #include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_iswblank" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_ISWBLANK $ac_have_decl" >>confdefs.h + if test $ac_cv_func_iswblank = no; then + HAVE_ISWBLANK=0 + if test $ac_cv_have_decl_iswblank = yes; then + REPLACE_ISWBLANK=1 + fi + fi + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + : + else + if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then + : + fi + fi - gl_LIBOBJS="$gl_LIBOBJS fpending.$ac_objext" + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + : + else + if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then - fi @@ -26983,7 +38655,10 @@ + gl_LIBOBJS="$gl_LIBOBJS iswblank.$ac_objext" + fi + fi @@ -26991,218 +38666,294 @@ - gl_cv_func_fprintf_posix=no - case "$gl_cv_func_printf_sizes_c99" in - *yes) - case "$gl_cv_func_printf_long_double" in - *yes) - case "$gl_cv_func_printf_infinite" in - *yes) - case "$gl_cv_func_printf_infinite_long_double" in - *yes) - case "$gl_cv_func_printf_directive_a" in - *yes) - case "$gl_cv_func_printf_directive_f" in - *yes) - case "$gl_cv_func_printf_directive_n" in - *yes) - case "$gl_cv_func_printf_directive_ls" in - *yes) - case "$gl_cv_func_printf_positions" in - *yes) - case "$gl_cv_func_printf_flag_grouping" in - *yes) - case "$gl_cv_func_printf_flag_leftadjust" in - *yes) - case "$gl_cv_func_printf_flag_zero" in - *yes) - case "$gl_cv_func_printf_precision" in - *yes) - case "$gl_cv_func_printf_enomem" in - *yes) - # fprintf exists and is - # already POSIX compliant. - gl_cv_func_fprintf_posix=yes - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - if test $gl_cv_func_fprintf_posix = no; then + GL_GNULIB_ISWBLANK=1 - case "$gl_cv_func_printf_infinite" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h - ;; - esac + + +printf "%s\n" "#define GNULIB_TEST_ISWBLANK 1" >>confdefs.h + - case "$gl_cv_func_printf_long_double" in - *yes) - case "$gl_cv_func_printf_infinite_long_double" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h - ;; - esac - ;; - esac - case "$gl_cv_func_printf_directive_a" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + REPLACE_ISWDIGIT="$REPLACE_ISWCNTRL" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether iswdigit is ISO C compliant" >&5 +printf %s "checking whether iswdigit is ISO C compliant... " >&6; } +if test ${gl_cv_func_iswdigit_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + case "$host_os" in + # Guess no on FreeBSD, NetBSD, Solaris, native Windows. + freebsd* | dragonfly* | netbsd* | solaris* | mingw*) + gl_cv_func_iswdigit_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_iswdigit_works="guessing yes" ;; + esac + if test $LOCALE_FR != none || test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - for ac_func in nl_langinfo -do : - ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" -if test "x$ac_cv_func_nl_langinfo" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_NL_LANGINFO 1 -_ACEOF +#include +#include +#include +#include +#include -fi -done +/* Returns the value of iswdigit for the multibyte character s[0..n-1]. */ +static int +for_character (const char *s, size_t n) +{ + mbstate_t state; + wchar_t wc; + size_t ret; + + memset (&state, '\0', sizeof (mbstate_t)); + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, s, n, &state); + if (ret != n) + abort (); - ;; - esac + return iswdigit (wc); +} +int +main (int argc, char *argv[]) +{ + int is; + int result = 0; + if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) + { + /* This fails on mingw, MSVC 14. */ + /* U+00B2 SUPERSCRIPT TWO */ + is = for_character ("\262", 1); + if (!(is == 0)) + result |= 1; + } + if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) + { + /* This fails on NetBSD 8.0. */ + /* U+FF11 FULLWIDTH DIGIT ONE */ + is = for_character ("\243\261", 2); + if (!(is == 0)) + result |= 2; + } + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + /* This fails on FreeBSD 13.0, NetBSD 8.0, MSVC 14. */ + /* U+0663 ARABIC-INDIC DIGIT THREE */ + is = for_character ("\331\243", 2); + if (!(is == 0)) + result |= 4; + /* This fails on FreeBSD 13.0, NetBSD 8.0, MSVC 14. */ + /* U+FF11 FULLWIDTH DIGIT ONE */ + is = for_character ("\357\274\221", 3); + if (!(is == 0)) + result |= 8; + } + if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) + { + /* This fails on NetBSD 8.0, Solaris 10, Solaris 11.4. */ + /* U+FF11 FULLWIDTH DIGIT ONE */ + is = for_character ("\243\261", 2); + if (!(is == 0)) + result |= 16; + } + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_iswdigit_works=yes +else $as_nop + gl_cv_func_iswdigit_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - case "$gl_cv_func_printf_directive_f" in - *yes) - ;; - *) + fi -$as_echo "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_iswdigit_works" >&5 +printf "%s\n" "$gl_cv_func_iswdigit_works" >&6; } + case "$gl_cv_func_iswdigit_works" in + *yes) ;; + *) REPLACE_ISWDIGIT=1 ;; + esac + fi - ;; - esac + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + : + else + if test $REPLACE_ISWDIGIT = 1; then - case "$gl_cv_func_printf_directive_ls" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h - ;; - esac - case "$gl_cv_func_printf_flag_grouping" in - *yes) - ;; - *) + gl_LIBOBJS="$gl_LIBOBJS iswdigit.$ac_objext" -$as_echo "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h + fi + fi - ;; - esac - case "$gl_cv_func_printf_flag_leftadjust" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h - ;; - esac - case "$gl_cv_func_printf_flag_zero" in - *yes) - ;; - *) + GL_GNULIB_ISWDIGIT=1 -$as_echo "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h - ;; - esac - case "$gl_cv_func_printf_precision" in - *yes) - ;; - *) +printf "%s\n" "#define GNULIB_TEST_ISWDIGIT 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h - ;; - esac - case "$gl_cv_func_printf_enomem" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + REPLACE_ISWXDIGIT="$REPLACE_ISWCNTRL" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether iswxdigit is ISO C compliant" >&5 +printf %s "checking whether iswxdigit is ISO C compliant... " >&6; } +if test ${gl_cv_func_iswxdigit_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + case "$host_os" in + # Guess no on FreeBSD, NetBSD, Solaris, native Windows. + freebsd* | dragonfly* | netbsd* | solaris* | mingw*) + gl_cv_func_iswxdigit_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_iswxdigit_works="guessing yes" ;; + esac + if test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +#include -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +/* Returns the value of iswxdigit for the multibyte character s[0..n-1]. */ +static int +for_character (const char *s, size_t n) +{ + mbstate_t state; + wchar_t wc; + size_t ret; + + memset (&state, '\0', sizeof (mbstate_t)); + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, s, n, &state); + if (ret != n) + abort (); + return iswxdigit (wc); +} -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h +int +main (int argc, char *argv[]) +{ + int is; + int result = 0; - ;; - esac + if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) + { + /* This fails on NetBSD 8.0. */ + /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ + is = for_character ("\243\301", 2); + if (!(is == 0)) + result |= 1; + } + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + /* This fails on FreeBSD 13.0. */ + /* U+0663 ARABIC-INDIC DIGIT THREE */ + is = for_character ("\331\243", 2); + if (!(is == 0)) + result |= 2; + /* This fails on MSVC 14. */ + /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ + is = for_character ("\357\274\241", 3); + if (!(is == 0)) + result |= 4; + } + if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) + { + /* This fails on Solaris 10, Solaris 11.4. */ + /* U+FF11 FULLWIDTH DIGIT ONE */ + is = for_character ("\243\261", 2); + if (!(is == 0)) + result |= 8; + } + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_iswxdigit_works=yes +else $as_nop + gl_cv_func_iswxdigit_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_iswxdigit_works" >&5 +printf "%s\n" "$gl_cv_func_iswxdigit_works" >&6; } + case "$gl_cv_func_iswxdigit_works" in + *yes) ;; + *) REPLACE_ISWXDIGIT=1 ;; + esac + fi + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + : + else + if test $REPLACE_ISWXDIGIT = 1; then @@ -27211,8 +38962,10 @@ - gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext" + gl_LIBOBJS="$gl_LIBOBJS iswxdigit.$ac_objext" + fi + fi @@ -27221,18 +38974,22 @@ - gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext" + GL_GNULIB_ISWXDIGIT=1 +printf "%s\n" "#define GNULIB_TEST_ISWXDIGIT 1" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext" + # You need to invoke gt_JAVACOMP yourself, possibly with arguments. + ac_config_files="$ac_config_files javacomp.sh:build-aux/javacomp.sh.in" + # You need to invoke gt_JAVAEXEC yourself, possibly with arguments. + ac_config_files="$ac_config_files javaexec.sh:build-aux/javaexec.sh.in" @@ -27241,37 +38998,180 @@ - gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext" + ac_fn_check_decl "$LINENO" "ldexpl" "ac_cv_have_decl_ldexpl" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_ldexpl" = xyes +then : - if test $ac_cv_func_vasnprintf = yes; then +else $as_nop + HAVE_DECL_LDEXPL=0 +fi -$as_echo "#define REPLACE_VASNPRINTF 1" >>confdefs.h + LDEXPL_LIBM= + if test $HAVE_DECL_LDEXPL = 1; then - fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ldexpl() can be used without linking with libm" >&5 +printf %s "checking whether ldexpl() can be used without linking with libm... " >&6; } +if test ${gl_cv_func_ldexpl_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + long double x; +int +main (void) +{ +return ldexpl (x, -1) > 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_ldexpl_no_libm=yes +else $as_nop + gl_cv_func_ldexpl_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexpl_no_libm" >&5 +printf "%s\n" "$gl_cv_func_ldexpl_no_libm" >&6; } + if test $gl_cv_func_ldexpl_no_libm = no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ldexpl() can be used with libm" >&5 +printf %s "checking whether ldexpl() can be used with libm... " >&6; } +if test ${gl_cv_func_ldexpl_in_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + long double x; +int +main (void) +{ +return ldexpl (x, -1) > 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_ldexpl_in_libm=yes +else $as_nop + gl_cv_func_ldexpl_in_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$save_LIBS" +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexpl_in_libm" >&5 +printf "%s\n" "$gl_cv_func_ldexpl_in_libm" >&6; } + if test $gl_cv_func_ldexpl_in_libm = yes; then + LDEXPL_LIBM=-lm + fi + fi + if test $gl_cv_func_ldexpl_no_libm = yes \ + || test $gl_cv_func_ldexpl_in_libm = yes; then + save_LIBS="$LIBS" + LIBS="$LIBS $LDEXPL_LIBM" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ldexpl works" >&5 +printf %s "checking whether ldexpl works... " >&6; } +if test ${gl_cv_func_ldexpl_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : - ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" -if test "x$ac_cv_type_ptrdiff_t" = xyes; then : + case "$host_os" in + aix | aix[3-6]*) gl_cv_func_ldexpl_works="guessing no" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_ldexpl_works="guessing yes" ;; + *) gl_cv_func_ldexpl_works="guessing yes" ;; + esac -else +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -$as_echo "#define ptrdiff_t long" >>confdefs.h +#include +extern +#ifdef __cplusplus +"C" +#endif +long double ldexpl (long double, int); +int main() +{ + int result = 0; + { + volatile long double x = 1.0; + volatile long double y = ldexpl (x, -1); + if (y != 0.5L) + result |= 1; + } + { + volatile long double x = 1.73205L; + volatile long double y = ldexpl (x, 0); + if (y != x) + result |= 2; + } + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_ldexpl_works=yes +else $as_nop + gl_cv_func_ldexpl_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexpl_works" >&5 +printf "%s\n" "$gl_cv_func_ldexpl_works" >&6; } + LIBS="$save_LIBS" + case "$gl_cv_func_ldexpl_works" in + *yes) gl_func_ldexpl=yes ;; + *) gl_func_ldexpl=no; REPLACE_LDEXPL=1 ;; + esac + else + gl_func_ldexpl=no + fi + if test $gl_func_ldexpl = yes; then +printf "%s\n" "#define HAVE_LDEXPL 1" >>confdefs.h + fi + fi + if test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; then + if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then + LDEXPL_LIBM="$LDEXP_LIBM" + else + LDEXPL_LIBM="$ISNANL_LIBM" + fi + fi + if test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; then @@ -27280,355 +39180,345 @@ + gl_LIBOBJS="$gl_LIBOBJS ldexpl.$ac_objext" + fi - gl_LIBOBJS="$gl_LIBOBJS fprintf.$ac_objext" - REPLACE_FPRINTF=1 -$as_echo "#define REPLACE_FPRINTF_POSIX 1" >>confdefs.h - : - fi + GL_GNULIB_LDEXPL=1 - GNULIB_FPRINTF_POSIX=1 +printf "%s\n" "#define GNULIB_TEST_LDEXPL 1" >>confdefs.h -$as_echo "#define GNULIB_TEST_FPRINTF_POSIX 1" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the __inline keyword" >&5 +printf %s "checking whether the compiler supports the __inline keyword... " >&6; } +if test ${gl_cv_c___inline+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +typedef int foo_t; + static __inline foo_t foo (void) { return 0; } +int +main (void) +{ +return foo (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_c___inline=yes +else $as_nop + gl_cv_c___inline=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c___inline" >&5 +printf "%s\n" "$gl_cv_c___inline" >&6; } + if test $gl_cv_c___inline = yes; then +printf "%s\n" "#define HAVE___INLINE 1" >>confdefs.h + fi + # You need to invoke gl_LIBTEXTSTYLE yourself, possibly with arguments. + # You need to invoke gl_LIBTEXTSTYLE_OPTIONAL yourself, possibly with arguments. - if test $gl_cv_func_frexp_no_libm = yes; then + LOCALCHARSET_TESTS_ENVIRONMENT= - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexp works" >&5 -$as_echo_n "checking whether frexp works... " >&6; } -if ${gl_cv_func_frexp_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - netbsd* | irix*) gl_cv_func_frexp_works="guessing no" ;; - mingw*) # Guess yes with MSVC, no with mingw. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef _MSC_VER - Good -#endif + if test "$gl_threads_api" = posix; then + # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the + # pthread_rwlock_* functions. + has_rwlock=false + ac_fn_c_check_type "$LINENO" "pthread_rwlock_t" "ac_cv_type_pthread_rwlock_t" "#include +" +if test "x$ac_cv_type_pthread_rwlock_t" = xyes +then : + has_rwlock=true + +printf "%s\n" "#define HAVE_PTHREAD_RWLOCK 1" >>confdefs.h -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Good" >/dev/null 2>&1; then : - gl_cv_func_frexp_works="guessing yes" -else - gl_cv_func_frexp_works="guessing no" fi -rm -f conftest* - ;; - *) gl_cv_func_frexp_works="guessing yes" ;; + if $has_rwlock; then + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthread_rwlock_rdlock prefers a writer to a reader" >&5 +printf %s "checking whether pthread_rwlock_rdlock prefers a writer to a reader... " >&6; } +if test ${gl_cv_pthread_rwlock_rdlock_prefer_writer+y} +then : + printf %s "(cached) " >&6 +else $as_nop + save_LIBS="$LIBS" + LIBS="$LIBS $LIBMULTITHREAD" + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess no on musl systems. + *-musl*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess no on bionic systems. + *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess yes on native Windows with the mingw-w64 winpthreads library. + # Guess no on native Windows with the gnulib windows-rwlock module. + mingw*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then + gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" + else + gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" + fi + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; esac -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include -#if HAVE_DECL_ALARM -# include -# include -#endif -/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. - ICC 10.0 has a bug when optimizing the expression -zero. - The expression -DBL_MIN * DBL_MIN does not work when cross-compiling - to PowerPC on Mac OS X 10.5. */ -#if defined __hpux || defined __sgi || defined __ICC -static double -compute_minus_zero (void) +#include +#include +#include +#include + +#define SUCCEED() exit (0) +#define FAILURE() exit (1) +#define UNEXPECTED(n) (exit (10 + (n))) + +/* The main thread creates the waiting writer and the requesting reader threads + in the default way; this guarantees that they have the same priority. + We can reuse the main thread as first reader thread. */ + +static pthread_rwlock_t lock; +static pthread_t reader1; +static pthread_t writer; +static pthread_t reader2; +static pthread_t timer; +/* Used to pass control from writer to reader2 and from reader2 to timer, + as in a relay race. + Passing control from one running thread to another running thread + is most likely faster than to create the second thread. */ +static pthread_mutex_t baton; + +static void * +timer_func (void *ignored) { - return -DBL_MIN * DBL_MIN; + /* Step 13 (can be before or after step 12): + The timer thread takes the baton, then waits a moment to make sure + it can tell whether the second reader thread is blocked at step 12. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (13); + usleep (100000); + /* By the time we get here, it's clear that the second reader thread is + blocked at step 12. This is the desired behaviour. */ + SUCCEED (); } -# define minus_zero compute_minus_zero () -#else -double minus_zero = -0.0; -#endif -int main() + +static void * +reader2_func (void *ignored) { - int result = 0; - int i; - volatile double x; - double zero = 0.0; -#if HAVE_DECL_ALARM - /* NeXTstep 3.3 frexp() runs into an endless loop when called on an infinite - number. Let the test fail in this case. */ - signal (SIGALRM, SIG_DFL); - alarm (5); -#endif - /* Test on denormalized numbers. */ - for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) - ; - if (x > 0.0) - { - int exp; - double y = frexp (x, &exp); - /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022. - On NetBSD: y = 0.75. Correct: y = 0.5. */ - if (y != 0.5) - result |= 1; - } - /* Test on infinite numbers. */ - x = 1.0 / zero; - { - int exp; - double y = frexp (x, &exp); - if (y != x) - result |= 2; - } - /* Test on negative zero. */ - x = minus_zero; - { - int exp; - double y = frexp (x, &exp); - if (memcmp (&y, &x, sizeof x)) - result |= 4; - } - return result; + int err; + + /* Step 8 (can be before or after step 7): + The second reader thread takes the baton, then waits a moment to make sure + the writer thread has reached step 7. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (8); + usleep (100000); + /* Step 9: The second reader thread requests the lock. */ + err = pthread_rwlock_tryrdlock (&lock); + if (err == 0) + FAILURE (); + else if (err != EBUSY) + UNEXPECTED (9); + /* Step 10: Launch a timer, to test whether the next call blocks. */ + if (pthread_create (&timer, NULL, timer_func, NULL)) + UNEXPECTED (10); + /* Step 11: Release the baton. */ + if (pthread_mutex_unlock (&baton)) + UNEXPECTED (11); + /* Step 12: The second reader thread requests the lock. */ + err = pthread_rwlock_rdlock (&lock); + if (err == 0) + FAILURE (); + else + UNEXPECTED (12); +} + +static void * +writer_func (void *ignored) +{ + /* Step 4: Take the baton, so that the second reader thread does not go ahead + too early. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (4); + /* Step 5: Create the second reader thread. */ + if (pthread_create (&reader2, NULL, reader2_func, NULL)) + UNEXPECTED (5); + /* Step 6: Release the baton. */ + if (pthread_mutex_unlock (&baton)) + UNEXPECTED (6); + /* Step 7: The writer thread requests the lock. */ + if (pthread_rwlock_wrlock (&lock)) + UNEXPECTED (7); + return NULL; +} + +int +main () +{ + reader1 = pthread_self (); + + /* Step 1: The main thread initializes the lock and the baton. */ + if (pthread_rwlock_init (&lock, NULL)) + UNEXPECTED (1); + if (pthread_mutex_init (&baton, NULL)) + UNEXPECTED (1); + /* Step 2: The main thread acquires the lock as a reader. */ + if (pthread_rwlock_rdlock (&lock)) + UNEXPECTED (2); + /* Step 3: Create the writer thread. */ + if (pthread_create (&writer, NULL, writer_func, NULL)) + UNEXPECTED (3); + /* Job done. Go to sleep. */ + for (;;) + { + sleep (1); + } } + _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_frexp_works=yes -else - gl_cv_func_frexp_works=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_pthread_rwlock_rdlock_prefer_writer=yes +else $as_nop + gl_cv_pthread_rwlock_rdlock_prefer_writer=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + LIBS="$save_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexp_works" >&5 -$as_echo "$gl_cv_func_frexp_works" >&6; } - - case "$gl_cv_func_frexp_works" in - *yes) gl_func_frexp_no_libm=yes ;; - *) gl_func_frexp_no_libm=no; REPLACE_FREXP=1 ;; - esac - else - gl_func_frexp_no_libm=no - REPLACE_FREXP=1 - fi - if test $gl_func_frexp_no_libm = yes; then - -$as_echo "#define HAVE_FREXP_IN_LIBC 1" >>confdefs.h - - fi - - if test $gl_func_frexp_no_libm != yes; then - +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_pthread_rwlock_rdlock_prefer_writer" >&5 +printf "%s\n" "$gl_cv_pthread_rwlock_rdlock_prefer_writer" >&6; } + case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in + *yes) +printf "%s\n" "#define HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER 1" >>confdefs.h + ;; + esac + fi + # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include +int +main (void) +{ +#if __FreeBSD__ == 4 +error "No, in FreeBSD 4.0 recursive mutexes actually don't work." +#elif (defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ \ + && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) +error "No, in Mac OS X < 10.7 recursive mutexes actually don't work." +#else +int x = (int)PTHREAD_MUTEX_RECURSIVE; +return !x; +#endif + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : - gl_LIBOBJS="$gl_LIBOBJS frexp.$ac_objext" +printf "%s\n" "#define HAVE_PTHREAD_MUTEX_RECURSIVE 1" >>confdefs.h +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi + : - - - GNULIB_FREXP=1 - - - - - -$as_echo "#define GNULIB_TEST_FREXP 1" >>confdefs.h +printf "%s\n" "#define GNULIB_LOCK 1" >>confdefs.h - ac_fn_c_check_decl "$LINENO" "frexpl" "ac_cv_have_decl_frexpl" "#include -" -if test "x$ac_cv_have_decl_frexpl" = xyes; then : -else - HAVE_DECL_FREXPL=0 -fi - if test $HAVE_DECL_FREXPL = 1; then + if test $REPLACE_MALLOC = 0; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexpl() can be used without linking with libm" >&5 -$as_echo_n "checking whether frexpl() can be used without linking with libm... " >&6; } -if ${gl_cv_func_frexpl_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether malloc (0) returns nonnull" >&5 +printf %s "checking whether malloc (0) returns nonnull... " >&6; } +if test ${ac_cv_func_malloc_0_nonnull+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | gnu* | *-musl* | midnightbsd* \ + | hpux* | solaris* | cygwin* | mingw* | msys* ) + ac_cv_func_malloc_0_nonnull="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; + esac - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - long double x; +#include + int -main () +main (void) { -int e; return frexpl (x, &e) > 0; +void *p = malloc (0); + int result = !p; + free (p); + return result; ; return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_frexpl_no_libm=yes -else - gl_cv_func_frexpl_no_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_no_libm" >&5 -$as_echo "$gl_cv_func_frexpl_no_libm" >&6; } - - if test $gl_cv_func_frexpl_no_libm = yes; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexpl works" >&5 -$as_echo_n "checking whether frexpl works... " >&6; } -if ${gl_cv_func_frexpl_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test "$cross_compiling" = yes; then : - - case "$host_os" in - aix | aix[3-6]* | beos* | darwin* | irix* | mingw* | pw*) - gl_cv_func_frexpl_works="guessing no";; - *) gl_cv_func_frexpl_works="guessing yes";; - esac - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -/* Override the values of , like done in float.in.h. */ -#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP (-16381) -#endif -#if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__) -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP (-16381) -#endif -#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__ -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP DBL_MIN_EXP -#endif -#if defined __sgi && (LDBL_MANT_DIG >= 106) -# if defined __GNUC__ -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP DBL_MIN_EXP -# endif -#endif -extern -#ifdef __cplusplus -"C" -#endif -long double frexpl (long double, int *); -int main() -{ - int result = 0; - volatile long double x; - /* Test on finite numbers that fails on AIX 5.1. */ - x = 16.0L; - { - int exp = -9999; - frexpl (x, &exp); - if (exp != 5) - result |= 1; - } - /* Test on finite numbers that fails on Mac OS X 10.4, because its frexpl - function returns an invalid (incorrectly normalized) value: it returns - y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } - but the correct result is - 0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 } */ - x = 1.01L; - { - int exp = -9999; - long double y = frexpl (x, &exp); - if (!(exp == 1 && y == 0.505L)) - result |= 2; - } - /* Test on large finite numbers. This fails on BeOS at i = 16322, while - LDBL_MAX_EXP = 16384. - In the loop end test, we test x against Infinity, rather than comparing - i with LDBL_MAX_EXP, because BeOS has a wrong LDBL_MAX_EXP. */ - { - int i; - for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L) - { - int exp = -9999; - frexpl (x, &exp); - if (exp != i) - { - result |= 4; - break; - } - } - } - /* Test on denormalized numbers. */ - { - int i; - for (i = 1, x = 1.0L; i >= LDBL_MIN_EXP; i--, x *= 0.5L) - ; - if (x > 0.0L) - { - int exp; - long double y = frexpl (x, &exp); - /* On machines with IEEE854 arithmetic: x = 1.68105e-4932, - exp = -16382, y = 0.5. On Mac OS X 10.5: exp = -16384, y = 0.5. */ - if (exp != LDBL_MIN_EXP - 1) - result |= 8; - } - } - /* Test on infinite numbers. */ - x = 1.0L / 0.0L; - { - int exp; - long double y = frexpl (x, &exp); - if (y != x) - result |= 16; - } - return result; -} _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_frexpl_works=yes -else - gl_cv_func_frexpl_works=no +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_func_malloc_0_nonnull=yes +else $as_nop + ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -27636,59 +39526,31 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_works" >&5 -$as_echo "$gl_cv_func_frexpl_works" >&6; } - - case "$gl_cv_func_frexpl_works" in - *yes) gl_func_frexpl_no_libm=yes ;; - *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; - esac - else - gl_func_frexpl_no_libm=no - REPLACE_FREXPL=1 - fi - if test $gl_func_frexpl_no_libm = yes; then - -$as_echo "#define HAVE_FREXPL_IN_LIBC 1" >>confdefs.h - - fi - fi - - if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no; then - - - - - - - - - gl_LIBOBJS="$gl_LIBOBJS frexpl.$ac_objext" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 +printf "%s\n" "$ac_cv_func_malloc_0_nonnull" >&6; } + case $ac_cv_func_malloc_0_nonnull in #( + *yes) : + ;; #( + *) : + REPLACE_MALLOC=1 ;; +esac fi + if test $REPLACE_MALLOC = 1; then - GNULIB_FREXPL=1 - - - - - -$as_echo "#define GNULIB_TEST_FREXPL 1" >>confdefs.h - + gl_LIBOBJS="$gl_LIBOBJS malloc.$ac_objext" - if test $ac_cv_func_fsync = no; then - HAVE_FSYNC=0 fi - if test $HAVE_FSYNC = 0; then + if test $REPLACE_MALLOC = 1; then @@ -27697,84 +39559,40 @@ - gl_LIBOBJS="$gl_LIBOBJS fsync.$ac_objext" + gl_LIBOBJS="$gl_LIBOBJS malloc.$ac_objext" - : fi - GNULIB_FSYNC=1 + GL_GNULIB_MALLOC_POSIX=1 -$as_echo "#define GNULIB_TEST_FSYNC 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_MALLOC_POSIX 1" >>confdefs.h - ac_fn_c_check_decl "$LINENO" "gethrtime" "ac_cv_have_decl_gethrtime" "#include -" -if test "x$ac_cv_have_decl_gethrtime" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETHRTIME $ac_have_decl -_ACEOF - LIB_GETHRXTIME= - if test $ac_cv_have_decl_gethrtime = no \ - || test $gl_cv_arithmetic_hrtime_t = no; then - if test $ac_cv_func_nanouptime != yes \ - && { test $ac_cv_have_decl_gethrtime = no \ - || test $gl_cv_arithmetic_hrtime_t = no; }; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CLOCK_MONOTONIC or CLOCK_REALTIME is defined" >&5 -$as_echo_n "checking whether CLOCK_MONOTONIC or CLOCK_REALTIME is defined... " >&6; } -if ${gl_cv_have_clock_gettime_macro+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -# include -# if defined CLOCK_MONOTONIC || defined CLOCK_REALTIME - have_clock_gettime_macro -# endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "have_clock_gettime_macro" >/dev/null 2>&1; then : - gl_cv_have_clock_gettime_macro=yes -else - gl_cv_have_clock_gettime_macro=no -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_clock_gettime_macro" >&5 -$as_echo "$gl_cv_have_clock_gettime_macro" >&6; } - if test $gl_cv_have_clock_gettime_macro = yes; then - LIB_GETHRXTIME=$LIB_CLOCK_GETTIME - fi - fi - fi + : @@ -27782,677 +39600,1113 @@ - REPLACE_GETOPT=0 - if test -n "$gl_replace_getopt"; then - REPLACE_GETOPT=1 - fi - if test $REPLACE_GETOPT = 1; then - if test $ac_cv_header_sys_cdefs_h = yes; then - HAVE_SYS_CDEFS_H=1 - else - HAVE_SYS_CDEFS_H=0 - fi -$as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h - GETOPT_H=getopt.h - GETOPT_CDEFS_H=getopt-cdefs.h + if case "$host_os" in + mingw*) true ;; + *) test $ac_cv_func_mbsinit = yes ;; + esac \ + && test $ac_cv_func_mbrtowc = yes; then - fi - if test $REPLACE_GETOPT = 1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles incomplete characters" >&5 +printf %s "checking whether mbrtowc handles incomplete characters... " >&6; } +if test ${gl_cv_func_mbrtowc_incomplete_state+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + # Guess no on AIX and OSF/1. + aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; + esac + if test $LOCALE_JA != none; then + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +int main () +{ + if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) + { + const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + if (mbsinit (&state)) + return 2; + } + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_mbrtowc_incomplete_state=yes +else $as_nop + gl_cv_func_mbrtowc_incomplete_state=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + else + if test $LOCALE_FR_UTF8 != none; then + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +int main () +{ + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + const char input[] = "B\303\274\303\237er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + if (mbsinit (&state)) + return 2; + } + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_mbrtowc_incomplete_state=yes +else $as_nop + gl_cv_func_mbrtowc_incomplete_state=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + fi + fi - gl_LIBOBJS="$gl_LIBOBJS getopt.$ac_objext" +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_incomplete_state" >&5 +printf "%s\n" "$gl_cv_func_mbrtowc_incomplete_state" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc works as well as mbtowc" >&5 +printf %s "checking whether mbrtowc works as well as mbtowc... " >&6; } +if test ${gl_cv_func_mbrtowc_sanitycheck+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + # Guess no on Solaris 8. + solaris2.8) gl_cv_func_mbrtowc_sanitycheck="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_mbrtowc_sanitycheck="guessing yes" ;; + esac + if test $LOCALE_ZH_CN != none; then + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +int main () +{ + /* This fails on Solaris 8: + mbrtowc returns 2, and sets wc to 0x00F0. + mbtowc returns 4 (correct) and sets wc to 0x5EDC. */ + if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) + { + char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 3, 6, &state) != 4 + && mbtowc (&wc, input + 3, 6) == 4) + return 2; + } + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_mbrtowc_sanitycheck=yes +else $as_nop + gl_cv_func_mbrtowc_sanitycheck=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + fi - gl_LIBOBJS="$gl_LIBOBJS getopt1.$ac_objext" +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_sanitycheck" >&5 +printf "%s\n" "$gl_cv_func_mbrtowc_sanitycheck" >&6; } - GNULIB_GL_UNISTD_H_GETOPT=1 + REPLACE_MBSTATE_T=0 + case "$gl_cv_func_mbrtowc_incomplete_state" in + *yes) ;; + *) REPLACE_MBSTATE_T=1 ;; + esac + case "$gl_cv_func_mbrtowc_sanitycheck" in + *yes) ;; + *) REPLACE_MBSTATE_T=1 ;; + esac + else + REPLACE_MBSTATE_T=1 fi + if test $ac_cv_func_mbrtowc = no; then + HAVE_MBRTOWC=0 + ac_fn_check_decl "$LINENO" "mbrtowc" "ac_cv_have_decl_mbrtowc" " + #include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_mbrtowc" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_MBRTOWC $ac_have_decl" >>confdefs.h + if test $ac_cv_have_decl_mbrtowc = yes; then + REPLACE_MBRTOWC=1 + fi + else + if test $REPLACE_MBSTATE_T = 1; then + REPLACE_MBRTOWC=1 + else - GNULIB_GETOPT_POSIX=1 - - - - - -$as_echo "#define GNULIB_TEST_GETOPT_POSIX 1" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles a NULL pwc argument" >&5 +printf %s "checking whether mbrtowc handles a NULL pwc argument... " >&6; } +if test ${gl_cv_func_mbrtowc_null_arg1+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + # Guess no on Solaris. + solaris*) gl_cv_func_mbrtowc_null_arg1="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; + esac + if test $LOCALE_FR_UTF8 != none; then + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +int main () +{ + int result = 0; + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + char input[] = "\303\237er"; + mbstate_t state; + wchar_t wc; + size_t ret; - ac_found=0 - ac_fn_c_check_decl "$LINENO" "program_invocation_name" "ac_cv_have_decl_program_invocation_name" "#include -" -if test "x$ac_cv_have_decl_program_invocation_name" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi + memset (&state, '\0', sizeof (mbstate_t)); + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input, 5, &state); + if (ret != 2) + result |= 1; + if (!mbsinit (&state)) + result |= 2; -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_PROGRAM_INVOCATION_NAME $ac_have_decl + memset (&state, '\0', sizeof (mbstate_t)); + ret = mbrtowc (NULL, input, 5, &state); + if (ret != 2) /* Solaris 7 fails here: ret is -1. */ + result |= 4; + if (!mbsinit (&state)) + result |= 8; + } + return result; +} _ACEOF -if test $ac_have_decl = 1; then : - ac_found=1 +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_mbrtowc_null_arg1=yes +else $as_nop + gl_cv_func_mbrtowc_null_arg1=no fi - - ac_fn_c_check_decl "$LINENO" "program_invocation_short_name" "ac_cv_have_decl_program_invocation_short_name" "#include -" -if test "x$ac_cv_have_decl_program_invocation_short_name" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : - ac_found=1 -fi + fi - ac_fn_c_check_decl "$LINENO" "__argv" "ac_cv_have_decl___argv" "#include -" -if test "x$ac_cv_have_decl___argv" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_null_arg1" >&5 +printf "%s\n" "$gl_cv_func_mbrtowc_null_arg1" >&6; } -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL___ARGV $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : - ac_found=1 -fi - # Incur the cost of this test only if none of the above worked. - if test $ac_found = 0; then - # On OpenBSD 5.1, using the global __progname variable appears to be - # the only way to implement getprogname. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __progname is defined in default libraries" >&5 -$as_echo_n "checking whether __progname is defined in default libraries... " >&6; } -if ${gl_cv_var___progname+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_var___progname= - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles a NULL string argument" >&5 +printf %s "checking whether mbrtowc handles a NULL string argument... " >&6; } +if test ${gl_cv_func_mbrtowc_null_arg2+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + case "$host_os" in + # Guess no on OSF/1. + osf*) gl_cv_func_mbrtowc_null_arg2="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;; + esac + if test $LOCALE_FR_UTF8 != none; then + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern char *__progname; -int -main () + +#include +#include +#include +int main () { -return *__progname; + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + mbstate_t state; + wchar_t wc; + int ret; - ; + memset (&state, '\0', sizeof (mbstate_t)); + wc = (wchar_t) 0xBADFACE; + mbrtowc (&wc, NULL, 5, &state); + /* Check that wc was not modified. */ + if (wc != (wchar_t) 0xBADFACE) + return 2; + } return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_var___progname=yes - +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_mbrtowc_null_arg2=yes +else $as_nop + gl_cv_func_mbrtowc_null_arg2=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_var___progname" >&5 -$as_echo "$gl_cv_var___progname" >&6; } - if test "$gl_cv_var___progname" = yes; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_null_arg2" >&5 +printf "%s\n" "$gl_cv_func_mbrtowc_null_arg2" >&6; } -$as_echo "#define HAVE_VAR___PROGNAME 1" >>confdefs.h - fi - fi - if test $ac_cv_func_getrusage = no; then - HAVE_GETRUSAGE=0 - fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc has a correct return value" >&5 +printf %s "checking whether mbrtowc has a correct return value... " >&6; } +if test ${gl_cv_func_mbrtowc_retval+y} +then : + printf %s "(cached) " >&6 +else $as_nop - if test $HAVE_GETRUSAGE = 0; then + case "$host_os" in + # Guess no on HP-UX, Solaris, native Windows. + hpux* | solaris* | mingw*) gl_cv_func_mbrtowc_retval="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_mbrtowc_retval="guessing yes" ;; + esac + if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ + || { case "$host_os" in mingw*) true;; *) false;; esac; }; then + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +int main () +{ + int result = 0; + int found_some_locale = 0; + /* This fails on Solaris. */ + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + char input[] = "B\303\274\303\237er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + { + input[1] = '\0'; + if (mbrtowc (&wc, input + 2, 5, &state) != 1) + result |= 1; + } + found_some_locale = 1; + } + /* This fails on HP-UX 11.11. */ + if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) + { + char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + { + input[1] = '\0'; + if (mbrtowc (&wc, input + 2, 5, &state) != 2) + result |= 2; + } + found_some_locale = 1; + } + /* This fails on native Windows. */ + if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) + { + char input[] = "<\223\372\226\173\214\352>"; /* "<日本語>" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) + { + input[3] = '\0'; + if (mbrtowc (&wc, input + 4, 4, &state) != 1) + result |= 4; + } + found_some_locale = 1; + } + if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) + { + char input[] = "<\244\351\245\273\273\171>"; /* "<日本語>" */ + mbstate_t state; + wchar_t wc; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) + { + input[3] = '\0'; + if (mbrtowc (&wc, input + 4, 4, &state) != 1) + result |= 8; + } + found_some_locale = 1; + } + if (setlocale (LC_ALL, "Chinese_China.936") != NULL) + { + char input[] = "<\310\325\261\276\325\132>"; /* "<日本語>" */ + mbstate_t state; + wchar_t wc; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) + { + input[3] = '\0'; + if (mbrtowc (&wc, input + 4, 4, &state) != 1) + result |= 16; + } + found_some_locale = 1; + } + return (found_some_locale ? result : 77); +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_mbrtowc_retval=yes +else $as_nop + if test $? != 77; then + gl_cv_func_mbrtowc_retval=no + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_retval" >&5 +printf "%s\n" "$gl_cv_func_mbrtowc_retval" >&6; } - gl_LIBOBJS="$gl_LIBOBJS getrusage.$ac_objext" - fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc returns 0 when parsing a NUL character" >&5 +printf %s "checking whether mbrtowc returns 0 when parsing a NUL character... " >&6; } +if test ${gl_cv_func_mbrtowc_nul_retval+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + # Guess no on Solaris 8 and 9. + solaris2.[89]) gl_cv_func_mbrtowc_nul_retval="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_mbrtowc_nul_retval="guessing yes" ;; + esac + if test $LOCALE_ZH_CN != none; then + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +int main () +{ + /* This fails on Solaris 8 and 9. */ + if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) + { + mbstate_t state; + wchar_t wc; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "", 1, &state) != 0) + return 2; + } + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_mbrtowc_nul_retval=yes +else $as_nop + gl_cv_func_mbrtowc_nul_retval=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + fi - GNULIB_GETRUSAGE=1 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_nul_retval" >&5 +printf "%s\n" "$gl_cv_func_mbrtowc_nul_retval" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc stores incomplete characters" >&5 +printf %s "checking whether mbrtowc stores incomplete characters... " >&6; } +if test ${gl_cv_func_mbrtowc_stores_incomplete+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + # Guess yes on native Windows. + mingw*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;; + *) gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;; + esac + case "$host_os" in + mingw*) + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -$as_echo "#define GNULIB_TEST_GETRUSAGE 1" >>confdefs.h +#include +#include +#include +int main () +{ + int result = 0; + if (setlocale (LC_ALL, "French_France.65001") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + result |= 1; + } + if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\226", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + result |= 2; + } + if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\245", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + result |= 4; + } + if (setlocale (LC_ALL, "Chinese_China.936") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\261", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + result |= 8; + } + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_mbrtowc_stores_incomplete=no +else $as_nop + gl_cv_func_mbrtowc_stores_incomplete=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + ;; + *) + if test $LOCALE_FR_UTF8 != none; then + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +int main () +{ + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + return 1; + } + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_mbrtowc_stores_incomplete=no +else $as_nop + gl_cv_func_mbrtowc_stores_incomplete=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + fi + ;; + esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_stores_incomplete" >&5 +printf "%s\n" "$gl_cv_func_mbrtowc_stores_incomplete" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc works on empty input" >&5 +printf %s "checking whether mbrtowc works on empty input... " >&6; } +if test ${gl_cv_func_mbrtowc_empty_input+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + # Guess no on AIX and glibc systems. + aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; + *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; + esac + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include + static wchar_t wc; + static mbstate_t mbs; + int + main (void) + { + return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2; + } +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_mbrtowc_empty_input=yes +else $as_nop + gl_cv_func_mbrtowc_empty_input=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - gl_gettimeofday_timezone=void - if test $ac_cv_func_gettimeofday != yes; then - HAVE_GETTIMEOFDAY=0 - else +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_empty_input" >&5 +printf "%s\n" "$gl_cv_func_mbrtowc_empty_input" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C locale is free of encoding errors" >&5 +printf %s "checking whether the C locale is free of encoding errors... " >&6; } +if test ${gl_cv_func_mbrtowc_C_locale_sans_EILSEQ+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gettimeofday clobbers localtime buffer" >&5 -$as_echo_n "checking whether gettimeofday clobbers localtime buffer... " >&6; } -if ${gl_cv_func_gettimeofday_clobber+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - # When cross-compiling: - case "$host_os" in - # Guess all is fine on glibc systems. - *-gnu* | gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;; - # Guess all is fine on musl systems. - *-musl*) gl_cv_func_gettimeofday_clobber="guessing no" ;; - # Guess no on native Windows. - mingw*) gl_cv_func_gettimeofday_clobber="guessing no" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_gettimeofday_clobber="$gl_cross_guess_inverted" ;; - esac + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on native Windows. + mingw*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; + esac -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #include - #include - #include +#include + #include + #include int -main () +main (void) { - time_t t = 0; - struct tm *lt; - struct tm saved_lt; - struct timeval tv; - lt = localtime (&t); - saved_lt = *lt; - gettimeofday (&tv, NULL); - return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0; + int i; + char *locale = setlocale (LC_ALL, "C"); + if (! locale) + return 2; + for (i = CHAR_MIN; i <= CHAR_MAX; i++) + { + char c = i; + wchar_t wc; + mbstate_t mbs = { 0, }; + size_t ss = mbrtowc (&wc, &c, 1, &mbs); + if (1 < ss) + return 3; + } + return 0; ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_gettimeofday_clobber=no -else - gl_cv_func_gettimeofday_clobber=yes +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes +else $as_nop + gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_gettimeofday_clobber" >&5 -$as_echo "$gl_cv_func_gettimeofday_clobber" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" >&5 +printf "%s\n" "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" >&6; } - case "$gl_cv_func_gettimeofday_clobber" in - *yes) - REPLACE_GETTIMEOFDAY=1 + case "$gl_cv_func_mbrtowc_null_arg1" in + *yes) ;; + *) +printf "%s\n" "#define MBRTOWC_NULL_ARG1_BUG 1" >>confdefs.h -$as_echo "#define GETTIMEOFDAY_CLOBBERS_LOCALTIME 1" >>confdefs.h + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_null_arg2" in + *yes) ;; + *) +printf "%s\n" "#define MBRTOWC_NULL_ARG2_BUG 1" >>confdefs.h + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_retval" in + *yes) ;; + *) +printf "%s\n" "#define MBRTOWC_RETVAL_BUG 1" >>confdefs.h + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_nul_retval" in + *yes) ;; + *) +printf "%s\n" "#define MBRTOWC_NUL_RETVAL_BUG 1" >>confdefs.h + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_stores_incomplete" in + *no) ;; + *) +printf "%s\n" "#define MBRTOWC_STORES_INCOMPLETE_BUG 1" >>confdefs.h - NEED_LOCALTIME_BUFFER=1 - REPLACE_GMTIME=1 - REPLACE_LOCALTIME=1 + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_empty_input" in + *yes) ;; + *) +printf "%s\n" "#define MBRTOWC_EMPTY_INPUT_BUG 1" >>confdefs.h - ;; - esac + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in + *yes) ;; + *) +printf "%s\n" "#define MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettimeofday with POSIX signature" >&5 -$as_echo_n "checking for gettimeofday with POSIX signature... " >&6; } -if ${gl_cv_func_gettimeofday_posix_signature+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - struct timeval c; - int gettimeofday (struct timeval *restrict, void *restrict); + REPLACE_MBRTOWC=1 + ;; + esac + fi + fi + if test $REPLACE_MBSTATE_T = 1; then + case "$host_os" in + mingw*) LIB_MBRTOWC= ;; + *) + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 +printf %s "checking whether imported symbols can be declared weak... " >&6; } +if test ${gl_cv_have_weak+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + cygwin*) + gl_cv_have_weak="guessing no" + ;; + *) + gl_cv_have_weak=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern void xyzzy (); +#pragma weak xyzzy int -main () +main (void) { -/* glibc uses struct timezone * rather than the POSIX void * - if _GNU_SOURCE is defined. However, since the only portable - use of gettimeofday uses NULL as the second parameter, and - since the glibc definition is actually more typesafe, it is - not worth wrapping this to get a compliant signature. */ - int (*f) (struct timeval *restrict, void *restrict) - = gettimeofday; - int x = f (&c, 0); - return !(x | c.tv_sec | c.tv_usec); - +xyzzy(); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_func_gettimeofday_posix_signature=yes -else +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_have_weak=maybe +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test $gl_cv_have_weak = maybe; then + if test "$cross_compiling" = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __ELF__ + Extensible Linking Format + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Extensible Linking Format" >/dev/null 2>&1 +then : + gl_cv_have_weak="guessing yes" +else $as_nop + gl_cv_have_weak="guessing no" +fi +rm -rf conftest* + + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -int gettimeofday (struct timeval *restrict, struct timezone *restrict); -int -main () +#include +#pragma weak fputs +int main () { - - ; - return 0; + return (fputs == NULL); } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_func_gettimeofday_posix_signature=almost -else - gl_cv_func_gettimeofday_posix_signature=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_have_weak=yes +else $as_nop + gl_cv_have_weak=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + fi + ;; + esac + case " $LDFLAGS " in + *" -static "*) gl_cv_have_weak=no ;; + esac + case "$gl_cv_have_weak" in + *yes) + case "$host_os" in + freebsd* | dragonfly* | midnightbsd*) + : > conftest1.c + $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 + cat < conftest2.c +#include +#pragma weak pthread_mutexattr_gettype +int main () +{ + return (pthread_mutexattr_gettype != NULL); +} +EOF + $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ + || gl_cv_have_weak=no + rm -f conftest1.c libempty.so conftest2.c conftest + ;; + esac + ;; + esac + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_gettimeofday_posix_signature" >&5 -$as_echo "$gl_cv_func_gettimeofday_posix_signature" >&6; } - if test $gl_cv_func_gettimeofday_posix_signature = almost; then - gl_gettimeofday_timezone='struct timezone' - elif test $gl_cv_func_gettimeofday_posix_signature != yes; then - REPLACE_GETTIMEOFDAY=1 - fi - if test $REPLACE_STRUCT_TIMEVAL = 1; then - REPLACE_GETTIMEOFDAY=1 - fi - case "$host_os" in - mingw*) REPLACE_GETTIMEOFDAY=1 ;; - esac - fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 +printf "%s\n" "$gl_cv_have_weak" >&6; } + case "$gl_cv_have_weak" in + *yes) -cat >>confdefs.h <<_ACEOF -#define GETTIMEOFDAY_TIMEZONE $gl_gettimeofday_timezone -_ACEOF +printf "%s\n" "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h + ;; + esac - if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then + case "$gl_cv_have_weak" in + *yes) LIB_MBRTOWC= ;; + *) LIB_MBRTOWC="$LIBPTHREAD" ;; + esac + ;; + esac + else + LIB_MBRTOWC= + fi + if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then - gl_LIBOBJS="$gl_LIBOBJS gettimeofday.$ac_objext" - : - fi + gl_LIBOBJS="$gl_LIBOBJS mbrtowc.$ac_objext" + if test $REPLACE_MBSTATE_T = 1; then - GNULIB_GETTIMEOFDAY=1 -$as_echo "#define GNULIB_TEST_GETTIMEOFDAY 1" >>confdefs.h + gl_LIBOBJS="$gl_LIBOBJS lc-charset-dispatch.$ac_objext" - # Autoconf 2.61a.99 and earlier don't support linking a file only - # in VPATH builds. But since GNUmakefile is for maintainer use - # only, it does not matter if we skip the link with older autoconf. - # Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH - # builds, so use a shell variable to bypass this. - GNUmakefile=GNUmakefile - ac_config_links="$ac_config_links $GNUmakefile:$GNUmakefile" - PRIPTR_PREFIX= - if test -n "$STDINT_H"; then - PRIPTR_PREFIX='"l"' - else - for glpfx in '' l ll I64; do - case $glpfx in - '') gltype1='int';; - l) gltype1='long int';; - ll) gltype1='long long int';; - I64) gltype1='__int64';; - esac - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - extern intptr_t foo; - extern $gltype1 foo; -int -main () -{ + gl_LIBOBJS="$gl_LIBOBJS mbtowc-lock.$ac_objext" - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - PRIPTR_PREFIX='"'$glpfx'"' -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test -n "$PRIPTR_PREFIX" && break - done - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether INT32_MAX < INTMAX_MAX" >&5 -$as_echo_n "checking whether INT32_MAX < INTMAX_MAX... " >&6; } -if ${gl_cv_test_INT32_MAX_LT_INTMAX_MAX+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + CFLAG_VISIBILITY= + HAVE_VISIBILITY=0 + if test -n "$GCC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5 +printf %s "checking whether the -Werror option is usable... " >&6; } +if test ${gl_cv_cc_vis_werror+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Work also in C++ mode. */ - #define __STDC_LIMIT_MACROS 1 - - /* Work if build is not clean. */ - #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H - - #include - #if HAVE_STDINT_H - #include - #endif - #if defined INT32_MAX && defined INTMAX_MAX - #define CONDITION (INT32_MAX < INTMAX_MAX) - #else - #define CONDITION (sizeof (int) < sizeof (long long int)) - #endif - int test[CONDITION ? 1 : -1]; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_test_INT32_MAX_LT_INTMAX_MAX=yes -else - gl_cv_test_INT32_MAX_LT_INTMAX_MAX=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_cc_vis_werror=yes +else $as_nop + gl_cv_cc_vis_werror=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_test_INT32_MAX_LT_INTMAX_MAX" >&5 -$as_echo "$gl_cv_test_INT32_MAX_LT_INTMAX_MAX" >&6; } - if test $gl_cv_test_INT32_MAX_LT_INTMAX_MAX = yes; then - INT32_MAX_LT_INTMAX_MAX=1; - else - INT32_MAX_LT_INTMAX_MAX=0; - fi - - - if test $APPLE_UNIVERSAL_BUILD = 0; then +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS="$gl_save_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether INT64_MAX == LONG_MAX" >&5 -$as_echo_n "checking whether INT64_MAX == LONG_MAX... " >&6; } -if ${gl_cv_test_INT64_MAX_EQ_LONG_MAX+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5 +printf "%s\n" "$gl_cv_cc_vis_werror" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5 +printf %s "checking for simple visibility declarations... " >&6; } +if test ${gl_cv_cc_visibility+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fvisibility=hidden" + if test $gl_cv_cc_vis_werror = yes; then + CFLAGS="$CFLAGS -Werror" + fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Work also in C++ mode. */ - #define __STDC_LIMIT_MACROS 1 - - /* Work if build is not clean. */ - #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H - - #include - #if HAVE_STDINT_H - #include - #endif +extern __attribute__((__visibility__("hidden"))) int hiddenvar; + extern __attribute__((__visibility__("default"))) int exportedvar; + extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); + extern __attribute__((__visibility__("default"))) int exportedfunc (void); + void dummyfunc (void); + int hiddenvar; + int exportedvar; + int hiddenfunc (void) { return 51; } + int exportedfunc (void) { return 1225736919; } + void dummyfunc (void) {} - #if defined INT64_MAX - #define CONDITION (INT64_MAX == LONG_MAX) - #else - #define CONDITION (sizeof (long long int) == sizeof (long int)) - #endif - int test[CONDITION ? 1 : -1]; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_test_INT64_MAX_EQ_LONG_MAX=yes -else - gl_cv_test_INT64_MAX_EQ_LONG_MAX=no +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_cc_visibility=yes +else $as_nop + gl_cv_cc_visibility=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS="$gl_save_CFLAGS" + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_test_INT64_MAX_EQ_LONG_MAX" >&5 -$as_echo "$gl_cv_test_INT64_MAX_EQ_LONG_MAX" >&6; } - if test $gl_cv_test_INT64_MAX_EQ_LONG_MAX = yes; then - INT64_MAX_EQ_LONG_MAX=1; - else - INT64_MAX_EQ_LONG_MAX=0; +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5 +printf "%s\n" "$gl_cv_cc_visibility" >&6; } + if test $gl_cv_cc_visibility = yes; then + CFLAG_VISIBILITY="-fvisibility=hidden" + HAVE_VISIBILITY=1 + fi fi - else - INT64_MAX_EQ_LONG_MAX=-1 - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether UINT32_MAX < UINTMAX_MAX" >&5 -$as_echo_n "checking whether UINT32_MAX < UINTMAX_MAX... " >&6; } -if ${gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Work also in C++ mode. */ - #define __STDC_LIMIT_MACROS 1 - /* Work if build is not clean. */ - #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H +printf "%s\n" "#define HAVE_VISIBILITY $HAVE_VISIBILITY" >>confdefs.h - #include - #if HAVE_STDINT_H - #include - #endif - #if defined UINT32_MAX && defined UINTMAX_MAX - #define CONDITION (UINT32_MAX < UINTMAX_MAX) - #else - #define CONDITION (sizeof (unsigned int) < sizeof (unsigned long long int)) - #endif - int test[CONDITION ? 1 : -1]; -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX=yes -else - gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX" >&5 -$as_echo "$gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX" >&6; } - if test $gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX = yes; then - UINT32_MAX_LT_UINTMAX_MAX=1; - else - UINT32_MAX_LT_UINTMAX_MAX=0; - fi + fi - if test $APPLE_UNIVERSAL_BUILD = 0; then + : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether UINT64_MAX == ULONG_MAX" >&5 -$as_echo_n "checking whether UINT64_MAX == ULONG_MAX... " >&6; } -if ${gl_cv_test_UINT64_MAX_EQ_ULONG_MAX+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Work also in C++ mode. */ - #define __STDC_LIMIT_MACROS 1 + fi - /* Work if build is not clean. */ - #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H - #include - #if HAVE_STDINT_H - #include - #endif - #if defined UINT64_MAX - #define CONDITION (UINT64_MAX == ULONG_MAX) - #else - #define CONDITION (sizeof (unsigned long long int) == sizeof (unsigned long int)) - #endif - int test[CONDITION ? 1 : -1]; -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_test_UINT64_MAX_EQ_ULONG_MAX=yes -else - gl_cv_test_UINT64_MAX_EQ_ULONG_MAX=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_test_UINT64_MAX_EQ_ULONG_MAX" >&5 -$as_echo "$gl_cv_test_UINT64_MAX_EQ_ULONG_MAX" >&6; } - if test $gl_cv_test_UINT64_MAX_EQ_ULONG_MAX = yes; then - UINT64_MAX_EQ_ULONG_MAX=1; - else - UINT64_MAX_EQ_ULONG_MAX=0; - fi - else - UINT64_MAX_EQ_ULONG_MAX=-1 - fi + GL_GNULIB_MBRTOWC=1 +printf "%s\n" "#define GNULIB_TEST_MBRTOWC 1" >>confdefs.h - # If we replaced any of the underlying isnan* functions, replace - # the isnan macro; it undoubtedly suffers from the same flaws. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan macro works" >&5 -$as_echo_n "checking whether isnan macro works... " >&6; } - if test $gl_func_isnanf = yes \ - && test $gl_func_isnand = yes \ - && test $gl_func_isnanl = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISNAN_LIBM= - case " $ISNAN_LIBM " in - *" $ISNANF_LIBM "*) ;; - *) ISNAN_LIBM="$ISNAN_LIBM $ISNANF_LIBM" ;; - esac - case " $ISNAN_LIBM " in - *" $ISNAND_LIBM "*) ;; - *) ISNAN_LIBM="$ISNAN_LIBM $ISNAND_LIBM" ;; - esac - case " $ISNAN_LIBM " in - *" $ISNANL_LIBM "*) ;; - *) ISNAN_LIBM="$ISNAN_LIBM $ISNANL_LIBM" ;; - esac - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - REPLACE_ISNAN=1 - ISNAN_LIBM= - fi @@ -28460,1419 +40714,809 @@ - GNULIB_ISNAN=1 -$as_echo "#define GNULIB_TEST_ISNAN 1" >>confdefs.h + if case "$host_os" in + mingw*) true ;; + *) test $ac_cv_func_mbsinit = yes ;; + esac \ + && test $ac_cv_func_mbrtowc = yes; then - ISNAND_LIBM= - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(double) can be used without linking with libm" >&5 -$as_echo_n "checking whether isnan(double) can be used without linking with libm... " >&6; } -if ${gl_cv_func_isnand_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles incomplete characters" >&5 +printf %s "checking whether mbrtowc handles incomplete characters... " >&6; } +if test ${gl_cv_func_mbrtowc_incomplete_state+y} +then : + printf %s "(cached) " >&6 +else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + case "$host_os" in + # Guess no on AIX and OSF/1. + aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; + esac + if test $LOCALE_JA != none; then + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #if __GNUC__ >= 4 - # undef isnand - # define isnand(x) __builtin_isnan ((double)(x)) - #else - # undef isnand - # define isnand(x) isnan ((double)(x)) - #endif - double x; -int -main () + +#include +#include +#include +int main () { -return isnand (x); - ; + if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) + { + const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + if (mbsinit (&state)) + return 2; + } return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_isnand_no_libm=yes -else - gl_cv_func_isnand_no_libm=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_mbrtowc_incomplete_state=yes +else $as_nop + gl_cv_func_mbrtowc_incomplete_state=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnand_no_libm" >&5 -$as_echo "$gl_cv_func_isnand_no_libm" >&6; } - if test $gl_cv_func_isnand_no_libm = no; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(double) can be used with libm" >&5 -$as_echo_n "checking whether isnan(double) can be used with libm... " >&6; } -if ${gl_cv_func_isnand_in_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - - save_LIBS="$LIBS" - LIBS="$LIBS -lm" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + else + if test $LOCALE_FR_UTF8 != none; then + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #if __GNUC__ >= 4 - # undef isnand - # define isnand(x) __builtin_isnan ((double)(x)) - #elif defined isnan - # undef isnand - # define isnand(x) isnan ((double)(x)) - #endif - double x; -int -main () + +#include +#include +#include +int main () { -return isnand (x); - ; + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + const char input[] = "B\303\274\303\237er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + if (mbsinit (&state)) + return 2; + } return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_isnand_in_libm=yes -else - gl_cv_func_isnand_in_libm=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_mbrtowc_incomplete_state=yes +else $as_nop + gl_cv_func_mbrtowc_incomplete_state=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$save_LIBS" - +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnand_in_libm" >&5 -$as_echo "$gl_cv_func_isnand_in_libm" >&6; } - - if test $gl_cv_func_isnand_in_libm = yes; then - ISNAND_LIBM=-lm - fi - fi - if test $gl_cv_func_isnand_no_libm = yes \ - || test $gl_cv_func_isnand_in_libm = yes; then - gl_func_isnand=yes - else - gl_func_isnand=no - HAVE_ISNAND=0 - fi + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_incomplete_state" >&5 +printf "%s\n" "$gl_cv_func_mbrtowc_incomplete_state" >&6; } - if test $HAVE_ISNAND = 0 || test $REPLACE_ISNAN = 1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc works as well as mbtowc" >&5 +printf %s "checking whether mbrtowc works as well as mbtowc... " >&6; } +if test ${gl_cv_func_mbrtowc_sanitycheck+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + # Guess no on Solaris 8. + solaris2.8) gl_cv_func_mbrtowc_sanitycheck="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_mbrtowc_sanitycheck="guessing yes" ;; + esac + if test $LOCALE_ZH_CN != none; then + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +int main () +{ + /* This fails on Solaris 8: + mbrtowc returns 2, and sets wc to 0x00F0. + mbtowc returns 4 (correct) and sets wc to 0x5EDC. */ + if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) + { + char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 3, 6, &state) != 4 + && mbtowc (&wc, input + 3, 6) == 4) + return 2; + } + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_mbrtowc_sanitycheck=yes +else $as_nop + gl_cv_func_mbrtowc_sanitycheck=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_sanitycheck" >&5 +printf "%s\n" "$gl_cv_func_mbrtowc_sanitycheck" >&6; } + REPLACE_MBSTATE_T=0 + case "$gl_cv_func_mbrtowc_incomplete_state" in + *yes) ;; + *) REPLACE_MBSTATE_T=1 ;; + esac + case "$gl_cv_func_mbrtowc_sanitycheck" in + *yes) ;; + *) REPLACE_MBSTATE_T=1 ;; + esac + else + REPLACE_MBSTATE_T=1 + fi - gl_LIBOBJS="$gl_LIBOBJS isnand.$ac_objext" + if test $ac_cv_func_mbsinit = no; then + HAVE_MBSINIT=0 + ac_fn_check_decl "$LINENO" "mbsinit" "ac_cv_have_decl_mbsinit" " + #include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_mbsinit" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_MBSINIT $ac_have_decl" >>confdefs.h + if test $ac_cv_have_decl_mbsinit = yes; then + REPLACE_MBSINIT=1 + fi + else + if test $REPLACE_MBSTATE_T = 1; then + REPLACE_MBSINIT=1 + else + case "$host_os" in + mingw*) REPLACE_MBSINIT=1 ;; + esac + fi fi - - - - - GNULIB_ISNAND=1 + if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then -$as_echo "#define GNULIB_TEST_ISNAND 1" >>confdefs.h + gl_LIBOBJS="$gl_LIBOBJS mbsinit.$ac_objext" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(double) can be used without linking with libm" >&5 -$as_echo_n "checking whether isnan(double) can be used without linking with libm... " >&6; } -if ${gl_cv_func_isnand_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else + : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #if __GNUC__ >= 4 - # undef isnand - # define isnand(x) __builtin_isnan ((double)(x)) - #else - # undef isnand - # define isnand(x) isnan ((double)(x)) - #endif - double x; -int -main () -{ -return isnand (x); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_isnand_no_libm=yes -else - gl_cv_func_isnand_no_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnand_no_libm" >&5 -$as_echo "$gl_cv_func_isnand_no_libm" >&6; } - gl_func_isnand_no_libm=$gl_cv_func_isnand_no_libm - if test $gl_cv_func_isnand_no_libm = yes; then -$as_echo "#define HAVE_ISNAND_IN_LIBC 1" >>confdefs.h - fi - if test $gl_func_isnand_no_libm != yes; then + GL_GNULIB_MBSINIT=1 - gl_LIBOBJS="$gl_LIBOBJS isnand.$ac_objext" +printf "%s\n" "#define GNULIB_TEST_MBSINIT 1" >>confdefs.h - fi - ISNANF_LIBM= - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) can be used without linking with libm" >&5 -$as_echo_n "checking whether isnan(float) can be used without linking with libm... " >&6; } -if ${gl_cv_func_isnanf_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbswidth is declared in " >&5 +printf %s "checking whether mbswidth is declared in ... " >&6; } +if test ${ac_cv_have_decl_mbswidth+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #if __GNUC__ >= 4 - # undef isnanf - # define isnanf(x) __builtin_isnanf ((float)(x)) - #elif defined isnan - # undef isnanf - # define isnanf(x) isnan ((float)(x)) - #endif - float x; +#include + int -main () +main (void) { -return isnanf (x); +char *p = (char *) mbswidth; + return !p; + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_isnanf_no_libm=yes -else - gl_cv_func_isnanf_no_libm=no +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_have_decl_mbswidth=yes +else $as_nop + ac_cv_have_decl_mbswidth=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_no_libm" >&5 -$as_echo "$gl_cv_func_isnanf_no_libm" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_decl_mbswidth" >&5 +printf "%s\n" "$ac_cv_have_decl_mbswidth" >&6; } + if test $ac_cv_have_decl_mbswidth = yes; then + ac_val=1 + else + ac_val=0 + fi - if test $gl_cv_func_isnanf_no_libm = no; then +printf "%s\n" "#define HAVE_DECL_MBSWIDTH_IN_WCHAR_H $ac_val" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) can be used with libm" >&5 -$as_echo_n "checking whether isnan(float) can be used with libm... " >&6; } -if ${gl_cv_func_isnanf_in_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LIBS="$LIBS" - LIBS="$LIBS -lm" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mbstate_t" >&5 +printf %s "checking for mbstate_t... " >&6; } +if test ${ac_cv_type_mbstate_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #if __GNUC__ >= 4 - # undef isnanf - # define isnanf(x) __builtin_isnanf ((float)(x)) - #elif defined isnan - # undef isnanf - # define isnanf(x) isnan ((float)(x)) - #endif - float x; +$ac_includes_default + #include int -main () +main (void) { -return isnanf (x); +mbstate_t x; return sizeof x; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_isnanf_in_libm=yes -else - gl_cv_func_isnanf_in_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$save_LIBS" - +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_type_mbstate_t=yes +else $as_nop + ac_cv_type_mbstate_t=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_in_libm" >&5 -$as_echo "$gl_cv_func_isnanf_in_libm" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_mbstate_t" >&5 +printf "%s\n" "$ac_cv_type_mbstate_t" >&6; } + if test $ac_cv_type_mbstate_t = yes; then - if test $gl_cv_func_isnanf_in_libm = yes; then - ISNANF_LIBM=-lm - fi - fi - if test $gl_cv_func_isnanf_no_libm = yes \ - || test $gl_cv_func_isnanf_in_libm = yes; then - save_LIBS="$LIBS" - LIBS="$LIBS $ISNANF_LIBM" +printf "%s\n" "#define HAVE_MBSTATE_T 1" >>confdefs.h + else +printf "%s\n" "#define mbstate_t int" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) works" >&5 -$as_echo_n "checking whether isnan(float) works... " >&6; } -if ${gl_cv_func_isnanf_works+:} false; then : - $as_echo_n "(cached) " >&6 -else + fi - if test "$cross_compiling" = yes; then : - case "$host_os" in - irix* | solaris*) gl_cv_func_isnanf_works="guessing no" ;; - mingw*) # Guess yes on mingw, no on MSVC. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __MINGW32__ - Known -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_isnanf_works="guessing yes" -else - gl_cv_func_isnanf_works="guessing no" -fi -rm -f conftest* + if test $REPLACE_MEMCHR = 1; then - ;; - *) gl_cv_func_isnanf_works="guessing yes" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#if __GNUC__ >= 4 -# undef isnanf -# define isnanf(x) __builtin_isnanf ((float)(x)) -#elif defined isnan -# undef isnanf -# define isnanf(x) isnan ((float)(x)) -#endif -/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ -#ifdef __DECC -static float -NaN () -{ - static float zero = 0.0f; - return zero / zero; -} -#else -# define NaN() (0.0f / 0.0f) -#endif -#define NWORDS \ - ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { unsigned int word[NWORDS]; float value; } memory_float; -int main() -{ - int result = 0; - if (isnanf (1.0f / 0.0f)) - result |= 1; - if (!isnanf (NaN ())) - result |= 2; -#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT - /* The isnanf function should be immune against changes in the sign bit and - in the mantissa bits. The xor operation twiddles a bit that can only be - a sign bit or a mantissa bit. */ - if (FLT_EXPBIT0_WORD == 0 && FLT_EXPBIT0_BIT > 0) - { - memory_float m; - m.value = NaN (); - /* Set the bits below the exponent to 01111...111. */ - m.word[0] &= -1U << FLT_EXPBIT0_BIT; - m.word[0] |= 1U << (FLT_EXPBIT0_BIT - 1) - 1; - if (!isnanf (m.value)) - result |= 4; - } -#endif - return result; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_isnanf_works=yes -else - gl_cv_func_isnanf_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + gl_LIBOBJS="$gl_LIBOBJS memchr.$ac_objext" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_works" >&5 -$as_echo "$gl_cv_func_isnanf_works" >&6; } + ac_fn_c_check_header_compile "$LINENO" "bp-sym.h" "ac_cv_header_bp_sym_h" "$ac_includes_default" +if test "x$ac_cv_header_bp_sym_h" = xyes +then : + printf "%s\n" "#define HAVE_BP_SYM_H 1" >>confdefs.h - LIBS="$save_LIBS" - case "$gl_cv_func_isnanf_works" in - *yes) gl_func_isnanf=yes ;; - *) gl_func_isnanf=no; ISNANF_LIBM= ;; - esac - else - gl_func_isnanf=no - fi - if test $gl_func_isnanf != yes; then - HAVE_ISNANF=0 - fi +fi + fi - if test $HAVE_ISNANF = 0 || test $REPLACE_ISNAN = 1; then + GL_GNULIB_MEMCHR=1 - gl_LIBOBJS="$gl_LIBOBJS isnanf.$ac_objext" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'float'" >&5 -$as_echo_n "checking where to find the exponent in a 'float'... " >&6; } -if ${gl_cv_cc_float_expbit0+:} false; then : - $as_echo_n "(cached) " >&6 -else +printf "%s\n" "#define GNULIB_TEST_MEMCHR 1" >>confdefs.h - if test "$cross_compiling" = yes; then : - gl_cv_cc_float_expbit0="word 0 bit 23" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -#define NWORDS \ - ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { float value; unsigned int word[NWORDS]; } memory_float; -static unsigned int ored_words[NWORDS]; -static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (float x) -{ - memory_float m; - size_t i; - /* Clear it first, in case - sizeof (float) < sizeof (memory_float). */ - memset (&m, 0, sizeof (memory_float)); - m.value = x; - for (i = 0; i < NWORDS; i++) - { - ored_words[i] |= m.word[i]; - anded_words[i] &= m.word[i]; - } -} -int main () -{ - size_t j; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) - return 1; - for (j = 0; j < NWORDS; j++) - anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25f); - add_to_ored_words (0.5f); - add_to_ored_words (1.0f); - add_to_ored_words (2.0f); - add_to_ored_words (4.0f); - /* Remove bits that are common (e.g. if representation of the first mantissa - bit is explicit). */ - for (j = 0; j < NWORDS; j++) - ored_words[j] &= ~anded_words[j]; - /* Now find the nonzero word. */ - for (j = 0; j < NWORDS; j++) - if (ored_words[j] != 0) - break; - if (j < NWORDS) - { - size_t i; - for (i = j + 1; i < NWORDS; i++) - if (ored_words[i] != 0) - { - fprintf (fp, "unknown"); - return (fclose (fp) != 0); - } - for (i = 0; ; i++) - if ((ored_words[j] >> i) & 1) - { - fprintf (fp, "word %d bit %d", (int) j, (int) i); - return (fclose (fp) != 0); - } - } - fprintf (fp, "unknown"); - return (fclose (fp) != 0); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_cc_float_expbit0=`cat conftest.out` -else - gl_cv_cc_float_expbit0="unknown" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - rm -f conftest.out -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_float_expbit0" >&5 -$as_echo "$gl_cv_cc_float_expbit0" >&6; } - case "$gl_cv_cc_float_expbit0" in - word*bit*) - word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` -cat >>confdefs.h <<_ACEOF -#define FLT_EXPBIT0_WORD $word -_ACEOF -cat >>confdefs.h <<_ACEOF -#define FLT_EXPBIT0_BIT $bit -_ACEOF - ;; - esac + ac_fn_c_check_func "$LINENO" "mempcpy" "ac_cv_func_mempcpy" +if test "x$ac_cv_func_mempcpy" = xyes +then : + printf "%s\n" "#define HAVE_MEMPCPY 1" >>confdefs.h +fi + if test $ac_cv_func_mempcpy = no; then + HAVE_MEMPCPY=0 fi + if test $HAVE_MEMPCPY = 0; then - GNULIB_ISNANF=1 + gl_LIBOBJS="$gl_LIBOBJS mempcpy.$ac_objext" -$as_echo "#define GNULIB_TEST_ISNANF 1" >>confdefs.h + : + fi - ISNANL_LIBM= - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(long double) can be used without linking with libm" >&5 -$as_echo_n "checking whether isnan(long double) can be used without linking with libm... " >&6; } -if ${gl_cv_func_isnanl_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #if __GNUC__ >= 4 - # undef isnanl - # define isnanl(x) __builtin_isnanl ((long double)(x)) - #elif defined isnan - # undef isnanl - # define isnanl(x) isnan ((long double)(x)) - #endif - long double x; -int -main () -{ -return isnanl (x); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_isnanl_no_libm=yes -else - gl_cv_func_isnanl_no_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_no_libm" >&5 -$as_echo "$gl_cv_func_isnanl_no_libm" >&6; } - if test $gl_cv_func_isnanl_no_libm = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(long double) can be used with libm" >&5 -$as_echo_n "checking whether isnan(long double) can be used with libm... " >&6; } -if ${gl_cv_func_isnanl_in_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LIBS="$LIBS" - LIBS="$LIBS -lm" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #if __GNUC__ >= 4 - # undef isnanl - # define isnanl(x) __builtin_isnanl ((long double)(x)) - #elif defined isnan - # undef isnanl - # define isnanl(x) isnan ((long double)(x)) - #endif - long double x; -int -main () -{ -return isnanl (x); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_isnanl_in_libm=yes -else - gl_cv_func_isnanl_in_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$save_LIBS" + GL_GNULIB_MEMPCPY=1 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_in_libm" >&5 -$as_echo "$gl_cv_func_isnanl_in_libm" >&6; } - if test $gl_cv_func_isnanl_in_libm = yes; then - ISNANL_LIBM=-lm - fi - fi - if test $gl_cv_func_isnanl_no_libm = yes \ - || test $gl_cv_func_isnanl_in_libm = yes; then - save_LIBS="$LIBS" - LIBS="$LIBS $ISNANL_LIBM" +printf "%s\n" "#define GNULIB_TEST_MEMPCPY 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnanl works" >&5 -$as_echo_n "checking whether isnanl works... " >&6; } -if ${gl_cv_func_isnanl_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - mingw*) # Guess yes on mingw, no on MSVC. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __MINGW32__ - Known -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_isnanl_works="guessing yes" -else - gl_cv_func_isnanl_works="guessing no" -fi -rm -f conftest* - ;; - *) gl_cv_func_isnanl_works="guessing yes" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#if __GNUC__ >= 4 -# undef isnanl -# define isnanl(x) __builtin_isnanl ((long double)(x)) -#elif defined isnan -# undef isnanl -# define isnanl(x) isnan ((long double)(x)) -#endif -#define NWORDS \ - ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { unsigned int word[NWORDS]; long double value; } - memory_long_double; -/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the - runtime type conversion. */ -#ifdef __sgi -static long double NaNl () -{ - double zero = 0.0; - return zero / zero; -} -#else -# define NaNl() (0.0L / 0.0L) -#endif -int main () -{ - int result = 0; + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then - if (!isnanl (NaNl ())) - result |= 1; - { - memory_long_double m; - unsigned int i; - /* The isnanl function should be immune against changes in the sign bit and - in the mantissa bits. The xor operation twiddles a bit that can only be - a sign bit or a mantissa bit (since the exponent never extends to - bit 31). */ - m.value = NaNl (); - m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); - for (i = 0; i < NWORDS; i++) - m.word[i] |= 1; - if (!isnanl (m.value)) - result |= 1; - } -#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE -/* Representation of an 80-bit 'long double' as an initializer for a sequence - of 'unsigned int' words. */ -# ifdef WORDS_BIGENDIAN -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ - ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \ - (unsigned int) (mantlo) << 16 \ - } -# else -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { mantlo, manthi, exponent } -# endif - { /* Quiet NaN. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; - if (!isnanl (x.value)) - result |= 2; - } - { - /* Signalling NaN. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; - if (!isnanl (x.value)) - result |= 2; - } - /* isnanl should return something even for noncanonical values. */ - { /* Pseudo-NaN. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 4; - } - { /* Pseudo-Infinity. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 8; - } - { /* Pseudo-Zero. */ - static memory_long_double x = - { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 16; - } - { /* Unnormalized number. */ - static memory_long_double x = - { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 32; - } - { /* Pseudo-Denormal. */ - static memory_long_double x = - { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 64; - } -#endif - return result; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_isnanl_works=yes -else - gl_cv_func_isnanl_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_works" >&5 -$as_echo "$gl_cv_func_isnanl_works" >&6; } - LIBS="$save_LIBS" - case "$gl_cv_func_isnanl_works" in - *yes) gl_func_isnanl=yes ;; - *) gl_func_isnanl=no; ISNANL_LIBM= ;; - esac - else - gl_func_isnanl=no - fi - if test $gl_func_isnanl != yes; then - HAVE_ISNANL=0 + gl_LIBOBJS="$gl_LIBOBJS msvc-inval.$ac_objext" + fi + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then - if test $HAVE_ISNANL = 0 || test $REPLACE_ISNAN = 1; then + gl_LIBOBJS="$gl_LIBOBJS msvc-nothrow.$ac_objext" + fi +printf "%s\n" "#define GNULIB_MSVC_NOTHROW 1" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS isnanl.$ac_objext" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'long double'" >&5 -$as_echo_n "checking where to find the exponent in a 'long double'... " >&6; } -if ${gl_cv_cc_long_double_expbit0+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - gl_cv_cc_long_double_expbit0="unknown" - case "$host_os" in - mingw*) # On native Windows (little-endian), we know the result - # in two cases: mingw, MSVC. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __MINGW32__ - Known -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_cc_long_double_expbit0="word 2 bit 0" -fi -rm -f conftest* - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef _MSC_VER - Known -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_cc_long_double_expbit0="word 1 bit 20" -fi -rm -f conftest* - ;; - esac -else + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for obstacks that work with any size object" >&5 +printf %s "checking for obstacks that work with any size object... " >&6; } +if test ${ac_cv_func_obstack+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include "obstack.h" + void *obstack_chunk_alloc (size_t n) { return 0; } + void obstack_chunk_free (void *p) { } + /* Check that an internal function returns size_t, not int. */ + size_t _obstack_memory_used (struct obstack *); -#include -#include -#include -#include -#define NWORDS \ - ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { long double value; unsigned int word[NWORDS]; } - memory_long_double; -static unsigned int ored_words[NWORDS]; -static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (long double x) -{ - memory_long_double m; - size_t i; - /* Clear it first, in case - sizeof (long double) < sizeof (memory_long_double). */ - memset (&m, 0, sizeof (memory_long_double)); - m.value = x; - for (i = 0; i < NWORDS; i++) - { - ored_words[i] |= m.word[i]; - anded_words[i] &= m.word[i]; - } -} -int main () +int +main (void) { - size_t j; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) - return 1; - for (j = 0; j < NWORDS; j++) - anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25L); - add_to_ored_words (0.5L); - add_to_ored_words (1.0L); - add_to_ored_words (2.0L); - add_to_ored_words (4.0L); - /* Remove bits that are common (e.g. if representation of the first mantissa - bit is explicit). */ - for (j = 0; j < NWORDS; j++) - ored_words[j] &= ~anded_words[j]; - /* Now find the nonzero word. */ - for (j = 0; j < NWORDS; j++) - if (ored_words[j] != 0) - break; - if (j < NWORDS) - { - size_t i; - for (i = j + 1; i < NWORDS; i++) - if (ored_words[i] != 0) - { - fprintf (fp, "unknown"); - return (fclose (fp) != 0); - } - for (i = 0; ; i++) - if ((ored_words[j] >> i) & 1) - { - fprintf (fp, "word %d bit %d", (int) j, (int) i); - return (fclose (fp) != 0); - } - } - fprintf (fp, "unknown"); - return (fclose (fp) != 0); +struct obstack mem; + obstack_init (&mem); + obstack_free (&mem, 0); + + ; + return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_func_obstack=yes +else $as_nop + ac_cv_func_obstack=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_obstack" >&5 +printf "%s\n" "$ac_cv_func_obstack" >&6; } + if test "$ac_cv_func_obstack" = yes; then + +printf "%s\n" "#define HAVE_OBSTACK 1" >>confdefs.h + + else + + + + + -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_cc_long_double_expbit0=`cat conftest.out` -else - gl_cv_cc_long_double_expbit0="unknown" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - rm -f conftest.out -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_long_double_expbit0" >&5 -$as_echo "$gl_cv_cc_long_double_expbit0" >&6; } - case "$gl_cv_cc_long_double_expbit0" in - word*bit*) - word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'` + gl_LIBOBJS="$gl_LIBOBJS obstack.$ac_objext" -cat >>confdefs.h <<_ACEOF -#define LDBL_EXPBIT0_WORD $word -_ACEOF + fi -cat >>confdefs.h <<_ACEOF -#define LDBL_EXPBIT0_BIT $bit -_ACEOF - ;; - esac + if test $ac_cv_func_obstack_printf = no ; then + + + if test $ac_cv_func_obstack_printf = yes; then + REPLACE_OBSTACK_PRINTF=1 fi + fi + if test $ac_cv_have_decl_obstack_printf = no; then + HAVE_DECL_OBSTACK_PRINTF=0 + fi - GNULIB_ISNANL=1 + if test $ac_cv_func_obstack_printf = no || test $REPLACE_OBSTACK_PRINTF = 1; then -$as_echo "#define GNULIB_TEST_ISNANL 1" >>confdefs.h + gl_LIBOBJS="$gl_LIBOBJS obstack_printf.$ac_objext" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(long double) can be used without linking with libm" >&5 -$as_echo_n "checking whether isnan(long double) can be used without linking with libm... " >&6; } -if ${gl_cv_func_isnanl_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else + fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #if __GNUC__ >= 4 - # undef isnanl - # define isnanl(x) __builtin_isnanl ((long double)(x)) - #elif defined isnan - # undef isnanl - # define isnanl(x) isnan ((long double)(x)) - #endif - long double x; -int -main () -{ -return isnanl (x); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_isnanl_no_libm=yes -else - gl_cv_func_isnanl_no_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_no_libm" >&5 -$as_echo "$gl_cv_func_isnanl_no_libm" >&6; } - gl_func_isnanl_no_libm=$gl_cv_func_isnanl_no_libm - if test $gl_func_isnanl_no_libm = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnanl works" >&5 -$as_echo_n "checking whether isnanl works... " >&6; } -if ${gl_cv_func_isnanl_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : + + GL_GNULIB_OBSTACK_PRINTF=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_OBSTACK_PRINTF 1" >>confdefs.h + + + + + + case "$host_os" in - mingw*) # Guess yes on mingw, no on MSVC. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + mingw* | pw*) + REPLACE_OPEN=1 + ;; + *) -#ifdef __MINGW32__ - Known -#endif + if test "$gl_cv_macro_O_CLOEXEC" != yes; then + REPLACE_OPEN=1 + fi -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_isnanl_works="guessing yes" -else - gl_cv_func_isnanl_works="guessing no" -fi -rm -f conftest* - ;; - *) gl_cv_func_isnanl_works="guessing yes" ;; - esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether open recognizes a trailing slash" >&5 +printf %s "checking whether open recognizes a trailing slash... " >&6; } +if test ${gl_cv_func_open_slash+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + touch conftest.tmp + ln -s conftest.tmp conftest.lnk + fi + if test "$cross_compiling" = yes +then : -else + case "$host_os" in + freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) + gl_cv_func_open_slash="guessing no" ;; + *) + gl_cv_func_open_slash="guessing yes" ;; + esac + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include -#if __GNUC__ >= 4 -# undef isnanl -# define isnanl(x) __builtin_isnanl ((long double)(x)) -#elif defined isnan -# undef isnanl -# define isnanl(x) isnan ((long double)(x)) -#endif -#define NWORDS \ - ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { unsigned int word[NWORDS]; long double value; } - memory_long_double; -/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the - runtime type conversion. */ -#ifdef __sgi -static long double NaNl () -{ - double zero = 0.0; - return zero / zero; -} -#else -# define NaNl() (0.0L / 0.0L) +#include +#if HAVE_UNISTD_H +# include #endif + + +$gl_mda_defines + int main () { int result = 0; - - if (!isnanl (NaNl ())) +#if HAVE_LSTAT + if (open ("conftest.lnk/", O_RDONLY) != -1) result |= 1; - - { - memory_long_double m; - unsigned int i; - - /* The isnanl function should be immune against changes in the sign bit and - in the mantissa bits. The xor operation twiddles a bit that can only be - a sign bit or a mantissa bit (since the exponent never extends to - bit 31). */ - m.value = NaNl (); - m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); - for (i = 0; i < NWORDS; i++) - m.word[i] |= 1; - if (!isnanl (m.value)) - result |= 1; - } - -#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE -/* Representation of an 80-bit 'long double' as an initializer for a sequence - of 'unsigned int' words. */ -# ifdef WORDS_BIGENDIAN -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ - ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \ - (unsigned int) (mantlo) << 16 \ - } -# else -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { mantlo, manthi, exponent } -# endif - { /* Quiet NaN. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; - if (!isnanl (x.value)) - result |= 2; - } - { - /* Signalling NaN. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; - if (!isnanl (x.value)) - result |= 2; - } - /* isnanl should return something even for noncanonical values. */ - { /* Pseudo-NaN. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 4; - } - { /* Pseudo-Infinity. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 8; - } - { /* Pseudo-Zero. */ - static memory_long_double x = - { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 16; - } - { /* Unnormalized number. */ - static memory_long_double x = - { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 32; - } - { /* Pseudo-Denormal. */ - static memory_long_double x = - { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; - if (isnanl (x.value) && !isnanl (x.value)) - result |= 64; - } #endif - + if (open ("conftest.sl/", O_CREAT, 0600) >= 0) + result |= 2; return result; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_isnanl_works=yes -else - gl_cv_func_isnanl_works=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_open_slash=yes +else $as_nop + gl_cv_func_open_slash=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + rm -f conftest.sl conftest.tmp conftest.lnk fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanl_works" >&5 -$as_echo "$gl_cv_func_isnanl_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_open_slash" >&5 +printf "%s\n" "$gl_cv_func_open_slash" >&6; } + case "$gl_cv_func_open_slash" in + *no) - case "$gl_cv_func_isnanl_works" in - *yes) ;; - *) gl_func_isnanl_no_libm=no ;; - esac - fi - if test $gl_func_isnanl_no_libm = yes; then +printf "%s\n" "#define OPEN_TRAILING_SLASH_BUG 1" >>confdefs.h + + ;; + esac + + case "$gl_cv_func_open_slash" in + *no) + REPLACE_OPEN=1 + ;; + esac + ;; + esac -$as_echo "#define HAVE_ISNANL_IN_LIBC 1" >>confdefs.h + if test $REPLACE_OPEN = 0; then + + + if test $ac_cv_func_fchdir = no; then + HAVE_FCHDIR=0 fi - if test $gl_func_isnanl_no_libm != yes; then + if test $HAVE_FCHDIR = 0; then + REPLACE_OPEN=1 + fi + fi + if test $REPLACE_OPEN = 1; then - gl_LIBOBJS="$gl_LIBOBJS isnanl.$ac_objext" + gl_LIBOBJS="$gl_LIBOBJS open.$ac_objext" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'long double'" >&5 -$as_echo_n "checking where to find the exponent in a 'long double'... " >&6; } -if ${gl_cv_cc_long_double_expbit0+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - gl_cv_cc_long_double_expbit0="unknown" - case "$host_os" in - mingw*) # On native Windows (little-endian), we know the result - # in two cases: mingw, MSVC. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + : -#ifdef __MINGW32__ - Known -#endif + fi -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_cc_long_double_expbit0="word 2 bit 0" -fi -rm -f conftest* - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef _MSC_VER - Known -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_cc_long_double_expbit0="word 1 bit 20" -fi -rm -f conftest* - ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -#define NWORDS \ - ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { long double value; unsigned int word[NWORDS]; } - memory_long_double; -static unsigned int ored_words[NWORDS]; -static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (long double x) -{ - memory_long_double m; - size_t i; - /* Clear it first, in case - sizeof (long double) < sizeof (memory_long_double). */ - memset (&m, 0, sizeof (memory_long_double)); - m.value = x; - for (i = 0; i < NWORDS; i++) - { - ored_words[i] |= m.word[i]; - anded_words[i] &= m.word[i]; - } -} -int main () -{ - size_t j; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) - return 1; - for (j = 0; j < NWORDS; j++) - anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25L); - add_to_ored_words (0.5L); - add_to_ored_words (1.0L); - add_to_ored_words (2.0L); - add_to_ored_words (4.0L); - /* Remove bits that are common (e.g. if representation of the first mantissa - bit is explicit). */ - for (j = 0; j < NWORDS; j++) - ored_words[j] &= ~anded_words[j]; - /* Now find the nonzero word. */ - for (j = 0; j < NWORDS; j++) - if (ored_words[j] != 0) - break; - if (j < NWORDS) - { - size_t i; - for (i = j + 1; i < NWORDS; i++) - if (ored_words[i] != 0) - { - fprintf (fp, "unknown"); - return (fclose (fp) != 0); - } - for (i = 0; ; i++) - if ((ored_words[j] >> i) & 1) - { - fprintf (fp, "word %d bit %d", (int) j, (int) i); - return (fclose (fp) != 0); - } - } - fprintf (fp, "unknown"); - return (fclose (fp) != 0); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_cc_long_double_expbit0=`cat conftest.out` -else - gl_cv_cc_long_double_expbit0="unknown" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - rm -f conftest.out + GL_GNULIB_OPEN=1 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_long_double_expbit0" >&5 -$as_echo "$gl_cv_cc_long_double_expbit0" >&6; } - case "$gl_cv_cc_long_double_expbit0" in - word*bit*) - word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'` -cat >>confdefs.h <<_ACEOF -#define LDBL_EXPBIT0_WORD $word -_ACEOF -cat >>confdefs.h <<_ACEOF -#define LDBL_EXPBIT0_BIT $bit -_ACEOF - ;; - esac +printf "%s\n" "#define GNULIB_TEST_OPEN 1" >>confdefs.h - fi - ac_fn_c_check_decl "$LINENO" "iswblank" "ac_cv_have_decl_iswblank" " -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be included - before . */ -#include -#include -#include -#include -#include -" -if test "x$ac_cv_have_decl_iswblank" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ISWBLANK $ac_have_decl -_ACEOF - if test $ac_cv_func_iswblank = no; then - HAVE_ISWBLANK=0 - if test $ac_cv_have_decl_iswblank = yes; then - REPLACE_ISWBLANK=1 - fi - fi - if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then - : - else - if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then - : - fi + if test "$ERRNO_H:$REPLACE_STRERROR_0" != :0; then + REPLACE_PERROR=1 fi + case ${gl_cv_func_strerror_r_works-unset} in + unset|*yes) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether perror matches strerror" >&5 +printf %s "checking whether perror matches strerror... " >&6; } +if test ${gl_cv_func_perror_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on musl systems. + *-musl*) gl_cv_func_perror_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_perror_works="guessing yes" ;; + # Otherwise obey --enable-cross-guesses. + *) gl_cv_func_perror_works="$gl_cross_guess_normal" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include + #include - if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then - : - else - if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then +int +main (void) +{ +char *str = strerror (-1); + if (!getenv("CONFTEST_OUTPUT")) return 0; + if (!str) str = ""; + puts (str); + errno = -1; + perror (""); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + if CONFTEST_OUTPUT=1 ./conftest$EXEEXT >conftest.txt1 2>conftest.txt2 \ + && cmp conftest.txt1 conftest.txt2 >/dev/null; then + gl_cv_func_perror_works=yes + else + gl_cv_func_perror_works=no + fi + rm -rf conftest.txt1 conftest.txt2 +else $as_nop + gl_cv_func_perror_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_perror_works" >&5 +printf "%s\n" "$gl_cv_func_perror_works" >&6; } + case "$gl_cv_func_perror_works" in + *yes) ;; + *) REPLACE_PERROR=1 ;; + esac + ;; + *) + REPLACE_PERROR=1 + ;; + esac + if test $REPLACE_PERROR = 1; then @@ -29880,30 +41524,26 @@ - gl_LIBOBJS="$gl_LIBOBJS iswblank.$ac_objext" - fi + gl_LIBOBJS="$gl_LIBOBJS perror.$ac_objext" + fi - GNULIB_ISWBLANK=1 + GL_GNULIB_PERROR=1 -$as_echo "#define GNULIB_TEST_ISWBLANK 1" >>confdefs.h - # You need to invoke gt_JAVACOMP yourself, possibly with arguments. - ac_config_files="$ac_config_files javacomp.sh:build-aux/javacomp.sh.in" - # You need to invoke gt_JAVAEXEC yourself, possibly with arguments. - ac_config_files="$ac_config_files javaexec.sh:build-aux/javaexec.sh.in" +printf "%s\n" "#define GNULIB_TEST_PERROR 1" >>confdefs.h @@ -29911,684 +41551,133 @@ + if test $ac_cv_func_pipe != yes; then + HAVE_PIPE=0 + fi - ac_fn_c_check_decl "$LINENO" "ldexpl" "ac_cv_have_decl_ldexpl" "#include -" -if test "x$ac_cv_have_decl_ldexpl" = xyes; then : + if test $HAVE_PIPE = 0; then -else - HAVE_DECL_LDEXPL=0 -fi - LDEXPL_LIBM= - if test $HAVE_DECL_LDEXPL = 1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ldexpl() can be used without linking with libm" >&5 -$as_echo_n "checking whether ldexpl() can be used without linking with libm... " >&6; } -if ${gl_cv_func_ldexpl_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - long double x; -int -main () -{ -return ldexpl (x, -1) > 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_ldexpl_no_libm=yes -else - gl_cv_func_ldexpl_no_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexpl_no_libm" >&5 -$as_echo "$gl_cv_func_ldexpl_no_libm" >&6; } - if test $gl_cv_func_ldexpl_no_libm = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ldexpl() can be used with libm" >&5 -$as_echo_n "checking whether ldexpl() can be used with libm... " >&6; } -if ${gl_cv_func_ldexpl_in_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LIBS="$LIBS" - LIBS="$LIBS -lm" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - long double x; -int -main () -{ -return ldexpl (x, -1) > 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_ldexpl_in_libm=yes -else - gl_cv_func_ldexpl_in_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$save_LIBS" + gl_LIBOBJS="$gl_LIBOBJS pipe.$ac_objext" + + fi + + + + -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexpl_in_libm" >&5 -$as_echo "$gl_cv_func_ldexpl_in_libm" >&6; } - if test $gl_cv_func_ldexpl_in_libm = yes; then - LDEXPL_LIBM=-lm - fi - fi - if test $gl_cv_func_ldexpl_no_libm = yes \ - || test $gl_cv_func_ldexpl_in_libm = yes; then - save_LIBS="$LIBS" - LIBS="$LIBS $LDEXPL_LIBM" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ldexpl works" >&5 -$as_echo_n "checking whether ldexpl works... " >&6; } -if ${gl_cv_func_ldexpl_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - aix | aix[3-6]*) gl_cv_func_ldexpl_works="guessing no" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_ldexpl_works="guessing yes" ;; - *) gl_cv_func_ldexpl_works="guessing yes" ;; - esac + GL_GNULIB_PIPE=1 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -extern -#ifdef __cplusplus -"C" -#endif -long double ldexpl (long double, int); -int main() -{ - int result = 0; - { - volatile long double x = 1.0; - volatile long double y = ldexpl (x, -1); - if (y != 0.5L) - result |= 1; - } - { - volatile long double x = 1.73205L; - volatile long double y = ldexpl (x, 0); - if (y != x) - result |= 2; - } - return result; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_ldexpl_works=yes -else - gl_cv_func_ldexpl_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexpl_works" >&5 -$as_echo "$gl_cv_func_ldexpl_works" >&6; } - LIBS="$save_LIBS" - case "$gl_cv_func_ldexpl_works" in - *yes) gl_func_ldexpl=yes ;; - *) gl_func_ldexpl=no; REPLACE_LDEXPL=1 ;; - esac - else - gl_func_ldexpl=no - fi - if test $gl_func_ldexpl = yes; then +printf "%s\n" "#define GNULIB_TEST_PIPE 1" >>confdefs.h -$as_echo "#define HAVE_LDEXPL 1" >>confdefs.h - fi - fi - if test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; then - if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then - LDEXPL_LIBM="$LDEXP_LIBM" - else - LDEXPL_LIBM="$ISNANL_LIBM" - fi - fi - if test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; then + if test $ac_cv_func_pipe2 != yes; then + HAVE_PIPE2=0 + fi - gl_LIBOBJS="$gl_LIBOBJS ldexpl.$ac_objext" - fi - GNULIB_LDEXPL=1 + GL_GNULIB_PIPE2=1 -$as_echo "#define GNULIB_TEST_LDEXPL 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_PIPE2 1" >>confdefs.h +printf "%s\n" "#define GNULIB_PIPE2_SAFER 1" >>confdefs.h + if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - use_additional=yes - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" - eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" + gl_LIBOBJS="$gl_LIBOBJS spawn.$ac_objext" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + fi -# Check whether --with-libtextstyle-prefix was given. -if test "${with_libtextstyle_prefix+set}" = set; then : - withval=$with_libtextstyle_prefix; - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" - eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - additional_libdir2="$withval/$acl_libdirstem2" - additional_libdir3="$withval/$acl_libdirstem3" - fi - fi -fi - if test "X$additional_libdir2" = "X$additional_libdir"; then - additional_libdir2= - fi - if test "X$additional_libdir3" = "X$additional_libdir"; then - additional_libdir3= - fi - LIBTEXTSTYLE= - LTLIBTEXTSTYLE= - INCTEXTSTYLE= - LIBTEXTSTYLE_PREFIX= - HAVE_LIBTEXTSTYLE= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='textstyle ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBTEXTSTYLE="${LTLIBTEXTSTYLE}${LTLIBTEXTSTYLE:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - eval libname=\"$acl_libname_spec\" # typically: libname=lib$name - if test -n "$acl_shlibext"; then - shrext=".$acl_shlibext" # typically: shrext=.so - else - shrext= - fi - if test $use_additional = yes; then - for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do - if test "X$found_dir" = "X"; then - eval dir=\$$additional_libdir_variable - if test -n "$dir"; then - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - fi - done - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBTEXTSTYLE; do - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + GL_GNULIB_POSIX_SPAWN=1 - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBTEXTSTYLE="${LTLIBTEXTSTYLE}${LTLIBTEXTSTYLE:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "$enable_rpath" = no \ - || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then - LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$acl_hardcode_direct" = yes; then - LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$found_so" - else - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBTEXTSTYLE; do - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }-L$found_dir" - fi - if test "$acl_hardcode_minus_L" != no; then - LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$found_so" - else - LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$found_a" - else - LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */$acl_libdirstem | */$acl_libdirstem/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = 'textstyle'; then - LIBTEXTSTYLE_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem2 | */$acl_libdirstem2/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = 'textstyle'; then - LIBTEXTSTYLE_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem3 | */$acl_libdirstem3/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` - if test "$name" = 'textstyle'; then - LIBTEXTSTYLE_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCTEXTSTYLE; do - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCTEXTSTYLE="${INCTEXTSTYLE}${INCTEXTSTYLE:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ - && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then - haveit= - if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ - || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBTEXTSTYLE; do +printf "%s\n" "#define GNULIB_TEST_POSIX_SPAWN 1" >>confdefs.h - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - if test "X$x" = "X-L$dependency_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$dependency_libdir"; then - LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }-L$dependency_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBTEXTSTYLE; do - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - if test "X$x" = "X-L$dependency_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$dependency_libdir"; then - LTLIBTEXTSTYLE="${LTLIBTEXTSTYLE}${LTLIBTEXTSTYLE:+ }-L$dependency_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$dep" - LTLIBTEXTSTYLE="${LTLIBTEXTSTYLE}${LTLIBTEXTSTYLE:+ }$dep" - ;; - esac - done - fi - else - LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }-l$name" - LTLIBTEXTSTYLE="${LTLIBTEXTSTYLE}${LTLIBTEXTSTYLE:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$acl_hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$flag" - else - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBTEXTSTYLE="${LIBTEXTSTYLE}${LIBTEXTSTYLE:+ }$flag" - done - fi + + + + + + + if test $ac_cv_func_posix_spawn_file_actions_addchdir = yes; then + REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=1 + else + HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=0 fi - if test "X$ltrpathdirs" != "X"; then - for found_dir in $ltrpathdirs; do - LTLIBTEXTSTYLE="${LTLIBTEXTSTYLE}${LTLIBTEXTSTYLE:+ }-R$found_dir" - done + + if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1 || test $HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR = 0 || test $REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS spawn_faction_addchdir.$ac_objext" + fi @@ -30596,80 +41685,91 @@ - ac_save_CPPFLAGS="$CPPFLAGS" - for element in $INCTEXTSTYLE; do - haveit= - for x in $CPPFLAGS; do - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" - fi - done + GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtextstyle" >&5 -$as_echo_n "checking for libtextstyle... " >&6; } -if ${ac_cv_libtextstyle+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_LIBS="$LIBS" - case " $LIBTEXTSTYLE" in - *" -l"*) LIBS="$LIBS $LIBTEXTSTYLE" ;; - *) LIBS="$LIBTEXTSTYLE $LIBS" ;; - esac - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + +printf "%s\n" "#define GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR 1" >>confdefs.h + + + + + + + + + + if test $REPLACE_POSIX_SPAWN = 1; then + REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=1 + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether posix_spawn_file_actions_addclose works" >&5 +printf %s "checking whether posix_spawn_file_actions_addclose works... " >&6; } +if test ${gl_cv_func_posix_spawn_file_actions_addclose_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + # Guess no on musl libc and Solaris, yes otherwise. + case "$host_os" in + *-musl*) gl_cv_func_posix_spawn_file_actions_addclose_works="guessing no" ;; + solaris*) gl_cv_func_posix_spawn_file_actions_addclose_works="guessing no" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_posix_spawn_file_actions_addclose_works="guessing no" ;; + *) gl_cv_func_posix_spawn_file_actions_addclose_works="guessing yes" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -int -main () + +#include +int main () { -term_styled_ostream_create(1,"",TTYCTL_AUTO,""); - ; + posix_spawn_file_actions_t actions; + if (posix_spawn_file_actions_init (&actions) != 0) + return 1; + if (posix_spawn_file_actions_addclose (&actions, -5) == 0) + return 2; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_libtextstyle=yes -else - ac_cv_libtextstyle='no' +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_posix_spawn_file_actions_addclose_works=yes +else $as_nop + gl_cv_func_posix_spawn_file_actions_addclose_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$ac_save_LIBS" + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libtextstyle" >&5 -$as_echo "$ac_cv_libtextstyle" >&6; } - if test "$ac_cv_libtextstyle" = yes; then - HAVE_LIBTEXTSTYLE=yes +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_posix_spawn_file_actions_addclose_works" >&5 +printf "%s\n" "$gl_cv_func_posix_spawn_file_actions_addclose_works" >&6; } + case "$gl_cv_func_posix_spawn_file_actions_addclose_works" in + *yes) ;; + *) REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=1 ;; + esac + fi -$as_echo "#define HAVE_LIBTEXTSTYLE 1" >>confdefs.h + if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1 || test $REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS spawn_faction_addclose.$ac_objext" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libtextstyle" >&5 -$as_echo_n "checking how to link with libtextstyle... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBTEXTSTYLE" >&5 -$as_echo "$LIBTEXTSTYLE" >&6; } - else - HAVE_LIBTEXTSTYLE=no - CPPFLAGS="$ac_save_CPPFLAGS" - LIBTEXTSTYLE= - LTLIBTEXTSTYLE= - LIBTEXTSTYLE_PREFIX= fi @@ -30680,336 +41780,376 @@ + GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=1 - if test $HAVE_LIBTEXTSTYLE = yes; then - TEXTSTYLE_H= + + + + +printf "%s\n" "#define GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE 1" >>confdefs.h + + + + + + + + + + if test $REPLACE_POSIX_SPAWN = 1; then + REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2=1 else - TEXTSTYLE_H=textstyle.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether posix_spawn_file_actions_adddup2 works" >&5 +printf %s "checking whether posix_spawn_file_actions_adddup2 works... " >&6; } +if test ${gl_cv_func_posix_spawn_file_actions_adddup2_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + # Guess no on musl libc and Solaris, yes otherwise. + case "$host_os" in + *-musl*) gl_cv_func_posix_spawn_file_actions_adddup2_works="guessing no";; + solaris*) gl_cv_func_posix_spawn_file_actions_adddup2_works="guessing no";; + # Guess no on native Windows. + mingw*) gl_cv_func_posix_spawn_file_actions_adddup2_works="guessing no" ;; + *) gl_cv_func_posix_spawn_file_actions_adddup2_works="guessing yes";; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +int main () +{ + posix_spawn_file_actions_t actions; + if (posix_spawn_file_actions_init (&actions) != 0) + return 1; + if (posix_spawn_file_actions_adddup2 (&actions, 10000000, 2) == 0) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_posix_spawn_file_actions_adddup2_works=yes +else $as_nop + gl_cv_func_posix_spawn_file_actions_adddup2_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - fi - if test -n "$TEXTSTYLE_H"; then - GL_GENERATE_TEXTSTYLE_H_TRUE= - GL_GENERATE_TEXTSTYLE_H_FALSE='#' -else - GL_GENERATE_TEXTSTYLE_H_TRUE='#' - GL_GENERATE_TEXTSTYLE_H_FALSE= fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_posix_spawn_file_actions_adddup2_works" >&5 +printf "%s\n" "$gl_cv_func_posix_spawn_file_actions_adddup2_works" >&6; } + case "$gl_cv_func_posix_spawn_file_actions_adddup2_works" in + *yes) ;; + *) REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2=1 ;; + esac + fi + if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1 || test $REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2 = 1; then - LOCALCHARSET_TESTS_ENVIRONMENT= - if test "$gl_threads_api" = posix; then - # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the - # pthread_rwlock_* functions. - has_rwlock=false - ac_fn_c_check_type "$LINENO" "pthread_rwlock_t" "ac_cv_type_pthread_rwlock_t" "#include -" -if test "x$ac_cv_type_pthread_rwlock_t" = xyes; then : - has_rwlock=true + gl_LIBOBJS="$gl_LIBOBJS spawn_faction_adddup2.$ac_objext" -$as_echo "#define HAVE_PTHREAD_RWLOCK 1" >>confdefs.h + fi -fi - if $has_rwlock; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthread_rwlock_rdlock prefers a writer to a reader" >&5 -$as_echo_n "checking whether pthread_rwlock_rdlock prefers a writer to a reader... " >&6; } -if ${gl_cv_pthread_rwlock_rdlock_prefer_writer+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LIBS="$LIBS" - LIBS="$LIBS $LIBMULTITHREAD" - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess no on glibc systems. - *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; - # Guess no on musl systems. - *-musl*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; - # Guess no on bionic systems. - *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; - # Guess yes on native Windows with the mingw-w64 winpthreads library. - # Guess no on native Windows with the gnulib windows-rwlock module. - mingw*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then - gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" - else - gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" - fi - ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -#define SUCCEED() exit (0) -#define FAILURE() exit (1) -#define UNEXPECTED(n) (exit (10 + (n))) -/* The main thread creates the waiting writer and the requesting reader threads - in the default way; this guarantees that they have the same priority. - We can reuse the main thread as first reader thread. */ -static pthread_rwlock_t lock; -static pthread_t reader1; -static pthread_t writer; -static pthread_t reader2; -static pthread_t timer; -/* Used to pass control from writer to reader2 and from reader2 to timer, - as in a relay race. - Passing control from one running thread to another running thread - is most likely faster than to create the second thread. */ -static pthread_mutex_t baton; + GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2=1 -static void * -timer_func (void *ignored) -{ - /* Step 13 (can be before or after step 12): - The timer thread takes the baton, then waits a moment to make sure - it can tell whether the second reader thread is blocked at step 12. */ - if (pthread_mutex_lock (&baton)) - UNEXPECTED (13); - usleep (100000); - /* By the time we get here, it's clear that the second reader thread is - blocked at step 12. This is the desired behaviour. */ - SUCCEED (); -} -static void * -reader2_func (void *ignored) -{ - int err; - /* Step 8 (can be before or after step 7): - The second reader thread takes the baton, then waits a moment to make sure - the writer thread has reached step 7. */ - if (pthread_mutex_lock (&baton)) - UNEXPECTED (8); - usleep (100000); - /* Step 9: The second reader thread requests the lock. */ - err = pthread_rwlock_tryrdlock (&lock); - if (err == 0) - FAILURE (); - else if (err != EBUSY) - UNEXPECTED (9); - /* Step 10: Launch a timer, to test whether the next call blocks. */ - if (pthread_create (&timer, NULL, timer_func, NULL)) - UNEXPECTED (10); - /* Step 11: Release the baton. */ - if (pthread_mutex_unlock (&baton)) - UNEXPECTED (11); - /* Step 12: The second reader thread requests the lock. */ - err = pthread_rwlock_rdlock (&lock); - if (err == 0) - FAILURE (); + + +printf "%s\n" "#define GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2 1" >>confdefs.h + + + + + + + + + + if test $REPLACE_POSIX_SPAWN = 1; then + REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=1 else - UNEXPECTED (12); -} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether posix_spawn_file_actions_addopen works" >&5 +printf %s "checking whether posix_spawn_file_actions_addopen works... " >&6; } +if test ${gl_cv_func_posix_spawn_file_actions_addopen_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + # Guess no on musl libc and Solaris, yes otherwise. + case "$host_os" in + *-musl*) gl_cv_func_posix_spawn_file_actions_addopen_works="guessing no";; + solaris*) gl_cv_func_posix_spawn_file_actions_addopen_works="guessing no";; + # Guess no on native Windows. + mingw*) gl_cv_func_posix_spawn_file_actions_addopen_works="guessing no" ;; + *) gl_cv_func_posix_spawn_file_actions_addopen_works="guessing yes";; + esac -static void * -writer_func (void *ignored) -{ - /* Step 4: Take the baton, so that the second reader thread does not go ahead - too early. */ - if (pthread_mutex_lock (&baton)) - UNEXPECTED (4); - /* Step 5: Create the second reader thread. */ - if (pthread_create (&reader2, NULL, reader2_func, NULL)) - UNEXPECTED (5); - /* Step 6: Release the baton. */ - if (pthread_mutex_unlock (&baton)) - UNEXPECTED (6); - /* Step 7: The writer thread requests the lock. */ - if (pthread_rwlock_wrlock (&lock)) - UNEXPECTED (7); - return NULL; -} +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -int -main () +#include +#include +int main () { - reader1 = pthread_self (); - - /* Step 1: The main thread initializes the lock and the baton. */ - if (pthread_rwlock_init (&lock, NULL)) - UNEXPECTED (1); - if (pthread_mutex_init (&baton, NULL)) - UNEXPECTED (1); - /* Step 2: The main thread acquires the lock as a reader. */ - if (pthread_rwlock_rdlock (&lock)) - UNEXPECTED (2); - /* Step 3: Create the writer thread. */ - if (pthread_create (&writer, NULL, writer_func, NULL)) - UNEXPECTED (3); - /* Job done. Go to sleep. */ - for (;;) - { - sleep (1); - } + posix_spawn_file_actions_t actions; + if (posix_spawn_file_actions_init (&actions) != 0) + return 1; + if (posix_spawn_file_actions_addopen (&actions, 10000000, "foo", 0, O_RDONLY) + == 0) + return 2; + return 0; } - _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_pthread_rwlock_rdlock_prefer_writer=yes -else - gl_cv_pthread_rwlock_rdlock_prefer_writer=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_posix_spawn_file_actions_addopen_works=yes +else $as_nop + gl_cv_func_posix_spawn_file_actions_addopen_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - LIBS="$save_LIBS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_pthread_rwlock_rdlock_prefer_writer" >&5 -$as_echo "$gl_cv_pthread_rwlock_rdlock_prefer_writer" >&6; } - case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in - *yes) +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_posix_spawn_file_actions_addopen_works" >&5 +printf "%s\n" "$gl_cv_func_posix_spawn_file_actions_addopen_works" >&6; } + case "$gl_cv_func_posix_spawn_file_actions_addopen_works" in + *yes) ;; + *) REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=1 ;; + esac + fi + + if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1 || test $REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS spawn_faction_addopen.$ac_objext" + + fi + + + + + + + + + + GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN 1" >>confdefs.h + + + + + + + if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS spawn_faction_destroy.$ac_objext" + + fi + + + + + + + + + + GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_DESTROY 1" >>confdefs.h + + + + + + + if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS spawn_faction_init.$ac_objext" + + fi + + + + + + + + + + GL_GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_INIT 1" >>confdefs.h + + + + + + + if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS spawnattr_destroy.$ac_objext" + + fi + + + + + + + + + + GL_GNULIB_POSIX_SPAWNATTR_DESTROY=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_POSIX_SPAWNATTR_DESTROY 1" >>confdefs.h + + + + + + + if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS spawnattr_init.$ac_objext" + + fi + + + + + + + + + + GL_GNULIB_POSIX_SPAWNATTR_INIT=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_POSIX_SPAWNATTR_INIT 1" >>confdefs.h + + -$as_echo "#define HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER 1" >>confdefs.h - ;; - esac - fi - # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - #include -int -main () -{ + if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then -#if __FreeBSD__ == 4 -error "No, in FreeBSD 4.0 recursive mutexes actually don't work." -#elif (defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ \ - && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) -error "No, in Mac OS X < 10.7 recursive mutexes actually don't work." -#else -int x = (int)PTHREAD_MUTEX_RECURSIVE; -return !x; -#endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : -$as_echo "#define HAVE_PTHREAD_MUTEX_RECURSIVE 1" >>confdefs.h -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - : -cat >>confdefs.h <<_ACEOF -#define GNULIB_LOCK 1 -_ACEOF + gl_LIBOBJS="$gl_LIBOBJS spawnattr_setflags.$ac_objext" + fi - for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF -fi -done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 -$as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if ${ac_cv_func_malloc_0_nonnull+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on platforms where we know the result. - *-gnu* | gnu* | *-musl* | freebsd* | netbsd* | openbsd* \ - | hpux* | solaris* | cygwin* | mingw*) - ac_cv_func_malloc_0_nonnull="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; - esac + GL_GNULIB_POSIX_SPAWNATTR_SETFLAGS=1 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H - # include - #else - char *malloc (); - #endif -int -main () -{ -char *p = malloc (0); - int result = !p; - free (p); - return result; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_malloc_0_nonnull=yes -else - ac_cv_func_malloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } - case "$ac_cv_func_malloc_0_nonnull" in - *yes) +printf "%s\n" "#define GNULIB_TEST_POSIX_SPAWNATTR_SETFLAGS 1" >>confdefs.h -$as_echo "#define HAVE_MALLOC_GNU 1" >>confdefs.h - ;; - *) - $as_echo "#define HAVE_MALLOC_GNU 0" >>confdefs.h - REPLACE_MALLOC=1 - ;; - esac - if test $REPLACE_MALLOC = 1; then + if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then @@ -31018,37 +42158,41 @@ - gl_LIBOBJS="$gl_LIBOBJS malloc.$ac_objext" + gl_LIBOBJS="$gl_LIBOBJS spawnattr_setpgroup.$ac_objext" fi -cat >>confdefs.h <<_ACEOF -#define GNULIB_MALLOC_GNU 1 -_ACEOF - if test $gl_cv_func_malloc_posix = yes; then -$as_echo "#define HAVE_MALLOC_POSIX 1" >>confdefs.h - else - REPLACE_MALLOC=1 - fi + GL_GNULIB_POSIX_SPAWNATTR_SETPGROUP=1 - if test $REPLACE_MALLOC = 1; then +printf "%s\n" "#define GNULIB_TEST_POSIX_SPAWNATTR_SETPGROUP 1" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS malloc.$ac_objext" + + + if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS spawnattr_setsigmask.$ac_objext" fi @@ -31056,1288 +42200,1322 @@ - GNULIB_MALLOC_POSIX=1 + GL_GNULIB_POSIX_SPAWNATTR_SETSIGMASK=1 -$as_echo "#define GNULIB_TEST_MALLOC_POSIX 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_POSIX_SPAWNATTR_SETSIGMASK 1" >>confdefs.h + if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - if test $gl_cv_have_include_next = yes; then - gl_cv_next_math_h='<'math.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_math_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test $ac_cv_header_math_h = yes; then + gl_LIBOBJS="$gl_LIBOBJS spawnp.$ac_objext" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac + fi - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'math.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - gl_cv_absolute_math_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_math_h - gl_cv_next_math_h='"'$gl_header'"' - else - gl_cv_next_math_h='<'math.h'>' - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_math_h" >&5 -$as_echo "$gl_cv_next_math_h" >&6; } - fi - NEXT_MATH_H=$gl_cv_next_math_h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'math.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_math_h - fi - NEXT_AS_FIRST_DIRECTIVE_MATH_H=$gl_next_as_first_directive + GL_GNULIB_POSIX_SPAWNP=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NAN macro works" >&5 -$as_echo_n "checking whether NAN macro works... " >&6; } -if ${gl_cv_header_math_nan_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + + +printf "%s\n" "#define GNULIB_TEST_POSIX_SPAWNP 1" >>confdefs.h + + + + + + if test $gl_cv_func_frexp_no_libm = yes; then + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether frexp works" >&5 +printf %s "checking whether frexp works... " >&6; } +if test ${gl_cv_func_frexp_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + case "$host_os" in + netbsd* | irix*) gl_cv_func_frexp_works="guessing no" ;; + mingw*) # Guess yes with MSVC, no with mingw. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -int -main () -{ -/* Solaris 10 has a broken definition of NAN. Other platforms - fail to provide NAN, or provide it only in C99 mode; this - test only needs to fail when NAN is provided but wrong. */ - float f = 1.0f; -#ifdef NAN - f = NAN; + +#ifdef _MSC_VER + Good #endif - return f == 0; - ; - return 0; -} + _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_math_nan_works=yes -else - gl_cv_header_math_nan_works=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Good" >/dev/null 2>&1 +then : + gl_cv_func_frexp_works="guessing yes" +else $as_nop + gl_cv_func_frexp_works="guessing no" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_math_nan_works" >&5 -$as_echo "$gl_cv_header_math_nan_works" >&6; } - if test $gl_cv_header_math_nan_works = no; then - REPLACE_NAN=1 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether HUGE_VAL works" >&5 -$as_echo_n "checking whether HUGE_VAL works... " >&6; } -if ${gl_cv_header_math_huge_val_works+:} false; then : - $as_echo_n "(cached) " >&6 -else +rm -rf conftest* + + ;; + *) gl_cv_func_frexp_works="guessing yes" ;; + esac + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + +#include #include -int -main () +#include +#if HAVE_DECL_ALARM +# include +# include +#endif +/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. + ICC 10.0 has a bug when optimizing the expression -zero. + The expression -DBL_MIN * DBL_MIN does not work when cross-compiling + to PowerPC on Mac OS X 10.5. */ +#if defined __hpux || defined __sgi || defined __ICC +static double +compute_minus_zero (void) { -/* Solaris 10 has a broken definition of HUGE_VAL. */ - double d = HUGE_VAL; - return d == 0; - ; - return 0; + return -DBL_MIN * DBL_MIN; +} +# define minus_zero compute_minus_zero () +#else +double minus_zero = -0.0; +#endif +int main() +{ + int result = 0; + int i; + volatile double x; + double zero = 0.0; +#if HAVE_DECL_ALARM + /* NeXTstep 3.3 frexp() runs into an endless loop when called on an infinite + number. Let the test fail in this case. */ + signal (SIGALRM, SIG_DFL); + alarm (5); +#endif + /* Test on denormalized numbers. */ + for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) + ; + if (x > 0.0) + { + int exp; + double y = frexp (x, &exp); + /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022. + On NetBSD: y = 0.75. Correct: y = 0.5. */ + if (y != 0.5) + result |= 1; + } + /* Test on infinite numbers. */ + x = 1.0 / zero; + { + int exp; + double y = frexp (x, &exp); + if (y != x) + result |= 2; + } + /* Test on negative zero. */ + x = minus_zero; + { + int exp; + double y = frexp (x, &exp); + if (memcmp (&y, &x, sizeof x)) + result |= 4; + } + return result; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_math_huge_val_works=yes -else - gl_cv_header_math_huge_val_works=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_frexp_works=yes +else $as_nop + gl_cv_func_frexp_works=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_math_huge_val_works" >&5 -$as_echo "$gl_cv_header_math_huge_val_works" >&6; } - if test $gl_cv_header_math_huge_val_works = no; then - REPLACE_HUGE_VAL=1 - fi - - - - - +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexp_works" >&5 +printf "%s\n" "$gl_cv_func_frexp_works" >&6; } + case "$gl_cv_func_frexp_works" in + *yes) +printf "%s\n" "#define HAVE_FREXP_IN_LIBC 1" >>confdefs.h - : + ;; + esac + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ldexp can be used without linking with libm" >&5 +printf %s "checking whether ldexp can be used without linking with libm... " >&6; } +if test ${gl_cv_func_ldexp_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + double x; + int y; +int +main (void) +{ +return ldexp (x, y) < 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_ldexp_no_libm=yes +else $as_nop + gl_cv_func_ldexp_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexp_no_libm" >&5 +printf "%s\n" "$gl_cv_func_ldexp_no_libm" >&6; } + if test $gl_cv_func_ldexp_no_libm = yes; then +printf "%s\n" "#define HAVE_LDEXP_IN_LIBC 1" >>confdefs.h + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether frexpl() can be used without linking with libm" >&5 +printf %s "checking whether frexpl() can be used without linking with libm... " >&6; } +if test ${gl_cv_func_frexpl_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + long double x; +int +main (void) +{ +int e; return frexpl (x, &e) > 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_frexpl_no_libm=yes +else $as_nop + gl_cv_func_frexpl_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_no_libm" >&5 +printf "%s\n" "$gl_cv_func_frexpl_no_libm" >&6; } - if case "$host_os" in - mingw*) true ;; - *) test $ac_cv_func_mbsinit = yes ;; - esac \ - && test $ac_cv_func_mbrtowc = yes; then + if test $gl_cv_func_frexpl_no_libm = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether frexpl works" >&5 +printf %s "checking whether frexpl works... " >&6; } +if test ${gl_cv_func_frexpl_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles incomplete characters" >&5 -$as_echo_n "checking whether mbrtowc handles incomplete characters... " >&6; } -if ${gl_cv_func_mbrtowc_incomplete_state+:} false; then : - $as_echo_n "(cached) " >&6 -else + case "$host_os" in + aix | aix[3-6]* | beos* | darwin* | irix* | mingw* | pw*) + gl_cv_func_frexpl_works="guessing no";; + *) gl_cv_func_frexpl_works="guessing yes";; + esac - case "$host_os" in - # Guess no on AIX and OSF/1. - aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; - esac - if test $LOCALE_JA != none; then - if test "$cross_compiling" = yes; then : - : -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -int main () +#include +#include +/* Override the values of , like done in float.in.h. */ +#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP (-16381) +#endif +#if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__) +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP (-16381) +#endif +#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__ +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP DBL_MIN_EXP +#endif +#if defined __sgi && (LDBL_MANT_DIG >= 106) +# if defined __GNUC__ +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP DBL_MIN_EXP +# endif +#endif +extern +#ifdef __cplusplus +"C" +#endif +long double frexpl (long double, int *); +long double zero = 0.0L; +int main() { - if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) - { - const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ - mbstate_t state; - wchar_t wc; - - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) - if (mbsinit (&state)) - return 2; - } - return 0; + int result = 0; + volatile long double x; + /* Test on finite numbers that fails on AIX 5.1. */ + x = 16.0L; + { + int exp = -9999; + frexpl (x, &exp); + if (exp != 5) + result |= 1; + } + /* Test on finite numbers that fails on Mac OS X 10.4, because its frexpl + function returns an invalid (incorrectly normalized) value: it returns + y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } + but the correct result is + 0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 } */ + x = 1.01L; + { + int exp = -9999; + long double y = frexpl (x, &exp); + if (!(exp == 1 && y == 0.505L)) + result |= 2; + } + /* Test on large finite numbers. This fails on BeOS at i = 16322, while + LDBL_MAX_EXP = 16384. + In the loop end test, we test x against Infinity, rather than comparing + i with LDBL_MAX_EXP, because BeOS has a wrong LDBL_MAX_EXP. */ + { + int i; + for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L) + { + int exp = -9999; + frexpl (x, &exp); + if (exp != i) + { + result |= 4; + break; + } + } + } + /* Test on denormalized numbers. */ + { + int i; + for (i = 1, x = 1.0L; i >= LDBL_MIN_EXP; i--, x *= 0.5L) + ; + if (x > 0.0L) + { + int exp; + long double y = frexpl (x, &exp); + /* On machines with IEEE854 arithmetic: x = 1.68105e-4932, + exp = -16382, y = 0.5. On Mac OS X 10.5: exp = -16384, y = 0.5. */ + if (exp != LDBL_MIN_EXP - 1) + result |= 8; + } + } + /* Test on infinite numbers. */ + /* The Microsoft MSVC 14 compiler chokes on the expression 1.0 / 0.0. */ + x = 1.0L / zero; + { + int exp; + long double y = frexpl (x, &exp); + if (y != x) + result |= 16; + } + return result; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_mbrtowc_incomplete_state=yes -else - gl_cv_func_mbrtowc_incomplete_state=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_frexpl_works=yes +else $as_nop + gl_cv_func_frexpl_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - else - if test $LOCALE_FR_UTF8 != none; then - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -int main () -{ - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) - { - const char input[] = "B\303\274\303\237er"; /* "Büßer" */ - mbstate_t state; - wchar_t wc; +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_works" >&5 +printf "%s\n" "$gl_cv_func_frexpl_works" >&6; } - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) - if (mbsinit (&state)) - return 2; - } + case "$gl_cv_func_frexpl_works" in + *yes) gl_func_frexpl_no_libm=yes ;; + *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; + esac + else + gl_func_frexpl_no_libm=no + REPLACE_FREXPL=1 + fi + if test $gl_func_frexpl_no_libm = yes; then + +printf "%s\n" "#define HAVE_FREXPL_IN_LIBC 1" >>confdefs.h + + ac_fn_check_decl "$LINENO" "frexpl" "ac_cv_have_decl_frexpl" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_frexpl" = xyes +then : + +else $as_nop + HAVE_DECL_FREXPL=0 +fi + fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ldexpl() can be used without linking with libm" >&5 +printf %s "checking whether ldexpl() can be used without linking with libm... " >&6; } +if test ${gl_cv_func_ldexpl_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + long double x; +int +main (void) +{ +return ldexpl (x, -1) > 0; + ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_mbrtowc_incomplete_state=yes -else - gl_cv_func_mbrtowc_incomplete_state=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_ldexpl_no_libm=yes +else $as_nop + gl_cv_func_ldexpl_no_libm=no fi - - fi - fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_incomplete_state" >&5 -$as_echo "$gl_cv_func_mbrtowc_incomplete_state" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexpl_no_libm" >&5 +printf "%s\n" "$gl_cv_func_ldexpl_no_libm" >&6; } + if test $gl_cv_func_ldexpl_no_libm = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ldexpl works" >&5 +printf %s "checking whether ldexpl works... " >&6; } +if test ${gl_cv_func_ldexpl_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc works as well as mbtowc" >&5 -$as_echo_n "checking whether mbrtowc works as well as mbtowc... " >&6; } -if ${gl_cv_func_mbrtowc_sanitycheck+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test "$cross_compiling" = yes +then : - case "$host_os" in - # Guess no on Solaris 8. - solaris2.8) gl_cv_func_mbrtowc_sanitycheck="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbrtowc_sanitycheck="guessing yes" ;; - esac - if test $LOCALE_ZH_CN != none; then - if test "$cross_compiling" = yes; then : - : -else + case "$host_os" in + aix | aix[3-6]*) gl_cv_func_ldexpl_works="guessing no" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_ldexpl_works="guessing yes" ;; + *) gl_cv_func_ldexpl_works="guessing yes" ;; + esac + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -int main () +#include +extern +#ifdef __cplusplus +"C" +#endif +long double ldexpl (long double, int); +int main() { - /* This fails on Solaris 8: - mbrtowc returns 2, and sets wc to 0x00F0. - mbtowc returns 4 (correct) and sets wc to 0x5EDC. */ - if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) - { - char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ - mbstate_t state; - wchar_t wc; - - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, input + 3, 6, &state) != 4 - && mbtowc (&wc, input + 3, 6) == 4) - return 2; - } - return 0; + int result = 0; + { + volatile long double x = 1.0; + volatile long double y = ldexpl (x, -1); + if (y != 0.5L) + result |= 1; + } + { + volatile long double x = 1.73205L; + volatile long double y = ldexpl (x, 0); + if (y != x) + result |= 2; + } + return result; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_mbrtowc_sanitycheck=yes -else - gl_cv_func_mbrtowc_sanitycheck=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_ldexpl_works=yes +else $as_nop + gl_cv_func_ldexpl_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_sanitycheck" >&5 -$as_echo "$gl_cv_func_mbrtowc_sanitycheck" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexpl_works" >&5 +printf "%s\n" "$gl_cv_func_ldexpl_works" >&6; } - REPLACE_MBSTATE_T=0 - case "$gl_cv_func_mbrtowc_incomplete_state" in - *yes) ;; - *) REPLACE_MBSTATE_T=1 ;; - esac - case "$gl_cv_func_mbrtowc_sanitycheck" in - *yes) ;; - *) REPLACE_MBSTATE_T=1 ;; + case "$gl_cv_func_ldexpl_works" in + *yes) + +printf "%s\n" "#define HAVE_LDEXPL_IN_LIBC 1" >>confdefs.h + + ac_fn_check_decl "$LINENO" "ldexpl" "ac_cv_have_decl_ldexpl" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_ldexpl" = xyes +then : + +else $as_nop + HAVE_DECL_LDEXPL=0 +fi + ;; esac - else - REPLACE_MBSTATE_T=1 fi - if test $ac_cv_func_mbrtowc = no; then - HAVE_MBRTOWC=0 - ac_fn_c_check_decl "$LINENO" "mbrtowc" "ac_cv_have_decl_mbrtowc" " -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include + if test $gl_cv_func_vfprintf_posix = no; then -" -if test "x$ac_cv_have_decl_mbrtowc" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_MBRTOWC $ac_have_decl -_ACEOF - if test $ac_cv_have_decl_mbrtowc = yes; then - REPLACE_MBRTOWC=1 - fi - else - if test $REPLACE_MBSTATE_T = 1; then - REPLACE_MBRTOWC=1 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles a NULL pwc argument" >&5 -$as_echo_n "checking whether mbrtowc handles a NULL pwc argument... " >&6; } -if ${gl_cv_func_mbrtowc_null_arg1+:} false; then : - $as_echo_n "(cached) " >&6 -else - case "$host_os" in - # Guess no on Solaris. - solaris*) gl_cv_func_mbrtowc_null_arg1="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; - esac - if test $LOCALE_FR_UTF8 != none; then - if test "$cross_compiling" = yes; then : + + + + + gl_LIBOBJS="$gl_LIBOBJS printf.$ac_objext" + + REPLACE_PRINTF=1 + +printf "%s\n" "#define REPLACE_PRINTF_POSIX 1" >>confdefs.h + : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -int main () -{ - int result = 0; + fi - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) - { - char input[] = "\303\237er"; - mbstate_t state; - wchar_t wc; - size_t ret; - memset (&state, '\0', sizeof (mbstate_t)); - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input, 5, &state); - if (ret != 2) - result |= 1; - if (!mbsinit (&state)) - result |= 2; - memset (&state, '\0', sizeof (mbstate_t)); - ret = mbrtowc (NULL, input, 5, &state); - if (ret != 2) /* Solaris 7 fails here: ret is -1. */ - result |= 4; - if (!mbsinit (&state)) - result |= 8; - } - return result; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_mbrtowc_null_arg1=yes -else - gl_cv_func_mbrtowc_null_arg1=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_null_arg1" >&5 -$as_echo "$gl_cv_func_mbrtowc_null_arg1" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles a NULL string argument" >&5 -$as_echo_n "checking whether mbrtowc handles a NULL string argument... " >&6; } -if ${gl_cv_func_mbrtowc_null_arg2+:} false; then : - $as_echo_n "(cached) " >&6 -else - case "$host_os" in - # Guess no on OSF/1. - osf*) gl_cv_func_mbrtowc_null_arg2="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;; - esac - if test $LOCALE_FR_UTF8 != none; then - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + GL_GNULIB_PRINTF_POSIX=1 -#include -#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -int main () -{ - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) - { - mbstate_t state; - wchar_t wc; - int ret; - memset (&state, '\0', sizeof (mbstate_t)); - wc = (wchar_t) 0xBADFACE; - mbrtowc (&wc, NULL, 5, &state); - /* Check that wc was not modified. */ - if (wc != (wchar_t) 0xBADFACE) - return 2; - } - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_mbrtowc_null_arg2=yes -else - gl_cv_func_mbrtowc_null_arg2=no + + + +printf "%s\n" "#define GNULIB_TEST_PRINTF_POSIX 1" >>confdefs.h + + + + + ac_fn_check_decl "$LINENO" "program_invocation_name" "ac_cv_have_decl_program_invocation_name" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_program_invocation_name" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +printf "%s\n" "#define HAVE_DECL_PROGRAM_INVOCATION_NAME $ac_have_decl" >>confdefs.h + + ac_fn_check_decl "$LINENO" "program_invocation_short_name" "ac_cv_have_decl_program_invocation_short_name" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_program_invocation_short_name" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 fi +printf "%s\n" "#define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME $ac_have_decl" >>confdefs.h - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_null_arg2" >&5 -$as_echo "$gl_cv_func_mbrtowc_null_arg2" >&6; } + : + : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc has a correct return value" >&5 -$as_echo_n "checking whether mbrtowc has a correct return value... " >&6; } -if ${gl_cv_func_mbrtowc_retval+:} false; then : - $as_echo_n "(cached) " >&6 -else - case "$host_os" in - # Guess no on HP-UX, Solaris, native Windows. - hpux* | solaris* | mingw*) gl_cv_func_mbrtowc_retval="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbrtowc_retval="guessing yes" ;; - esac - if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ - || { case "$host_os" in mingw*) true;; *) false;; esac; }; then - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + ac_fn_c_check_func "$LINENO" "raise" "ac_cv_func_raise" +if test "x$ac_cv_func_raise" = xyes +then : + printf "%s\n" "#define HAVE_RAISE 1" >>confdefs.h -#include -#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -int main () -{ - int result = 0; - int found_some_locale = 0; - /* This fails on Solaris. */ - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) - { - char input[] = "B\303\274\303\237er"; /* "Büßer" */ - mbstate_t state; - wchar_t wc; +fi - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) - { - input[1] = '\0'; - if (mbrtowc (&wc, input + 2, 5, &state) != 1) - result |= 1; - } - found_some_locale = 1; - } - /* This fails on HP-UX 11.11. */ - if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) - { - char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ - mbstate_t state; - wchar_t wc; + if test $ac_cv_func_raise = no; then + HAVE_RAISE=0 + else - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) - { - input[1] = '\0'; - if (mbrtowc (&wc, input + 2, 5, &state) != 2) - result |= 2; - } - found_some_locale = 1; - } - /* This fails on native Windows. */ - if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) - { - char input[] = "<\223\372\226\173\214\352>"; /* "<日本語>" */ - mbstate_t state; - wchar_t wc; - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) - { - input[3] = '\0'; - if (mbrtowc (&wc, input + 4, 4, &state) != 1) - result |= 4; - } - found_some_locale = 1; - } - if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) - { - char input[] = "<\244\351\245\273\273\171>"; /* "<日本語>" */ - mbstate_t state; - wchar_t wc; + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + REPLACE_RAISE=1 + fi - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) - { - input[3] = '\0'; - if (mbrtowc (&wc, input + 4, 4, &state) != 1) - result |= 8; - } - found_some_locale = 1; - } - if (setlocale (LC_ALL, "Chinese_China.936") != NULL) - { - char input[] = "<\310\325\261\276\325\132>"; /* "<日本語>" */ - mbstate_t state; - wchar_t wc; - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) - { - input[3] = '\0'; - if (mbrtowc (&wc, input + 4, 4, &state) != 1) - result |= 16; - } - found_some_locale = 1; - } - return (found_some_locale ? result : 77); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_mbrtowc_retval=yes -else - if test $? != 77; then - gl_cv_func_mbrtowc_retval=no - fi + + + HAVE_POSIX_SIGNALBLOCKING=0 + if test "$gl_cv_type_sigset_t" = yes; then + ac_fn_c_check_func "$LINENO" "sigprocmask" "ac_cv_func_sigprocmask" +if test "x$ac_cv_func_sigprocmask" = xyes +then : + HAVE_POSIX_SIGNALBLOCKING=1 fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + fi + + if test $HAVE_POSIX_SIGNALBLOCKING = 0; then + : fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_retval" >&5 -$as_echo "$gl_cv_func_mbrtowc_retval" >&6; } + fi + if test $HAVE_RAISE = 0 || test $REPLACE_RAISE = 1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc returns 0 when parsing a NUL character" >&5 -$as_echo_n "checking whether mbrtowc returns 0 when parsing a NUL character... " >&6; } -if ${gl_cv_func_mbrtowc_nul_retval+:} false; then : - $as_echo_n "(cached) " >&6 -else - case "$host_os" in - # Guess no on Solaris 8 and 9. - solaris2.[89]) gl_cv_func_mbrtowc_nul_retval="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbrtowc_nul_retval="guessing yes" ;; - esac - if test $LOCALE_ZH_CN != none; then - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -int main () -{ - /* This fails on Solaris 8 and 9. */ - if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) - { - mbstate_t state; - wchar_t wc; - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, "", 1, &state) != 0) - return 2; - } - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_mbrtowc_nul_retval=yes -else - gl_cv_func_mbrtowc_nul_retval=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_nul_retval" >&5 -$as_echo "$gl_cv_func_mbrtowc_nul_retval" >&6; } + gl_LIBOBJS="$gl_LIBOBJS raise.$ac_objext" + : + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc stores incomplete characters" >&5 -$as_echo_n "checking whether mbrtowc stores incomplete characters... " >&6; } -if ${gl_cv_func_mbrtowc_stores_incomplete+:} false; then : - $as_echo_n "(cached) " >&6 -else - case "$host_os" in - # Guess yes on native Windows. - mingw*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;; - *) gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;; - esac - case "$host_os" in - mingw*) - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -int main () -{ - int result = 0; - if (setlocale (LC_ALL, "French_France.65001") != NULL) - { - wchar_t wc = (wchar_t) 0xBADFACE; - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) - && wc != (wchar_t) 0xBADFACE) - result |= 1; - } - if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) - { - wchar_t wc = (wchar_t) 0xBADFACE; - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, "\226", 1, &state) == (size_t)(-2) - && wc != (wchar_t) 0xBADFACE) - result |= 2; - } - if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) - { - wchar_t wc = (wchar_t) 0xBADFACE; - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, "\245", 1, &state) == (size_t)(-2) - && wc != (wchar_t) 0xBADFACE) - result |= 4; - } - if (setlocale (LC_ALL, "Chinese_China.936") != NULL) - { - wchar_t wc = (wchar_t) 0xBADFACE; - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, "\261", 1, &state) == (size_t)(-2) - && wc != (wchar_t) 0xBADFACE) - result |= 8; - } - return result; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_mbrtowc_stores_incomplete=no -else - gl_cv_func_mbrtowc_stores_incomplete=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - ;; - *) + GL_GNULIB_RAISE=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_RAISE 1" >>confdefs.h + - if test $LOCALE_FR_UTF8 != none; then - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -int main () -{ - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) - { - wchar_t wc = (wchar_t) 0xBADFACE; - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) - && wc != (wchar_t) 0xBADFACE) - return 1; - } - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_mbrtowc_stores_incomplete=no -else - gl_cv_func_mbrtowc_stores_incomplete=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - fi - ;; - esac + + + ac_fn_c_check_func "$LINENO" "rawmemchr" "ac_cv_func_rawmemchr" +if test "x$ac_cv_func_rawmemchr" = xyes +then : + printf "%s\n" "#define HAVE_RAWMEMCHR 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_stores_incomplete" >&5 -$as_echo "$gl_cv_func_mbrtowc_stores_incomplete" >&6; } + if test $ac_cv_func_rawmemchr = no; then + HAVE_RAWMEMCHR=0 + fi + if test $HAVE_RAWMEMCHR = 0; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc works on empty input" >&5 -$as_echo_n "checking whether mbrtowc works on empty input... " >&6; } -if ${gl_cv_func_mbrtowc_empty_input+:} false; then : - $as_echo_n "(cached) " >&6 -else - case "$host_os" in - # Guess no on AIX and glibc systems. - aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; - *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; - esac - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - #include - static wchar_t wc; - static mbstate_t mbs; - int - main (void) - { - return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2; - } -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_mbrtowc_empty_input=yes -else - gl_cv_func_mbrtowc_empty_input=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_empty_input" >&5 -$as_echo "$gl_cv_func_mbrtowc_empty_input" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C locale is free of encoding errors" >&5 -$as_echo_n "checking whether the C locale is free of encoding errors... " >&6; } -if ${gl_cv_func_mbrtowc_C_locale_sans_EILSEQ+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" + gl_LIBOBJS="$gl_LIBOBJS rawmemchr.$ac_objext" - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on native Windows. - mingw*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; - esac + : + fi -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - #include -int -main () -{ - int i; - char *locale = setlocale (LC_ALL, "C"); - if (! locale) - return 2; - for (i = CHAR_MIN; i <= CHAR_MAX; i++) - { - char c = i; - wchar_t wc; - mbstate_t mbs = { 0, }; - size_t ss = mbrtowc (&wc, &c, 1, &mbs); - if (1 < ss) - return 3; - } - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes -else - gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" >&5 -$as_echo "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" >&6; } - case "$gl_cv_func_mbrtowc_null_arg1" in - *yes) ;; - *) -$as_echo "#define MBRTOWC_NULL_ARG1_BUG 1" >>confdefs.h - REPLACE_MBRTOWC=1 - ;; - esac - case "$gl_cv_func_mbrtowc_null_arg2" in - *yes) ;; - *) -$as_echo "#define MBRTOWC_NULL_ARG2_BUG 1" >>confdefs.h - REPLACE_MBRTOWC=1 - ;; - esac - case "$gl_cv_func_mbrtowc_retval" in - *yes) ;; - *) -$as_echo "#define MBRTOWC_RETVAL_BUG 1" >>confdefs.h + GL_GNULIB_RAWMEMCHR=1 - REPLACE_MBRTOWC=1 - ;; - esac - case "$gl_cv_func_mbrtowc_nul_retval" in - *yes) ;; - *) -$as_echo "#define MBRTOWC_NUL_RETVAL_BUG 1" >>confdefs.h - REPLACE_MBRTOWC=1 - ;; - esac - case "$gl_cv_func_mbrtowc_stores_incomplete" in - *no) ;; - *) -$as_echo "#define MBRTOWC_STORES_INCOMPLETE_BUG 1" >>confdefs.h - REPLACE_MBRTOWC=1 - ;; - esac - case "$gl_cv_func_mbrtowc_empty_input" in - *yes) ;; - *) -$as_echo "#define MBRTOWC_EMPTY_INPUT_BUG 1" >>confdefs.h - REPLACE_MBRTOWC=1 - ;; - esac - case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in - *yes) ;; - *) -$as_echo "#define MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ 1" >>confdefs.h - REPLACE_MBRTOWC=1 - ;; - esac - fi - fi - if test $REPLACE_MBSTATE_T = 1; then - case "$host_os" in - mingw*) LIB_MBRTOWC= ;; - *) +printf "%s\n" "#define GNULIB_TEST_RAWMEMCHR 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 -$as_echo_n "checking whether imported symbols can be declared weak... " >&6; } -if ${gl_cv_have_weak+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_have_weak=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -extern void xyzzy (); -#pragma weak xyzzy -int -main () -{ -xyzzy(); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_have_weak=maybe -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test $gl_cv_have_weak = maybe; then - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __ELF__ - Extensible Linking Format - #endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Extensible Linking Format" >/dev/null 2>&1; then : - gl_cv_have_weak="guessing yes" -else - gl_cv_have_weak="guessing no" -fi -rm -f conftest* -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#pragma weak fputs -int main () -{ - return (fputs == NULL); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_have_weak=yes -else - gl_cv_have_weak=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - fi - case " $LDFLAGS " in - *" -static "*) gl_cv_have_weak=no ;; - esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 -$as_echo "$gl_cv_have_weak" >&6; } - case "$gl_cv_have_weak" in - *yes) -$as_echo "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h - ;; - esac - case "$gl_cv_have_weak" in - *yes) LIB_MBRTOWC= ;; - *) LIB_MBRTOWC="$LIBPTHREAD" ;; - esac - ;; - esac - else - LIB_MBRTOWC= - fi - if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" +# Check whether --with-libreadline-prefix was given. +if test ${with_libreadline_prefix+y} +then : + withval=$with_libreadline_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" - gl_LIBOBJS="$gl_LIBOBJS mbrtowc.$ac_objext" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" - if test $REPLACE_MBSTATE_T = 1; then + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + additional_libdir2="$withval/$acl_libdirstem2" + additional_libdir3="$withval/$acl_libdirstem3" + fi + fi + +fi + + if test "X$additional_libdir2" = "X$additional_libdir"; then + additional_libdir2= + fi + if test "X$additional_libdir3" = "X$additional_libdir"; then + additional_libdir3= + fi + LIBREADLINE= + LTLIBREADLINE= + INCREADLINE= + LIBREADLINE_PREFIX= + HAVE_LIBREADLINE= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='readline ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBREADLINE="${LIBREADLINE}${LIBREADLINE:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBREADLINE="${LTLIBREADLINE}${LTLIBREADLINE:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do + if test "X$found_dir" = "X"; then + eval dir=\$$additional_libdir_variable + if test -n "$dir"; then + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + fi + done + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBREADLINE; do + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBREADLINE="${LTLIBREADLINE}${LTLIBREADLINE:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then + LIBREADLINE="${LIBREADLINE}${LIBREADLINE:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBREADLINE="${LIBREADLINE}${LIBREADLINE:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBREADLINE="${LIBREADLINE}${LIBREADLINE:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBREADLINE; do + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBREADLINE="${LIBREADLINE}${LIBREADLINE:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBREADLINE="${LIBREADLINE}${LIBREADLINE:+ }$found_so" + else + LIBREADLINE="${LIBREADLINE}${LIBREADLINE:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBREADLINE="${LIBREADLINE}${LIBREADLINE:+ }$found_a" + else + LIBREADLINE="${LIBREADLINE}${LIBREADLINE:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'readline'; then + LIBREADLINE_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'readline'; then + LIBREADLINE_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem3 | */$acl_libdirstem3/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` + if test "$name" = 'readline'; then + LIBREADLINE_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCREADLINE; do + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCREADLINE="${INCREADLINE}${INCREADLINE:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then + haveit= + if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBREADLINE; do + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" - gl_LIBOBJS="$gl_LIBOBJS lc-charset-dispatch.$ac_objext" + if test "X$x" = "X-L$dependency_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$dependency_libdir"; then + LIBREADLINE="${LIBREADLINE}${LIBREADLINE:+ }-L$dependency_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBREADLINE; do + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + if test "X$x" = "X-L$dependency_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$dependency_libdir"; then + LTLIBREADLINE="${LTLIBREADLINE}${LTLIBREADLINE:+ }-L$dependency_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dep=`echo "X$dep" | sed -e 's/^X-l//'` + if test "X$dep" != Xc \ + || case $host_os in + linux* | gnu* | k*bsd*-gnu) false ;; + *) true ;; + esac; then + names_next_round="$names_next_round $dep" + fi + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBREADLINE="${LIBREADLINE}${LIBREADLINE:+ }$dep" + LTLIBREADLINE="${LTLIBREADLINE}${LTLIBREADLINE:+ }$dep" + ;; + esac + done + fi + else + LIBREADLINE="${LIBREADLINE}${LIBREADLINE:+ }-l$name" + LTLIBREADLINE="${LTLIBREADLINE}${LTLIBREADLINE:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBREADLINE="${LIBREADLINE}${LIBREADLINE:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBREADLINE="${LIBREADLINE}${LIBREADLINE:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBREADLINE="${LTLIBREADLINE}${LTLIBREADLINE:+ }-R$found_dir" + done + fi + am_save_CPPFLAGS="$CPPFLAGS" - gl_LIBOBJS="$gl_LIBOBJS mbtowc-lock.$ac_objext" + for element in $INCREADLINE; do + haveit= + for x in $CPPFLAGS; do + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done - CFLAG_VISIBILITY= - HAVE_VISIBILITY=0 - if test -n "$GCC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5 -$as_echo_n "checking whether the -Werror option is usable... " >&6; } -if ${gl_cv_cc_vis_werror+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for readline" >&5 +printf %s "checking for readline... " >&6; } +if test ${gl_cv_lib_readline+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_cv_lib_readline=no + am_save_LIBS="$LIBS" + for extra_lib in "" ncurses termcap curses; do + LIBS="$am_save_LIBS $LIBREADLINE" + if test -n "$extra_lib"; then + LIBS="$LIBS -l$extra_lib" + fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +#include +#include int -main () +main (void) { - +readline((char*)0); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_cc_vis_werror=yes -else - gl_cv_cc_vis_werror=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$gl_save_CFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5 -$as_echo "$gl_cv_cc_vis_werror" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5 -$as_echo_n "checking for simple visibility declarations... " >&6; } -if ${gl_cv_cc_visibility+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fvisibility=hidden" - if test $gl_cv_cc_vis_werror = yes; then - CFLAGS="$CFLAGS -Werror" - fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -extern __attribute__((__visibility__("hidden"))) int hiddenvar; - extern __attribute__((__visibility__("default"))) int exportedvar; - extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); - extern __attribute__((__visibility__("default"))) int exportedfunc (void); - void dummyfunc (void) {} - -int -main () -{ +if ac_fn_c_try_link "$LINENO" +then : + if test -n "$extra_lib"; then + gl_cv_lib_readline="yes, requires -l$extra_lib" + else + gl_cv_lib_readline="yes" + fi - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_cc_visibility=yes -else - gl_cv_cc_visibility=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$gl_save_CFLAGS" +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test "$gl_cv_lib_readline" != no; then + break + fi + done + LIBS="$am_save_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5 -$as_echo "$gl_cv_cc_visibility" >&6; } - if test $gl_cv_cc_visibility = yes; then - CFLAG_VISIBILITY="-fvisibility=hidden" - HAVE_VISIBILITY=1 - fi - fi - - - -cat >>confdefs.h <<_ACEOF -#define HAVE_VISIBILITY $HAVE_VISIBILITY -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_lib_readline" >&5 +printf "%s\n" "$gl_cv_lib_readline" >&6; } + if test "$gl_cv_lib_readline" != no; then +printf "%s\n" "#define HAVE_READLINE 1" >>confdefs.h + extra_lib=`echo "$gl_cv_lib_readline" | sed -n -e 's/yes, requires //p'` + if test -n "$extra_lib"; then + LIBREADLINE="$LIBREADLINE $extra_lib" + LTLIBREADLINE="$LTLIBREADLINE $extra_lib" fi - - - : - + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to link with libreadline" >&5 +printf %s "checking how to link with libreadline... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIBREADLINE" >&5 +printf "%s\n" "$LIBREADLINE" >&6; } + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBREADLINE= + LTLIBREADLINE= fi + ac_fn_c_check_header_compile "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default" +if test "x$ac_cv_header_readline_readline_h" = xyes +then : + printf "%s\n" "#define HAVE_READLINE_READLINE_H 1" >>confdefs.h +fi +ac_fn_c_check_header_compile "$LINENO" "readline/history.h" "ac_cv_header_readline_history_h" "$ac_includes_default" +if test "x$ac_cv_header_readline_history_h" = xyes +then : + printf "%s\n" "#define HAVE_READLINE_HISTORY_H 1" >>confdefs.h - GNULIB_MBRTOWC=1 - - - - - -$as_echo "#define GNULIB_TEST_MBRTOWC 1" >>confdefs.h - - - - +fi + if test "$gl_cv_lib_readline" = no; then @@ -32346,239 +43524,178 @@ + gl_LIBOBJS="$gl_LIBOBJS readline.$ac_objext" - if case "$host_os" in - mingw*) true ;; - *) test $ac_cv_func_mbsinit = yes ;; - esac \ - && test $ac_cv_func_mbrtowc = yes; then + : + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles incomplete characters" >&5 -$as_echo_n "checking whether mbrtowc handles incomplete characters... " >&6; } -if ${gl_cv_func_mbrtowc_incomplete_state+:} false; then : - $as_echo_n "(cached) " >&6 -else - case "$host_os" in - # Guess no on AIX and OSF/1. - aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; - esac - if test $LOCALE_JA != none; then - if test "$cross_compiling" = yes; then : - : -else + if test $ac_cv_func_readlink = no; then + HAVE_READLINK=0 + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether readlink signature is correct" >&5 +printf %s "checking whether readlink signature is correct... " >&6; } +if test ${gl_cv_decl_readlink_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#include -#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -int main () +#include + /* Cause compilation failure if original declaration has wrong type. */ + ssize_t readlink (const char *, char *, size_t); +int +main (void) { - if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) - { - const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ - mbstate_t state; - wchar_t wc; - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) - if (mbsinit (&state)) - return 2; - } + ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_mbrtowc_incomplete_state=yes -else - gl_cv_func_mbrtowc_incomplete_state=no +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_decl_readlink_works=yes +else $as_nop + gl_cv_decl_readlink_works=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_readlink_works" >&5 +printf "%s\n" "$gl_cv_decl_readlink_works" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether readlink handles trailing slash correctly" >&5 +printf %s "checking whether readlink handles trailing slash correctly... " >&6; } +if test ${gl_cv_func_readlink_trailing_slash+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # We have readlink, so assume ln -s works. + ln -s conftest.no-such conftest.link + ln -s conftest.link conftest.lnk2 + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on Linux or glibc systems. + linux-* | linux | *-gnu* | gnu*) + gl_cv_func_readlink_trailing_slash="guessing yes" ;; + # Guess no on AIX or HP-UX. + aix* | hpux*) + gl_cv_func_readlink_trailing_slash="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_readlink_trailing_slash="$gl_cross_guess_normal" ;; + esac - else - if test $LOCALE_FR_UTF8 != none; then - if test "$cross_compiling" = yes; then : - : -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include -#include -#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -int main () +int +main (void) { - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) - { - const char input[] = "B\303\274\303\237er"; /* "Büßer" */ - mbstate_t state; - wchar_t wc; - - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) - if (mbsinit (&state)) - return 2; - } +char buf[20]; + return readlink ("conftest.lnk2/", buf, sizeof buf) != -1; + ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_mbrtowc_incomplete_state=yes -else - gl_cv_func_mbrtowc_incomplete_state=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_readlink_trailing_slash=yes +else $as_nop + gl_cv_func_readlink_trailing_slash=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi - fi - + rm -f conftest.link conftest.lnk2 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_incomplete_state" >&5 -$as_echo "$gl_cv_func_mbrtowc_incomplete_state" >&6; } - +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_readlink_trailing_slash" >&5 +printf "%s\n" "$gl_cv_func_readlink_trailing_slash" >&6; } + case "$gl_cv_func_readlink_trailing_slash" in + *yes) + if test "$gl_cv_decl_readlink_works" != yes; then + REPLACE_READLINK=1 + fi + ;; + *) +printf "%s\n" "#define READLINK_TRAILING_SLASH_BUG 1" >>confdefs.h + REPLACE_READLINK=1 + ;; + esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc works as well as mbtowc" >&5 -$as_echo_n "checking whether mbrtowc works as well as mbtowc... " >&6; } -if ${gl_cv_func_mbrtowc_sanitycheck+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether readlink truncates results correctly" >&5 +printf %s "checking whether readlink truncates results correctly... " >&6; } +if test ${gl_cv_func_readlink_truncate+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # We have readlink, so assume ln -s works. + ln -s ab conftest.link + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on Linux or glibc systems. + linux-* | linux | *-gnu* | gnu*) + gl_cv_func_readlink_truncate="guessing yes" ;; + # Guess no on AIX or HP-UX. + aix* | hpux*) + gl_cv_func_readlink_truncate="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_readlink_truncate="$gl_cross_guess_normal" ;; + esac - case "$host_os" in - # Guess no on Solaris 8. - solaris2.8) gl_cv_func_mbrtowc_sanitycheck="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbrtowc_sanitycheck="guessing yes" ;; - esac - if test $LOCALE_ZH_CN != none; then - if test "$cross_compiling" = yes; then : - : -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include -#include -#include -#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -int main () +int +main (void) { - /* This fails on Solaris 8: - mbrtowc returns 2, and sets wc to 0x00F0. - mbtowc returns 4 (correct) and sets wc to 0x5EDC. */ - if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) - { - char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ - mbstate_t state; - wchar_t wc; - - memset (&state, '\0', sizeof (mbstate_t)); - if (mbrtowc (&wc, input + 3, 6, &state) != 4 - && mbtowc (&wc, input + 3, 6) == 4) - return 2; - } +char c; + return readlink ("conftest.link", &c, 1) != 1; + ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_mbrtowc_sanitycheck=yes -else - gl_cv_func_mbrtowc_sanitycheck=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_readlink_truncate=yes +else $as_nop + gl_cv_func_readlink_truncate=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_sanitycheck" >&5 -$as_echo "$gl_cv_func_mbrtowc_sanitycheck" >&6; } - - REPLACE_MBSTATE_T=0 - case "$gl_cv_func_mbrtowc_incomplete_state" in - *yes) ;; - *) REPLACE_MBSTATE_T=1 ;; - esac - case "$gl_cv_func_mbrtowc_sanitycheck" in - *yes) ;; - *) REPLACE_MBSTATE_T=1 ;; - esac - else - REPLACE_MBSTATE_T=1 - fi - - - - if test $ac_cv_func_mbsinit = no; then - HAVE_MBSINIT=0 - ac_fn_c_check_decl "$LINENO" "mbsinit" "ac_cv_have_decl_mbsinit" " -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include - -" -if test "x$ac_cv_have_decl_mbsinit" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 + rm -f conftest.link conftest.lnk2 fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_readlink_truncate" >&5 +printf "%s\n" "$gl_cv_func_readlink_truncate" >&6; } + case $gl_cv_func_readlink_truncate in + *yes) + if test "$gl_cv_decl_readlink_works" != yes; then + REPLACE_READLINK=1 + fi + ;; + *) -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_MBSINIT $ac_have_decl -_ACEOF +printf "%s\n" "#define READLINK_TRUNCATE_BUG 1" >>confdefs.h - if test $ac_cv_have_decl_mbsinit = yes; then - REPLACE_MBSINIT=1 - fi - else - if test $REPLACE_MBSTATE_T = 1; then - REPLACE_MBSINIT=1 - else - case "$host_os" in - mingw*) REPLACE_MBSINIT=1 ;; - esac - fi + REPLACE_READLINK=1 + ;; + esac fi - if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then + if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then @@ -32587,7 +43704,7 @@ - gl_LIBOBJS="$gl_LIBOBJS mbsinit.$ac_objext" + gl_LIBOBJS="$gl_LIBOBJS readlink.$ac_objext" : @@ -32598,161 +43715,84 @@ - GNULIB_MBSINIT=1 + GL_GNULIB_READLINK=1 -$as_echo "#define GNULIB_TEST_MBSINIT 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_READLINK 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbswidth is declared in " >&5 -$as_echo_n "checking whether mbswidth is declared in ... " >&6; } -if ${ac_cv_have_decl_mbswidth+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be included - before . */ -#include -#include -#include -#include - -int -main () -{ - - char *p = (char *) mbswidth; - return !p; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_have_decl_mbswidth=yes -else - ac_cv_have_decl_mbswidth=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_decl_mbswidth" >&5 -$as_echo "$ac_cv_have_decl_mbswidth" >&6; } - if test $ac_cv_have_decl_mbswidth = yes; then - ac_val=1 - else - ac_val=0 - fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_MBSWIDTH_IN_WCHAR_H $ac_val -_ACEOF + if test $REPLACE_REALLOC = 0; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether realloc (0, 0) returns nonnull" >&5 +printf %s "checking whether realloc (0, 0) returns nonnull... " >&6; } +if test ${ac_cv_func_realloc_0_nonnull+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | gnu* | *-musl* | midnightbsd* \ + | hpux* | solaris* | cygwin* | mingw* | msys* ) + ac_cv_func_realloc_0_nonnull="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;; + esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mbstate_t" >&5 -$as_echo_n "checking for mbstate_t... " >&6; } -if ${ac_cv_type_mbstate_t+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include +#include + int -main () +main (void) { -mbstate_t x; return sizeof x; +void *p = realloc (0, 0); + int result = !p; + free (p); + return result; ; return 0; } + _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_type_mbstate_t=yes -else - ac_cv_type_mbstate_t=no +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_func_realloc_0_nonnull=yes +else $as_nop + ac_cv_func_realloc_0_nonnull=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_mbstate_t" >&5 -$as_echo "$ac_cv_type_mbstate_t" >&6; } - if test $ac_cv_type_mbstate_t = yes; then - -$as_echo "#define HAVE_MBSTATE_T 1" >>confdefs.h - - else - -$as_echo "#define mbstate_t int" >>confdefs.h - - fi - - - - if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then - - - - - - - gl_LIBOBJS="$gl_LIBOBJS memchr.$ac_objext" - - - for ac_header in bp-sym.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "bp-sym.h" "ac_cv_header_bp_sym_h" "$ac_includes_default" -if test "x$ac_cv_header_bp_sym_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_BP_SYM_H 1 -_ACEOF - fi - -done - +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 +printf "%s\n" "$ac_cv_func_realloc_0_nonnull" >&6; } + case $ac_cv_func_realloc_0_nonnull in #( + *yes) : + ;; #( + *) : + REPLACE_REALLOC=1 ;; +esac fi - - - - - GNULIB_MEMCHR=1 - - - - - -$as_echo "#define GNULIB_TEST_MEMCHR 1" >>confdefs.h - - - - - - - - if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + if test $REPLACE_REALLOC = 1; then @@ -32761,31 +43801,28 @@ - gl_LIBOBJS="$gl_LIBOBJS msvc-inval.$ac_objext" + gl_LIBOBJS="$gl_LIBOBJS realloc.$ac_objext" fi - if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then - - - + if test $REPLACE_MALLOC = 1; then + REPLACE_REALLOC=1 + fi + if test $REPLACE_REALLOC = 1; then - gl_LIBOBJS="$gl_LIBOBJS msvc-nothrow.$ac_objext" - fi -cat >>confdefs.h <<_ACEOF -#define GNULIB_MSVC_NOTHROW 1 -_ACEOF + gl_LIBOBJS="$gl_LIBOBJS realloc.$ac_objext" + fi @@ -32795,82 +43832,52 @@ + GL_GNULIB_REALLOC_POSIX=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for obstacks that work with any size object" >&5 -$as_echo_n "checking for obstacks that work with any size object... " >&6; } -if ${ac_cv_func_obstack+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include "obstack.h" - void *obstack_chunk_alloc (size_t n) { return 0; } - void obstack_chunk_free (void *p) { } - /* Check that an internal function returns size_t, not int. */ - size_t _obstack_memory_used (struct obstack *); -int -main () -{ -struct obstack mem; - obstack_init (&mem); - obstack_free (&mem, 0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_func_obstack=yes -else - ac_cv_func_obstack=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_obstack" >&5 -$as_echo "$ac_cv_func_obstack" >&6; } - if test "$ac_cv_func_obstack" = yes; then +printf "%s\n" "#define GNULIB_TEST_REALLOC_POSIX 1" >>confdefs.h -$as_echo "#define HAVE_OBSTACK 1" >>confdefs.h - else + ac_fn_c_check_func "$LINENO" "reallocarray" "ac_cv_func_reallocarray" +if test "x$ac_cv_func_reallocarray" = xyes +then : + printf "%s\n" "#define HAVE_REALLOCARRAY 1" >>confdefs.h +fi - gl_LIBOBJS="$gl_LIBOBJS obstack.$ac_objext" + if test "$ac_cv_func_reallocarray" = no; then + HAVE_REALLOCARRAY=0 + elif test "$gl_cv_malloc_ptrdiff" = no; then + REPLACE_REALLOCARRAY=1 + fi - fi + if test $HAVE_REALLOCARRAY = 0 || test $REPLACE_REALLOCARRAY = 1; then - if test $ac_cv_func_obstack_printf = no ; then - if test $ac_cv_func_obstack_printf = yes; then - REPLACE_OBSTACK_PRINTF=1 - fi + gl_LIBOBJS="$gl_LIBOBJS reallocarray.$ac_objext" + : fi - - if test $ac_cv_have_decl_obstack_printf = no; then - HAVE_DECL_OBSTACK_PRINTF=0 - fi +printf "%s\n" "#define GNULIB_REALLOCARRAY 1" >>confdefs.h - if test $ac_cv_func_obstack_printf = no || test $REPLACE_OBSTACK_PRINTF = 1; then @@ -32879,244 +43886,175 @@ - gl_LIBOBJS="$gl_LIBOBJS obstack_printf.$ac_objext" - fi + GL_GNULIB_REALLOCARRAY=1 - GNULIB_OBSTACK_PRINTF=1 +printf "%s\n" "#define GNULIB_TEST_REALLOCARRAY 1" >>confdefs.h -$as_echo "#define GNULIB_TEST_OBSTACK_PRINTF 1" >>confdefs.h + : ${RELOCATABLE_CONFIG_H_DIR='$(top_builddir)'} + RELOCATABLE_SRC_DIR="\$(top_srcdir)/$gl_source_base" + RELOCATABLE_BUILD_DIR="\$(top_builddir)/$gl_source_base" + if test $RELOCATABLE = yes; then - case "$host_os" in - mingw* | pw*) - REPLACE_OPEN=1 - ;; - *) - if test "$gl_cv_macro_O_CLOEXEC" != yes; then - REPLACE_OPEN=1 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether open recognizes a trailing slash" >&5 -$as_echo_n "checking whether open recognizes a trailing slash... " >&6; } -if ${gl_cv_func_open_slash+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Assume that if we have lstat, we can also check symlinks. - if test $ac_cv_func_lstat = yes; then - touch conftest.tmp - ln -s conftest.tmp conftest.lnk - fi - if test "$cross_compiling" = yes; then : - case "$host_os" in - freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) - gl_cv_func_open_slash="guessing no" ;; - *) - gl_cv_func_open_slash="guessing yes" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#if HAVE_UNISTD_H -# include -#endif -int main () -{ - int result = 0; -#if HAVE_LSTAT - if (open ("conftest.lnk/", O_RDONLY) != -1) - result |= 1; -#endif - if (open ("conftest.sl/", O_CREAT, 0600) >= 0) - result |= 2; - return result; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_open_slash=yes -else - gl_cv_func_open_slash=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + gl_LIBOBJS="$gl_LIBOBJS progreloc.$ac_objext" - rm -f conftest.sl conftest.tmp conftest.lnk -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_open_slash" >&5 -$as_echo "$gl_cv_func_open_slash" >&6; } - case "$gl_cv_func_open_slash" in - *no) -$as_echo "#define OPEN_TRAILING_SLASH_BUG 1" >>confdefs.h - ;; - esac - case "$gl_cv_func_open_slash" in - *no) - REPLACE_OPEN=1 - ;; - esac - ;; - esac - if test $REPLACE_OPEN = 1; then + gl_LIBOBJS="$gl_LIBOBJS relocatable.$ac_objext" + fi + : - gl_LIBOBJS="$gl_LIBOBJS open.$ac_objext" - : - fi + case "$host_os" in + mingw*) ;; + *) ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" +if test "x$ac_cv_func_getcwd" = xyes +then : + printf "%s\n" "#define HAVE_GETCWD 1" >>confdefs.h +fi + ;; + esac - GNULIB_OPEN=1 -$as_echo "#define GNULIB_TEST_OPEN 1" >>confdefs.h + if test "$gl_cv_func_malloc_posix" = yes; then +printf "%s\n" "#define HAVE_MALLOC_POSIX 1" >>confdefs.h + else + REPLACE_MALLOC=1 + fi + if test $REPLACE_MALLOC = 1; then + REPLACE_REALLOC=1 + fi - if test "$ERRNO_H:$REPLACE_STRERROR_0" != :0; then - REPLACE_PERROR=1 - fi - case ${gl_cv_func_strerror_r_works-unset} in - unset|*yes) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether perror matches strerror" >&5 -$as_echo_n "checking whether perror matches strerror... " >&6; } -if ${gl_cv_func_perror_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on musl systems. - *-musl*) gl_cv_func_perror_works="guessing yes" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_perror_works="guessing yes" ;; - # Otherwise obey --enable-cross-guesses. - *) gl_cv_func_perror_works="$gl_cross_guess_normal" ;; - esac -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether free is known to preserve errno" >&5 +printf %s "checking whether free is known to preserve errno... " >&6; } +if test ${gl_cv_func_free_preserves_errno+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #include - #include - #include +#include int -main () +main (void) { -char *str = strerror (-1); - if (!getenv("CONFTEST_OUTPUT")) return 0; - if (!str) str = ""; - puts (str); - errno = -1; - perror (""); - return 0; +#if 2 < __GLIBC__ + (33 <= __GLIBC_MINOR__) + #elif defined __OpenBSD__ + #elif defined __sun + #else + #error "'free' is not known to preserve errno" + #endif ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - if CONFTEST_OUTPUT=1 ./conftest$EXEEXT >conftest.txt1 2>conftest.txt2 \ - && cmp conftest.txt1 conftest.txt2 >/dev/null; then - gl_cv_func_perror_works=yes - else - gl_cv_func_perror_works=no - fi - rm -rf conftest.txt1 conftest.txt2 -else - gl_cv_func_perror_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_free_preserves_errno=yes +else $as_nop + gl_cv_func_free_preserves_errno=no fi - +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_perror_works" >&5 -$as_echo "$gl_cv_func_perror_works" >&6; } - case "$gl_cv_func_perror_works" in - *yes) ;; - *) REPLACE_PERROR=1 ;; - esac - ;; - *) - REPLACE_PERROR=1 - ;; - esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_free_preserves_errno" >&5 +printf "%s\n" "$gl_cv_func_free_preserves_errno" >&6; } - if test $REPLACE_PERROR = 1; then + case $gl_cv_func_free_preserves_errno in + *yes) +printf "%s\n" "#define HAVE_FREE_POSIX 1" >>confdefs.h + ;; + *) REPLACE_FREE=1 ;; + esac - gl_LIBOBJS="$gl_LIBOBJS perror.$ac_objext" - fi + ac_fn_c_check_func "$LINENO" "mempcpy" "ac_cv_func_mempcpy" +if test "x$ac_cv_func_mempcpy" = xyes +then : + printf "%s\n" "#define HAVE_MEMPCPY 1" >>confdefs.h +fi + if test $ac_cv_func_mempcpy = no; then + HAVE_MEMPCPY=0 + fi - GNULIB_PERROR=1 + ac_fn_c_check_func "$LINENO" "rawmemchr" "ac_cv_func_rawmemchr" +if test "x$ac_cv_func_rawmemchr" = xyes +then : + printf "%s\n" "#define HAVE_RAWMEMCHR 1" >>confdefs.h +fi + if test $ac_cv_func_rawmemchr = no; then + HAVE_RAWMEMCHR=0 + fi -$as_echo "#define GNULIB_TEST_PERROR 1" >>confdefs.h @@ -33126,185 +44064,365 @@ - if test $ac_cv_func_pipe2 != yes; then - HAVE_PIPE2=0 + if test $ac_cv_have_decl_setenv = no; then + HAVE_DECL_SETENV=0 fi + ac_fn_c_check_header_compile "$LINENO" "search.h" "ac_cv_header_search_h" "$ac_includes_default" +if test "x$ac_cv_header_search_h" = xyes +then : + printf "%s\n" "#define HAVE_SEARCH_H 1" >>confdefs.h - GNULIB_PIPE2=1 - - - - - -$as_echo "#define GNULIB_TEST_PIPE2 1" >>confdefs.h - +fi + ac_fn_c_check_func "$LINENO" "tsearch" "ac_cv_func_tsearch" +if test "x$ac_cv_func_tsearch" = xyes +then : + printf "%s\n" "#define HAVE_TSEARCH 1" >>confdefs.h +fi -cat >>confdefs.h <<_ACEOF -#define GNULIB_PIPE2_SAFER 1 -_ACEOF + relocatable_sh=$ac_aux_dir/relocatable.sh.in - if test $REPLACE_POSIX_SPAWN = 1; then - REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=1 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether posix_spawn_file_actions_addclose works" >&5 -$as_echo_n "checking whether posix_spawn_file_actions_addclose works... " >&6; } -if ${gl_cv_func_posix_spawn_file_actions_addclose_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - # Guess no on musl libc and Solaris, yes otherwise. - case "$host_os" in - *-musl*) gl_cv_func_posix_spawn_file_actions_addclose_works="guessing no" ;; - solaris*) gl_cv_func_posix_spawn_file_actions_addclose_works="guessing no" ;; - # Guess no on native Windows. - mingw*) gl_cv_func_posix_spawn_file_actions_addclose_works="guessing no" ;; - *) gl_cv_func_posix_spawn_file_actions_addclose_works="guessing yes" ;; - esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether rename honors trailing slash on destination" >&5 +printf %s "checking whether rename honors trailing slash on destination... " >&6; } +if test ${gl_cv_func_rename_slash_dst_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + rm -rf conftest.f conftest.f1 conftest.f2 conftest.d1 conftest.d2 conftest.lnk + touch conftest.f && touch conftest.f1 && mkdir conftest.d1 || + as_fn_error $? "cannot create temporary files" "$LINENO" 5 + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + ln -s conftest.f conftest.lnk + fi + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rename_slash_dst_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_rename_slash_dst_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_rename_slash_dst_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rename_slash_dst_works="$gl_cross_guess_normal" ;; + esac -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -int main () +# include +# include + +int +main (void) { - posix_spawn_file_actions_t actions; - if (posix_spawn_file_actions_init (&actions) != 0) - return 1; - if (posix_spawn_file_actions_addclose (&actions, 10000000) == 0) - return 2; +int result = 0; + if (rename ("conftest.f1", "conftest.f2/") == 0) + result |= 1; + if (rename ("conftest.d1", "conftest.d2/") != 0) + result |= 2; +#if HAVE_LSTAT + if (rename ("conftest.f", "conftest.lnk/") == 0) + result |= 4; +#endif + return result; + + ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_posix_spawn_file_actions_addclose_works=yes -else - gl_cv_func_posix_spawn_file_actions_addclose_works=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_rename_slash_dst_works=yes +else $as_nop + gl_cv_func_rename_slash_dst_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + rm -rf conftest.f conftest.f1 conftest.f2 conftest.d1 conftest.d2 conftest.lnk fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_posix_spawn_file_actions_addclose_works" >&5 -$as_echo "$gl_cv_func_posix_spawn_file_actions_addclose_works" >&6; } - case "$gl_cv_func_posix_spawn_file_actions_addclose_works" in - *yes) ;; - *) REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=1 ;; - esac - fi - - if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1 || test $REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE = 1; then - - +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_rename_slash_dst_works" >&5 +printf "%s\n" "$gl_cv_func_rename_slash_dst_works" >&6; } + case "$gl_cv_func_rename_slash_dst_works" in + *yes) ;; + *) + REPLACE_RENAME=1 +printf "%s\n" "#define RENAME_TRAILING_SLASH_DEST_BUG 1" >>confdefs.h + ;; + esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether rename honors trailing slash on source" >&5 +printf %s "checking whether rename honors trailing slash on source... " >&6; } +if test ${gl_cv_func_rename_slash_src_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + rm -rf conftest.f conftest.f1 conftest.d1 conftest.d2 conftest.d3 conftest.lnk + touch conftest.f && touch conftest.f1 && mkdir conftest.d1 || + as_fn_error $? "cannot create temporary files" "$LINENO" 5 + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + ln -s conftest.f conftest.lnk + fi + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rename_slash_src_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_rename_slash_src_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_rename_slash_src_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rename_slash_src_works="$gl_cross_guess_normal" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +# include +# include - gl_LIBOBJS="$gl_LIBOBJS spawn_faction_addclose.$ac_objext" +int +main (void) +{ +int result = 0; + if (rename ("conftest.f1/", "conftest.d3") == 0) + result |= 1; + if (rename ("conftest.d1/", "conftest.d2") != 0) + result |= 2; +#if HAVE_LSTAT + if (rename ("conftest.lnk/", "conftest.f") == 0) + result |= 4; +#endif + return result; - fi + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_rename_slash_src_works=yes +else $as_nop + gl_cv_func_rename_slash_src_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + rm -rf conftest.f conftest.f1 conftest.d1 conftest.d2 conftest.d3 conftest.lnk +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_rename_slash_src_works" >&5 +printf "%s\n" "$gl_cv_func_rename_slash_src_works" >&6; } + case "$gl_cv_func_rename_slash_src_works" in + *yes) ;; + *) + REPLACE_RENAME=1 +printf "%s\n" "#define RENAME_TRAILING_SLASH_SOURCE_BUG 1" >>confdefs.h + ;; + esac - GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=1 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether rename manages hard links correctly" >&5 +printf %s "checking whether rename manages hard links correctly... " >&6; } +if test ${gl_cv_func_rename_link_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test $ac_cv_func_link = yes; then + if test $cross_compiling != yes; then + rm -rf conftest.f conftest.f1 conftest.f2 + if touch conftest.f conftest.f2 && ln conftest.f conftest.f1 && + set x `ls -i conftest.f conftest.f1` && test "" = ""; then + if test "$cross_compiling" = yes +then : + : +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +# include +# include +# include +# include -$as_echo "#define GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE 1" >>confdefs.h +$gl_mda_defines +int +main (void) +{ +int result = 0; + if (rename ("conftest.f", "conftest.f1")) + result |= 1; + if (unlink ("conftest.f1")) + result |= 2; + /* Allow either the POSIX-required behavior, where the + previous rename kept conftest.f, or the (better) NetBSD + behavior, where it removed conftest.f. */ + if (rename ("conftest.f", "conftest.f") != 0 + && errno != ENOENT) + result |= 4; + if (rename ("conftest.f1", "conftest.f1") == 0) + result |= 8; + if (rename ("conftest.f2", "conftest.f2") != 0) + result |= 16; + return result; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_rename_link_works=yes +else $as_nop + gl_cv_func_rename_link_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + else + gl_cv_func_rename_link_works="guessing no" + fi + rm -rf conftest.f conftest.f1 conftest.f2 + else + case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rename_link_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_rename_link_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_rename_link_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rename_link_works="$gl_cross_guess_normal" ;; + esac + fi + else + gl_cv_func_rename_link_works=yes + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_rename_link_works" >&5 +printf "%s\n" "$gl_cv_func_rename_link_works" >&6; } + case "$gl_cv_func_rename_link_works" in + *yes) ;; + *) + REPLACE_RENAME=1 +printf "%s\n" "#define RENAME_HARD_LINK_BUG 1" >>confdefs.h + ;; + esac - if test $REPLACE_POSIX_SPAWN = 1; then - REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2=1 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether posix_spawn_file_actions_adddup2 works" >&5 -$as_echo_n "checking whether posix_spawn_file_actions_adddup2 works... " >&6; } -if ${gl_cv_func_posix_spawn_file_actions_adddup2_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - # Guess no on musl libc and Solaris, yes otherwise. - case "$host_os" in - *-musl*) gl_cv_func_posix_spawn_file_actions_adddup2_works="guessing no";; - solaris*) gl_cv_func_posix_spawn_file_actions_adddup2_works="guessing no";; - # Guess no on native Windows. - mingw*) gl_cv_func_posix_spawn_file_actions_adddup2_works="guessing no" ;; - *) gl_cv_func_posix_spawn_file_actions_adddup2_works="guessing yes";; - esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether rename manages existing destinations correctly" >&5 +printf %s "checking whether rename manages existing destinations correctly... " >&6; } +if test ${gl_cv_func_rename_dest_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + rm -rf conftest.f conftest.d1 conftest.d2 + touch conftest.f && mkdir conftest.d1 conftest.d2 || + as_fn_error $? "cannot create temporary files" "$LINENO" 5 + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rename_dest_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_rename_dest_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_rename_dest_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rename_dest_works="$gl_cross_guess_normal" ;; + esac -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -int main () +# include +# include + +int +main (void) { - posix_spawn_file_actions_t actions; - if (posix_spawn_file_actions_init (&actions) != 0) - return 1; - if (posix_spawn_file_actions_adddup2 (&actions, 10000000, 2) == 0) - return 2; +int result = 0; + if (rename ("conftest.d1", "conftest.d2") != 0) + result |= 1; + if (rename ("conftest.d2", "conftest.f") == 0) + result |= 2; + return result; + + ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_posix_spawn_file_actions_adddup2_works=yes -else - gl_cv_func_posix_spawn_file_actions_adddup2_works=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_rename_dest_works=yes +else $as_nop + gl_cv_func_rename_dest_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + rm -rf conftest.f conftest.d1 conftest.d2 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_posix_spawn_file_actions_adddup2_works" >&5 -$as_echo "$gl_cv_func_posix_spawn_file_actions_adddup2_works" >&6; } - case "$gl_cv_func_posix_spawn_file_actions_adddup2_works" in - *yes) ;; - *) REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2=1 ;; - esac - fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_rename_dest_works" >&5 +printf "%s\n" "$gl_cv_func_rename_dest_works" >&6; } + case "$gl_cv_func_rename_dest_works" in + *yes) ;; + *) + REPLACE_RENAME=1 - if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1 || test $REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2 = 1; then +printf "%s\n" "#define RENAME_DEST_EXISTS_BUG 1" >>confdefs.h + ;; + esac + if test $REPLACE_RENAME = 1; then - gl_LIBOBJS="$gl_LIBOBJS spawn_faction_adddup2.$ac_objext" + + + gl_LIBOBJS="$gl_LIBOBJS rename.$ac_objext" fi @@ -33312,77 +44430,49 @@ - GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2=1 + GL_GNULIB_RENAME=1 -$as_echo "#define GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_RENAME 1" >>confdefs.h - if test $REPLACE_POSIX_SPAWN = 1; then - REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=1 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether posix_spawn_file_actions_addopen works" >&5 -$as_echo_n "checking whether posix_spawn_file_actions_addopen works... " >&6; } -if ${gl_cv_func_posix_spawn_file_actions_addopen_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - # Guess no on musl libc and Solaris, yes otherwise. - case "$host_os" in - *-musl*) gl_cv_func_posix_spawn_file_actions_addopen_works="guessing no";; - solaris*) gl_cv_func_posix_spawn_file_actions_addopen_works="guessing no";; - # Guess no on native Windows. - mingw*) gl_cv_func_posix_spawn_file_actions_addopen_works="guessing no" ;; - *) gl_cv_func_posix_spawn_file_actions_addopen_works="guessing yes";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int main () -{ - posix_spawn_file_actions_t actions; - if (posix_spawn_file_actions_init (&actions) != 0) - return 1; - if (posix_spawn_file_actions_addopen (&actions, 10000000, "foo", 0, O_RDONLY) - == 0) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_posix_spawn_file_actions_addopen_works=yes -else - gl_cv_func_posix_spawn_file_actions_addopen_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + + + + + + + if test $ac_cv_func_sigaction = yes; then + ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include +" +if test "x$ac_cv_member_struct_sigaction_sa_sigaction" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_posix_spawn_file_actions_addopen_works" >&5 -$as_echo "$gl_cv_func_posix_spawn_file_actions_addopen_works" >&6; } - case "$gl_cv_func_posix_spawn_file_actions_addopen_works" in - *yes) ;; - *) REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=1 ;; - esac + + if test $ac_cv_member_struct_sigaction_sa_sigaction = no; then + HAVE_STRUCT_SIGACTION_SA_SIGACTION=0 + fi + else + HAVE_SIGACTION=0 fi - if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1 || test $REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN = 1; then + if test $HAVE_SIGACTION = 0; then @@ -33391,7 +44481,29 @@ - gl_LIBOBJS="$gl_LIBOBJS spawn_faction_addopen.$ac_objext" + gl_LIBOBJS="$gl_LIBOBJS sigaction.$ac_objext" + + + + + + + + ac_fn_c_check_type "$LINENO" "siginfo_t" "ac_cv_type_siginfo_t" " +#include + +" +if test "x$ac_cv_type_siginfo_t" = xyes +then : + +printf "%s\n" "#define HAVE_SIGINFO_T 1" >>confdefs.h + + +fi + + if test $ac_cv_type_siginfo_t = no; then + HAVE_SIGINFO_T=0 + fi fi @@ -33399,20 +44511,19 @@ - GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=1 + GL_GNULIB_SIGACTION=1 -$as_echo "#define GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_SIGACTION 1" >>confdefs.h - if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then @@ -33421,178 +44532,814 @@ - gl_LIBOBJS="$gl_LIBOBJS spawn_faction_destroy.$ac_objext" - fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for signbit macro" >&5 +printf %s "checking for signbit macro... " >&6; } +if test ${gl_cv_func_signbit+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_signbit="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_signbit="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_signbit="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_signbit="$gl_cross_guess_normal" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +/* If signbit is defined as a function, don't use it, since calling it for + 'float' or 'long double' arguments would involve conversions. + If signbit is not declared at all but exists as a library function, don't + use it, since the prototype may not match. + If signbit is not declared at all but exists as a compiler built-in, don't + use it, since it's preferable to use __builtin_signbit* (no warnings, + no conversions). */ +#ifndef signbit +# error "signbit should be a macro" +#endif +#include +/* Global variables. + Needed because GCC 4 constant-folds __builtin_signbitl (literal) + but cannot constant-fold __builtin_signbitl (variable). */ +float vf; +double vd; +long double vl; +int main () +{ +/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. + So we use -p0f and -p0d instead. */ +float p0f = 0.0f; +float m0f = -p0f; +double p0d = 0.0; +double m0d = -p0d; +/* On HP-UX 10.20, negating 0.0L does not yield -0.0L. + So we use another constant expression instead. + But that expression does not work on other platforms, such as when + cross-compiling to PowerPC on Mac OS X 10.5. */ +long double p0l = 0.0L; +#if defined __hpux || defined __sgi +long double m0l = -LDBL_MIN * LDBL_MIN; +#else +long double m0l = -p0l; +#endif + int result = 0; + if (signbit (vf)) /* link check */ + vf++; + { + float plus_inf = 1.0f / p0f; + float minus_inf = -1.0f / p0f; + if (!(!signbit (255.0f) + && signbit (-255.0f) + && !signbit (p0f) + && (memcmp (&m0f, &p0f, sizeof (float)) == 0 || signbit (m0f)) + && !signbit (plus_inf) + && signbit (minus_inf))) + result |= 1; + } + if (signbit (vd)) /* link check */ + vd++; + { + double plus_inf = 1.0 / p0d; + double minus_inf = -1.0 / p0d; + if (!(!signbit (255.0) + && signbit (-255.0) + && !signbit (p0d) + && (memcmp (&m0d, &p0d, sizeof (double)) == 0 || signbit (m0d)) + && !signbit (plus_inf) + && signbit (minus_inf))) + result |= 2; + } + if (signbit (vl)) /* link check */ + vl++; + { + long double plus_inf = 1.0L / p0l; + long double minus_inf = -1.0L / p0l; + if (signbit (255.0L)) + result |= 4; + if (!signbit (-255.0L)) + result |= 4; + if (signbit (p0l)) + result |= 8; + if (!(memcmp (&m0l, &p0l, sizeof (long double)) == 0 || signbit (m0l))) + result |= 16; + if (signbit (plus_inf)) + result |= 32; + if (!signbit (minus_inf)) + result |= 64; + } + return result; +} - GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY=1 +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_signbit=yes +else $as_nop + gl_cv_func_signbit=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_signbit" >&5 +printf "%s\n" "$gl_cv_func_signbit" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for signbit compiler built-ins" >&5 +printf %s "checking for signbit compiler built-ins... " >&6; } +if test ${gl_cv_func_signbit_builtins+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_signbit_builtins="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_signbit_builtins="guessing yes" ;; + # Guess yes on mingw, no on MSVC. + mingw*) if test -n "$GCC"; then + gl_cv_func_signbit_builtins="guessing yes" + else + gl_cv_func_signbit_builtins="guessing no" + fi + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_signbit_builtins="$gl_cross_guess_normal" ;; + esac -$as_echo "#define GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_DESTROY 1" >>confdefs.h +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if (__GNUC__ >= 4) || (__clang_major__ >= 4) +# define signbit(x) \ + (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \ + sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \ + __builtin_signbitf (x)) +#else +# error "signbit should be three compiler built-ins" +#endif +#include +/* Global variables. + Needed because GCC 4 constant-folds __builtin_signbitl (literal) + but cannot constant-fold __builtin_signbitl (variable). */ +float vf; +double vd; +long double vl; +int main () +{ +/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. + So we use -p0f and -p0d instead. */ +float p0f = 0.0f; +float m0f = -p0f; +double p0d = 0.0; +double m0d = -p0d; +/* On HP-UX 10.20, negating 0.0L does not yield -0.0L. + So we use another constant expression instead. + But that expression does not work on other platforms, such as when + cross-compiling to PowerPC on Mac OS X 10.5. */ +long double p0l = 0.0L; +#if defined __hpux || defined __sgi +long double m0l = -LDBL_MIN * LDBL_MIN; +#else +long double m0l = -p0l; +#endif + int result = 0; + if (signbit (vf)) /* link check */ + vf++; + { + float plus_inf = 1.0f / p0f; + float minus_inf = -1.0f / p0f; + if (!(!signbit (255.0f) + && signbit (-255.0f) + && !signbit (p0f) + && (memcmp (&m0f, &p0f, sizeof (float)) == 0 || signbit (m0f)) + && !signbit (plus_inf) + && signbit (minus_inf))) + result |= 1; + } + if (signbit (vd)) /* link check */ + vd++; + { + double plus_inf = 1.0 / p0d; + double minus_inf = -1.0 / p0d; + if (!(!signbit (255.0) + && signbit (-255.0) + && !signbit (p0d) + && (memcmp (&m0d, &p0d, sizeof (double)) == 0 || signbit (m0d)) + && !signbit (plus_inf) + && signbit (minus_inf))) + result |= 2; + } + if (signbit (vl)) /* link check */ + vl++; + { + long double plus_inf = 1.0L / p0l; + long double minus_inf = -1.0L / p0l; + if (signbit (255.0L)) + result |= 4; + if (!signbit (-255.0L)) + result |= 4; + if (signbit (p0l)) + result |= 8; + if (!(memcmp (&m0l, &p0l, sizeof (long double)) == 0 || signbit (m0l))) + result |= 16; + if (signbit (plus_inf)) + result |= 32; + if (!signbit (minus_inf)) + result |= 64; + } + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_signbit_builtins=yes +else $as_nop + gl_cv_func_signbit_builtins=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_signbit_builtins" >&5 +printf "%s\n" "$gl_cv_func_signbit_builtins" >&6; } + case "$gl_cv_func_signbit_builtins" in + *yes) + REPLACE_SIGNBIT_USING_BUILTINS=1 + ;; + *) + case "$gl_cv_func_signbit" in + *yes) ;; + *) + REPLACE_SIGNBIT=1 + ;; + esac + ;; + esac + case "$host_os" in + solaris*) + REPLACE_SIGNBIT=1 + ;; + esac + if test $REPLACE_SIGNBIT = 1; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking where to find the sign bit in a 'float'" >&5 +printf %s "checking where to find the sign bit in a 'float'... " >&6; } +if test ${gl_cv_cc_float_signbit+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + gl_cv_cc_float_signbit="unknown" +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#define NWORDS \ + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { float value; unsigned int word[NWORDS]; } + memory_float; +static memory_float plus = { 1.0f }; +static memory_float minus = { -1.0f }; +int main () +{ + size_t j, k, i; + unsigned int m; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + /* Find the different bit. */ + k = 0; m = 0; + for (j = 0; j < NWORDS; j++) + { + unsigned int x = plus.word[j] ^ minus.word[j]; + if ((x & (x - 1)) || (x && m)) + { + /* More than one bit difference. */ + fprintf (fp, "unknown"); + fclose (fp); + return 2; + } + if (x) + { + k = j; + m = x; + } + } + if (m == 0) + { + /* No difference. */ + fprintf (fp, "unknown"); + fclose (fp); + return 3; + } + /* Now m = plus.word[k] ^ ~minus.word[k]. */ + if (plus.word[k] & ~minus.word[k]) + { + /* Oh? The sign bit is set in the positive and cleared in the negative + numbers? */ + fprintf (fp, "unknown"); + fclose (fp); + return 4; + } + for (i = 0; ; i++) + if ((m >> i) & 1) + break; + fprintf (fp, "word %d bit %d", (int) k, (int) i); + if (fclose (fp) != 0) + return 5; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_cc_float_signbit=`cat conftest.out` +else $as_nop + gl_cv_cc_float_signbit="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + rm -f conftest.out - gl_LIBOBJS="$gl_LIBOBJS spawn_faction_init.$ac_objext" +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_float_signbit" >&5 +printf "%s\n" "$gl_cv_cc_float_signbit" >&6; } + case "$gl_cv_cc_float_signbit" in + word*bit*) + word=`echo "$gl_cv_cc_float_signbit" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_float_signbit" | sed -e 's/word.*bit //'` - fi +printf "%s\n" "#define FLT_SIGNBIT_WORD $word" >>confdefs.h +printf "%s\n" "#define FLT_SIGNBIT_BIT $bit" >>confdefs.h + ;; + esac - GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT=1 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking where to find the sign bit in a 'double'" >&5 +printf %s "checking where to find the sign bit in a 'double'... " >&6; } +if test ${gl_cv_cc_double_signbit+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + gl_cv_cc_double_signbit="unknown" -$as_echo "#define GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_INIT 1" >>confdefs.h +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { double value; unsigned int word[NWORDS]; } + memory_float; +static memory_float plus = { 1.0 }; +static memory_float minus = { -1.0 }; +int main () +{ + size_t j, k, i; + unsigned int m; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + /* Find the different bit. */ + k = 0; m = 0; + for (j = 0; j < NWORDS; j++) + { + unsigned int x = plus.word[j] ^ minus.word[j]; + if ((x & (x - 1)) || (x && m)) + { + /* More than one bit difference. */ + fprintf (fp, "unknown"); + fclose (fp); + return 2; + } + if (x) + { + k = j; + m = x; + } + } + if (m == 0) + { + /* No difference. */ + fprintf (fp, "unknown"); + fclose (fp); + return 3; + } + /* Now m = plus.word[k] ^ ~minus.word[k]. */ + if (plus.word[k] & ~minus.word[k]) + { + /* Oh? The sign bit is set in the positive and cleared in the negative + numbers? */ + fprintf (fp, "unknown"); + fclose (fp); + return 4; + } + for (i = 0; ; i++) + if ((m >> i) & 1) + break; + fprintf (fp, "word %d bit %d", (int) k, (int) i); + if (fclose (fp) != 0) + return 5; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_cc_double_signbit=`cat conftest.out` +else $as_nop + gl_cv_cc_double_signbit="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + rm -f conftest.out +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_double_signbit" >&5 +printf "%s\n" "$gl_cv_cc_double_signbit" >&6; } + case "$gl_cv_cc_double_signbit" in + word*bit*) + word=`echo "$gl_cv_cc_double_signbit" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_double_signbit" | sed -e 's/word.*bit //'` +printf "%s\n" "#define DBL_SIGNBIT_WORD $word" >>confdefs.h - if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then +printf "%s\n" "#define DBL_SIGNBIT_BIT $bit" >>confdefs.h + ;; + esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking where to find the sign bit in a 'long double'" >&5 +printf %s "checking where to find the sign bit in a 'long double'... " >&6; } +if test ${gl_cv_cc_long_double_signbit+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : - gl_LIBOBJS="$gl_LIBOBJS spawnattr_destroy.$ac_objext" + gl_cv_cc_long_double_signbit="unknown" - fi +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { long double value; unsigned int word[NWORDS]; } + memory_float; +static memory_float plus = { 1.0L }; +static memory_float minus = { -1.0L }; +int main () +{ + size_t j, k, i; + unsigned int m; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + /* Find the different bit. */ + k = 0; m = 0; + for (j = 0; j < NWORDS; j++) + { + unsigned int x = plus.word[j] ^ minus.word[j]; + if ((x & (x - 1)) || (x && m)) + { + /* More than one bit difference. */ + fprintf (fp, "unknown"); + fclose (fp); + return 2; + } + if (x) + { + k = j; + m = x; + } + } + if (m == 0) + { + /* No difference. */ + fprintf (fp, "unknown"); + fclose (fp); + return 3; + } + /* Now m = plus.word[k] ^ ~minus.word[k]. */ + if (plus.word[k] & ~minus.word[k]) + { + /* Oh? The sign bit is set in the positive and cleared in the negative + numbers? */ + fprintf (fp, "unknown"); + fclose (fp); + return 4; + } + for (i = 0; ; i++) + if ((m >> i) & 1) + break; + fprintf (fp, "word %d bit %d", (int) k, (int) i); + if (fclose (fp) != 0) + return 5; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_cc_long_double_signbit=`cat conftest.out` +else $as_nop + gl_cv_cc_long_double_signbit="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + rm -f conftest.out +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_long_double_signbit" >&5 +printf "%s\n" "$gl_cv_cc_long_double_signbit" >&6; } + case "$gl_cv_cc_long_double_signbit" in + word*bit*) + word=`echo "$gl_cv_cc_long_double_signbit" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_long_double_signbit" | sed -e 's/word.*bit //'` - GNULIB_POSIX_SPAWNATTR_DESTROY=1 +printf "%s\n" "#define LDBL_SIGNBIT_WORD $word" >>confdefs.h +printf "%s\n" "#define LDBL_SIGNBIT_BIT $bit" >>confdefs.h + ;; + esac -$as_echo "#define GNULIB_TEST_POSIX_SPAWNATTR_DESTROY 1" >>confdefs.h + if test "$gl_cv_cc_float_signbit" = unknown; then + ac_fn_check_decl "$LINENO" "copysignf" "ac_cv_have_decl_copysignf" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_copysignf" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_COPYSIGNF $ac_have_decl" >>confdefs.h + if test "$ac_cv_have_decl_copysignf" = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether copysignf can be used without linking with libm" >&5 +printf %s "checking whether copysignf can be used without linking with libm... " >&6; } +if test ${gl_cv_func_copysignf_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + float x, y; +int +main (void) +{ +return copysignf (x, y) < 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_copysignf_no_libm=yes +else $as_nop + gl_cv_func_copysignf_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_copysignf_no_libm" >&5 +printf "%s\n" "$gl_cv_func_copysignf_no_libm" >&6; } + if test $gl_cv_func_copysignf_no_libm = yes; then +printf "%s\n" "#define HAVE_COPYSIGNF_IN_LIBC 1" >>confdefs.h + fi + fi + fi + if test "$gl_cv_cc_double_signbit" = unknown; then + ac_fn_check_decl "$LINENO" "copysign" "ac_cv_have_decl_copysign" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_copysign" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_COPYSIGN $ac_have_decl" >>confdefs.h - if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then + if test "$ac_cv_have_decl_copysign" = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether copysign can be used without linking with libm" >&5 +printf %s "checking whether copysign can be used without linking with libm... " >&6; } +if test ${gl_cv_func_copysign_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + double x, y; +int +main (void) +{ +return copysign (x, y) < 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_copysign_no_libm=yes +else $as_nop + gl_cv_func_copysign_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_copysign_no_libm" >&5 +printf "%s\n" "$gl_cv_func_copysign_no_libm" >&6; } + if test $gl_cv_func_copysign_no_libm = yes; then +printf "%s\n" "#define HAVE_COPYSIGN_IN_LIBC 1" >>confdefs.h + fi + fi + fi + if test "$gl_cv_cc_long_double_signbit" = unknown; then + ac_fn_check_decl "$LINENO" "copysignl" "ac_cv_have_decl_copysignl" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_copysignl" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_COPYSIGNL $ac_have_decl" >>confdefs.h + if test "$ac_cv_have_decl_copysignl" = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether copysignl can be used without linking with libm" >&5 +printf %s "checking whether copysignl can be used without linking with libm... " >&6; } +if test ${gl_cv_func_copysignl_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + long double x, y; +int +main (void) +{ +return copysignl (x, y) < 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_copysignl_no_libm=yes +else $as_nop + gl_cv_func_copysignl_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_copysignl_no_libm" >&5 +printf "%s\n" "$gl_cv_func_copysignl_no_libm" >&6; } + if test $gl_cv_func_copysignl_no_libm = yes; then - gl_LIBOBJS="$gl_LIBOBJS spawnattr_init.$ac_objext" +printf "%s\n" "#define HAVE_COPYSIGNL_IN_LIBC 1" >>confdefs.h + fi + fi + fi fi + if test $REPLACE_SIGNBIT = 1; then - GNULIB_POSIX_SPAWNATTR_INIT=1 - -$as_echo "#define GNULIB_TEST_POSIX_SPAWNATTR_INIT 1" >>confdefs.h + gl_LIBOBJS="$gl_LIBOBJS signbitf.$ac_objext" - if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then + gl_LIBOBJS="$gl_LIBOBJS signbitd.$ac_objext" - gl_LIBOBJS="$gl_LIBOBJS spawnattr_setflags.$ac_objext" - fi + gl_LIBOBJS="$gl_LIBOBJS signbitl.$ac_objext" + fi - GNULIB_POSIX_SPAWNATTR_SETFLAGS=1 -$as_echo "#define GNULIB_TEST_POSIX_SPAWNATTR_SETFLAGS 1" >>confdefs.h + GL_GNULIB_SIGNBIT=1 - if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then +printf "%s\n" "#define GNULIB_TEST_SIGNBIT 1" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS spawnattr_setsigmask.$ac_objext" + HAVE_POSIX_SIGNALBLOCKING=0 + if test "$gl_cv_type_sigset_t" = yes; then + ac_fn_c_check_func "$LINENO" "sigprocmask" "ac_cv_func_sigprocmask" +if test "x$ac_cv_func_sigprocmask" = xyes +then : + HAVE_POSIX_SIGNALBLOCKING=1 +fi fi - - - - - GNULIB_POSIX_SPAWNATTR_SETSIGMASK=1 - - - - - -$as_echo "#define GNULIB_TEST_POSIX_SPAWNATTR_SETSIGMASK 1" >>confdefs.h - - - - - - - if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then + if test $HAVE_POSIX_SIGNALBLOCKING = 0; then @@ -33601,340 +45348,184 @@ - gl_LIBOBJS="$gl_LIBOBJS spawnp.$ac_objext" + gl_LIBOBJS="$gl_LIBOBJS sigprocmask.$ac_objext" + : fi - GNULIB_POSIX_SPAWNP=1 - -$as_echo "#define GNULIB_TEST_POSIX_SPAWNP 1" >>confdefs.h + GL_GNULIB_SIGPROCMASK=1 - if test $gl_cv_func_frexp_no_libm = yes; then - +printf "%s\n" "#define GNULIB_TEST_SIGPROCMASK 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexp works" >&5 -$as_echo_n "checking whether frexp works... " >&6; } -if ${gl_cv_func_frexp_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - netbsd* | irix*) gl_cv_func_frexp_works="guessing no" ;; - mingw*) # Guess yes with MSVC, no with mingw. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef _MSC_VER - Good -#endif + ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" +if test "x$ac_cv_header_stdint_h" = xyes +then : + printf "%s\n" "#define HAVE_STDINT_H 1" >>confdefs.h -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Good" >/dev/null 2>&1; then : - gl_cv_func_frexp_works="guessing yes" -else - gl_cv_func_frexp_works="guessing no" fi -rm -f conftest* - ;; - *) gl_cv_func_frexp_works="guessing yes" ;; - esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SIZE_MAX" >&5 +printf %s "checking for SIZE_MAX... " >&6; } +if test ${gl_cv_size_max+y} +then : + printf %s "(cached) " >&6 +else $as_nop -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + gl_cv_size_max=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include -#if HAVE_DECL_ALARM -# include -# include -#endif -/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. - ICC 10.0 has a bug when optimizing the expression -zero. - The expression -DBL_MIN * DBL_MIN does not work when cross-compiling - to PowerPC on Mac OS X 10.5. */ -#if defined __hpux || defined __sgi || defined __ICC -static double -compute_minus_zero (void) -{ - return -DBL_MIN * DBL_MIN; -} -# define minus_zero compute_minus_zero () -#else -double minus_zero = -0.0; +#include +#if HAVE_STDINT_H +#include #endif -int main() -{ - int result = 0; - int i; - volatile double x; - double zero = 0.0; -#if HAVE_DECL_ALARM - /* NeXTstep 3.3 frexp() runs into an endless loop when called on an infinite - number. Let the test fail in this case. */ - signal (SIGALRM, SIG_DFL); - alarm (5); +#ifdef SIZE_MAX +Found it #endif - /* Test on denormalized numbers. */ - for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) - ; - if (x > 0.0) - { - int exp; - double y = frexp (x, &exp); - /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022. - On NetBSD: y = 0.75. Correct: y = 0.5. */ - if (y != 0.5) - result |= 1; - } - /* Test on infinite numbers. */ - x = 1.0 / zero; - { - int exp; - double y = frexp (x, &exp); - if (y != x) - result |= 2; - } - /* Test on negative zero. */ - x = minus_zero; - { - int exp; - double y = frexp (x, &exp); - if (memcmp (&y, &x, sizeof x)) - result |= 4; - } - return result; -} + _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_frexp_works=yes -else - gl_cv_func_frexp_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Found it" >/dev/null 2>&1 +then : + gl_cv_size_max=yes fi +rm -rf conftest* + if test $gl_cv_size_max != yes; then + if ac_fn_c_compute_int "$LINENO" "sizeof (size_t) * CHAR_BIT - 1" "size_t_bits_minus_1" "#include +#include " +then : +else $as_nop + size_t_bits_minus_1= fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexp_works" >&5 -$as_echo "$gl_cv_func_frexp_works" >&6; } - case "$gl_cv_func_frexp_works" in - *yes) - -$as_echo "#define HAVE_FREXP_IN_LIBC 1" >>confdefs.h - - ;; - esac - fi + if ac_fn_c_compute_int "$LINENO" "sizeof (size_t) <= sizeof (unsigned int)" "fits_in_uint" "#include " +then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ldexp can be used without linking with libm" >&5 -$as_echo_n "checking whether ldexp can be used without linking with libm... " >&6; } -if ${gl_cv_func_ldexp_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + fits_in_uint= +fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then + if test $fits_in_uint = 1; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - double x; - int y; +#include + extern size_t foo; + extern unsigned long foo; + int -main () +main (void) { -return ldexp (x, y) < 1; + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_ldexp_no_libm=yes -else - gl_cv_func_ldexp_no_libm=no +if ac_fn_c_try_compile "$LINENO" +then : + fits_in_uint=0 fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + if test $fits_in_uint = 1; then + gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" + else + gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" + fi + else + gl_cv_size_max='((size_t)~(size_t)0)' + fi + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexp_no_libm" >&5 -$as_echo "$gl_cv_func_ldexp_no_libm" >&6; } - if test $gl_cv_func_ldexp_no_libm = yes; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_size_max" >&5 +printf "%s\n" "$gl_cv_size_max" >&6; } + if test "$gl_cv_size_max" != yes; then -$as_echo "#define HAVE_LDEXP_IN_LIBC 1" >>confdefs.h +printf "%s\n" "#define SIZE_MAX $gl_cv_size_max" >>confdefs.h fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexpl() can be used without linking with libm" >&5 -$as_echo_n "checking whether frexpl() can be used without linking with libm... " >&6; } -if ${gl_cv_func_frexpl_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - long double x; -int -main () -{ -int e; return frexpl (x, &e) > 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_frexpl_no_libm=yes -else - gl_cv_func_frexpl_no_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + gl_cv_func_snprintf_usable=no + ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" +if test "x$ac_cv_func_snprintf" = xyes +then : + printf "%s\n" "#define HAVE_SNPRINTF 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_no_libm" >&5 -$as_echo "$gl_cv_func_frexpl_no_libm" >&6; } - if test $gl_cv_func_frexpl_no_libm = yes; then + if test $ac_cv_func_snprintf = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexpl works" >&5 -$as_echo_n "checking whether frexpl works... " >&6; } -if ${gl_cv_func_frexpl_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether snprintf respects a size of 1" >&5 +printf %s "checking whether snprintf respects a size of 1... " >&6; } +if test ${gl_cv_func_snprintf_size1+y} +then : + printf %s "(cached) " >&6 +else $as_nop - case "$host_os" in - aix | aix[3-6]* | beos* | darwin* | irix* | mingw* | pw*) - gl_cv_func_frexpl_works="guessing no";; - *) gl_cv_func_frexpl_works="guessing yes";; + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on Android. + linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; + *) gl_cv_func_snprintf_size1="guessing yes" ;; esac -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -/* Override the values of , like done in float.in.h. */ -#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP (-16381) -#endif -#if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__) -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP (-16381) -#endif -#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__ -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP DBL_MIN_EXP -#endif -#if defined __sgi && (LDBL_MANT_DIG >= 106) -# if defined __GNUC__ -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP DBL_MIN_EXP -# endif -#endif -extern -#ifdef __cplusplus -"C" +#include +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} #endif -long double frexpl (long double, int *); int main() { - int result = 0; - volatile long double x; - /* Test on finite numbers that fails on AIX 5.1. */ - x = 16.0L; - { - int exp = -9999; - frexpl (x, &exp); - if (exp != 5) - result |= 1; - } - /* Test on finite numbers that fails on Mac OS X 10.4, because its frexpl - function returns an invalid (incorrectly normalized) value: it returns - y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } - but the correct result is - 0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 } */ - x = 1.01L; - { - int exp = -9999; - long double y = frexpl (x, &exp); - if (!(exp == 1 && y == 0.505L)) - result |= 2; - } - /* Test on large finite numbers. This fails on BeOS at i = 16322, while - LDBL_MAX_EXP = 16384. - In the loop end test, we test x against Infinity, rather than comparing - i with LDBL_MAX_EXP, because BeOS has a wrong LDBL_MAX_EXP. */ - { - int i; - for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L) - { - int exp = -9999; - frexpl (x, &exp); - if (exp != i) - { - result |= 4; - break; - } - } - } - /* Test on denormalized numbers. */ - { - int i; - for (i = 1, x = 1.0L; i >= LDBL_MIN_EXP; i--, x *= 0.5L) - ; - if (x > 0.0L) - { - int exp; - long double y = frexpl (x, &exp); - /* On machines with IEEE854 arithmetic: x = 1.68105e-4932, - exp = -16382, y = 0.5. On Mac OS X 10.5: exp = -16384, y = 0.5. */ - if (exp != LDBL_MIN_EXP - 1) - result |= 8; - } - } - /* Test on infinite numbers. */ - x = 1.0L / 0.0L; - { - int exp; - long double y = frexpl (x, &exp); - if (y != x) - result |= 16; - } - return result; + static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; + my_snprintf (buf, 1, "%d", 12345); + return buf[1] != 'E'; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_frexpl_works=yes -else - gl_cv_func_frexpl_works=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_snprintf_size1=yes +else $as_nop + gl_cv_func_snprintf_size1=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -33942,254 +45533,132 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_works" >&5 -$as_echo "$gl_cv_func_frexpl_works" >&6; } - - case "$gl_cv_func_frexpl_works" in - *yes) gl_func_frexpl_no_libm=yes ;; - *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; - esac - else - gl_func_frexpl_no_libm=no - REPLACE_FREXPL=1 - fi - if test $gl_func_frexpl_no_libm = yes; then - -$as_echo "#define HAVE_FREXPL_IN_LIBC 1" >>confdefs.h - - ac_fn_c_check_decl "$LINENO" "frexpl" "ac_cv_have_decl_frexpl" "#include -" -if test "x$ac_cv_have_decl_frexpl" = xyes; then : - -else - HAVE_DECL_FREXPL=0 -fi - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ldexpl() can be used without linking with libm" >&5 -$as_echo_n "checking whether ldexpl() can be used without linking with libm... " >&6; } -if ${gl_cv_func_ldexpl_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - long double x; -int -main () -{ -return ldexpl (x, -1) > 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_ldexpl_no_libm=yes -else - gl_cv_func_ldexpl_no_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_size1" >&5 +printf "%s\n" "$gl_cv_func_snprintf_size1" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexpl_no_libm" >&5 -$as_echo "$gl_cv_func_ldexpl_no_libm" >&6; } + case "$gl_cv_func_snprintf_size1" in + *yes) - if test $gl_cv_func_ldexpl_no_libm = yes; then + case "$gl_cv_func_snprintf_retval_c99" in + *yes) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ldexpl works" >&5 -$as_echo_n "checking whether ldexpl works... " >&6; } -if ${gl_cv_func_ldexpl_works+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports POSIX/XSI format strings with positions" >&5 +printf %s "checking whether printf supports POSIX/XSI format strings with positions... " >&6; } +if test ${gl_cv_func_printf_positions+y} +then : + printf %s "(cached) " >&6 +else $as_nop - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes +then : case "$host_os" in - aix | aix[3-6]*) gl_cv_func_ldexpl_works="guessing no" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_ldexpl_works="guessing yes" ;; - *) gl_cv_func_ldexpl_works="guessing yes" ;; + netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) + gl_cv_func_printf_positions="guessing no";; + beos*) gl_cv_func_printf_positions="guessing no";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_positions="guessing yes";; + # Guess no on native Windows. + mingw* | pw*) gl_cv_func_printf_positions="guessing no";; + *) gl_cv_func_printf_positions="guessing yes";; esac -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -extern -#ifdef __cplusplus -"C" -#endif -long double ldexpl (long double, int); -int main() +#include +#include +/* The string "%2$d %1$d", with dollar characters protected from the shell's + dollar expansion (possibly an autoconf bug). */ +static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; +static char buf[100]; +int main () { - int result = 0; - { - volatile long double x = 1.0; - volatile long double y = ldexpl (x, -1); - if (y != 0.5L) - result |= 1; - } - { - volatile long double x = 1.73205L; - volatile long double y = ldexpl (x, 0); - if (y != x) - result |= 2; - } - return result; + sprintf (buf, format, 33, 55); + return (strcmp (buf, "55 33") != 0); } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_ldexpl_works=yes -else - gl_cv_func_ldexpl_works=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_positions=yes +else $as_nop + gl_cv_func_printf_positions=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexpl_works" >&5 -$as_echo "$gl_cv_func_ldexpl_works" >&6; } - - case "$gl_cv_func_ldexpl_works" in - *yes) - -$as_echo "#define HAVE_LDEXPL_IN_LIBC 1" >>confdefs.h - - ac_fn_c_check_decl "$LINENO" "ldexpl" "ac_cv_have_decl_ldexpl" "#include -" -if test "x$ac_cv_have_decl_ldexpl" = xyes; then : - -else - HAVE_DECL_LDEXPL=0 -fi - - ;; - esac - fi - - - - if test $gl_cv_func_vfprintf_posix = no; then - - - - - - - - - - - - gl_LIBOBJS="$gl_LIBOBJS printf.$ac_objext" - - REPLACE_PRINTF=1 + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi -$as_echo "#define REPLACE_PRINTF_POSIX 1" >>confdefs.h - : +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_positions" >&5 +printf "%s\n" "$gl_cv_func_printf_positions" >&6; } + case "$gl_cv_func_printf_positions" in + *yes) + gl_cv_func_snprintf_usable=yes + ;; + esac + ;; + esac + ;; + esac fi + if test $gl_cv_func_snprintf_usable = no; then - GNULIB_PRINTF_POSIX=1 - - -$as_echo "#define GNULIB_TEST_PRINTF_POSIX 1" >>confdefs.h + gl_LIBOBJS="$gl_LIBOBJS snprintf.$ac_objext" + if test $ac_cv_func_snprintf = yes; then + REPLACE_SNPRINTF=1 + else + if test $ac_cv_have_decl_snprintf = yes; then + REPLACE_SNPRINTF=1 + fi + fi + : - ac_fn_c_check_decl "$LINENO" "program_invocation_name" "ac_cv_have_decl_program_invocation_name" "#include -" -if test "x$ac_cv_have_decl_program_invocation_name" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi + fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_PROGRAM_INVOCATION_NAME $ac_have_decl -_ACEOF + if test $ac_cv_have_decl_snprintf = no; then + HAVE_DECL_SNPRINTF=0 + fi - ac_fn_c_check_decl "$LINENO" "program_invocation_short_name" "ac_cv_have_decl_program_invocation_short_name" "#include -" -if test "x$ac_cv_have_decl_program_invocation_short_name" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME $ac_have_decl -_ACEOF - : - : - for ac_func in raise -do : - ac_fn_c_check_func "$LINENO" "raise" "ac_cv_func_raise" -if test "x$ac_cv_func_raise" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_RAISE 1 -_ACEOF + GL_GNULIB_SNPRINTF=1 -fi -done - if test $ac_cv_func_raise = no; then - HAVE_RAISE=0 - else - if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then - REPLACE_RAISE=1 - fi +printf "%s\n" "#define GNULIB_TEST_SNPRINTF 1" >>confdefs.h - if test $gl_cv_type_sigset_t = yes; then - ac_fn_c_check_func "$LINENO" "sigprocmask" "ac_cv_func_sigprocmask" -if test "x$ac_cv_func_sigprocmask" = xyes; then : - gl_cv_func_sigprocmask=1 -fi - fi - if test -z "$gl_cv_func_sigprocmask"; then - HAVE_POSIX_SIGNALBLOCKING=0 - fi +printf "%s\n" "#define GNULIB_SNPRINTF 1" >>confdefs.h - if test $HAVE_POSIX_SIGNALBLOCKING = 0; then - : - fi - fi - if test $HAVE_RAISE = 0 || test $REPLACE_RAISE = 1; then @@ -34198,223 +45667,522 @@ - gl_LIBOBJS="$gl_LIBOBJS raise.$ac_objext" - : - fi - GNULIB_RAISE=1 + gl_cv_func_snprintf_posix=no + ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" +if test "x$ac_cv_func_snprintf" = xyes +then : + printf "%s\n" "#define HAVE_SNPRINTF 1" >>confdefs.h +fi + if test $ac_cv_func_snprintf = yes; then -$as_echo "#define GNULIB_TEST_RAISE 1" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether snprintf fully supports the 'n' directive" >&5 +printf %s "checking whether snprintf fully supports the 'n' directive... " >&6; } +if test ${gl_cv_func_snprintf_directive_n+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess no on glibc when _FORTIFY_SOURCE >= 2. + *-gnu* | gnu*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if _FORTIFY_SOURCE >= 2 + error fail + #endif +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_snprintf_directive_n="guessing yes" +else $as_nop + gl_cv_func_snprintf_directive_n="guessing no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; + midnightbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on Mac OS X >= 10.3. + darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; + darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on Solaris >= 2.6. + solaris2.[0-5] | solaris2.[0-5].*) + gl_cv_func_snprintf_directive_n="guessing no";; + solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; + aix*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on IRIX >= 6.5. + irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on OSF/1 >= 5. + osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";; + osf*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_snprintf_directive_n="guessing no";; + netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; + # Guess no on native Windows. + mingw*) gl_cv_func_snprintf_directive_n="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; + esac - if test $ac_cv_func_readlink = no; then - HAVE_READLINK=0 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether readlink signature is correct" >&5 -$as_echo_n "checking whether readlink signature is correct... " >&6; } -if ${gl_cv_decl_readlink_works+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - /* Cause compilation failure if original declaration has wrong type. */ - ssize_t readlink (const char *, char *, size_t); -int -main () -{ - ; +#include +#include +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +#endif +static char fmtstring[10]; +static char buf[100]; +int main () +{ + int count = -1; + /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) + support %n in format strings in read-only memory but not in writable + memory. */ + strcpy (fmtstring, "%d %n"); + my_snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); + if (count != 6) + return 1; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_decl_readlink_works=yes -else - gl_cv_decl_readlink_works=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_snprintf_directive_n=yes +else $as_nop + gl_cv_func_snprintf_directive_n=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_readlink_works" >&5 -$as_echo "$gl_cv_decl_readlink_works" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether readlink handles trailing slash correctly" >&5 -$as_echo_n "checking whether readlink handles trailing slash correctly... " >&6; } -if ${gl_cv_func_readlink_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - # We have readlink, so assume ln -s works. - ln -s conftest.no-such conftest.link - ln -s conftest.link conftest.lnk2 - if test "$cross_compiling" = yes; then : + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_directive_n" >&5 +printf "%s\n" "$gl_cv_func_snprintf_directive_n" >&6; } + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether snprintf respects a size of 1" >&5 +printf %s "checking whether snprintf respects a size of 1... " >&6; } +if test ${gl_cv_func_snprintf_size1+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : case "$host_os" in - # Guess yes on Linux systems. - linux-* | linux) gl_cv_func_readlink_works="guessing yes" ;; - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_readlink_works="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_readlink_works="$gl_cross_guess_normal" ;; - esac + # Guess yes on Android. + linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; + *) gl_cv_func_snprintf_size1="guessing yes" ;; + esac -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -int -main () +#include +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include +static int my_snprintf (char *buf, int size, const char *format, ...) { -char buf[20]; - return readlink ("conftest.lnk2/", buf, sizeof buf) != -1; - ; - return 0; + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +#endif +int main() +{ + static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; + my_snprintf (buf, 1, "%d", 12345); + return buf[1] != 'E'; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_readlink_works=yes -else - gl_cv_func_readlink_works=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_snprintf_size1=yes +else $as_nop + gl_cv_func_snprintf_size1=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - rm -f conftest.link conftest.lnk2 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_readlink_works" >&5 -$as_echo "$gl_cv_func_readlink_works" >&6; } - case "$gl_cv_func_readlink_works" in - *yes) - if test "$gl_cv_decl_readlink_works" != yes; then - REPLACE_READLINK=1 - fi - ;; - *) - -$as_echo "#define READLINK_TRAILING_SLASH_BUG 1" >>confdefs.h - REPLACE_READLINK=1 - ;; - esac - fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_size1" >&5 +printf "%s\n" "$gl_cv_func_snprintf_size1" >&6; } - if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether vsnprintf respects a zero size as in C99" >&5 +printf %s "checking whether vsnprintf respects a zero size as in C99... " >&6; } +if test ${gl_cv_func_vsnprintf_zerosize_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Mac OS X >= 10.3. + darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Cygwin. + cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Solaris >= 2.6. + solaris2.[0-5] | solaris2.[0-5].*) + gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on IRIX >= 6.5. + irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Android. + linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on native Windows. + mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +int main() +{ + static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; + my_snprintf (buf, 0, "%d", 12345); + return buf[0] != 'D'; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_vsnprintf_zerosize_c99=yes +else $as_nop + gl_cv_func_vsnprintf_zerosize_c99=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - gl_LIBOBJS="$gl_LIBOBJS readlink.$ac_objext" +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_vsnprintf_zerosize_c99" >&5 +printf "%s\n" "$gl_cv_func_vsnprintf_zerosize_c99" >&6; } + case "$gl_cv_func_printf_sizes_c99" in + *yes) + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + case "$gl_cv_func_printf_directive_a" in + *yes) + case "$gl_cv_func_printf_directive_f" in + *yes) + case "$gl_cv_func_printf_directive_n" in + *yes) + case "$gl_cv_func_printf_directive_ls" in + *yes) + case "$gl_cv_func_printf_positions" in + *yes) + case "$gl_cv_func_printf_flag_grouping" in + *yes) + case "$gl_cv_func_printf_flag_leftadjust" in + *yes) + case "$gl_cv_func_printf_flag_zero" in + *yes) + case "$gl_cv_func_printf_precision" in + *yes) + case "$gl_cv_func_printf_enomem" in + *yes) + case "$gl_cv_func_snprintf_truncation_c99" in + *yes) + case "$gl_cv_func_snprintf_retval_c99" in + *yes) + case "$gl_cv_func_snprintf_directive_n" in + *yes) + case "$gl_cv_func_snprintf_size1" in + *yes) + case "$gl_cv_func_vsnprintf_zerosize_c99" in + *yes) + # snprintf exists and is + # already POSIX compliant. + gl_cv_func_snprintf_posix=yes + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + fi + if test $gl_cv_func_snprintf_posix = no; then - : - fi + case "$gl_cv_func_printf_infinite" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h + ;; + esac - GNULIB_READLINK=1 + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h + ;; + esac + ;; + esac -$as_echo "#define GNULIB_TEST_READLINK 1" >>confdefs.h + case "$gl_cv_func_printf_directive_a" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h + ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" +if test "x$ac_cv_func_nl_langinfo" = xyes +then : + printf "%s\n" "#define HAVE_NL_LANGINFO 1" >>confdefs.h +fi - if test $gl_cv_func_malloc_posix = yes; then + ;; + esac -$as_echo "#define HAVE_REALLOC_POSIX 1" >>confdefs.h - else - REPLACE_REALLOC=1 - fi - if test $REPLACE_REALLOC = 1; then + case "$gl_cv_func_printf_directive_f" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h + ;; + esac + case "$gl_cv_func_printf_directive_ls" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h + ;; + esac - gl_LIBOBJS="$gl_LIBOBJS realloc.$ac_objext" - fi + case "$gl_cv_func_printf_flag_grouping" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h + ;; + esac - GNULIB_REALLOC_POSIX=1 + case "$gl_cv_func_printf_flag_leftadjust" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h + ;; + esac -$as_echo "#define GNULIB_TEST_REALLOC_POSIX 1" >>confdefs.h + case "$gl_cv_func_printf_flag_zero" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h + ;; + esac + case "$gl_cv_func_printf_precision" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h - : ${RELOCATABLE_CONFIG_H_DIR='$(top_builddir)'} - RELOCATABLE_SRC_DIR="\$(top_srcdir)/$gl_source_base" - RELOCATABLE_BUILD_DIR="\$(top_builddir)/$gl_source_base" - if test $RELOCATABLE = yes; then +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h + ;; + esac + case "$gl_cv_func_printf_enomem" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS progreloc.$ac_objext" +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h + ;; + esac - gl_LIBOBJS="$gl_LIBOBJS relocatable.$ac_objext" - fi - : + gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext" @@ -34424,6 +46192,7 @@ + gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext" @@ -34431,549 +46200,320 @@ - if test $ac_cv_have_decl_setenv = no; then - HAVE_DECL_SETENV=0 - fi + gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext" - for ac_header in search.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "search.h" "ac_cv_header_search_h" "$ac_includes_default" -if test "x$ac_cv_header_search_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SEARCH_H 1 -_ACEOF -fi -done - for ac_func in tsearch -do : - ac_fn_c_check_func "$LINENO" "tsearch" "ac_cv_func_tsearch" -if test "x$ac_cv_func_tsearch" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_TSEARCH 1 -_ACEOF -fi -done + gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext" + if test $ac_cv_func_vasnprintf = yes; then - relocatable_sh=$ac_aux_dir/relocatable.sh.in +printf "%s\n" "#define REPLACE_VASNPRINTF 1" >>confdefs.h + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether rename honors trailing slash on destination" >&5 -$as_echo_n "checking whether rename honors trailing slash on destination... " >&6; } -if ${gl_cv_func_rename_slash_dst_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -rf conftest.f conftest.f1 conftest.f2 conftest.d1 conftest.d2 conftest.lnk - touch conftest.f && touch conftest.f1 && mkdir conftest.d1 || - as_fn_error $? "cannot create temporary files" "$LINENO" 5 - # Assume that if we have lstat, we can also check symlinks. - if test $ac_cv_func_lstat = yes; then - ln -s conftest.f conftest.lnk - fi - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on Linux systems. - linux-* | linux) gl_cv_func_rename_slash_dst_works="guessing yes" ;; - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_rename_slash_dst_works="guessing yes" ;; - # Guess no on native Windows. - mingw*) gl_cv_func_rename_slash_dst_works="guessing no" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_rename_slash_dst_works="$gl_cross_guess_normal" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -# include -# include -int -main () -{ -int result = 0; - if (rename ("conftest.f1", "conftest.f2/") == 0) - result |= 1; - if (rename ("conftest.d1", "conftest.d2/") != 0) - result |= 2; -#if HAVE_LSTAT - if (rename ("conftest.f", "conftest.lnk/") == 0) - result |= 4; -#endif - return result; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_rename_slash_dst_works=yes -else - gl_cv_func_rename_slash_dst_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" +if test "x$ac_cv_type_ptrdiff_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define ptrdiff_t long" >>confdefs.h - rm -rf conftest.f conftest.f1 conftest.f2 conftest.d1 conftest.d2 conftest.lnk fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_rename_slash_dst_works" >&5 -$as_echo "$gl_cv_func_rename_slash_dst_works" >&6; } - case "$gl_cv_func_rename_slash_dst_works" in - *yes) ;; - *) - REPLACE_RENAME=1 -$as_echo "#define RENAME_TRAILING_SLASH_DEST_BUG 1" >>confdefs.h - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether rename honors trailing slash on source" >&5 -$as_echo_n "checking whether rename honors trailing slash on source... " >&6; } -if ${gl_cv_func_rename_slash_src_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -rf conftest.f conftest.f1 conftest.d1 conftest.d2 conftest.d3 conftest.lnk - touch conftest.f && touch conftest.f1 && mkdir conftest.d1 || - as_fn_error $? "cannot create temporary files" "$LINENO" 5 - # Assume that if we have lstat, we can also check symlinks. - if test $ac_cv_func_lstat = yes; then - ln -s conftest.f conftest.lnk - fi - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on Linux systems. - linux-* | linux) gl_cv_func_rename_slash_src_works="guessing yes" ;; - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_rename_slash_src_works="guessing yes" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_rename_slash_src_works="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_rename_slash_src_works="$gl_cross_guess_normal" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -# include -# include -int -main () -{ -int result = 0; - if (rename ("conftest.f1/", "conftest.d3") == 0) - result |= 1; - if (rename ("conftest.d1/", "conftest.d2") != 0) - result |= 2; -#if HAVE_LSTAT - if (rename ("conftest.lnk/", "conftest.f") == 0) - result |= 4; -#endif - return result; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_rename_slash_src_works=yes -else - gl_cv_func_rename_slash_src_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - rm -rf conftest.f conftest.f1 conftest.d1 conftest.d2 conftest.d3 conftest.lnk -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_rename_slash_src_works" >&5 -$as_echo "$gl_cv_func_rename_slash_src_works" >&6; } - case "$gl_cv_func_rename_slash_src_works" in - *yes) ;; - *) - REPLACE_RENAME=1 -$as_echo "#define RENAME_TRAILING_SLASH_SOURCE_BUG 1" >>confdefs.h - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether rename manages hard links correctly" >&5 -$as_echo_n "checking whether rename manages hard links correctly... " >&6; } -if ${gl_cv_func_rename_link_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test $ac_cv_func_link = yes; then - if test $cross_compiling != yes; then - rm -rf conftest.f conftest.f1 conftest.f2 - if touch conftest.f conftest.f2 && ln conftest.f conftest.f1 && - set x `ls -i conftest.f conftest.f1` && test "" = ""; then - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -# include -# include -# include -# include -int -main () -{ -int result = 0; - if (rename ("conftest.f", "conftest.f1")) - result |= 1; - if (unlink ("conftest.f1")) - result |= 2; - /* Allow either the POSIX-required behavior, where the - previous rename kept conftest.f, or the (better) NetBSD - behavior, where it removed conftest.f. */ - if (rename ("conftest.f", "conftest.f") != 0 - && errno != ENOENT) - result |= 4; + gl_LIBOBJS="$gl_LIBOBJS snprintf.$ac_objext" - if (rename ("conftest.f1", "conftest.f1") == 0) - result |= 8; - if (rename ("conftest.f2", "conftest.f2") != 0) - result |= 16; - return result; + if test $ac_cv_func_snprintf = yes; then + REPLACE_SNPRINTF=1 + else - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_rename_link_works=yes -else - gl_cv_func_rename_link_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + if test $ac_cv_have_decl_snprintf = yes; then + REPLACE_SNPRINTF=1 + fi + fi + : - else - gl_cv_func_rename_link_works="guessing no" - fi - rm -rf conftest.f conftest.f1 conftest.f2 - else - case "$host_os" in - # Guess yes on Linux systems. - linux-* | linux) gl_cv_func_rename_link_works="guessing yes" ;; - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_rename_link_works="guessing yes" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_rename_link_works="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_rename_link_works="$gl_cross_guess_normal" ;; - esac - fi - else - gl_cv_func_rename_link_works=yes - fi + fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_rename_link_works" >&5 -$as_echo "$gl_cv_func_rename_link_works" >&6; } - case "$gl_cv_func_rename_link_works" in - *yes) ;; - *) - REPLACE_RENAME=1 -$as_echo "#define RENAME_HARD_LINK_BUG 1" >>confdefs.h - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether rename manages existing destinations correctly" >&5 -$as_echo_n "checking whether rename manages existing destinations correctly... " >&6; } -if ${gl_cv_func_rename_dest_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -rf conftest.f conftest.d1 conftest.d2 - touch conftest.f && mkdir conftest.d1 conftest.d2 || - as_fn_error $? "cannot create temporary files" "$LINENO" 5 - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on Linux systems. - linux-* | linux) gl_cv_func_rename_dest_works="guessing yes" ;; - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_rename_dest_works="guessing yes" ;; - # Guess no on native Windows. - mingw*) gl_cv_func_rename_dest_works="guessing no" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_rename_dest_works="$gl_cross_guess_normal" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -# include -# include -int -main () -{ -int result = 0; - if (rename ("conftest.d1", "conftest.d2") != 0) - result |= 1; - if (rename ("conftest.d2", "conftest.f") == 0) - result |= 2; - return result; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_rename_dest_works=yes -else - gl_cv_func_rename_dest_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - rm -rf conftest.f conftest.d1 conftest.d2 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_rename_dest_works" >&5 -$as_echo "$gl_cv_func_rename_dest_works" >&6; } - case "$gl_cv_func_rename_dest_works" in - *yes) ;; - *) - REPLACE_RENAME=1 -$as_echo "#define RENAME_DEST_EXISTS_BUG 1" >>confdefs.h + case "$host_os" in + os2*) + + - ;; - esac - if test $REPLACE_RENAME = 1; then + gl_LIBOBJS="$gl_LIBOBJS os2-spawn.$ac_objext" + ;; + esac - gl_LIBOBJS="$gl_LIBOBJS rename.$ac_objext" - fi - GNULIB_RENAME=1 -$as_echo "#define GNULIB_TEST_RENAME 1" >>confdefs.h + gl_cv_func_sprintf_posix=no + case "$gl_cv_func_printf_sizes_c99" in + *yes) + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + case "$gl_cv_func_printf_directive_a" in + *yes) + case "$gl_cv_func_printf_directive_f" in + *yes) + case "$gl_cv_func_printf_directive_n" in + *yes) + case "$gl_cv_func_printf_directive_ls" in + *yes) + case "$gl_cv_func_printf_positions" in + *yes) + case "$gl_cv_func_printf_flag_grouping" in + *yes) + case "$gl_cv_func_printf_flag_leftadjust" in + *yes) + case "$gl_cv_func_printf_flag_zero" in + *yes) + case "$gl_cv_func_printf_precision" in + *yes) + case "$gl_cv_func_printf_enomem" in + *yes) + # sprintf exists and is + # already POSIX compliant. + gl_cv_func_sprintf_posix=yes + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + if test $gl_cv_func_sprintf_posix = no; then + case "$gl_cv_func_printf_infinite" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h + ;; + esac - for ac_header in sched.h -do : - ac_fn_c_check_header_compile "$LINENO" "sched.h" "ac_cv_header_sched_h" "#if HAVE_SYS_CDEFS_H - #include - #endif -" -if test "x$ac_cv_header_sched_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SCHED_H 1 -_ACEOF + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + ;; + *) -fi +printf "%s\n" "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h -done + ;; + esac + ;; + esac + case "$gl_cv_func_printf_directive_a" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h + ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" +if test "x$ac_cv_func_nl_langinfo" = xyes +then : + printf "%s\n" "#define HAVE_NL_LANGINFO 1" >>confdefs.h +fi + ;; + esac - if test $gl_cv_have_include_next = yes; then - gl_cv_next_sched_h='<'sched.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_sched_h+:} false; then : - $as_echo_n "(cached) " >&6 -else + case "$gl_cv_func_printf_directive_f" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; + ;; esac - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' + + + case "$gl_cv_func_printf_directive_ls" in + *yes) ;; *) - gl_dirsep_regex='\/' + +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h + ;; esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'sched.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - gl_cv_absolute_sched_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_sched_h - gl_cv_next_sched_h='"'$gl_header'"' + case "$gl_cv_func_printf_flag_grouping" in + *yes) + ;; + *) -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sched_h" >&5 -$as_echo "$gl_cv_next_sched_h" >&6; } - fi - NEXT_SCHED_H=$gl_cv_next_sched_h +printf "%s\n" "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'sched.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_sched_h - fi - NEXT_AS_FIRST_DIRECTIVE_SCHED_H=$gl_next_as_first_directive + ;; + esac + case "$gl_cv_func_printf_flag_leftadjust" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h - if test "$ac_cv_header_sched_h" = yes; then - HAVE_SCHED_H=1 - else - HAVE_SCHED_H=0 - fi + ;; + esac - if test "$HAVE_SCHED_H" = 1; then - ac_fn_c_check_type "$LINENO" "struct sched_param" "ac_cv_type_struct_sched_param" "#if HAVE_SYS_CDEFS_H - #include - #endif - #include -" -if test "x$ac_cv_type_struct_sched_param" = xyes; then : - HAVE_STRUCT_SCHED_PARAM=1 -else - HAVE_STRUCT_SCHED_PARAM=0 -fi + case "$gl_cv_func_printf_flag_zero" in + *yes) + ;; + *) - else - HAVE_STRUCT_SCHED_PARAM=0 - case "$host_os" in - os2*) - ac_fn_c_check_type "$LINENO" "struct sched_param" "ac_cv_type_struct_sched_param" "#include -" -if test "x$ac_cv_type_struct_sched_param" = xyes; then : - HAVE_STRUCT_SCHED_PARAM=1 -fi +printf "%s\n" "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h - ;; - vms) - ac_fn_c_check_type "$LINENO" "struct sched_param" "ac_cv_type_struct_sched_param" "#include -" -if test "x$ac_cv_type_struct_sched_param" = xyes; then : - HAVE_STRUCT_SCHED_PARAM=1 -fi + ;; + esac - ;; - esac - fi - if test "$ac_cv_header_sys_cdefs_h" = yes; then - HAVE_SYS_CDEFS_H=1 - else - HAVE_SYS_CDEFS_H=0 - fi + case "$gl_cv_func_printf_precision" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h + ;; + esac + case "$gl_cv_func_printf_enomem" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h - if test $ac_cv_func_sigaction = yes; then - ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include -" -if test "x$ac_cv_member_struct_sigaction_sa_sigaction" = xyes; then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1 -_ACEOF +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h -fi +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h - if test $ac_cv_member_struct_sigaction_sa_sigaction = no; then - HAVE_STRUCT_SIGACTION_SA_SIGACTION=0 - fi - else - HAVE_SIGACTION=0 - fi + ;; + esac - if test $HAVE_SIGACTION = 0; then @@ -34982,133 +46522,72 @@ - gl_LIBOBJS="$gl_LIBOBJS sigaction.$ac_objext" + gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext" - ac_fn_c_check_type "$LINENO" "siginfo_t" "ac_cv_type_siginfo_t" " -#include -" -if test "x$ac_cv_type_siginfo_t" = xyes; then : -cat >>confdefs.h <<_ACEOF -#define HAVE_SIGINFO_T 1 -_ACEOF -fi + gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext" - if test $ac_cv_type_siginfo_t = no; then - HAVE_SIGINFO_T=0 - fi - fi - GNULIB_SIGACTION=1 + gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext" -$as_echo "#define GNULIB_TEST_SIGACTION 1" >>confdefs.h + gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext" + if test $ac_cv_func_vasnprintf = yes; then +printf "%s\n" "#define REPLACE_VASNPRINTF 1" >>confdefs.h + fi - if test $gl_cv_have_include_next = yes; then - gl_cv_next_signal_h='<'signal.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_signal_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'signal.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' + ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" +if test "x$ac_cv_type_ptrdiff_t" = xyes +then : - gl_cv_absolute_signal_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` +else $as_nop - gl_header=$gl_cv_absolute_signal_h - gl_cv_next_signal_h='"'$gl_header'"' +printf "%s\n" "#define ptrdiff_t long" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_signal_h" >&5 -$as_echo "$gl_cv_next_signal_h" >&6; } - fi - NEXT_SIGNAL_H=$gl_cv_next_signal_h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'signal.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_signal_h - fi - NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H=$gl_next_as_first_directive -# AIX declares sig_atomic_t to already include volatile, and C89 compilers -# then choke on 'volatile sig_atomic_t'. C99 requires that it compile. - ac_fn_c_check_type "$LINENO" "volatile sig_atomic_t" "ac_cv_type_volatile_sig_atomic_t" " -#include -" -if test "x$ac_cv_type_volatile_sig_atomic_t" = xyes; then : -else - HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0 -fi @@ -35116,17 +46595,14 @@ - ac_fn_c_check_type "$LINENO" "sighandler_t" "ac_cv_type_sighandler_t" " -#include -" -if test "x$ac_cv_type_sighandler_t" = xyes; then : -else - HAVE_SIGHANDLER_T=0 -fi + gl_LIBOBJS="$gl_LIBOBJS sprintf.$ac_objext" + REPLACE_SPRINTF=1 + : + fi @@ -35134,745 +46610,301 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for signbit macro" >&5 -$as_echo_n "checking for signbit macro... " >&6; } -if ${gl_cv_func_signbit+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_signbit="guessing yes" ;; - # Guess yes on musl systems. - *-musl*) gl_cv_func_signbit="guessing yes" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_signbit="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_signbit="$gl_cross_guess_normal" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -/* If signbit is defined as a function, don't use it, since calling it for - 'float' or 'long double' arguments would involve conversions. - If signbit is not declared at all but exists as a library function, don't - use it, since the prototype may not match. - If signbit is not declared at all but exists as a compiler built-in, don't - use it, since it's preferable to use __builtin_signbit* (no warnings, - no conversions). */ -#ifndef signbit -# error "signbit should be a macro" -#endif -#include + GL_GNULIB_SPRINTF_POSIX=1 + + -/* Global variables. - Needed because GCC 4 constant-folds __builtin_signbitl (literal) - but cannot constant-fold __builtin_signbitl (variable). */ -float vf; -double vd; -long double vl; -int main () -{ -/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. - So we use -p0f and -p0d instead. */ -float p0f = 0.0f; -float m0f = -p0f; -double p0d = 0.0; -double m0d = -p0d; -/* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use another constant expression instead. - But that expression does not work on other platforms, such as when - cross-compiling to PowerPC on Mac OS X 10.5. */ -long double p0l = 0.0L; -#if defined __hpux || defined __sgi -long double m0l = -LDBL_MIN * LDBL_MIN; -#else -long double m0l = -p0l; -#endif - int result = 0; - if (signbit (vf)) /* link check */ - vf++; - { - float plus_inf = 1.0f / p0f; - float minus_inf = -1.0f / p0f; - if (!(!signbit (255.0f) - && signbit (-255.0f) - && !signbit (p0f) - && (memcmp (&m0f, &p0f, sizeof (float)) == 0 || signbit (m0f)) - && !signbit (plus_inf) - && signbit (minus_inf))) - result |= 1; - } - if (signbit (vd)) /* link check */ - vd++; - { - double plus_inf = 1.0 / p0d; - double minus_inf = -1.0 / p0d; - if (!(!signbit (255.0) - && signbit (-255.0) - && !signbit (p0d) - && (memcmp (&m0d, &p0d, sizeof (double)) == 0 || signbit (m0d)) - && !signbit (plus_inf) - && signbit (minus_inf))) - result |= 2; - } - if (signbit (vl)) /* link check */ - vl++; - { - long double plus_inf = 1.0L / p0l; - long double minus_inf = -1.0L / p0l; - if (signbit (255.0L)) - result |= 4; - if (!signbit (-255.0L)) - result |= 4; - if (signbit (p0l)) - result |= 8; - if (!(memcmp (&m0l, &p0l, sizeof (long double)) == 0 || signbit (m0l))) - result |= 16; - if (signbit (plus_inf)) - result |= 32; - if (!signbit (minus_inf)) - result |= 64; - } - return result; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_signbit=yes -else - gl_cv_func_signbit=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi +printf "%s\n" "#define GNULIB_TEST_SPRINTF_POSIX 1" >>confdefs.h -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_signbit" >&5 -$as_echo "$gl_cv_func_signbit" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for signbit compiler built-ins" >&5 -$as_echo_n "checking for signbit compiler built-ins... " >&6; } -if ${gl_cv_func_signbit_gcc+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_signbit_gcc="guessing yes" ;; - # Guess yes on musl systems. - *-musl*) gl_cv_func_signbit_gcc="guessing yes" ;; - # Guess yes on mingw, no on MSVC. - mingw*) if test -n "$GCC"; then - gl_cv_func_signbit_gcc="guessing yes" - else - gl_cv_func_signbit_gcc="guessing no" - fi - ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_signbit_gcc="$gl_cross_guess_normal" ;; - esac -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ssize_t" >&5 +printf %s "checking for ssize_t... " >&6; } +if test ${gt_cv_ssize_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#if __GNUC__ >= 4 -# define signbit(x) \ - (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \ - sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \ - __builtin_signbitf (x)) -#else -# error "signbit should be three compiler built-ins" -#endif -#include - -/* Global variables. - Needed because GCC 4 constant-folds __builtin_signbitl (literal) - but cannot constant-fold __builtin_signbitl (variable). */ -float vf; -double vd; -long double vl; -int main () +#include +int +main (void) { -/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. - So we use -p0f and -p0d instead. */ -float p0f = 0.0f; -float m0f = -p0f; -double p0d = 0.0; -double m0d = -p0d; -/* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use another constant expression instead. - But that expression does not work on other platforms, such as when - cross-compiling to PowerPC on Mac OS X 10.5. */ -long double p0l = 0.0L; -#if defined __hpux || defined __sgi -long double m0l = -LDBL_MIN * LDBL_MIN; -#else -long double m0l = -p0l; -#endif - int result = 0; - if (signbit (vf)) /* link check */ - vf++; - { - float plus_inf = 1.0f / p0f; - float minus_inf = -1.0f / p0f; - if (!(!signbit (255.0f) - && signbit (-255.0f) - && !signbit (p0f) - && (memcmp (&m0f, &p0f, sizeof (float)) == 0 || signbit (m0f)) - && !signbit (plus_inf) - && signbit (minus_inf))) - result |= 1; - } - if (signbit (vd)) /* link check */ - vd++; - { - double plus_inf = 1.0 / p0d; - double minus_inf = -1.0 / p0d; - if (!(!signbit (255.0) - && signbit (-255.0) - && !signbit (p0d) - && (memcmp (&m0d, &p0d, sizeof (double)) == 0 || signbit (m0d)) - && !signbit (plus_inf) - && signbit (minus_inf))) - result |= 2; - } - if (signbit (vl)) /* link check */ - vl++; - { - long double plus_inf = 1.0L / p0l; - long double minus_inf = -1.0L / p0l; - if (signbit (255.0L)) - result |= 4; - if (!signbit (-255.0L)) - result |= 4; - if (signbit (p0l)) - result |= 8; - if (!(memcmp (&m0l, &p0l, sizeof (long double)) == 0 || signbit (m0l))) - result |= 16; - if (signbit (plus_inf)) - result |= 32; - if (!signbit (minus_inf)) - result |= 64; - } - return result; +int x = sizeof (ssize_t *) + sizeof (ssize_t); + return !x; + ; + return 0; } - - _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_signbit_gcc=yes -else - gl_cv_func_signbit_gcc=no +if ac_fn_c_try_compile "$LINENO" +then : + gt_cv_ssize_t=yes +else $as_nop + gt_cv_ssize_t=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_ssize_t" >&5 +printf "%s\n" "$gt_cv_ssize_t" >&6; } + if test $gt_cv_ssize_t = no; then +printf "%s\n" "#define ssize_t int" >>confdefs.h -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_signbit_gcc" >&5 -$as_echo "$gl_cv_func_signbit_gcc" >&6; } - case "$gl_cv_func_signbit_gcc" in - *yes) - REPLACE_SIGNBIT_USING_GCC=1 - ;; - *) - case "$gl_cv_func_signbit" in - *yes) ;; - *) - REPLACE_SIGNBIT=1 - ;; - esac - ;; - esac - case "$host_os" in - solaris*) - REPLACE_SIGNBIT=1 - ;; - esac - if test $REPLACE_SIGNBIT = 1; then + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the sign bit in a 'float'" >&5 -$as_echo_n "checking where to find the sign bit in a 'float'... " >&6; } -if ${gl_cv_cc_float_signbit+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - gl_cv_cc_float_signbit="unknown" -else + case "$host_os" in + mingw*) + REPLACE_STAT=1 + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stat handles trailing slashes on files" >&5 +printf %s "checking whether stat handles trailing slashes on files... " >&6; } +if test ${gl_cv_func_stat_file_slash+y} +then : + printf %s "(cached) " >&6 +else $as_nop + touch conftest.tmp + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + ln -s conftest.tmp conftest.lnk + fi + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_stat_file_slash="$gl_cross_guess_normal" ;; + esac + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include -#include -#include -#define NWORDS \ - ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { float value; unsigned int word[NWORDS]; } - memory_float; -static memory_float plus = { 1.0f }; -static memory_float minus = { -1.0f }; -int main () +int +main (void) { - size_t j, k, i; - unsigned int m; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) - return 1; - /* Find the different bit. */ - k = 0; m = 0; - for (j = 0; j < NWORDS; j++) - { - unsigned int x = plus.word[j] ^ minus.word[j]; - if ((x & (x - 1)) || (x && m)) - { - /* More than one bit difference. */ - fprintf (fp, "unknown"); - fclose (fp); - return 2; - } - if (x) - { - k = j; - m = x; - } - } - if (m == 0) - { - /* No difference. */ - fprintf (fp, "unknown"); - fclose (fp); - return 3; - } - /* Now m = plus.word[k] ^ ~minus.word[k]. */ - if (plus.word[k] & ~minus.word[k]) - { - /* Oh? The sign bit is set in the positive and cleared in the negative - numbers? */ - fprintf (fp, "unknown"); - fclose (fp); - return 4; - } - for (i = 0; ; i++) - if ((m >> i) & 1) - break; - fprintf (fp, "word %d bit %d", (int) k, (int) i); - if (fclose (fp) != 0) - return 5; +int result = 0; + struct stat st; + if (!stat ("conftest.tmp/", &st)) + result |= 1; +#if HAVE_LSTAT + if (!stat ("conftest.lnk/", &st)) + result |= 2; +#endif + return result; + + ; return 0; } - _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_cc_float_signbit=`cat conftest.out` -else - gl_cv_cc_float_signbit="unknown" +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_stat_file_slash=yes +else $as_nop + gl_cv_func_stat_file_slash=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - rm -f conftest.out - + rm -f conftest.tmp conftest.lnk fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_float_signbit" >&5 -$as_echo "$gl_cv_cc_float_signbit" >&6; } - case "$gl_cv_cc_float_signbit" in - word*bit*) - word=`echo "$gl_cv_cc_float_signbit" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_float_signbit" | sed -e 's/word.*bit //'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_stat_file_slash" >&5 +printf "%s\n" "$gl_cv_func_stat_file_slash" >&6; } + case $gl_cv_func_stat_file_slash in + *no) + REPLACE_STAT=1 -cat >>confdefs.h <<_ACEOF -#define FLT_SIGNBIT_WORD $word -_ACEOF +printf "%s\n" "#define REPLACE_FUNC_STAT_FILE 1" >>confdefs.h +;; + esac + case $host_os in + solaris*) + REPLACE_FSTAT=1 ;; + esac + ;; + esac + if test $REPLACE_STAT = 1; then -cat >>confdefs.h <<_ACEOF -#define FLT_SIGNBIT_BIT $bit -_ACEOF - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the sign bit in a 'double'" >&5 -$as_echo_n "checking where to find the sign bit in a 'double'... " >&6; } -if ${gl_cv_cc_double_signbit+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - gl_cv_cc_double_signbit="unknown" + gl_LIBOBJS="$gl_LIBOBJS stat.$ac_objext" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + case "$host_os" in + mingw*) -#include -#include -#define NWORDS \ - ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { double value; unsigned int word[NWORDS]; } - memory_float; -static memory_float plus = { 1.0 }; -static memory_float minus = { -1.0 }; -int main () -{ - size_t j, k, i; - unsigned int m; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) - return 1; - /* Find the different bit. */ - k = 0; m = 0; - for (j = 0; j < NWORDS; j++) - { - unsigned int x = plus.word[j] ^ minus.word[j]; - if ((x & (x - 1)) || (x && m)) - { - /* More than one bit difference. */ - fprintf (fp, "unknown"); - fclose (fp); - return 2; - } - if (x) - { - k = j; - m = x; - } - } - if (m == 0) - { - /* No difference. */ - fprintf (fp, "unknown"); - fclose (fp); - return 3; - } - /* Now m = plus.word[k] ^ ~minus.word[k]. */ - if (plus.word[k] & ~minus.word[k]) - { - /* Oh? The sign bit is set in the positive and cleared in the negative - numbers? */ - fprintf (fp, "unknown"); - fclose (fp); - return 4; - } - for (i = 0; ; i++) - if ((m >> i) & 1) - break; - fprintf (fp, "word %d bit %d", (int) k, (int) i); - if (fclose (fp) != 0) - return 5; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_cc_double_signbit=`cat conftest.out` -else - gl_cv_cc_double_signbit="unknown" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - rm -f conftest.out -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_double_signbit" >&5 -$as_echo "$gl_cv_cc_double_signbit" >&6; } - case "$gl_cv_cc_double_signbit" in - word*bit*) - word=`echo "$gl_cv_cc_double_signbit" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_double_signbit" | sed -e 's/word.*bit //'` -cat >>confdefs.h <<_ACEOF -#define DBL_SIGNBIT_WORD $word -_ACEOF -cat >>confdefs.h <<_ACEOF -#define DBL_SIGNBIT_BIT $bit -_ACEOF - ;; - esac + gl_LIBOBJS="$gl_LIBOBJS stat-w32.$ac_objext" + ;; + esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the sign bit in a 'long double'" >&5 -$as_echo_n "checking where to find the sign bit in a 'long double'... " >&6; } -if ${gl_cv_cc_long_double_signbit+:} false; then : - $as_echo_n "(cached) " >&6 -else + : - if test "$cross_compiling" = yes; then : + fi - gl_cv_cc_long_double_signbit="unknown" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#define NWORDS \ - ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { long double value; unsigned int word[NWORDS]; } - memory_float; -static memory_float plus = { 1.0L }; -static memory_float minus = { -1.0L }; -int main () -{ - size_t j, k, i; - unsigned int m; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) - return 1; - /* Find the different bit. */ - k = 0; m = 0; - for (j = 0; j < NWORDS; j++) - { - unsigned int x = plus.word[j] ^ minus.word[j]; - if ((x & (x - 1)) || (x && m)) - { - /* More than one bit difference. */ - fprintf (fp, "unknown"); - fclose (fp); - return 2; - } - if (x) - { - k = j; - m = x; - } - } - if (m == 0) - { - /* No difference. */ - fprintf (fp, "unknown"); - fclose (fp); - return 3; - } - /* Now m = plus.word[k] ^ ~minus.word[k]. */ - if (plus.word[k] & ~minus.word[k]) - { - /* Oh? The sign bit is set in the positive and cleared in the negative - numbers? */ - fprintf (fp, "unknown"); - fclose (fp); - return 4; - } - for (i = 0; ; i++) - if ((m >> i) & 1) - break; - fprintf (fp, "word %d bit %d", (int) k, (int) i); - if (fclose (fp) != 0) - return 5; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_cc_long_double_signbit=`cat conftest.out` -else - gl_cv_cc_long_double_signbit="unknown" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - rm -f conftest.out -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_long_double_signbit" >&5 -$as_echo "$gl_cv_cc_long_double_signbit" >&6; } - case "$gl_cv_cc_long_double_signbit" in - word*bit*) - word=`echo "$gl_cv_cc_long_double_signbit" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_long_double_signbit" | sed -e 's/word.*bit //'` -cat >>confdefs.h <<_ACEOF -#define LDBL_SIGNBIT_WORD $word -_ACEOF -cat >>confdefs.h <<_ACEOF -#define LDBL_SIGNBIT_BIT $bit -_ACEOF + GL_GNULIB_STAT=1 - ;; - esac - if test "$gl_cv_cc_float_signbit" = unknown; then - ac_fn_c_check_decl "$LINENO" "copysignf" "ac_cv_have_decl_copysignf" "#include -" -if test "x$ac_cv_have_decl_copysignf" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_COPYSIGNF $ac_have_decl -_ACEOF - if test "$ac_cv_have_decl_copysignf" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether copysignf can be used without linking with libm" >&5 -$as_echo_n "checking whether copysignf can be used without linking with libm... " >&6; } -if ${gl_cv_func_copysignf_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else +printf "%s\n" "#define GNULIB_TEST_STAT 1" >>confdefs.h - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working stdalign.h" >&5 +printf %s "checking for working stdalign.h... " >&6; } +if test ${gl_cv_header_working_stdalign_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - float x, y; +#include + #include + #include + + /* Test that alignof yields a result consistent with offsetof. + This catches GCC bug 52023 + . */ + #ifdef __cplusplus + template struct alignof_helper { char a; t b; }; + # define ao(type) offsetof (alignof_helper, b) + #else + # define ao(type) offsetof (struct { char a; type b; }, b) + #endif + char test_double[ao (double) % _Alignof (double) == 0 ? 1 : -1]; + char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1]; + char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1]; + + /* Test _Alignas only on platforms where gnulib can help. */ + #if \ + ((defined __cplusplus && 201103 <= __cplusplus) \ + || (__TINYC__ && defined __attribute__) \ + || (defined __APPLE__ && defined __MACH__ \ + ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ + : __GNUC__) \ + || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ + || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__ \ + || 1300 <= _MSC_VER) + struct alignas_test { char c; char alignas (8) alignas_8; }; + char test_alignas[offsetof (struct alignas_test, alignas_8) == 8 + ? 1 : -1]; + #endif + int -main () +main (void) { -return copysignf (x, y) < 0; + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_copysignf_no_libm=yes -else - gl_cv_func_copysignf_no_libm=no +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_header_working_stdalign_h=yes +else $as_nop + gl_cv_header_working_stdalign_h=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_copysignf_no_libm" >&5 -$as_echo "$gl_cv_func_copysignf_no_libm" >&6; } - if test $gl_cv_func_copysignf_no_libm = yes; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_stdalign_h" >&5 +printf "%s\n" "$gl_cv_header_working_stdalign_h" >&6; } -$as_echo "#define HAVE_COPYSIGNF_IN_LIBC 1" >>confdefs.h + if test $gl_cv_header_working_stdalign_h = yes; then + STDALIGN_H='' + else + STDALIGN_H='stdalign.h' + fi - fi - fi - fi - if test "$gl_cv_cc_double_signbit" = unknown; then - ac_fn_c_check_decl "$LINENO" "copysign" "ac_cv_have_decl_copysign" "#include -" -if test "x$ac_cv_have_decl_copysign" = xyes; then : - ac_have_decl=1 + + if test -n "$STDALIGN_H"; then + GL_GENERATE_STDALIGN_H_TRUE= + GL_GENERATE_STDALIGN_H_FALSE='#' else - ac_have_decl=0 + GL_GENERATE_STDALIGN_H_TRUE='#' + GL_GENERATE_STDALIGN_H_FALSE= fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_COPYSIGN $ac_have_decl -_ACEOF - if test "$ac_cv_have_decl_copysign" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether copysign can be used without linking with libm" >&5 -$as_echo_n "checking whether copysign can be used without linking with libm... " >&6; } -if ${gl_cv_func_copysign_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - double x, y; -int -main () -{ -return copysign (x, y) < 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_copysign_no_libm=yes -else - gl_cv_func_copysign_no_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_copysign_no_libm" >&5 -$as_echo "$gl_cv_func_copysign_no_libm" >&6; } - if test $gl_cv_func_copysign_no_libm = yes; then -$as_echo "#define HAVE_COPYSIGN_IN_LIBC 1" >>confdefs.h + if test "$ac_cv_header_stdbool_h" = yes; then + case "$host_os" in + solaris*) + if test -z "$GCC"; then + STDBOOL_H='stdbool.h' + else + STDBOOL_H='' fi - fi - fi - if test "$gl_cv_cc_long_double_signbit" = unknown; then - ac_fn_c_check_decl "$LINENO" "copysignl" "ac_cv_have_decl_copysignl" "#include -" -if test "x$ac_cv_have_decl_copysignl" = xyes; then : - ac_have_decl=1 + ;; + *) + STDBOOL_H='' + ;; + esac + else + STDBOOL_H='stdbool.h' + fi + + if test -n "$STDBOOL_H"; then + GL_GENERATE_STDBOOL_H_TRUE= + GL_GENERATE_STDBOOL_H_FALSE='#' else - ac_have_decl=0 + GL_GENERATE_STDBOOL_H_TRUE='#' + GL_GENERATE_STDBOOL_H_FALSE= fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_COPYSIGNL $ac_have_decl -_ACEOF - if test "$ac_cv_have_decl_copysignl" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether copysignl can be used without linking with libm" >&5 -$as_echo_n "checking whether copysignl can be used without linking with libm... " >&6; } -if ${gl_cv_func_copysignl_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test "$ac_cv_type__Bool" = yes; then + HAVE__BOOL=1 + else + HAVE__BOOL=0 + fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - long double x, y; -int -main () -{ -return copysignl (x, y) < 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_copysignl_no_libm=yes -else - gl_cv_func_copysignl_no_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_copysignl_no_libm" >&5 -$as_echo "$gl_cv_func_copysignl_no_libm" >&6; } - if test $gl_cv_func_copysignl_no_libm = yes; then -$as_echo "#define HAVE_COPYSIGNL_IN_LIBC 1" >>confdefs.h - fi - fi - fi - fi - if test $REPLACE_SIGNBIT = 1; then @@ -35881,7 +46913,6 @@ - gl_LIBOBJS="$gl_LIBOBJS signbitf.$ac_objext" @@ -35891,359 +46922,144 @@ - gl_LIBOBJS="$gl_LIBOBJS signbitd.$ac_objext" + GL_GNULIB_FSCANF=1 +printf "%s\n" "#define GNULIB_TEST_FSCANF 1" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS signbitl.$ac_objext" - fi +printf "%s\n" "#define GNULIB_FSCANF 1" >>confdefs.h - GNULIB_SIGNBIT=1 -$as_echo "#define GNULIB_TEST_SIGNBIT 1" >>confdefs.h + GL_GNULIB_SCANF=1 - if test $gl_cv_type_sigset_t = yes; then - ac_fn_c_check_func "$LINENO" "sigprocmask" "ac_cv_func_sigprocmask" -if test "x$ac_cv_func_sigprocmask" = xyes; then : - gl_cv_func_sigprocmask=1 -fi - fi - if test -z "$gl_cv_func_sigprocmask"; then - HAVE_POSIX_SIGNALBLOCKING=0 - fi - if test $HAVE_POSIX_SIGNALBLOCKING = 0; then +printf "%s\n" "#define GNULIB_TEST_SCANF 1" >>confdefs.h +printf "%s\n" "#define GNULIB_SCANF 1" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS sigprocmask.$ac_objext" - : - fi - GNULIB_SIGPROCMASK=1 + GL_GNULIB_FGETC=1 -$as_echo "#define GNULIB_TEST_SIGPROCMASK 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_FGETC 1" >>confdefs.h - for ac_header in stdint.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" -if test "x$ac_cv_header_stdint_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDINT_H 1 -_ACEOF -fi -done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SIZE_MAX" >&5 -$as_echo_n "checking for SIZE_MAX... " >&6; } -if ${gl_cv_size_max+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_size_max= - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#if HAVE_STDINT_H -#include -#endif -#ifdef SIZE_MAX -Found it -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Found it" >/dev/null 2>&1; then : - gl_cv_size_max=yes -fi -rm -f conftest* - if test -z "$gl_cv_size_max"; then - if ac_fn_c_compute_int "$LINENO" "sizeof (size_t) * CHAR_BIT - 1" "size_t_bits_minus_1" "#include -#include "; then : -else - size_t_bits_minus_1= -fi - if ac_fn_c_compute_int "$LINENO" "sizeof (size_t) <= sizeof (unsigned int)" "fits_in_uint" "#include "; then : -else - fits_in_uint= -fi + GL_GNULIB_GETC=1 - if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then - if test $fits_in_uint = 1; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - extern size_t foo; - extern unsigned long foo; -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - fits_in_uint=0 -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $fits_in_uint = 1; then - gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" - else - gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" - fi - else - gl_cv_size_max='((size_t)~(size_t)0)' - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_size_max" >&5 -$as_echo "$gl_cv_size_max" >&6; } - if test "$gl_cv_size_max" != yes; then -cat >>confdefs.h <<_ACEOF -#define SIZE_MAX $gl_cv_size_max -_ACEOF +printf "%s\n" "#define GNULIB_TEST_GETC 1" >>confdefs.h - fi - gl_cv_func_snprintf_usable=no - for ac_func in snprintf -do : - ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" -if test "x$ac_cv_func_snprintf" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SNPRINTF 1 -_ACEOF -fi -done - if test $ac_cv_func_snprintf = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether snprintf respects a size of 1" >&5 -$as_echo_n "checking whether snprintf respects a size of 1... " >&6; } -if ${gl_cv_func_snprintf_size1+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on Android. - linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; - *) gl_cv_func_snprintf_size1="guessing yes" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + GL_GNULIB_GETCHAR=1 -#include -#if HAVE_SNPRINTF -# define my_snprintf snprintf -#else -# include -static int my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} -#endif -int main() -{ - static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; - my_snprintf (buf, 1, "%d", 12345); - return buf[1] != 'E'; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_snprintf_size1=yes -else - gl_cv_func_snprintf_size1=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_size1" >&5 -$as_echo "$gl_cv_func_snprintf_size1" >&6; } - case "$gl_cv_func_snprintf_size1" in - *yes) - case "$gl_cv_func_snprintf_retval_c99" in - *yes) +printf "%s\n" "#define GNULIB_TEST_GETCHAR 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports POSIX/XSI format strings with positions" >&5 -$as_echo_n "checking whether printf supports POSIX/XSI format strings with positions... " >&6; } -if ${gl_cv_func_printf_positions+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) - gl_cv_func_printf_positions="guessing no";; - beos*) gl_cv_func_printf_positions="guessing no";; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_positions="guessing yes";; - # Guess no on native Windows. - mingw* | pw*) gl_cv_func_printf_positions="guessing no";; - *) gl_cv_func_printf_positions="guessing yes";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -/* The string "%2$d %1$d", with dollar characters protected from the shell's - dollar expansion (possibly an autoconf bug). */ -static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; -static char buf[100]; -int main () -{ - sprintf (buf, format, 33, 55); - return (strcmp (buf, "55 33") != 0); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_positions=yes -else - gl_cv_func_printf_positions=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_positions" >&5 -$as_echo "$gl_cv_func_printf_positions" >&6; } - case "$gl_cv_func_printf_positions" in - *yes) - gl_cv_func_snprintf_usable=yes - ;; - esac - ;; - esac - ;; - esac - fi - if test $gl_cv_func_snprintf_usable = no; then + GL_GNULIB_FGETS=1 +printf "%s\n" "#define GNULIB_TEST_FGETS 1" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS snprintf.$ac_objext" - if test $ac_cv_func_snprintf = yes; then - REPLACE_SNPRINTF=1 - else - if test $ac_cv_have_decl_snprintf = yes; then - REPLACE_SNPRINTF=1 - fi - fi - : - fi - if test $ac_cv_have_decl_snprintf = no; then - HAVE_DECL_SNPRINTF=0 - fi - GNULIB_SNPRINTF=1 + GL_GNULIB_FREAD=1 -$as_echo "#define GNULIB_TEST_SNPRINTF 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_FREAD 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define GNULIB_SNPRINTF 1 -_ACEOF @@ -36251,595 +47067,189 @@ + GL_GNULIB_FPRINTF=1 +printf "%s\n" "#define GNULIB_TEST_FPRINTF 1" >>confdefs.h - gl_cv_func_snprintf_posix=no - for ac_func in snprintf -do : - ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" -if test "x$ac_cv_func_snprintf" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SNPRINTF 1 -_ACEOF -fi -done - if test $ac_cv_func_snprintf = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether snprintf truncates the result as in C99" >&5 -$as_echo_n "checking whether snprintf truncates the result as in C99... " >&6; } -if ${gl_cv_func_snprintf_truncation_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; - darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on OpenBSD >= 3.9. - openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) - gl_cv_func_snprintf_truncation_c99="guessing no";; - openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5] | solaris2.[0-5].*) - gl_cv_func_snprintf_truncation_c99="guessing no";; - solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; - aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on HP-UX >= 11. - hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; - hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on IRIX >= 6.5. - irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on OSF/1 >= 5. - osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; - osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_snprintf_truncation_c99="guessing no";; - netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on Android. - linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess no on native Windows. - mingw*) gl_cv_func_snprintf_truncation_c99="guessing no";; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; - esac + GL_GNULIB_PRINTF=1 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if HAVE_SNPRINTF -# define my_snprintf snprintf -#else -# include -static int my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} -#endif -static char buf[100]; -int main () -{ - strcpy (buf, "ABCDEF"); - my_snprintf (buf, 3, "%d %d", 4567, 89); - if (memcmp (buf, "45\0DEF", 6) != 0) - return 1; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_snprintf_truncation_c99=yes -else - gl_cv_func_snprintf_truncation_c99=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_truncation_c99" >&5 -$as_echo "$gl_cv_func_snprintf_truncation_c99" >&6; } +printf "%s\n" "#define GNULIB_TEST_PRINTF 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_VFPRINTF=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_VFPRINTF 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_VPRINTF=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_VPRINTF 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_FPUTC=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FPUTC 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether snprintf fully supports the 'n' directive" >&5 -$as_echo_n "checking whether snprintf fully supports the 'n' directive... " >&6; } -if ${gl_cv_func_snprintf_directive_n+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; - darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5] | solaris2.[0-5].*) - gl_cv_func_snprintf_directive_n="guessing no";; - solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; - aix*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on IRIX >= 6.5. - irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on OSF/1 >= 5. - osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";; - osf*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_snprintf_directive_n="guessing no";; - netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess no on Android. - linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; - # Guess no on native Windows. - mingw*) gl_cv_func_snprintf_directive_n="guessing no";; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if HAVE_SNPRINTF -# define my_snprintf snprintf -#else -# include -static int my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} -#endif -static char fmtstring[10]; -static char buf[100]; -int main () -{ - int count = -1; - /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) - support %n in format strings in read-only memory but not in writable - memory. */ - strcpy (fmtstring, "%d %n"); - my_snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); - if (count != 6) - return 1; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_snprintf_directive_n=yes -else - gl_cv_func_snprintf_directive_n=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_directive_n" >&5 -$as_echo "$gl_cv_func_snprintf_directive_n" >&6; } + GL_GNULIB_PUTC=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether snprintf respects a size of 1" >&5 -$as_echo_n "checking whether snprintf respects a size of 1... " >&6; } -if ${gl_cv_func_snprintf_size1+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on Android. - linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; - *) gl_cv_func_snprintf_size1="guessing yes" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#if HAVE_SNPRINTF -# define my_snprintf snprintf -#else -# include -static int my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} -#endif -int main() -{ - static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; - my_snprintf (buf, 1, "%d", 12345); - return buf[1] != 'E'; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_snprintf_size1=yes -else - gl_cv_func_snprintf_size1=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi +printf "%s\n" "#define GNULIB_TEST_PUTC 1" >>confdefs.h -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_size1" >&5 -$as_echo "$gl_cv_func_snprintf_size1" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether vsnprintf respects a zero size as in C99" >&5 -$as_echo_n "checking whether vsnprintf respects a zero size as in C99... " >&6; } -if ${gl_cv_func_vsnprintf_zerosize_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Cygwin. - cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5] | solaris2.[0-5].*) - gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on IRIX >= 6.5. - irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Android. - linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on native Windows. - mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -static int my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} -int main() -{ - static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; - my_snprintf (buf, 0, "%d", 12345); - return buf[0] != 'D'; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_vsnprintf_zerosize_c99=yes -else - gl_cv_func_vsnprintf_zerosize_c99=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_vsnprintf_zerosize_c99" >&5 -$as_echo "$gl_cv_func_vsnprintf_zerosize_c99" >&6; } - case "$gl_cv_func_printf_sizes_c99" in - *yes) - case "$gl_cv_func_printf_long_double" in - *yes) - case "$gl_cv_func_printf_infinite" in - *yes) - case "$gl_cv_func_printf_infinite_long_double" in - *yes) - case "$gl_cv_func_printf_directive_a" in - *yes) - case "$gl_cv_func_printf_directive_f" in - *yes) - case "$gl_cv_func_printf_directive_n" in - *yes) - case "$gl_cv_func_printf_directive_ls" in - *yes) - case "$gl_cv_func_printf_positions" in - *yes) - case "$gl_cv_func_printf_flag_grouping" in - *yes) - case "$gl_cv_func_printf_flag_leftadjust" in - *yes) - case "$gl_cv_func_printf_flag_zero" in - *yes) - case "$gl_cv_func_printf_precision" in - *yes) - case "$gl_cv_func_printf_enomem" in - *yes) - case "$gl_cv_func_snprintf_truncation_c99" in - *yes) - case "$gl_cv_func_snprintf_retval_c99" in - *yes) - case "$gl_cv_func_snprintf_directive_n" in - *yes) - case "$gl_cv_func_snprintf_size1" in - *yes) - case "$gl_cv_func_vsnprintf_zerosize_c99" in - *yes) - # snprintf exists and is - # already POSIX compliant. - gl_cv_func_snprintf_posix=yes - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - fi - if test $gl_cv_func_snprintf_posix = no; then + GL_GNULIB_PUTCHAR=1 - case "$gl_cv_func_printf_infinite" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h - ;; - esac +printf "%s\n" "#define GNULIB_TEST_PUTCHAR 1" >>confdefs.h - case "$gl_cv_func_printf_long_double" in - *yes) - case "$gl_cv_func_printf_infinite_long_double" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h - ;; - esac - ;; - esac - case "$gl_cv_func_printf_directive_a" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h - for ac_func in nl_langinfo -do : - ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" -if test "x$ac_cv_func_nl_langinfo" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_NL_LANGINFO 1 -_ACEOF -fi -done + GL_GNULIB_FPUTS=1 - ;; - esac - case "$gl_cv_func_printf_directive_f" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_FPUTS 1" >>confdefs.h - ;; - esac - case "$gl_cv_func_printf_directive_ls" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h - ;; - esac - case "$gl_cv_func_printf_flag_grouping" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h - ;; - esac + GL_GNULIB_PUTS=1 - case "$gl_cv_func_printf_flag_leftadjust" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h - ;; - esac +printf "%s\n" "#define GNULIB_TEST_PUTS 1" >>confdefs.h - case "$gl_cv_func_printf_flag_zero" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h - ;; - esac - case "$gl_cv_func_printf_precision" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h + GL_GNULIB_FWRITE=1 - ;; - esac - case "$gl_cv_func_printf_enomem" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_FWRITE 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h - ;; - esac @@ -36850,10 +47260,18 @@ + ac_fn_c_check_func "$LINENO" "stpcpy" "ac_cv_func_stpcpy" +if test "x$ac_cv_func_stpcpy" = xyes +then : + printf "%s\n" "#define HAVE_STPCPY 1" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext" +fi + if test $ac_cv_func_stpcpy = no; then + HAVE_STPCPY=0 + fi + if test $HAVE_STPCPY = 0; then @@ -36861,33 +47279,32 @@ - gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext" + gl_LIBOBJS="$gl_LIBOBJS stpcpy.$ac_objext" + : + fi - gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext" + GL_GNULIB_STPCPY=1 - gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext" +printf "%s\n" "#define GNULIB_TEST_STPCPY 1" >>confdefs.h - if test $ac_cv_func_vasnprintf = yes; then -$as_echo "#define REPLACE_VASNPRINTF 1" >>confdefs.h - fi @@ -36897,24 +47314,111 @@ - ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" -if test "x$ac_cv_type_ptrdiff_t" = xyes; then : -else -$as_echo "#define ptrdiff_t long" >>confdefs.h + if test $ac_cv_func_stpncpy = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working stpncpy" >&5 +printf %s "checking for working stpncpy... " >&6; } +if test ${gl_cv_func_stpncpy+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef __GNU_LIBRARY__ + Thanks for using GNU +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Thanks for using GNU" >/dev/null 2>&1 +then : + gl_cv_func_stpncpy="guessing yes" +else $as_nop + case "$host_os" in + *-musl*) gl_cv_func_stpncpy="guessing yes" ;; + *) gl_cv_func_stpncpy="$gl_cross_guess_normal" ;; + esac fi +rm -rf conftest* +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include /* for strcpy */ +/* The stpncpy prototype is missing in on AIX 4. */ +#if !HAVE_DECL_STPNCPY +extern +# ifdef __cplusplus +"C" +# endif +char *stpncpy (char *dest, const char *src, size_t n); +#endif +int main () +{ + int result = 0; + const char *src = "Hello"; + char dest[10]; + /* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+1 here. */ + { + strcpy (dest, "\377\377\377\377\377\377"); + if (stpncpy (dest, src, 2) != dest + 2) + result |= 1; + } + /* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+4 here. */ + { + strcpy (dest, "\377\377\377\377\377\377"); + if (stpncpy (dest, src, 5) != dest + 5) + result |= 2; + } + /* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+6 here. */ + { + strcpy (dest, "\377\377\377\377\377\377"); + if (stpncpy (dest, src, 7) != dest + 5) + result |= 4; + } + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_stpncpy=yes +else $as_nop + gl_cv_func_stpncpy=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_stpncpy" >&5 +printf "%s\n" "$gl_cv_func_stpncpy" >&6; } + case "$gl_cv_func_stpncpy" in + *yes) +printf "%s\n" "#define HAVE_STPNCPY 1" >>confdefs.h + ;; + *) + REPLACE_STPNCPY=1 + ;; + esac + else + HAVE_STPNCPY=0 + fi + if test $HAVE_STPNCPY = 0 || test $REPLACE_STPNCPY = 1; then @@ -36923,16 +47427,9 @@ - gl_LIBOBJS="$gl_LIBOBJS snprintf.$ac_objext" + gl_LIBOBJS="$gl_LIBOBJS stpncpy.$ac_objext" - if test $ac_cv_func_snprintf = yes; then - REPLACE_SNPRINTF=1 - else - if test $ac_cv_have_decl_snprintf = yes; then - REPLACE_SNPRINTF=1 - fi - fi : fi @@ -36945,121 +47442,256 @@ + GL_GNULIB_STPNCPY=1 - if test $gl_cv_have_include_next = yes; then - gl_cv_next_spawn_h='<'spawn.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_spawn_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test $ac_cv_header_spawn_h = yes; then +printf "%s\n" "#define GNULIB_TEST_STPNCPY 1" >>confdefs.h + + + + + + + if test $gl_cv_func_malloc_posix != yes; then + REPLACE_STRDUP=1 + fi + + if test $ac_cv_have_decl_strdup = no; then + HAVE_DECL_STRDUP=0 + fi + + if test $REPLACE_STRDUP = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS strdup.$ac_objext" + + : + fi + + + + + + + + + + GL_GNULIB_STRDUP=1 + + + +printf "%s\n" "#define GNULIB_TEST_STRDUP 1" >>confdefs.h + + + + + + + + + if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working strerror function" >&5 +printf %s "checking for working strerror function... " >&6; } +if test ${gl_cv_func_working_strerror+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_working_strerror="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; + esac + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include + +int +main (void) +{ +if (!*strerror (-2)) return 1; + ; + return 0; +} _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_working_strerror=yes +else $as_nop + gl_cv_func_working_strerror=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'spawn.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - gl_cv_absolute_spawn_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_working_strerror" >&5 +printf "%s\n" "$gl_cv_func_working_strerror" >&6; } + case "$gl_cv_func_working_strerror" in + *yes) ;; + *) + REPLACE_STRERROR=1 + ;; + esac - gl_header=$gl_cv_absolute_spawn_h - gl_cv_next_spawn_h='"'$gl_header'"' - else - gl_cv_next_spawn_h='<'spawn.h'>' - fi + case "$gl_cv_func_strerror_r_works" in + *no) REPLACE_STRERROR=1 ;; + esac + else + REPLACE_STRERROR=1 + fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_spawn_h" >&5 -$as_echo "$gl_cv_next_spawn_h" >&6; } - fi - NEXT_SPAWN_H=$gl_cv_next_spawn_h + if test $REPLACE_STRERROR = 1; then - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'spawn.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_spawn_h - fi - NEXT_AS_FIRST_DIRECTIVE_SPAWN_H=$gl_next_as_first_directive - if test $ac_cv_header_spawn_h = yes; then - HAVE_SPAWN_H=1 - ac_fn_c_check_type "$LINENO" "posix_spawnattr_t" "ac_cv_type_posix_spawnattr_t" " -#include -" -if test "x$ac_cv_type_posix_spawnattr_t" = xyes; then : -cat >>confdefs.h <<_ACEOF -#define HAVE_POSIX_SPAWNATTR_T 1 + gl_LIBOBJS="$gl_LIBOBJS strerror.$ac_objext" + + fi + + +printf "%s\n" "#define GNULIB_STRERROR 1" >>confdefs.h + + + + + + + + + + + + GL_GNULIB_STRERROR=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_STRERROR 1" >>confdefs.h + + + + + + + + + + + + + + + + if test $ac_cv_have_decl_strndup = no; then + HAVE_DECL_STRNDUP=0 + fi + + if test $ac_cv_func_strndup = yes; then + HAVE_STRNDUP=1 + # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working strndup" >&5 +printf %s "checking for working strndup... " >&6; } +if test ${gl_cv_func_strndup_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + + case $host_os in + aix | aix[3-6]*) gl_cv_func_strndup_works="guessing no";; + *) gl_cv_func_strndup_works="guessing yes";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include +int +main (void) +{ + +#if !HAVE_DECL_STRNDUP + extern + #ifdef __cplusplus + "C" + #endif + char *strndup (const char *, size_t); +#endif + int result; + char *s; + s = strndup ("some longer string", 15); + free (s); + s = strndup ("shorter string", 13); + result = s[13] != '\0'; + free (s); + return result; + ; + return 0; +} _ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_strndup_works=yes +else $as_nop + gl_cv_func_strndup_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - -else - HAVE_POSIX_SPAWNATTR_T=0 fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strndup_works" >&5 +printf "%s\n" "$gl_cv_func_strndup_works" >&6; } + case $gl_cv_func_strndup_works in + *no) REPLACE_STRNDUP=1 ;; + esac + else + HAVE_STRNDUP=0 + fi - ac_fn_c_check_type "$LINENO" "posix_spawn_file_actions_t" "ac_cv_type_posix_spawn_file_actions_t" " -#include + if test $HAVE_STRNDUP = 0 || test $REPLACE_STRNDUP = 1; then -" -if test "x$ac_cv_type_posix_spawn_file_actions_t" = xyes; then : -cat >>confdefs.h <<_ACEOF -#define HAVE_POSIX_SPAWN_FILE_ACTIONS_T 1 -_ACEOF -else - HAVE_POSIX_SPAWN_FILE_ACTIONS_T=0 -fi - else - HAVE_SPAWN_H=0 - HAVE_POSIX_SPAWNATTR_T=0 - HAVE_POSIX_SPAWN_FILE_ACTIONS_T=0 - fi + gl_LIBOBJS="$gl_LIBOBJS strndup.$ac_objext" + fi @@ -37069,246 +47701,264 @@ + GL_GNULIB_STRNDUP=1 +printf "%s\n" "#define GNULIB_TEST_STRNDUP 1" >>confdefs.h + if test $HAVE_STRTOD = 1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strtod obeys C99" >&5 +printf %s "checking whether strtod obeys C99... " >&6; } +if test ${gl_cv_func_strtod_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#ifdef __GNU_LIBRARY__ + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8) || (__GLIBC__ > 2)) \ + && !defined __UCLIBC__ + Lucky user + #endif +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Lucky user" >/dev/null 2>&1 +then : + gl_cv_func_strtod_works="guessing yes" +else $as_nop + case "$host_os" in + # Guess yes on musl systems. + *-musl*) gl_cv_func_strtod_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_strtod_works="guessing yes" ;; + *) gl_cv_func_strtod_works="$gl_cross_guess_normal" ;; + esac +fi +rm -rf conftest* +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +/* Compare two numbers with ==. + This is a separate function because IRIX 6.5 "cc -O" miscompiles an + 'x == x' test. */ +static int +numeric_equal (double x, double y) +{ + return x == y; +} +int +main (void) +{ - gl_cv_func_sprintf_posix=no - case "$gl_cv_func_printf_sizes_c99" in - *yes) - case "$gl_cv_func_printf_long_double" in - *yes) - case "$gl_cv_func_printf_infinite" in - *yes) - case "$gl_cv_func_printf_infinite_long_double" in - *yes) - case "$gl_cv_func_printf_directive_a" in - *yes) - case "$gl_cv_func_printf_directive_f" in - *yes) - case "$gl_cv_func_printf_directive_n" in - *yes) - case "$gl_cv_func_printf_directive_ls" in - *yes) - case "$gl_cv_func_printf_positions" in - *yes) - case "$gl_cv_func_printf_flag_grouping" in - *yes) - case "$gl_cv_func_printf_flag_leftadjust" in - *yes) - case "$gl_cv_func_printf_flag_zero" in - *yes) - case "$gl_cv_func_printf_precision" in - *yes) - case "$gl_cv_func_printf_enomem" in - *yes) - # sprintf exists and is - # already POSIX compliant. - gl_cv_func_sprintf_posix=yes - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - if test $gl_cv_func_sprintf_posix = no; then + int result = 0; + { + /* In some old versions of Linux (2000 or before), strtod mis-parses + strings with leading '+'. */ + const char *string = " +69"; + char *term; + double value = strtod (string, &term); + if (value != 69 || term != (string + 4)) + result |= 1; + } + { + /* Under Solaris 2.4, strtod returns the wrong value for the + terminating character under some conditions. */ + const char *string = "NaN"; + char *term; + strtod (string, &term); + if (term != string && *(term - 1) == 0) + result |= 2; + } + { + /* Older glibc and Cygwin mis-parse "-0x". */ + const char *string = "-0x"; + char *term; + double value = strtod (string, &term); + double zero = 0.0; + if (1.0 / value != -1.0 / zero || term != (string + 2)) + result |= 4; + } + { + /* Many platforms do not parse hex floats. */ + const char *string = "0XaP+1"; + char *term; + double value = strtod (string, &term); + if (value != 20.0 || term != (string + 6)) + result |= 8; + } + { + /* Many platforms do not parse infinities. HP-UX 11.31 parses inf, + but mistakenly sets errno. */ + const char *string = "inf"; + char *term; + double value; + errno = 0; + value = strtod (string, &term); + if (value != HUGE_VAL || term != (string + 3) || errno) + result |= 16; + } + { + /* glibc 2.7 and cygwin 1.5.24 misparse "nan()". */ + const char *string = "nan()"; + char *term; + double value = strtod (string, &term); + if (numeric_equal (value, value) || term != (string + 5)) + result |= 32; + } + { + /* darwin 10.6.1 misparses "nan(". */ + const char *string = "nan("; + char *term; + double value = strtod (string, &term); + if (numeric_equal (value, value) || term != (string + 3)) + result |= 64; + } + return result; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_strtod_works=yes +else $as_nop + gl_cv_func_strtod_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - case "$gl_cv_func_printf_infinite" in - *yes) - ;; - *) +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strtod_works" >&5 +printf "%s\n" "$gl_cv_func_strtod_works" >&6; } + case "$gl_cv_func_strtod_works" in + *yes) ;; + *) + REPLACE_STRTOD=1 + ;; + esac + fi -$as_echo "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h + if test $HAVE_STRTOD = 0 || test $REPLACE_STRTOD = 1; then - ;; - esac - case "$gl_cv_func_printf_long_double" in - *yes) - case "$gl_cv_func_printf_infinite_long_double" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h - ;; - esac - ;; - esac + gl_LIBOBJS="$gl_LIBOBJS strtod.$ac_objext" - case "$gl_cv_func_printf_directive_a" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h + if test $gl_cv_func_ldexp_no_libm = yes; then + +printf "%s\n" "#define HAVE_LDEXP_IN_LIBC 1" >>confdefs.h - for ac_func in nl_langinfo -do : + fi ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" -if test "x$ac_cv_func_nl_langinfo" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_NL_LANGINFO 1 -_ACEOF +if test "x$ac_cv_func_nl_langinfo" = xyes +then : + printf "%s\n" "#define HAVE_NL_LANGINFO 1" >>confdefs.h fi -done - ;; - esac + fi - case "$gl_cv_func_printf_directive_f" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h - ;; - esac - case "$gl_cv_func_printf_directive_ls" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h - ;; - esac + GL_GNULIB_STRTOD=1 - case "$gl_cv_func_printf_flag_grouping" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h - ;; - esac +printf "%s\n" "#define GNULIB_TEST_STRTOD 1" >>confdefs.h - case "$gl_cv_func_printf_flag_leftadjust" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h - ;; - esac + ac_fn_c_check_func "$LINENO" "strverscmp" "ac_cv_func_strverscmp" +if test "x$ac_cv_func_strverscmp" = xyes +then : + printf "%s\n" "#define HAVE_STRVERSCMP 1" >>confdefs.h - case "$gl_cv_func_printf_flag_zero" in - *yes) - ;; - *) +fi -$as_echo "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h + if test $ac_cv_func_strverscmp = no; then + HAVE_STRVERSCMP=0 + fi - ;; - esac + if test $HAVE_STRVERSCMP = 0; then - case "$gl_cv_func_printf_precision" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h + gl_LIBOBJS="$gl_LIBOBJS strverscmp.$ac_objext" - ;; - esac + : + fi - case "$gl_cv_func_printf_enomem" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h - ;; - esac + GL_GNULIB_STRVERSCMP=1 +printf "%s\n" "#define GNULIB_TEST_STRVERSCMP 1" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext" @@ -37318,7 +47968,6 @@ - gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext" @@ -37328,7 +47977,6 @@ - gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext" @@ -37338,13 +47986,9 @@ - gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext" - if test $ac_cv_func_vasnprintf = yes; then -$as_echo "#define REPLACE_VASNPRINTF 1" >>confdefs.h - fi @@ -37354,15 +47998,10 @@ - ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" -if test "x$ac_cv_type_ptrdiff_t" = xyes; then : -else -$as_echo "#define ptrdiff_t long" >>confdefs.h -fi @@ -37374,425 +48013,399 @@ + ac_fn_c_check_header_compile "$LINENO" "sys/single_threaded.h" "ac_cv_header_sys_single_threaded_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_single_threaded_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SINGLE_THREADED_H 1" >>confdefs.h +fi - gl_LIBOBJS="$gl_LIBOBJS sprintf.$ac_objext" - REPLACE_SPRINTF=1 - : - fi + : - GNULIB_SPRINTF_POSIX=1 -$as_echo "#define GNULIB_TEST_SPRINTF_POSIX 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssize_t" >&5 -$as_echo_n "checking for ssize_t... " >&6; } -if ${gt_cv_ssize_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -int x = sizeof (ssize_t *) + sizeof (ssize_t); - return !x; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gt_cv_ssize_t=yes -else - gt_cv_ssize_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_ssize_t" >&5 -$as_echo "$gt_cv_ssize_t" >&6; } - if test $gt_cv_ssize_t = no; then -$as_echo "#define ssize_t int" >>confdefs.h - fi + if { test "$HAVE_LIBUNISTRING" != yes \ + || { + test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ + || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ + && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ + || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ + && test $LIBUNISTRING_VERSION_SUBMINOR -lt 11 + } + } + } - if test "$ac_cv_header_stdbool_h" = yes; then - case "$host_os" in - solaris*) - if test -z "$GCC"; then - STDBOOL_H='stdbool.h' - else - STDBOOL_H='' - fi - ;; - *) - STDBOOL_H='' - ;; - esac - else - STDBOOL_H='stdbool.h' - fi - if test -n "$STDBOOL_H"; then - GL_GENERATE_STDBOOL_H_TRUE= - GL_GENERATE_STDBOOL_H_FALSE='#' -else - GL_GENERATE_STDBOOL_H_TRUE='#' - GL_GENERATE_STDBOOL_H_FALSE= -fi - if test "$ac_cv_type__Bool" = yes; then - HAVE__BOOL=1 + } + }; then + LIBUNISTRING_UNISTR_H='unistr.h' else - HAVE__BOOL=0 + LIBUNISTRING_UNISTR_H= fi +printf "%s\n" "#define GNULIB_UNISTR_U8_MBTOUCR 1" >>confdefs.h - STDDEF_H= - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for good max_align_t" >&5 -$as_echo_n "checking for good max_align_t... " >&6; } -if ${gl_cv_type_max_align_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - unsigned int s = sizeof (max_align_t); - #if defined __GNUC__ || defined __IBM__ALIGNOF__ - int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1]; - int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1]; - #endif -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_type_max_align_t=yes -else - gl_cv_type_max_align_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if { test "$HAVE_LIBUNISTRING" != yes \ + || { -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_max_align_t" >&5 -$as_echo "$gl_cv_type_max_align_t" >&6; } - if test $gl_cv_type_max_align_t = no; then - HAVE_MAX_ALIGN_T=0 - STDDEF_H=stddef.h - fi - if test $gt_cv_c_wchar_t = no; then - HAVE_WCHAR_T=0 - STDDEF_H=stddef.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NULL can be used in arbitrary expressions" >&5 -$as_echo_n "checking whether NULL can be used in arbitrary expressions... " >&6; } -if ${gl_cv_decl_null_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - int test[2 * (sizeof NULL == sizeof (void *)) -1]; + test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ + || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ + && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ + || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ + && test $LIBUNISTRING_VERSION_SUBMINOR -lt 0 + } + } + } -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_decl_null_works=yes -else - gl_cv_decl_null_works=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_null_works" >&5 -$as_echo "$gl_cv_decl_null_works" >&6; } - if test $gl_cv_decl_null_works = no; then - REPLACE_NULL=1 - STDDEF_H=stddef.h - fi - if test -n "$STDDEF_H"; then - GL_GENERATE_STDDEF_H_TRUE= - GL_GENERATE_STDDEF_H_FALSE='#' + } + }; then + LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_TRUE= + LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_FALSE='#' else - GL_GENERATE_STDDEF_H_TRUE='#' - GL_GENERATE_STDDEF_H_FALSE= + LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_TRUE='#' + LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_FALSE= fi - if test -n "$STDDEF_H"; then - - +printf "%s\n" "#define GNULIB_UNISTR_U8_UCTOMB 1" >>confdefs.h - if test $gl_cv_have_include_next = yes; then - gl_cv_next_stddef_h='<'stddef.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_stddef_h+:} false; then : - $as_echo_n "(cached) " >&6 -else + if { test "$HAVE_LIBUNISTRING" != yes \ + || { - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'stddef.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' + test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ + || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ + && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ + || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ + && test $LIBUNISTRING_VERSION_SUBMINOR -lt 0 + } + } + } - gl_cv_absolute_stddef_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_stddef_h - gl_cv_next_stddef_h='"'$gl_header'"' + } + }; then + LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_TRUE= + LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_FALSE='#' +else + LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_TRUE='#' + LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_FALSE= fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stddef_h" >&5 -$as_echo "$gl_cv_next_stddef_h" >&6; } - fi - NEXT_STDDEF_H=$gl_cv_next_stddef_h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'stddef.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_stddef_h - fi - NEXT_AS_FIRST_DIRECTIVE_STDDEF_H=$gl_next_as_first_directive + if { test "$HAVE_LIBUNISTRING" != yes \ + || { - fi + test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ + || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ + && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ + || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ + && test $LIBUNISTRING_VERSION_SUBMINOR -lt 11 + } + } + } - $as_echo "#define __USE_MINGW_ANSI_STDIO 1" >>confdefs.h + } + }; then + LIBUNISTRING_UNITYPES_H='unitypes.h' + else + LIBUNISTRING_UNITYPES_H= + fi + if { test "$HAVE_LIBUNISTRING" != yes \ + || { - if test $gl_cv_have_include_next = yes; then - gl_cv_next_stdio_h='<'stdio.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_stdio_h+:} false; then : - $as_echo_n "(cached) " >&6 -else + test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ + || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ + && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ + || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ + && test $LIBUNISTRING_VERSION_SUBMINOR -lt 11 + } + } + } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'stdio.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' + } + }; then + LIBUNISTRING_UNIWIDTH_H='uniwidth.h' + else + LIBUNISTRING_UNIWIDTH_H= + fi + - gl_cv_absolute_stdio_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_stdio_h - gl_cv_next_stdio_h='"'$gl_header'"' + if { test "$HAVE_LIBUNISTRING" != yes \ + || { -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdio_h" >&5 -$as_echo "$gl_cv_next_stdio_h" >&6; } - fi - NEXT_STDIO_H=$gl_cv_next_stdio_h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'stdio.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_stdio_h - fi - NEXT_AS_FIRST_DIRECTIVE_STDIO_H=$gl_next_as_first_directive + test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ + || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ + && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ + || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ + && test $LIBUNISTRING_VERSION_SUBMINOR -lt 8 + } + } + } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking which flavor of printf attribute matches inttypes macros" >&5 -$as_echo_n "checking which flavor of printf attribute matches inttypes macros... " >&6; } -if ${gl_cv_func_printf_attribute_flavor+:} false; then : - $as_echo_n "(cached) " >&6 + } + }; then + LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE= + LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_FALSE='#' else + LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE='#' + LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_FALSE= +fi + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether unlink honors trailing slashes" >&5 +printf %s "checking whether unlink honors trailing slashes... " >&6; } +if test ${gl_cv_func_unlink_honors_slashes+y} +then : + printf %s "(cached) " >&6 +else $as_nop + touch conftest.file + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + ln -s conftest.file conftest.lnk + fi + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_unlink_honors_slashes="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_unlink_honors_slashes="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_unlink_honors_slashes="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_unlink_honors_slashes="$gl_cross_guess_normal" ;; + esac + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#if HAVE_UNISTD_H + # include + #else /* on Windows with MSVC */ + # include + #endif + #include - #define __STDC_FORMAT_MACROS 1 - #include - #include - /* For non-mingw systems, compilation will trivially succeed. - For mingw, compilation will succeed for older mingw (system - printf, "I64d") and fail for newer mingw (gnu printf, "lld"). */ - #if (defined _WIN32 && ! defined __CYGWIN__) && \ - (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) - extern char PRIdMAX_probe[sizeof PRIdMAX == sizeof "I64d" ? 1 : -1]; - #endif + +$gl_mda_defines int -main () +main (void) { +int result = 0; + if (!unlink ("conftest.file/")) + result |= 1; + else if (errno != ENOTDIR) + result |= 2; +#if HAVE_LSTAT + if (!unlink ("conftest.lnk/")) + result |= 4; + else if (errno != ENOTDIR) + result |= 8; +#endif + return result; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_func_printf_attribute_flavor=system -else - gl_cv_func_printf_attribute_flavor=gnu +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_unlink_honors_slashes=yes +else $as_nop + gl_cv_func_unlink_honors_slashes=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_attribute_flavor" >&5 -$as_echo "$gl_cv_func_printf_attribute_flavor" >&6; } - if test "$gl_cv_func_printf_attribute_flavor" = gnu; then -$as_echo "#define GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU 1" >>confdefs.h + rm -f conftest.file conftest.lnk +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_unlink_honors_slashes" >&5 +printf "%s\n" "$gl_cv_func_unlink_honors_slashes" >&6; } + case "$gl_cv_func_unlink_honors_slashes" in + *no) + REPLACE_UNLINK=1 + ;; + esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether unlink of a parent directory fails as it should" >&5 +printf %s "checking whether unlink of a parent directory fails as it should... " >&6; } +if test ${gl_cv_func_unlink_parent_fails+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + darwin*) + if { + # Use the mktemp program if available. If not available, hide the error + # message. + tmp=`(umask 077 && mktemp -d /tmp/gtXXXXXX) 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" + } || + { + # Use a simple mkdir command. It is guaranteed to fail if the directory + # already exists. $RANDOM is bash specific and expands to empty in shells + # other than bash, ksh and zsh. Its use does not increase security; + # rather, it minimizes the probability of failure in a very cluttered /tmp + # directory. + tmp=/tmp/gt$$-$RANDOM + (umask 077 && mkdir "$tmp") + }; then + mkdir "$tmp/subdir" + GL_SUBDIR_FOR_UNLINK="$tmp/subdir" + export GL_SUBDIR_FOR_UNLINK + if test "$cross_compiling" = yes +then : + # If we don't know, obey --enable-cross-guesses. + gl_cv_func_unlink_parent_fails="$gl_cross_guess_normal" + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #if HAVE_UNISTD_H + # include + #else /* on Windows with MSVC */ + # include + # include + #endif - fi - GNULIB_FSCANF=1 +$gl_mda_defines + int main () + { + int result = 0; + if (chdir (getenv ("GL_SUBDIR_FOR_UNLINK")) != 0) + result |= 1; + else if (unlink ("..") == 0) + result |= 2; + return result; + } -cat >>confdefs.h <<_ACEOF -#define GNULIB_FSCANF 1 _ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_unlink_parent_fails=yes +else $as_nop + gl_cv_func_unlink_parent_fails=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + unset GL_SUBDIR_FOR_UNLINK + rm -rf "$tmp" + else + gl_cv_func_unlink_parent_fails="guessing no" + fi + ;; + *) + gl_cv_func_unlink_parent_fails="guessing yes" + ;; + esac - GNULIB_SCANF=1 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_unlink_parent_fails" >&5 +printf "%s\n" "$gl_cv_func_unlink_parent_fails" >&6; } + case "$gl_cv_func_unlink_parent_fails" in + *no) + REPLACE_UNLINK=1 +printf "%s\n" "#define UNLINK_PARENT_BUG 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define GNULIB_SCANF 1 -_ACEOF + ;; + esac + if test $REPLACE_UNLINK = 1; then - GNULIB_FGETC=1 - GNULIB_GETC=1 - GNULIB_GETCHAR=1 - GNULIB_FGETS=1 - GNULIB_FREAD=1 - GNULIB_FPRINTF=1 - GNULIB_PRINTF=1 - GNULIB_VFPRINTF=1 - GNULIB_VPRINTF=1 - GNULIB_FPUTC=1 - GNULIB_PUTC=1 - GNULIB_PUTCHAR=1 - GNULIB_FPUTS=1 - GNULIB_PUTS=1 - GNULIB_FWRITE=1 + gl_LIBOBJS="$gl_LIBOBJS unlink.$ac_objext" + fi @@ -37802,67 +48415,21 @@ + GL_GNULIB_UNLINK=1 - if test $gl_cv_have_include_next = yes; then - gl_cv_next_stdlib_h='<'stdlib.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_stdlib_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac +printf "%s\n" "#define GNULIB_TEST_UNLINK 1" >>confdefs.h - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'stdlib.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - gl_cv_absolute_stdlib_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_stdlib_h - gl_cv_next_stdlib_h='"'$gl_header'"' +printf "%s\n" "#define GNULIB_STDIO_SINGLE_THREAD 1" >>confdefs.h -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdlib_h" >&5 -$as_echo "$gl_cv_next_stdlib_h" >&6; } - fi - NEXT_STDLIB_H=$gl_cv_next_stdlib_h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'stdlib.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_stdlib_h - fi - NEXT_AS_FIRST_DIRECTIVE_STDLIB_H=$gl_next_as_first_directive +printf "%s\n" "#define USE_UNLOCKED_IO GNULIB_STDIO_SINGLE_THREAD" >>confdefs.h @@ -37878,158 +48445,203 @@ - for ac_func in stpcpy -do : - ac_fn_c_check_func "$LINENO" "stpcpy" "ac_cv_func_stpcpy" -if test "x$ac_cv_func_stpcpy" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STPCPY 1 -_ACEOF -fi -done - if test $ac_cv_func_stpcpy = no; then - HAVE_STPCPY=0 + + + + + if test $ac_cv_have_decl_unsetenv = no; then + HAVE_DECL_UNSETENV=0 fi + ac_fn_c_check_func "$LINENO" "unsetenv" "ac_cv_func_unsetenv" +if test "x$ac_cv_func_unsetenv" = xyes +then : + printf "%s\n" "#define HAVE_UNSETENV 1" >>confdefs.h - if test $HAVE_STPCPY = 0; then +fi + + if test $ac_cv_func_unsetenv = no; then + HAVE_UNSETENV=0 + else + HAVE_UNSETENV=1 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for unsetenv() return type" >&5 +printf %s "checking for unsetenv() return type... " >&6; } +if test ${gt_cv_func_unsetenv_ret+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#undef _BSD +#define _BSD 1 /* unhide unsetenv declaration in OSF/1 5.1 */ +#include +extern +#ifdef __cplusplus +"C" +#endif +int unsetenv (const char *name); + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gt_cv_func_unsetenv_ret='int' +else $as_nop + gt_cv_func_unsetenv_ret='void' +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_unsetenv_ret" >&5 +printf "%s\n" "$gt_cv_func_unsetenv_ret" >&6; } + if test $gt_cv_func_unsetenv_ret = 'void'; then +printf "%s\n" "#define VOID_UNSETENV 1" >>confdefs.h + REPLACE_UNSETENV=1 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether unsetenv obeys POSIX" >&5 +printf %s "checking whether unsetenv obeys POSIX... " >&6; } +if test ${gl_cv_func_unsetenv_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_unsetenv_works="$gl_cross_guess_normal" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include + #include + extern char **environ; +$gl_mda_defines - gl_LIBOBJS="$gl_LIBOBJS stpcpy.$ac_objext" +int +main (void) +{ + char entry1[] = "a=1"; + char entry2[] = "b=2"; + char *env[] = { entry1, entry2, NULL }; + if (putenv ((char *) "a=1")) return 1; + if (putenv (entry2)) return 2; + entry2[0] = 'a'; + unsetenv ("a"); + if (getenv ("a")) return 3; + if (!unsetenv ("") || errno != EINVAL) return 4; + entry2[0] = 'b'; + environ = env; + if (!getenv ("a")) return 5; + entry2[0] = 'a'; + unsetenv ("a"); + if (getenv ("a")) return 6; - : + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_unsetenv_works=yes +else $as_nop + gl_cv_func_unsetenv_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_unsetenv_works" >&5 +printf "%s\n" "$gl_cv_func_unsetenv_works" >&6; } + case "$gl_cv_func_unsetenv_works" in + *yes) ;; + *) + REPLACE_UNSETENV=1 + ;; + esac fi + if test $HAVE_UNSETENV = 0 || test $REPLACE_UNSETENV = 1; then - GNULIB_STPCPY=1 + gl_LIBOBJS="$gl_LIBOBJS unsetenv.$ac_objext" -$as_echo "#define GNULIB_TEST_STPCPY 1" >>confdefs.h + fi - if test $ac_cv_func_strdup = yes; then - if test $gl_cv_func_malloc_posix != yes; then - REPLACE_STRDUP=1 - fi - fi - if test $ac_cv_have_decl_strdup = no; then - HAVE_DECL_STRDUP=0 - fi - if test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1; then + GL_GNULIB_UNSETENV=1 - gl_LIBOBJS="$gl_LIBOBJS strdup.$ac_objext" - : - fi +printf "%s\n" "#define GNULIB_TEST_UNSETENV 1" >>confdefs.h - GNULIB_STRDUP=1 + if test $ac_cv_func_vasnprintf = no; then -$as_echo "#define GNULIB_TEST_STRDUP 1" >>confdefs.h + gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext" - if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strerror function" >&5 -$as_echo_n "checking for working strerror function... " >&6; } -if ${gl_cv_func_working_strerror+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; - # Guess yes on musl systems. - *-musl*) gl_cv_func_working_strerror="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -if (!*strerror (-2)) return 1; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_working_strerror=yes -else - gl_cv_func_working_strerror=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_working_strerror" >&5 -$as_echo "$gl_cv_func_working_strerror" >&6; } - case "$gl_cv_func_working_strerror" in - *yes) ;; - *) - REPLACE_STRERROR=1 - ;; - esac - case "$gl_cv_func_strerror_r_works" in - *no) REPLACE_STRERROR=1 ;; - esac + gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext" - else - REPLACE_STRERROR=1 - fi - if test $REPLACE_STRERROR = 1; then @@ -38037,109 +48649,60 @@ + gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext" - gl_LIBOBJS="$gl_LIBOBJS strerror.$ac_objext" - fi -cat >>confdefs.h <<_ACEOF -#define GNULIB_STRERROR 1 -_ACEOF + gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext" + if test $ac_cv_func_vasnprintf = yes; then - GNULIB_STRERROR=1 +printf "%s\n" "#define REPLACE_VASNPRINTF 1" >>confdefs.h + fi -$as_echo "#define GNULIB_TEST_STRERROR 1" >>confdefs.h + ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" +if test "x$ac_cv_type_ptrdiff_t" = xyes +then : +else $as_nop +printf "%s\n" "#define ptrdiff_t long" >>confdefs.h +fi - if test $ac_cv_have_decl_strndup = no; then - HAVE_DECL_STRNDUP=0 - fi - if test $ac_cv_func_strndup = yes; then - HAVE_STRNDUP=1 - # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strndup" >&5 -$as_echo_n "checking for working strndup... " >&6; } -if ${gl_cv_func_strndup_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case $host_os in - aix | aix[3-6]*) gl_cv_func_strndup_works="guessing no";; - *) gl_cv_func_strndup_works="guessing yes";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - #include - #include -int -main () -{ + fi -#if !HAVE_DECL_STRNDUP - extern - #ifdef __cplusplus - "C" - #endif - char *strndup (const char *, size_t); -#endif - int result; - char *s; - s = strndup ("some longer string", 15); - free (s); - s = strndup ("shorter string", 13); - result = s[13] != '\0'; - free (s); - return result; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_strndup_works=yes -else - gl_cv_func_strndup_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + + ac_fn_c_check_func "$LINENO" "vasprintf" "ac_cv_func_vasprintf" +if test "x$ac_cv_func_vasprintf" = xyes +then : + printf "%s\n" "#define HAVE_VASPRINTF 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strndup_works" >&5 -$as_echo "$gl_cv_func_strndup_works" >&6; } - case $gl_cv_func_strndup_works in - *no) REPLACE_STRNDUP=1 ;; - esac - else - HAVE_STRNDUP=0 - fi - if test $HAVE_STRNDUP = 0 || test $REPLACE_STRNDUP = 1; then + if test $ac_cv_func_vasprintf = no; then @@ -38148,45 +48711,35 @@ - gl_LIBOBJS="$gl_LIBOBJS strndup.$ac_objext" - fi + gl_LIBOBJS="$gl_LIBOBJS vasprintf.$ac_objext" - GNULIB_STRNDUP=1 + gl_LIBOBJS="$gl_LIBOBJS asprintf.$ac_objext" -$as_echo "#define GNULIB_TEST_STRNDUP 1" >>confdefs.h + if test $ac_cv_func_vasprintf = yes; then + REPLACE_VASPRINTF=1 + else + HAVE_VASPRINTF=0 + fi - for ac_func in strverscmp -do : - ac_fn_c_check_func "$LINENO" "strverscmp" "ac_cv_func_strverscmp" -if test "x$ac_cv_func_strverscmp" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRVERSCMP 1 -_ACEOF -fi -done - if test $ac_cv_func_strverscmp = no; then - HAVE_STRVERSCMP=0 fi - if test $HAVE_STRVERSCMP = 0; then - @@ -38194,26 +48747,25 @@ - gl_LIBOBJS="$gl_LIBOBJS strverscmp.$ac_objext" - : + GL_GNULIB_VASPRINTF=1 - fi +printf "%s\n" "#define GNULIB_TEST_VASPRINTF 1" >>confdefs.h - GNULIB_STRVERSCMP=1 + XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=asprintf:2:c-format" -$as_echo "#define GNULIB_TEST_STRVERSCMP 1" >>confdefs.h + XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=vasprintf:2:c-format" @@ -38226,279 +48778,238 @@ - if test $gl_cv_have_include_next = yes; then - gl_cv_next_sys_resource_h='<'sys/resource.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_sys_resource_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test $ac_cv_header_sys_resource_h = yes; then + gl_cv_func_vasprintf_posix=no + ac_fn_c_check_func "$LINENO" "vasprintf" "ac_cv_func_vasprintf" +if test "x$ac_cv_func_vasprintf" = xyes +then : + printf "%s\n" "#define HAVE_VASPRINTF 1" >>confdefs.h - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac +fi - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' + case "$gl_cv_func_printf_sizes_c99" in + *yes) + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + case "$gl_cv_func_printf_directive_a" in + *yes) + case "$gl_cv_func_printf_directive_f" in + *yes) + case "$gl_cv_func_printf_directive_n" in + *yes) + case "$gl_cv_func_printf_directive_ls" in + *yes) + case "$gl_cv_func_printf_positions" in + *yes) + case "$gl_cv_func_printf_flag_grouping" in + *yes) + case "$gl_cv_func_printf_flag_leftadjust" in + *yes) + case "$gl_cv_func_printf_flag_zero" in + *yes) + case "$gl_cv_func_printf_precision" in + *yes) + case "$gl_cv_func_printf_enomem" in + *yes) + if test $ac_cv_func_vasprintf = yes; then + # vasprintf exists and is + # already POSIX compliant. + gl_cv_func_vasprintf_posix=yes + fi + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac ;; esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'sys/resource.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - - gl_cv_absolute_sys_resource_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - - gl_header=$gl_cv_absolute_sys_resource_h - gl_cv_next_sys_resource_h='"'$gl_header'"' - else - gl_cv_next_sys_resource_h='<'sys/resource.h'>' - fi - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_resource_h" >&5 -$as_echo "$gl_cv_next_sys_resource_h" >&6; } - fi - NEXT_SYS_RESOURCE_H=$gl_cv_next_sys_resource_h - - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'sys/resource.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_sys_resource_h - fi - NEXT_AS_FIRST_DIRECTIVE_SYS_RESOURCE_H=$gl_next_as_first_directive - - - - - if test $ac_cv_header_sys_resource_h = yes; then - HAVE_SYS_RESOURCE_H=1 - else - HAVE_SYS_RESOURCE_H=0 - fi - - - + if test $gl_cv_func_vasprintf_posix = no; then + case "$gl_cv_func_printf_infinite" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h + ;; + esac + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h + ;; + esac + ;; + esac + case "$gl_cv_func_printf_directive_a" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h + ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" +if test "x$ac_cv_func_nl_langinfo" = xyes +then : + printf "%s\n" "#define HAVE_NL_LANGINFO 1" >>confdefs.h +fi + ;; + esac - if test $gl_cv_have_include_next = yes; then - gl_cv_next_sys_times_h='<'sys/times.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_sys_times_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test $ac_cv_header_sys_times_h = yes; then + case "$gl_cv_func_printf_directive_f" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h + ;; + esac - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' + case "$gl_cv_func_printf_directive_ls" in + *yes) ;; *) - gl_dirsep_regex='\/' + +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h + ;; esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'sys/times.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - gl_cv_absolute_sys_times_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_sys_times_h - gl_cv_next_sys_times_h='"'$gl_header'"' - else - gl_cv_next_sys_times_h='<'sys/times.h'>' - fi + case "$gl_cv_func_printf_flag_grouping" in + *yes) + ;; + *) -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_times_h" >&5 -$as_echo "$gl_cv_next_sys_times_h" >&6; } - fi - NEXT_SYS_TIMES_H=$gl_cv_next_sys_times_h +printf "%s\n" "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'sys/times.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_sys_times_h - fi - NEXT_AS_FIRST_DIRECTIVE_SYS_TIMES_H=$gl_next_as_first_directive + ;; + esac + case "$gl_cv_func_printf_flag_leftadjust" in + *yes) + ;; + *) - if test $ac_cv_header_sys_times_h = yes; then - HAVE_SYS_TIMES_H=1 - ac_fn_c_check_type "$LINENO" "struct tms" "ac_cv_type_struct_tms" " -#include +printf "%s\n" "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h -" -if test "x$ac_cv_type_struct_tms" = xyes; then : + ;; + esac -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_TMS 1 -_ACEOF -else - HAVE_STRUCT_TMS=0 -fi + case "$gl_cv_func_printf_flag_zero" in + *yes) + ;; + *) - else - HAVE_SYS_TIMES_H=0 - HAVE_STRUCT_TMS=0 - fi +printf "%s\n" "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h + ;; + esac + case "$gl_cv_func_printf_precision" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h + ;; + esac + case "$gl_cv_func_printf_enomem" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h + ;; + esac - if test $gl_cv_have_include_next = yes; then - gl_cv_next_sys_wait_h='<'sys/wait.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_sys_wait_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test $ac_cv_header_sys_wait_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'sys/wait.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - gl_cv_absolute_sys_wait_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_sys_wait_h - gl_cv_next_sys_wait_h='"'$gl_header'"' - else - gl_cv_next_sys_wait_h='<'sys/wait.h'>' - fi + gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_wait_h" >&5 -$as_echo "$gl_cv_next_sys_wait_h" >&6; } - fi - NEXT_SYS_WAIT_H=$gl_cv_next_sys_wait_h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'sys/wait.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_sys_wait_h - fi - NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H=$gl_next_as_first_directive @@ -38506,6 +49017,7 @@ + gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext" @@ -38515,7 +49027,7 @@ - : + gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext" @@ -38525,86 +49037,37 @@ + gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext" + if test $ac_cv_func_vasnprintf = yes; then +printf "%s\n" "#define REPLACE_VASNPRINTF 1" >>confdefs.h + fi - if test $gl_cv_have_include_next = yes; then - gl_cv_next_unistd_h='<'unistd.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_unistd_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test $ac_cv_header_unistd_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'unistd.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' + ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" +if test "x$ac_cv_type_ptrdiff_t" = xyes +then : - gl_cv_absolute_unistd_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` +else $as_nop - gl_header=$gl_cv_absolute_unistd_h - gl_cv_next_unistd_h='"'$gl_header'"' - else - gl_cv_next_unistd_h='<'unistd.h'>' - fi +printf "%s\n" "#define ptrdiff_t long" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_unistd_h" >&5 -$as_echo "$gl_cv_next_unistd_h" >&6; } - fi - NEXT_UNISTD_H=$gl_cv_next_unistd_h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'unistd.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_unistd_h - fi - NEXT_AS_FIRST_DIRECTIVE_UNISTD_H=$gl_next_as_first_directive - if test $ac_cv_header_unistd_h = yes; then - HAVE_UNISTD_H=1 - else - HAVE_UNISTD_H=0 - fi @@ -38616,281 +49079,220 @@ + gl_LIBOBJS="$gl_LIBOBJS vasprintf.$ac_objext" - if { test "$HAVE_LIBUNISTRING" != yes \ - || { - test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ - || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ - && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ - || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ - && test $LIBUNISTRING_VERSION_SUBMINOR -lt 4 - } - } - } + gl_LIBOBJS="$gl_LIBOBJS asprintf.$ac_objext" - } - }; then - LIBUNISTRING_UNITYPES_H='unitypes.h' + if test $ac_cv_func_vasprintf = yes; then + REPLACE_VASPRINTF=1 else - LIBUNISTRING_UNITYPES_H= + HAVE_VASPRINTF=0 fi - if { test "$HAVE_LIBUNISTRING" != yes \ - || { - - - - test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ - || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ - && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ - || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ - && test $LIBUNISTRING_VERSION_SUBMINOR -lt 4 - } - } - } - } - }; then - LIBUNISTRING_UNIWIDTH_H='uniwidth.h' - else - LIBUNISTRING_UNIWIDTH_H= fi + gl_cv_func_vsnprintf_usable=no + ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf" +if test "x$ac_cv_func_vsnprintf" = xyes +then : + printf "%s\n" "#define HAVE_VSNPRINTF 1" >>confdefs.h - if { test "$HAVE_LIBUNISTRING" != yes \ - || { - - - - test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ - || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ - && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ - || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ - && test $LIBUNISTRING_VERSION_SUBMINOR -lt 8 - } - } - } - - - - - } - }; then - LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE= - LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_FALSE='#' -else - LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE='#' - LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_FALSE= fi + if test $ac_cv_func_vsnprintf = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether snprintf respects a size of 1" >&5 +printf %s "checking whether snprintf respects a size of 1... " >&6; } +if test ${gl_cv_func_snprintf_size1+y} +then : + printf %s "(cached) " >&6 +else $as_nop - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether unlink honors trailing slashes" >&5 -$as_echo_n "checking whether unlink honors trailing slashes... " >&6; } -if ${gl_cv_func_unlink_honors_slashes+:} false; then : - $as_echo_n "(cached) " >&6 -else - touch conftest.file - # Assume that if we have lstat, we can also check symlinks. - if test $ac_cv_func_lstat = yes; then - ln -s conftest.file conftest.lnk - fi - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes +then : case "$host_os" in - # Guess yes on Linux systems. - linux-* | linux) gl_cv_func_unlink_honors_slashes="guessing yes" ;; - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_unlink_honors_slashes="guessing yes" ;; - # Guess no on native Windows. - mingw*) gl_cv_func_unlink_honors_slashes="guessing no" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_unlink_honors_slashes="$gl_cross_guess_normal" ;; - esac + # Guess yes on Android. + linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; + *) gl_cv_func_snprintf_size1="guessing yes" ;; + esac -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if HAVE_UNISTD_H - # include - #else /* on Windows with MSVC */ - # include - #endif - #include -int -main () +#include +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include +static int my_snprintf (char *buf, int size, const char *format, ...) { -int result = 0; - if (!unlink ("conftest.file/")) - result |= 1; - else if (errno != ENOTDIR) - result |= 2; -#if HAVE_LSTAT - if (!unlink ("conftest.lnk/")) - result |= 4; - else if (errno != ENOTDIR) - result |= 8; + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} #endif - return result; - - ; - return 0; +int main() +{ + static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; + my_snprintf (buf, 1, "%d", 12345); + return buf[1] != 'E'; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_unlink_honors_slashes=yes -else - gl_cv_func_unlink_honors_slashes=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_snprintf_size1=yes +else $as_nop + gl_cv_func_snprintf_size1=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - rm -f conftest.file conftest.lnk + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_unlink_honors_slashes" >&5 -$as_echo "$gl_cv_func_unlink_honors_slashes" >&6; } - case "$gl_cv_func_unlink_honors_slashes" in - *no) - REPLACE_UNLINK=1 - ;; - esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_size1" >&5 +printf "%s\n" "$gl_cv_func_snprintf_size1" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether unlink of a parent directory fails as it should" >&5 -$as_echo_n "checking whether unlink of a parent directory fails as it should... " >&6; } -if ${gl_cv_func_unlink_parent_fails+:} false; then : - $as_echo_n "(cached) " >&6 -else - case "$host_os" in - darwin*) - if { - # Use the mktemp program if available. If not available, hide the error - # message. - tmp=`(umask 077 && mktemp -d /tmp/gtXXXXXX) 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" - } || - { - # Use a simple mkdir command. It is guaranteed to fail if the directory - # already exists. $RANDOM is bash specific and expands to empty in shells - # other than bash, ksh and zsh. Its use does not increase security; - # rather, it minimizes the probability of failure in a very cluttered /tmp - # directory. - tmp=/tmp/gt$$-$RANDOM - (umask 077 && mkdir "$tmp") - }; then - mkdir "$tmp/subdir" - GL_SUBDIR_FOR_UNLINK="$tmp/subdir" - export GL_SUBDIR_FOR_UNLINK - if test "$cross_compiling" = yes; then : - # If we don't know, obey --enable-cross-guesses. - gl_cv_func_unlink_parent_fails="$gl_cross_guess_normal" + case "$gl_cv_func_snprintf_size1" in + *yes) -else + case "$gl_cv_func_snprintf_retval_c99" in + *yes) + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports POSIX/XSI format strings with positions" >&5 +printf %s "checking whether printf supports POSIX/XSI format strings with positions... " >&6; } +if test ${gl_cv_func_printf_positions+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + case "$host_os" in + netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) + gl_cv_func_printf_positions="guessing no";; + beos*) gl_cv_func_printf_positions="guessing no";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_positions="guessing yes";; + # Guess no on native Windows. + mingw* | pw*) gl_cv_func_printf_positions="guessing no";; + *) gl_cv_func_printf_positions="guessing yes";; + esac + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #if HAVE_UNISTD_H - # include - #else /* on Windows with MSVC */ - # include - # include - #endif - int main () - { - int result = 0; - if (chdir (getenv ("GL_SUBDIR_FOR_UNLINK")) != 0) - result |= 1; - else if (unlink ("..") == 0) - result |= 2; - return result; - } - +#include +#include +/* The string "%2$d %1$d", with dollar characters protected from the shell's + dollar expansion (possibly an autoconf bug). */ +static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; +static char buf[100]; +int main () +{ + sprintf (buf, format, 33, 55); + return (strcmp (buf, "55 33") != 0); +} _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_unlink_parent_fails=yes -else - gl_cv_func_unlink_parent_fails=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_printf_positions=yes +else $as_nop + gl_cv_func_printf_positions=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - unset GL_SUBDIR_FOR_UNLINK - rm -rf "$tmp" - else - gl_cv_func_unlink_parent_fails="guessing no" - fi - ;; - *) - gl_cv_func_unlink_parent_fails="guessing yes" - ;; - esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_unlink_parent_fails" >&5 -$as_echo "$gl_cv_func_unlink_parent_fails" >&6; } - case "$gl_cv_func_unlink_parent_fails" in - *no) - REPLACE_UNLINK=1 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_positions" >&5 +printf "%s\n" "$gl_cv_func_printf_positions" >&6; } + + case "$gl_cv_func_printf_positions" in + *yes) + gl_cv_func_vsnprintf_usable=yes + ;; + esac + ;; + esac + ;; + esac + fi + if test $gl_cv_func_vsnprintf_usable = no; then + -$as_echo "#define UNLINK_PARENT_BUG 1" >>confdefs.h - ;; - esac - if test $REPLACE_UNLINK = 1; then + gl_LIBOBJS="$gl_LIBOBJS vsnprintf.$ac_objext" + if test $ac_cv_func_vsnprintf = yes; then + REPLACE_VSNPRINTF=1 + else - gl_LIBOBJS="$gl_LIBOBJS unlink.$ac_objext" + if test $ac_cv_have_decl_vsnprintf = yes; then + REPLACE_VSNPRINTF=1 + fi + fi + : fi + if test $ac_cv_have_decl_vsnprintf = no; then + HAVE_DECL_VSNPRINTF=0 + fi - GNULIB_UNLINK=1 -$as_echo "#define GNULIB_TEST_UNLINK 1" >>confdefs.h + GL_GNULIB_VSNPRINTF=1 -$as_echo "#define USE_UNLOCKED_IO 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_VSNPRINTF 1" >>confdefs.h @@ -38909,253 +49311,527 @@ + gl_cv_func_vsnprintf_posix=no + ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf" +if test "x$ac_cv_func_vsnprintf" = xyes +then : + printf "%s\n" "#define HAVE_VSNPRINTF 1" >>confdefs.h +fi - if test $ac_cv_have_decl_unsetenv = no; then - HAVE_DECL_UNSETENV=0 - fi - for ac_func in unsetenv -do : - ac_fn_c_check_func "$LINENO" "unsetenv" "ac_cv_func_unsetenv" -if test "x$ac_cv_func_unsetenv" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_UNSETENV 1 -_ACEOF + if test $ac_cv_func_vsnprintf = yes; then + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether snprintf fully supports the 'n' directive" >&5 +printf %s "checking whether snprintf fully supports the 'n' directive... " >&6; } +if test ${gl_cv_func_snprintf_directive_n+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + case "$host_os" in + # Guess no on glibc when _FORTIFY_SOURCE >= 2. + *-gnu* | gnu*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if _FORTIFY_SOURCE >= 2 + error fail + #endif +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_snprintf_directive_n="guessing yes" +else $as_nop + gl_cv_func_snprintf_directive_n="guessing no" fi -done +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; + midnightbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on Mac OS X >= 10.3. + darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; + darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on Solaris >= 2.6. + solaris2.[0-5] | solaris2.[0-5].*) + gl_cv_func_snprintf_directive_n="guessing no";; + solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; + aix*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on IRIX >= 6.5. + irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on OSF/1 >= 5. + osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";; + osf*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_snprintf_directive_n="guessing no";; + netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; + # Guess no on native Windows. + mingw*) gl_cv_func_snprintf_directive_n="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; + esac - if test $ac_cv_func_unsetenv = no; then - HAVE_UNSETENV=0 - else - HAVE_UNSETENV=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsetenv() return type" >&5 -$as_echo_n "checking for unsetenv() return type... " >&6; } -if ${gt_cv_func_unsetenv_ret+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#undef _BSD -#define _BSD 1 /* unhide unsetenv declaration in OSF/1 5.1 */ -#include -extern -#ifdef __cplusplus -"C" +#include +#include +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} #endif -int unsetenv (const char *name); - -int -main () +static char fmtstring[10]; +static char buf[100]; +int main () { - - ; + int count = -1; + /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) + support %n in format strings in read-only memory but not in writable + memory. */ + strcpy (fmtstring, "%d %n"); + my_snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); + if (count != 6) + return 1; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gt_cv_func_unsetenv_ret='int' -else - gt_cv_func_unsetenv_ret='void' +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_snprintf_directive_n=yes +else $as_nop + gl_cv_func_snprintf_directive_n=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_unsetenv_ret" >&5 -$as_echo "$gt_cv_func_unsetenv_ret" >&6; } - if test $gt_cv_func_unsetenv_ret = 'void'; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_directive_n" >&5 +printf "%s\n" "$gl_cv_func_snprintf_directive_n" >&6; } -$as_echo "#define VOID_UNSETENV 1" >>confdefs.h - REPLACE_UNSETENV=1 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether unsetenv obeys POSIX" >&5 -$as_echo_n "checking whether unsetenv obeys POSIX... " >&6; } -if ${gl_cv_func_unsetenv_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_unsetenv_works="$gl_cross_guess_normal" ;; - esac -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether snprintf respects a size of 1" >&5 +printf %s "checking whether snprintf respects a size of 1... " >&6; } +if test ${gl_cv_func_snprintf_size1+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on Android. + linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; + *) gl_cv_func_snprintf_size1="guessing yes" ;; + esac + +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include - extern char **environ; - -int -main () +#include +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include +static int my_snprintf (char *buf, int size, const char *format, ...) { - - char entry1[] = "a=1"; - char entry2[] = "b=2"; - char *env[] = { entry1, entry2, NULL }; - if (putenv ((char *) "a=1")) return 1; - if (putenv (entry2)) return 2; - entry2[0] = 'a'; - unsetenv ("a"); - if (getenv ("a")) return 3; - if (!unsetenv ("") || errno != EINVAL) return 4; - entry2[0] = 'b'; - environ = env; - if (!getenv ("a")) return 5; - entry2[0] = 'a'; - unsetenv ("a"); - if (getenv ("a")) return 6; - - ; - return 0; + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +#endif +int main() +{ + static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; + my_snprintf (buf, 1, "%d", 12345); + return buf[1] != 'E'; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_unsetenv_works=yes -else - gl_cv_func_unsetenv_works=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_snprintf_size1=yes +else $as_nop + gl_cv_func_snprintf_size1=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_unsetenv_works" >&5 -$as_echo "$gl_cv_func_unsetenv_works" >&6; } - case "$gl_cv_func_unsetenv_works" in - *yes) ;; - *) - REPLACE_UNSETENV=1 - ;; - esac - fi - if test $HAVE_UNSETENV = 0 || test $REPLACE_UNSETENV = 1; then +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_size1" >&5 +printf "%s\n" "$gl_cv_func_snprintf_size1" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether vsnprintf respects a zero size as in C99" >&5 +printf %s "checking whether vsnprintf respects a zero size as in C99... " >&6; } +if test ${gl_cv_func_vsnprintf_zerosize_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Mac OS X >= 10.3. + darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Cygwin. + cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Solaris >= 2.6. + solaris2.[0-5] | solaris2.[0-5].*) + gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on IRIX >= 6.5. + irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Android. + linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on native Windows. + mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +int main() +{ + static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; + my_snprintf (buf, 0, "%d", 12345); + return buf[0] != 'D'; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_vsnprintf_zerosize_c99=yes +else $as_nop + gl_cv_func_vsnprintf_zerosize_c99=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - gl_LIBOBJS="$gl_LIBOBJS unsetenv.$ac_objext" +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_vsnprintf_zerosize_c99" >&5 +printf "%s\n" "$gl_cv_func_vsnprintf_zerosize_c99" >&6; } + case "$gl_cv_func_printf_sizes_c99" in + *yes) + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + case "$gl_cv_func_printf_directive_a" in + *yes) + case "$gl_cv_func_printf_directive_f" in + *yes) + case "$gl_cv_func_printf_directive_n" in + *yes) + case "$gl_cv_func_printf_directive_ls" in + *yes) + case "$gl_cv_func_printf_positions" in + *yes) + case "$gl_cv_func_printf_flag_grouping" in + *yes) + case "$gl_cv_func_printf_flag_leftadjust" in + *yes) + case "$gl_cv_func_printf_flag_zero" in + *yes) + case "$gl_cv_func_printf_precision" in + *yes) + case "$gl_cv_func_printf_enomem" in + *yes) + case "$gl_cv_func_snprintf_truncation_c99" in + *yes) + case "$gl_cv_func_snprintf_retval_c99" in + *yes) + case "$gl_cv_func_snprintf_directive_n" in + *yes) + case "$gl_cv_func_snprintf_size1" in + *yes) + case "$gl_cv_func_vsnprintf_zerosize_c99" in + *yes) + # vsnprintf exists and is + # already POSIX compliant. + gl_cv_func_vsnprintf_posix=yes + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + fi + if test $gl_cv_func_vsnprintf_posix = no; then - fi + case "$gl_cv_func_printf_infinite" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h + ;; + esac - GNULIB_UNSETENV=1 + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h + ;; + esac + ;; + esac -$as_echo "#define GNULIB_TEST_UNSETENV 1" >>confdefs.h + case "$gl_cv_func_printf_directive_a" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h + ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" +if test "x$ac_cv_func_nl_langinfo" = xyes +then : + printf "%s\n" "#define HAVE_NL_LANGINFO 1" >>confdefs.h +fi - if test $ac_cv_func_vasnprintf = no; then + ;; + esac + case "$gl_cv_func_printf_directive_f" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h + ;; + esac + case "$gl_cv_func_printf_directive_ls" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext" + ;; + esac + case "$gl_cv_func_printf_flag_grouping" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h + ;; + esac + case "$gl_cv_func_printf_flag_leftadjust" in + *yes) + ;; + *) - gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext" +printf "%s\n" "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h + ;; + esac + case "$gl_cv_func_printf_flag_zero" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h + ;; + esac - gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext" + case "$gl_cv_func_printf_precision" in + *yes) + ;; + *) +printf "%s\n" "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h + ;; + esac - gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext" + case "$gl_cv_func_printf_enomem" in + *yes) + ;; + *) - if test $ac_cv_func_vasnprintf = yes; then +printf "%s\n" "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h -$as_echo "#define REPLACE_VASNPRINTF 1" >>confdefs.h - fi +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h + ;; + esac - ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" -if test "x$ac_cv_type_ptrdiff_t" = xyes; then : -else -$as_echo "#define ptrdiff_t long" >>confdefs.h -fi + gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext" - fi - for ac_func in vasprintf -do : - ac_fn_c_check_func "$LINENO" "vasprintf" "ac_cv_func_vasprintf" -if test "x$ac_cv_func_vasprintf" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_VASPRINTF 1 -_ACEOF -fi -done + gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext" - if test $ac_cv_func_vasprintf = no; then @@ -39164,8 +49840,8 @@ + gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext" - gl_LIBOBJS="$gl_LIBOBJS vasprintf.$ac_objext" @@ -39174,14 +49850,12 @@ + gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext" - gl_LIBOBJS="$gl_LIBOBJS asprintf.$ac_objext" + if test $ac_cv_func_vasnprintf = yes; then +printf "%s\n" "#define REPLACE_VASNPRINTF 1" >>confdefs.h - if test $ac_cv_func_vasprintf = yes; then - REPLACE_VASPRINTF=1 - else - HAVE_VASPRINTF=0 fi @@ -39191,34 +49865,47 @@ - fi + ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" +if test "x$ac_cv_type_ptrdiff_t" = xyes +then : + +else $as_nop +printf "%s\n" "#define ptrdiff_t long" >>confdefs.h +fi + - GNULIB_VASPRINTF=1 -$as_echo "#define GNULIB_TEST_VASPRINTF 1" >>confdefs.h - XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=asprintf:2:c-format" - XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=vasprintf:2:c-format" + gl_LIBOBJS="$gl_LIBOBJS vsnprintf.$ac_objext" + if test $ac_cv_func_vsnprintf = yes; then + REPLACE_VSNPRINTF=1 + else + if test $ac_cv_have_decl_vsnprintf = yes; then + REPLACE_VSNPRINTF=1 + fi + fi + : + fi @@ -39231,18 +49918,11 @@ - gl_cv_func_vasprintf_posix=no - for ac_func in vasprintf -do : - ac_fn_c_check_func "$LINENO" "vasprintf" "ac_cv_func_vasprintf" -if test "x$ac_cv_func_vasprintf" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_VASPRINTF 1 -_ACEOF -fi -done + + + gl_cv_func_vsprintf_posix=no case "$gl_cv_func_printf_sizes_c99" in *yes) case "$gl_cv_func_printf_long_double" in @@ -39271,11 +49951,9 @@ *yes) case "$gl_cv_func_printf_enomem" in *yes) - if test $ac_cv_func_vasprintf = yes; then - # vasprintf exists and is - # already POSIX compliant. - gl_cv_func_vasprintf_posix=yes - fi + # vsprintf exists and is + # already POSIX compliant. + gl_cv_func_vsprintf_posix=yes ;; esac ;; @@ -39304,7 +49982,7 @@ esac ;; esac - if test $gl_cv_func_vasprintf_posix = no; then + if test $gl_cv_func_vsprintf_posix = no; then @@ -39313,7 +49991,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h ;; esac @@ -39328,7 +50006,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h ;; esac @@ -39342,18 +50020,14 @@ ;; *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h - for ac_func in nl_langinfo -do : - ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" -if test "x$ac_cv_func_nl_langinfo" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_NL_LANGINFO 1 -_ACEOF + ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" +if test "x$ac_cv_func_nl_langinfo" = xyes +then : + printf "%s\n" "#define HAVE_NL_LANGINFO 1" >>confdefs.h fi -done ;; esac @@ -39365,7 +50039,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h ;; esac @@ -39377,7 +50051,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h ;; esac @@ -39389,7 +50063,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h ;; esac @@ -39401,7 +50075,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h ;; esac @@ -39413,7 +50087,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h ;; esac @@ -39425,13 +50099,13 @@ ;; *) -$as_echo "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h ;; esac @@ -39443,13 +50117,13 @@ ;; *) -$as_echo "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h ;; esac @@ -39464,67 +50138,17 @@ - gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext" - - - - - - - - - - gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext" - - - - - - - - - - gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext" - - - - - - - - - - gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext" - - if test $ac_cv_func_vasnprintf = yes; then - -$as_echo "#define REPLACE_VASNPRINTF 1" >>confdefs.h - - fi - - - - - - - - - - ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" -if test "x$ac_cv_type_ptrdiff_t" = xyes; then : - -else + gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext" -$as_echo "#define ptrdiff_t long" >>confdefs.h -fi + gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext" @@ -39534,8 +50158,8 @@ + gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext" - gl_LIBOBJS="$gl_LIBOBJS vasprintf.$ac_objext" @@ -39544,14 +50168,12 @@ + gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext" - gl_LIBOBJS="$gl_LIBOBJS asprintf.$ac_objext" + if test $ac_cv_func_vasnprintf = yes; then +printf "%s\n" "#define REPLACE_VASNPRINTF 1" >>confdefs.h - if test $ac_cv_func_vasprintf = yes; then - REPLACE_VASPRINTF=1 - else - HAVE_VASPRINTF=0 fi @@ -39561,149 +50183,40 @@ - fi + ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" +if test "x$ac_cv_type_ptrdiff_t" = xyes +then : +else $as_nop - gl_cv_func_vsnprintf_usable=no - for ac_func in vsnprintf -do : - ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf" -if test "x$ac_cv_func_vsnprintf" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_VSNPRINTF 1 -_ACEOF +printf "%s\n" "#define ptrdiff_t long" >>confdefs.h -fi -done - if test $ac_cv_func_vsnprintf = yes; then +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether snprintf respects a size of 1" >&5 -$as_echo_n "checking whether snprintf respects a size of 1... " >&6; } -if ${gl_cv_func_snprintf_size1+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on Android. - linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; - *) gl_cv_func_snprintf_size1="guessing yes" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#if HAVE_SNPRINTF -# define my_snprintf snprintf -#else -# include -static int my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} -#endif -int main() -{ - static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; - my_snprintf (buf, 1, "%d", 12345); - return buf[1] != 'E'; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_snprintf_size1=yes -else - gl_cv_func_snprintf_size1=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_size1" >&5 -$as_echo "$gl_cv_func_snprintf_size1" >&6; } - case "$gl_cv_func_snprintf_size1" in - *yes) - case "$gl_cv_func_snprintf_retval_c99" in - *yes) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports POSIX/XSI format strings with positions" >&5 -$as_echo_n "checking whether printf supports POSIX/XSI format strings with positions... " >&6; } -if ${gl_cv_func_printf_positions+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) - gl_cv_func_printf_positions="guessing no";; - beos*) gl_cv_func_printf_positions="guessing no";; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_positions="guessing yes";; - # Guess no on native Windows. - mingw* | pw*) gl_cv_func_printf_positions="guessing no";; - *) gl_cv_func_printf_positions="guessing yes";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -/* The string "%2$d %1$d", with dollar characters protected from the shell's - dollar expansion (possibly an autoconf bug). */ -static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; -static char buf[100]; -int main () -{ - sprintf (buf, format, 33, 55); - return (strcmp (buf, "55 33") != 0); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_positions=yes -else - gl_cv_func_printf_positions=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + gl_LIBOBJS="$gl_LIBOBJS vsprintf.$ac_objext" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_positions" >&5 -$as_echo "$gl_cv_func_printf_positions" >&6; } + REPLACE_VSPRINTF=1 + : - case "$gl_cv_func_printf_positions" in - *yes) - gl_cv_func_vsnprintf_usable=yes - ;; - esac - ;; - esac - ;; - esac fi - if test $gl_cv_func_vsnprintf_usable = no; then - @@ -39713,39 +50226,35 @@ - gl_LIBOBJS="$gl_LIBOBJS vsnprintf.$ac_objext" - - if test $ac_cv_func_vsnprintf = yes; then - REPLACE_VSNPRINTF=1 - else - if test $ac_cv_have_decl_vsnprintf = yes; then - REPLACE_VSNPRINTF=1 - fi - fi - : + GL_GNULIB_VSPRINTF_POSIX=1 - fi - if test $ac_cv_have_decl_vsnprintf = no; then - HAVE_DECL_VSNPRINTF=0 - fi +printf "%s\n" "#define GNULIB_TEST_VSPRINTF_POSIX 1" >>confdefs.h - GNULIB_VSNPRINTF=1 + ac_fn_c_check_func "$LINENO" "waitid" "ac_cv_func_waitid" +if test "x$ac_cv_func_waitid" = xyes +then : + printf "%s\n" "#define HAVE_WAITID 1" >>confdefs.h +fi -$as_echo "#define GNULIB_TEST_VSNPRINTF 1" >>confdefs.h + HAVE_WAITPID=1 + case $host_os in + mingw*) HAVE_WAITPID=0 ;; + esac + if test $HAVE_WAITPID = 0; then @@ -39754,662 +50263,571 @@ + gl_LIBOBJS="$gl_LIBOBJS waitpid.$ac_objext" + fi - gl_cv_func_vsnprintf_posix=no - for ac_func in vsnprintf -do : - ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf" -if test "x$ac_cv_func_vsnprintf" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_VSNPRINTF 1 -_ACEOF -fi -done - if test $ac_cv_func_vsnprintf = yes; then + GL_GNULIB_WAITPID=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether snprintf truncates the result as in C99" >&5 -$as_echo_n "checking whether snprintf truncates the result as in C99... " >&6; } -if ${gl_cv_func_snprintf_truncation_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; - darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on OpenBSD >= 3.9. - openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) - gl_cv_func_snprintf_truncation_c99="guessing no";; - openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5] | solaris2.[0-5].*) - gl_cv_func_snprintf_truncation_c99="guessing no";; - solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; - aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on HP-UX >= 11. - hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; - hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on IRIX >= 6.5. - irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on OSF/1 >= 5. - osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; - osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_snprintf_truncation_c99="guessing no";; - netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on Android. - linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess no on native Windows. - mingw*) gl_cv_func_snprintf_truncation_c99="guessing no";; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +printf "%s\n" "#define GNULIB_TEST_WAITPID 1" >>confdefs.h -#include -#include -#if HAVE_SNPRINTF -# define my_snprintf snprintf -#else -# include -static int my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} -#endif -static char buf[100]; -int main () -{ - strcpy (buf, "ABCDEF"); - my_snprintf (buf, 3, "%d %d", 4567, 89); - if (memcmp (buf, "45\0DEF", 6) != 0) - return 1; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_snprintf_truncation_c99=yes -else - gl_cv_func_snprintf_truncation_c99=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_truncation_c99" >&5 -$as_echo "$gl_cv_func_snprintf_truncation_c99" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether snprintf fully supports the 'n' directive" >&5 -$as_echo_n "checking whether snprintf fully supports the 'n' directive... " >&6; } -if ${gl_cv_func_snprintf_directive_n+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; - darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5] | solaris2.[0-5].*) - gl_cv_func_snprintf_directive_n="guessing no";; - solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; - aix*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on IRIX >= 6.5. - irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on OSF/1 >= 5. - osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";; - osf*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_snprintf_directive_n="guessing no";; - netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess no on Android. - linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; - # Guess no on native Windows. - mingw*) gl_cv_func_snprintf_directive_n="guessing no";; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if HAVE_SNPRINTF -# define my_snprintf snprintf -#else -# include -static int my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} -#endif -static char fmtstring[10]; -static char buf[100]; -int main () -{ - int count = -1; - /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) - support %n in format strings in read-only memory but not in writable - memory. */ - strcpy (fmtstring, "%d %n"); - my_snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); - if (count != 6) - return 1; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_snprintf_directive_n=yes -else - gl_cv_func_snprintf_directive_n=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_directive_n" >&5 -$as_echo "$gl_cv_func_snprintf_directive_n" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether snprintf respects a size of 1" >&5 -$as_echo_n "checking whether snprintf respects a size of 1... " >&6; } -if ${gl_cv_func_snprintf_size1+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on Android. - linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; - *) gl_cv_func_snprintf_size1="guessing yes" ;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#if HAVE_SNPRINTF -# define my_snprintf snprintf -#else -# include -static int my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} -#endif -int main() -{ - static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; - my_snprintf (buf, 1, "%d", 12345); - return buf[1] != 'E'; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_snprintf_size1=yes -else - gl_cv_func_snprintf_size1=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_size1" >&5 -$as_echo "$gl_cv_func_snprintf_size1" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether vsnprintf respects a zero size as in C99" >&5 -$as_echo_n "checking whether vsnprintf respects a zero size as in C99... " >&6; } -if ${gl_cv_func_vsnprintf_zerosize_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else + ac_fn_check_decl "$LINENO" "wcwidth" "ac_cv_have_decl_wcwidth" " + #include - if test "$cross_compiling" = yes; then : +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_wcwidth" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_WCWIDTH $ac_have_decl" >>confdefs.h - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Cygwin. - cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5] | solaris2.[0-5].*) - gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on IRIX >= 6.5. - irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Android. - linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on native Windows. - mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; - esac + if test $ac_cv_have_decl_wcwidth != yes; then + HAVE_DECL_WCWIDTH=0 + fi -else + if test $ac_cv_func_wcwidth != yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether wcwidth is a macro" >&5 +printf %s "checking whether wcwidth is a macro... " >&6; } +if test ${gl_cv_func_wcwidth_macro+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -static int my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} -int main() -{ - static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; - my_snprintf (buf, 0, "%d", 12345); - return buf[0] != 'D'; -} +#include +#ifdef wcwidth + wchar_header_defines_wcwidth +#endif _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_vsnprintf_zerosize_c99=yes -else - gl_cv_func_vsnprintf_zerosize_c99=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "wchar_header_defines_wcwidth" >/dev/null 2>&1 +then : + gl_cv_func_wcwidth_macro=yes +else $as_nop + gl_cv_func_wcwidth_macro=no fi +rm -rf conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_vsnprintf_zerosize_c99" >&5 -$as_echo "$gl_cv_func_vsnprintf_zerosize_c99" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_wcwidth_macro" >&5 +printf "%s\n" "$gl_cv_func_wcwidth_macro" >&6; } + fi - case "$gl_cv_func_printf_sizes_c99" in - *yes) - case "$gl_cv_func_printf_long_double" in - *yes) - case "$gl_cv_func_printf_infinite" in - *yes) - case "$gl_cv_func_printf_infinite_long_double" in - *yes) - case "$gl_cv_func_printf_directive_a" in - *yes) - case "$gl_cv_func_printf_directive_f" in - *yes) - case "$gl_cv_func_printf_directive_n" in - *yes) - case "$gl_cv_func_printf_directive_ls" in - *yes) - case "$gl_cv_func_printf_positions" in - *yes) - case "$gl_cv_func_printf_flag_grouping" in - *yes) - case "$gl_cv_func_printf_flag_leftadjust" in - *yes) - case "$gl_cv_func_printf_flag_zero" in - *yes) - case "$gl_cv_func_printf_precision" in - *yes) - case "$gl_cv_func_printf_enomem" in - *yes) - case "$gl_cv_func_snprintf_truncation_c99" in - *yes) - case "$gl_cv_func_snprintf_retval_c99" in - *yes) - case "$gl_cv_func_snprintf_directive_n" in - *yes) - case "$gl_cv_func_snprintf_size1" in - *yes) - case "$gl_cv_func_vsnprintf_zerosize_c99" in - *yes) - # vsnprintf exists and is - # already POSIX compliant. - gl_cv_func_vsnprintf_posix=yes - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; + if test $ac_cv_func_wcwidth = yes || test $gl_cv_func_wcwidth_macro = yes; then + HAVE_WCWIDTH=1 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether wcwidth works reasonably in UTF-8 locales" >&5 +printf %s "checking whether wcwidth works reasonably in UTF-8 locales... " >&6; } +if test ${gl_cv_func_wcwidth_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test "$cross_compiling" = yes +then : + + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_wcwidth_works="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_wcwidth_works="guessing yes";; + # Guess yes on AIX 7 systems. + aix[7-9]*) gl_cv_func_wcwidth_works="guessing yes";; + *) gl_cv_func_wcwidth_works="$gl_cross_guess_normal";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#if !HAVE_DECL_WCWIDTH +extern +# ifdef __cplusplus +"C" +# endif +int wcwidth (int); +#endif +int main () +{ + int result = 0; + if (setlocale (LC_ALL, "en_US.UTF-8") != NULL) + { + if (wcwidth (0x0301) > 0) + result |= 1; + if (wcwidth (0x05B0) > 0) + result |= 2; + if (wcwidth (0x200B) > 0) + result |= 4; + if (wcwidth (0xFF1A) == 0) + result |= 8; + if (wcwidth (0x2202) > 1) + result |= 16; + } + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_wcwidth_works=yes +else $as_nop + gl_cv_func_wcwidth_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_wcwidth_works" >&5 +printf "%s\n" "$gl_cv_func_wcwidth_works" >&6; } + case "$gl_cv_func_wcwidth_works" in + *yes) ;; + *no) REPLACE_WCWIDTH=1 ;; esac + else + HAVE_WCWIDTH=0 fi - if test $gl_cv_func_vsnprintf_posix = no; then + if test $HAVE_WCWIDTH = 0 || test $REPLACE_WCWIDTH = 1; then - case "$gl_cv_func_printf_infinite" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h - ;; - esac - case "$gl_cv_func_printf_long_double" in - *yes) - case "$gl_cv_func_printf_infinite_long_double" in - *yes) - ;; - *) + gl_LIBOBJS="$gl_LIBOBJS wcwidth.$ac_objext" -$as_echo "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h - ;; - esac - ;; - esac + : + fi - case "$gl_cv_func_printf_directive_a" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h - for ac_func in nl_langinfo -do : - ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" -if test "x$ac_cv_func_nl_langinfo" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_NL_LANGINFO 1 -_ACEOF -fi -done - ;; - esac - case "$gl_cv_func_printf_directive_f" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h + GL_GNULIB_WCWIDTH=1 - ;; - esac - case "$gl_cv_func_printf_directive_ls" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_WCWIDTH 1" >>confdefs.h - ;; - esac - case "$gl_cv_func_printf_flag_grouping" in - *yes) - ;; - *) + case "$host_os" in + mingw*) + -$as_echo "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h - ;; - esac - case "$gl_cv_func_printf_flag_leftadjust" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h + + gl_LIBOBJS="$gl_LIBOBJS windows-spawn.$ac_objext" ;; esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether use of TIOCGWINSZ requires sys/ioctl.h" >&5 +printf %s "checking whether use of TIOCGWINSZ requires sys/ioctl.h... " >&6; } +if test ${gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no + if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +# include +# ifdef TIOCGWINSZ + yes +# endif - case "$gl_cv_func_printf_flag_zero" in - *yes) - ;; - *) +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes +fi +rm -rf conftest* -$as_echo "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h + fi - ;; - esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h" >&5 +printf "%s\n" "$gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h" >&6; } + if test $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then +printf "%s\n" "#define GWINSZ_IN_SYS_IOCTL 1" >>confdefs.h + fi - case "$gl_cv_func_printf_precision" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether use of TIOCGWINSZ requires termios.h" >&5 +printf %s "checking whether use of TIOCGWINSZ requires termios.h... " >&6; } +if test ${gl_cv_sys_tiocgwinsz_needs_termios_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_sys_tiocgwinsz_needs_termios_h=no + + if test $ac_cv_sys_posix_termios = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +# include +# ifdef TIOCGWINSZ + yes +# endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_sys_tiocgwinsz_needs_termios_h=yes +fi +rm -rf conftest* -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_tiocgwinsz_needs_termios_h" >&5 +printf "%s\n" "$gl_cv_sys_tiocgwinsz_needs_termios_h" >&6; } -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h - ;; - esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether use of struct winsize requires sys/ptem.h" >&5 +printf %s "checking whether use of struct winsize requires sys/ptem.h... " >&6; } +if test ${gl_cv_sys_struct_winsize_needs_sys_ptem_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_sys_struct_winsize_needs_sys_ptem_h=yes + if test $ac_cv_sys_posix_termios = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +struct winsize x; + if (sizeof x > 0) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_sys_struct_winsize_needs_sys_ptem_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + if test $gl_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +struct winsize x; + if (sizeof x > 0) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : +else $as_nop + gl_cv_sys_struct_winsize_needs_sys_ptem_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_winsize_needs_sys_ptem_h" >&5 +printf "%s\n" "$gl_cv_sys_struct_winsize_needs_sys_ptem_h" >&6; } + if test $gl_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then - case "$gl_cv_func_printf_enomem" in - *yes) - ;; - *) +printf "%s\n" "#define WINSIZE_IN_PTEM 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h + fi + : -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define GNULIB_XALLOC 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h - ;; - esac +printf "%s\n" "#define GNULIB_XALLOC_DIE 1" >>confdefs.h + ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" +if test "x$ac_cv_header_stdint_h" = xyes +then : + printf "%s\n" "#define HAVE_STDINT_H 1" >>confdefs.h +fi - gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext" + : + gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b=false + gl_gnulib_enabled_chdir=false + gl_gnulib_enabled_8198daae261b932d64a998f8586f5005=false + gl_gnulib_enabled_closedir=false + gl_gnulib_enabled_75c65a2c014cf8235dd95289676302a4=false + gl_gnulib_enabled_dirent=false + gl_gnulib_enabled_dirfd=false + gl_gnulib_enabled_dup=false + gl_gnulib_enabled_fchdir=false + gl_gnulib_enabled_43fe87a341d9b4b93c47c3ad819a5239=false + gl_gnulib_enabled_fdopendir=false + gl_gnulib_enabled_ffs=false + gl_gnulib_enabled_fca9852db2a43bb33f02f0fbdbc174f6=false + gl_gnulib_enabled_fseterr=false + gl_gnulib_enabled_fstat=false + gl_gnulib_enabled_fstatat=false + gl_gnulib_enabled_3d094ef542bfdd238a5194e172bfe5f6=false + gl_gnulib_enabled_getdelim=false + gl_gnulib_enabled_getdtablesize=false + gl_gnulib_enabled_getline=false + gl_gnulib_enabled_30838f5439487421042f2225bed3af76=false + gl_gnulib_enabled_3f0e593033d1fc2c127581960f641b66=false + gl_gnulib_enabled_ldexp=false + gl_gnulib_enabled_locale=false + gl_gnulib_enabled_lstat=false + gl_gnulib_enabled_malloca=false + gl_gnulib_enabled_memrchr=false + gl_gnulib_enabled_openat=false + gl_gnulib_enabled_1840129d490f3a00c8a098316d0fa345=false + gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7=false + gl_gnulib_enabled_opendir=false + gl_gnulib_enabled_332607f759618fb73dfc3076748afea7=false + gl_gnulib_enabled_readdir=false + gl_gnulib_enabled_rewinddir=false + gl_gnulib_enabled_rmdir=false + gl_gnulib_enabled_d4850532688ba16d685f036076611f21=false + gl_gnulib_enabled_e7e881d32ca02f1c997b13c737c64bbd=false + gl_gnulib_enabled_cdeb0f2aaf9d280baa6526bfa1b07f70=false + gl_gnulib_enabled_0137e3d3638b33e5819d132d0b23165c=false + gl_gnulib_enabled_strchrnul=false + gl_gnulib_enabled_dbb57f49352be8fb86869629a254fb72=false + gl_gnulib_enabled_1f32594a85e6221ba15f884daeee8c2a=false + gl_gnulib_enabled_strings=false + gl_gnulib_enabled_strnlen=false + gl_gnulib_enabled_ed5616be3593d355b981ffab56b9f37b=false + gl_gnulib_enabled_503a4cb75d69c787103d0aa2ab7d8440=false + gl_gnulib_enabled_68a4501daeca58988392c7e60b4917ab=false + gl_gnulib_enabled_f0efff84a70f4afba30902bb8ffe9354=false + gl_gnulib_enabled_8bb827fe37eaccf1b97feb0c87bc92ef=false + gl_gnulib_enabled_48b2271240803e4879464b755748a89d=false + func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b () + { + if ! $gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b; then + gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b=true + fi + } + func_gl_gnulib_m4code_chdir () + { + if ! $gl_gnulib_enabled_chdir; then - gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext" + GL_GNULIB_CHDIR=1 +printf "%s\n" "#define GNULIB_TEST_CHDIR 1" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext" + gl_gnulib_enabled_chdir=true + fi + } + func_gl_gnulib_m4code_8198daae261b932d64a998f8586f5005 () + { + if ! $gl_gnulib_enabled_8198daae261b932d64a998f8586f5005; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether this system supports file names of any length" >&5 +printf %s "checking whether this system supports file names of any length... " >&6; } +if test ${gl_cv_have_unlimited_file_name_length+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Arrange to define PATH_MAX, like "pathmax.h" does. */ +#if HAVE_UNISTD_H +# include +#endif +#include +#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN +# include +#endif +#if !defined PATH_MAX && defined MAXPATHLEN +# define PATH_MAX MAXPATHLEN +#endif +#ifdef __hpux +# undef PATH_MAX +# define PATH_MAX 1024 +#endif +#if defined _WIN32 && ! defined __CYGWIN__ +# undef PATH_MAX +# define PATH_MAX 260 +#endif +#ifdef PATH_MAX +have_arbitrary_file_name_length_limit +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "have_arbitrary_file_name_length_limit" >/dev/null 2>&1 +then : + gl_cv_have_unlimited_file_name_length=no +else $as_nop + gl_cv_have_unlimited_file_name_length=yes +fi +rm -rf conftest* +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_unlimited_file_name_length" >&5 +printf "%s\n" "$gl_cv_have_unlimited_file_name_length" >&6; } + if test $gl_cv_have_unlimited_file_name_length = no; then - gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext" - if test $ac_cv_func_vasnprintf = yes; then -$as_echo "#define REPLACE_VASNPRINTF 1" >>confdefs.h - fi + gl_LIBOBJS="$gl_LIBOBJS chdir-long.$ac_objext" + : + fi + gl_gnulib_enabled_8198daae261b932d64a998f8586f5005=true + func_gl_gnulib_m4code_chdir + if test $gl_cv_have_unlimited_file_name_length = no; then + func_gl_gnulib_m4code_fchdir + fi + if test $gl_cv_have_unlimited_file_name_length = no; then + func_gl_gnulib_m4code_memrchr + fi + if test $gl_cv_have_unlimited_file_name_length = no; then + func_gl_gnulib_m4code_openat + fi + fi + } + func_gl_gnulib_m4code_closedir () + { + if ! $gl_gnulib_enabled_closedir; then + ac_fn_c_check_func "$LINENO" "closedir" "ac_cv_func_closedir" +if test "x$ac_cv_func_closedir" = xyes +then : + printf "%s\n" "#define HAVE_CLOSEDIR 1" >>confdefs.h - ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" -if test "x$ac_cv_type_ptrdiff_t" = xyes; then : +fi -else + if test $ac_cv_func_closedir = no; then + HAVE_CLOSEDIR=0 + fi -$as_echo "#define ptrdiff_t long" >>confdefs.h -fi + if test $ac_cv_func_fchdir = no; then + HAVE_FCHDIR=0 + fi + if test $HAVE_FCHDIR = 0; then + if test $HAVE_CLOSEDIR = 1; then + REPLACE_CLOSEDIR=1 + fi + fi + case $host_os,$HAVE_CLOSEDIR in + os2*,1) + REPLACE_CLOSEDIR=1;; + esac + if test $HAVE_CLOSEDIR = 0 || test $REPLACE_CLOSEDIR = 1; then @@ -40418,501 +50836,745 @@ + gl_LIBOBJS="$gl_LIBOBJS closedir.$ac_objext" + fi - gl_LIBOBJS="$gl_LIBOBJS vsnprintf.$ac_objext" - if test $ac_cv_func_vsnprintf = yes; then - REPLACE_VSNPRINTF=1 - else - if test $ac_cv_have_decl_vsnprintf = yes; then - REPLACE_VSNPRINTF=1 - fi - fi - : - fi + GL_GNULIB_CLOSEDIR=1 +printf "%s\n" "#define GNULIB_TEST_CLOSEDIR 1" >>confdefs.h + gl_gnulib_enabled_closedir=true + func_gl_gnulib_m4code_dirent + if test $HAVE_CLOSEDIR = 0 || test $REPLACE_CLOSEDIR = 1; then + func_gl_gnulib_m4code_dirfd + fi + fi + } + func_gl_gnulib_m4code_75c65a2c014cf8235dd95289676302a4 () + { + if ! $gl_gnulib_enabled_75c65a2c014cf8235dd95289676302a4; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for d_ino member in directory struct" >&5 +printf %s "checking for d_ino member in directory struct... " >&6; } +if test ${gl_cv_struct_dirent_d_ino+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems with Linux kernel. + linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;; + # Guess yes on musl systems with Linux kernel. + linux*-musl*) gl_cv_struct_dirent_d_ino="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_struct_dirent_d_ino="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_struct_dirent_d_ino="$gl_cross_guess_normal" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include +int +main (void) +{ +DIR *dp = opendir ("."); + struct dirent *e; + struct stat st; + if (! dp) + return 1; + e = readdir (dp); + if (! e) + { closedir (dp); return 2; } + if (lstat (e->d_name, &st) != 0) + { closedir (dp); return 3; } + if (e->d_ino != st.st_ino) + { closedir (dp); return 4; } + closedir (dp); + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_struct_dirent_d_ino=yes +else $as_nop + gl_cv_struct_dirent_d_ino=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_struct_dirent_d_ino" >&5 +printf "%s\n" "$gl_cv_struct_dirent_d_ino" >&6; } + case "$gl_cv_struct_dirent_d_ino" in + *yes) +printf "%s\n" "#define D_INO_IN_DIRENT 1" >>confdefs.h - gl_cv_func_vsprintf_posix=no - case "$gl_cv_func_printf_sizes_c99" in - *yes) - case "$gl_cv_func_printf_long_double" in - *yes) - case "$gl_cv_func_printf_infinite" in - *yes) - case "$gl_cv_func_printf_infinite_long_double" in - *yes) - case "$gl_cv_func_printf_directive_a" in - *yes) - case "$gl_cv_func_printf_directive_f" in - *yes) - case "$gl_cv_func_printf_directive_n" in - *yes) - case "$gl_cv_func_printf_directive_ls" in - *yes) - case "$gl_cv_func_printf_positions" in - *yes) - case "$gl_cv_func_printf_flag_grouping" in - *yes) - case "$gl_cv_func_printf_flag_leftadjust" in - *yes) - case "$gl_cv_func_printf_flag_zero" in - *yes) - case "$gl_cv_func_printf_precision" in - *yes) - case "$gl_cv_func_printf_enomem" in - *yes) - # vsprintf exists and is - # already POSIX compliant. - gl_cv_func_vsprintf_posix=yes - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - if test $gl_cv_func_vsprintf_posix = no; then + ;; + esac + gl_gnulib_enabled_75c65a2c014cf8235dd95289676302a4=true + fi + } + func_gl_gnulib_m4code_dirent () + { + if ! $gl_gnulib_enabled_dirent; then - case "$gl_cv_func_printf_infinite" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h - ;; - esac + gl_gnulib_enabled_dirent=true + fi + } + func_gl_gnulib_m4code_dirfd () + { + if ! $gl_gnulib_enabled_dirfd; then - case "$gl_cv_func_printf_long_double" in - *yes) - case "$gl_cv_func_printf_infinite_long_double" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h - ;; - esac - ;; - esac + ac_fn_c_check_func "$LINENO" "dirfd" "ac_cv_func_dirfd" +if test "x$ac_cv_func_dirfd" = xyes +then : + printf "%s\n" "#define HAVE_DIRFD 1" >>confdefs.h - case "$gl_cv_func_printf_directive_a" in - *yes) - ;; - *) +fi -$as_echo "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h + ac_fn_check_decl "$LINENO" "dirfd" "ac_cv_have_decl_dirfd" "#include + #include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_dirfd" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_DIRFD $ac_have_decl" >>confdefs.h - for ac_func in nl_langinfo -do : - ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" -if test "x$ac_cv_func_nl_langinfo" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_NL_LANGINFO 1 + if test $ac_cv_have_decl_dirfd = no; then + HAVE_DECL_DIRFD=0 + fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether dirfd is a macro" >&5 +printf %s "checking whether dirfd is a macro... " >&6; } +if test ${gl_cv_func_dirfd_macro+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#ifdef dirfd + dirent_header_defines_dirfd +#endif _ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "dirent_header_defines_dirfd" >/dev/null 2>&1 +then : + gl_cv_func_dirfd_macro=yes +else $as_nop + gl_cv_func_dirfd_macro=no +fi +rm -rf conftest* fi -done +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_dirfd_macro" >&5 +printf "%s\n" "$gl_cv_func_dirfd_macro" >&6; } - ;; + # Use the replacement if we have no function or macro with that name, + # or if OS/2 kLIBC whose dirfd() does not work. + # Replace only if the system declares dirfd already. + case $ac_cv_func_dirfd,$gl_cv_func_dirfd_macro,$host_os,$ac_cv_have_decl_dirfd in + no,no,*,yes | *,*,os2*,yes) + REPLACE_DIRFD=1 + +printf "%s\n" "#define REPLACE_DIRFD 1" >>confdefs.h +;; esac + if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no \ + || test $REPLACE_DIRFD = 1; then - case "$gl_cv_func_printf_directive_f" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h - ;; - esac - case "$gl_cv_func_printf_directive_ls" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h + gl_LIBOBJS="$gl_LIBOBJS dirfd.$ac_objext" - ;; - esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to get the file descriptor associated with an open DIR*" >&5 +printf %s "checking how to get the file descriptor associated with an open DIR*... " >&6; } +if test ${gl_cv_sys_dir_fd_member_name+y} +then : + printf %s "(cached) " >&6 +else $as_nop + dirfd_save_CFLAGS=$CFLAGS + for ac_expr in d_fd dd_fd; do - case "$gl_cv_func_printf_flag_grouping" in - *yes) - ;; - *) + CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -$as_echo "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h + #include + #include +int +main (void) +{ +DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + dir_fd_found=yes - ;; - esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$dirfd_save_CFLAGS + test "$dir_fd_found" = yes && break + done + test "$dir_fd_found" = yes || ac_expr=no_such_member + gl_cv_sys_dir_fd_member_name=$ac_expr - case "$gl_cv_func_printf_flag_leftadjust" in - *yes) - ;; - *) +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_dir_fd_member_name" >&5 +printf "%s\n" "$gl_cv_sys_dir_fd_member_name" >&6; } + if test $gl_cv_sys_dir_fd_member_name != no_such_member; then -$as_echo "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h +printf "%s\n" "#define DIR_FD_MEMBER_NAME $gl_cv_sys_dir_fd_member_name" >>confdefs.h - ;; - esac + fi + fi - case "$gl_cv_func_printf_flag_zero" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h - ;; - esac - case "$gl_cv_func_printf_precision" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h + GL_GNULIB_DIRFD=1 -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h - ;; - esac +printf "%s\n" "#define GNULIB_TEST_DIRFD 1" >>confdefs.h + - case "$gl_cv_func_printf_enomem" in - *yes) - ;; - *) -$as_echo "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h + gl_gnulib_enabled_dirfd=true + func_gl_gnulib_m4code_dirent + fi + } + func_gl_gnulib_m4code_dup () + { + if ! $gl_gnulib_enabled_dup; then -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + REPLACE_DUP=1 + fi - ;; - esac + if test $ac_cv_func_fchdir = no; then + HAVE_FCHDIR=0 + fi + if test $HAVE_FCHDIR = 0; then + REPLACE_DUP=1 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether dup works" >&5 +printf %s "checking whether dup works... " >&6; } +if test ${gl_cv_func_dup_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess no on native Windows. + mingw*) gl_cv_func_dup_works="guessing no" ;; + *) gl_cv_func_dup_works="guessing yes" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include +$gl_mda_defines +int +main (void) +{ +/* On OS/2 kLIBC, dup does not work on a directory fd. */ + int fd = open (".", O_RDONLY); + return fd < 0 ? 1 : dup (fd) < 0 ? 2 : 0; - gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext" + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_dup_works=yes +else $as_nop + gl_cv_func_dup_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_dup_works" >&5 +printf "%s\n" "$gl_cv_func_dup_works" >&6; } + case "$gl_cv_func_dup_works" in + *yes) ;; + *) + REPLACE_DUP=1 + ;; + esac + if test $REPLACE_DUP = 1; then - gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext" + gl_LIBOBJS="$gl_LIBOBJS dup.$ac_objext" + : + fi - gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext" + GL_GNULIB_DUP=1 - gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext" +printf "%s\n" "#define GNULIB_TEST_DUP 1" >>confdefs.h - if test $ac_cv_func_vasnprintf = yes; then -$as_echo "#define REPLACE_VASNPRINTF 1" >>confdefs.h - fi + gl_gnulib_enabled_dup=true + fi + } + func_gl_gnulib_m4code_fchdir () + { + if ! $gl_gnulib_enabled_fchdir; then + if test $ac_cv_have_decl_fchdir = no; then + HAVE_DECL_FCHDIR=0 + fi + if test $HAVE_FCHDIR = 0; then - ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" -if test "x$ac_cv_type_ptrdiff_t" = xyes; then : -else -$as_echo "#define ptrdiff_t long" >>confdefs.h -fi + gl_LIBOBJS="$gl_LIBOBJS fchdir.$ac_objext" + : +printf "%s\n" "#define REPLACE_FCHDIR 1" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether open can visit directories" >&5 +printf %s "checking whether open can visit directories... " >&6; } +if test ${gl_cv_func_open_directory_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_open_directory_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_open_directory_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_open_directory_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_open_directory_works="$gl_cross_guess_normal" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +$gl_mda_defines +int +main (void) +{ +return open(".", O_RDONLY) < 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_open_directory_works=yes +else $as_nop + gl_cv_func_open_directory_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_open_directory_works" >&5 +printf "%s\n" "$gl_cv_func_open_directory_works" >&6; } + case "$gl_cv_func_open_directory_works" in + *yes) ;; + *) +printf "%s\n" "#define REPLACE_OPEN_DIRECTORY 1" >>confdefs.h + ;; + esac + fi - gl_LIBOBJS="$gl_LIBOBJS vsprintf.$ac_objext" - REPLACE_VSPRINTF=1 - : - fi + GL_GNULIB_FCHDIR=1 - GNULIB_VSPRINTF_POSIX=1 +printf "%s\n" "#define GNULIB_TEST_FCHDIR 1" >>confdefs.h -$as_echo "#define GNULIB_TEST_VSPRINTF_POSIX 1" >>confdefs.h + gl_gnulib_enabled_fchdir=true + if test $HAVE_FCHDIR = 0; then + func_gl_gnulib_m4code_chdir + fi + if test $HAVE_FCHDIR = 0; then + func_gl_gnulib_m4code_dirent + fi + if test $HAVE_FCHDIR = 0; then + func_gl_gnulib_m4code_dirfd + fi + if test $HAVE_FCHDIR = 0; then + func_gl_gnulib_m4code_fca9852db2a43bb33f02f0fbdbc174f6 + fi + if test $HAVE_FCHDIR = 0; then + func_gl_gnulib_m4code_fstat + fi + if test $HAVE_FCHDIR = 0; then + func_gl_gnulib_m4code_3d094ef542bfdd238a5194e172bfe5f6 + fi + fi + } + func_gl_gnulib_m4code_43fe87a341d9b4b93c47c3ad819a5239 () + { + if ! $gl_gnulib_enabled_43fe87a341d9b4b93c47c3ad819a5239; then + gl_gnulib_enabled_43fe87a341d9b4b93c47c3ad819a5239=true + fi + } + func_gl_gnulib_m4code_fdopendir () + { + if ! $gl_gnulib_enabled_fdopendir; then - for ac_func in waitid -do : - ac_fn_c_check_func "$LINENO" "waitid" "ac_cv_func_waitid" -if test "x$ac_cv_func_waitid" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_WAITID 1 -_ACEOF + ac_fn_check_decl "$LINENO" "fdopendir" "ac_cv_have_decl_fdopendir" " +#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_fdopendir" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_FDOPENDIR $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : + +else $as_nop + HAVE_DECL_FDOPENDIR=0 fi -done + if test $ac_cv_func_fdopendir = no; then + HAVE_FDOPENDIR=0 + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fdopendir works" >&5 +printf %s "checking whether fdopendir works... " >&6; } +if test ${gl_cv_func_fdopendir_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_fdopendir_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_fdopendir_works="$gl_cross_guess_normal" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - HAVE_WAITPID=1 - case $host_os in - mingw*) HAVE_WAITPID=0 ;; - esac +#include +#include +#include - if test $HAVE_WAITPID = 0; then +$gl_mda_defines +#if !HAVE_DECL_FDOPENDIR +extern +# ifdef __cplusplus +"C" +# endif +DIR *fdopendir (int); +#endif +int +main (void) +{ +int result = 0; + int fd = open ("conftest.c", O_RDONLY); + if (fd < 0) result |= 1; + if (fdopendir (fd)) result |= 2; + if (close (fd)) result |= 4; + return result; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_fdopendir_works=yes +else $as_nop + gl_cv_func_fdopendir_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fdopendir_works" >&5 +printf "%s\n" "$gl_cv_func_fdopendir_works" >&6; } + case "$gl_cv_func_fdopendir_works" in + *yes) ;; + *) + REPLACE_FDOPENDIR=1 + ;; + esac + fi + if test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1; then - gl_LIBOBJS="$gl_LIBOBJS waitpid.$ac_objext" - fi - GNULIB_WAITPID=1 + gl_LIBOBJS="$gl_LIBOBJS fdopendir.$ac_objext" + fi -$as_echo "#define GNULIB_TEST_WAITPID 1" >>confdefs.h + GL_GNULIB_FDOPENDIR=1 +printf "%s\n" "#define GNULIB_TEST_FDOPENDIR 1" >>confdefs.h - if test $gl_cv_have_include_next = yes; then - gl_cv_next_wchar_h='<'wchar.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_wchar_h+:} false; then : - $as_echo_n "(cached) " >&6 -else +printf "%s\n" "#define GNULIB_FDOPENDIR 1" >>confdefs.h - if test $ac_cv_header_wchar_h = yes; then + gl_gnulib_enabled_fdopendir=true + if test $HAVE_FDOPENDIR = 0; then + func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b + fi + func_gl_gnulib_m4code_dirent + if test $HAVE_FDOPENDIR = 0; then + func_gl_gnulib_m4code_dirfd + fi + if test $HAVE_FDOPENDIR = 0; then + func_gl_gnulib_m4code_dup + fi + if test $HAVE_FDOPENDIR = 0; then + func_gl_gnulib_m4code_fchdir + fi + if test $HAVE_FDOPENDIR = 0; then + func_gl_gnulib_m4code_fstat + fi + if test $HAVE_FDOPENDIR = 0; then + func_gl_gnulib_m4code_1840129d490f3a00c8a098316d0fa345 + fi + if test $HAVE_FDOPENDIR = 0; then + func_gl_gnulib_m4code_opendir + fi + if test $HAVE_FDOPENDIR = 0; then + func_gl_gnulib_m4code_d4850532688ba16d685f036076611f21 + fi + fi + } + func_gl_gnulib_m4code_ffs () + { + if ! $gl_gnulib_enabled_ffs; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ffs" >&5 +printf %s "checking for ffs... " >&6; } +if test ${gl_cv_func_ffs+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'wchar.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - - gl_cv_absolute_wchar_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` +#include + int x; - gl_header=$gl_cv_absolute_wchar_h - gl_cv_next_wchar_h='"'$gl_header'"' - else - gl_cv_next_wchar_h='<'wchar.h'>' - fi +int +main (void) +{ +int (*func) (int) = ffs; + return func (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_func_ffs=yes +else $as_nop + gl_cv_func_ffs=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_wchar_h" >&5 -$as_echo "$gl_cv_next_wchar_h" >&6; } - fi - NEXT_WCHAR_H=$gl_cv_next_wchar_h - - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'wchar.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_wchar_h - fi - NEXT_AS_FIRST_DIRECTIVE_WCHAR_H=$gl_next_as_first_directive - +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ffs" >&5 +printf "%s\n" "$gl_cv_func_ffs" >&6; } + if test $gl_cv_func_ffs = no; then + HAVE_FFS=0 + fi + if test $HAVE_FFS = 0; then - if test $ac_cv_header_wchar_h = yes; then - HAVE_WCHAR_H=1 - else - HAVE_WCHAR_H=0 - fi - if test $gt_cv_c_wint_t = yes; then - HAVE_WINT_T=1 - else - HAVE_WINT_T=0 - fi + gl_LIBOBJS="$gl_LIBOBJS ffs.$ac_objext" + fi @@ -40922,26 +51584,31 @@ + GL_GNULIB_FFS=1 - if test $ac_cv_func_iswcntrl = yes; then - HAVE_ISWCNTRL=1 - else - HAVE_ISWCNTRL=0 - fi - if test $gt_cv_c_wint_t = yes; then - HAVE_WINT_T=1 - else - HAVE_WINT_T=0 - fi + gl_gnulib_enabled_ffs=true + func_gl_gnulib_m4code_strings + fi + } + func_gl_gnulib_m4code_fca9852db2a43bb33f02f0fbdbc174f6 () + { + if ! $gl_gnulib_enabled_fca9852db2a43bb33f02f0fbdbc174f6; then + gl_gnulib_enabled_fca9852db2a43bb33f02f0fbdbc174f6=true + fi + } + func_gl_gnulib_m4code_fseterr () + { + if ! $gl_gnulib_enabled_fseterr; then + if test $ac_cv_func___fseterr = no; then @@ -40949,425 +51616,145 @@ - if test $gl_cv_have_include_next = yes; then - gl_cv_next_wctype_h='<'wctype.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_wctype_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test $ac_cv_header_wctype_h = yes; then + gl_LIBOBJS="$gl_LIBOBJS fseterr.$ac_objext" + fi + gl_gnulib_enabled_fseterr=true + fi + } + func_gl_gnulib_m4code_fstat () + { + if ! $gl_gnulib_enabled_fstat; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' + mingw* | solaris*) + REPLACE_FSTAT=1 ;; esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'wctype.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - - gl_cv_absolute_wctype_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_wctype_h - gl_cv_next_wctype_h='"'$gl_header'"' - else - gl_cv_next_wctype_h='<'wctype.h'>' - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_wctype_h" >&5 -$as_echo "$gl_cv_next_wctype_h" >&6; } - fi - NEXT_WCTYPE_H=$gl_cv_next_wctype_h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'wctype.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_wctype_h - fi - NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H=$gl_next_as_first_directive + if test $ac_cv_func_fchdir = no; then + HAVE_FCHDIR=0 + fi + if test $HAVE_FCHDIR = 0; then + case "$gl_cv_func_open_directory_works" in + *yes) ;; + *) + REPLACE_FSTAT=1 + ;; + esac + fi - if test $ac_cv_header_wctype_h = yes; then - if test $ac_cv_func_iswcntrl = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether iswcntrl works" >&5 -$as_echo_n "checking whether iswcntrl works... " >&6; } -if ${gl_cv_func_iswcntrl_works+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test $REPLACE_FSTAT = 1; then - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #if __GNU_LIBRARY__ == 1 - Linux libc5 i18n is broken. - #endif -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_func_iswcntrl_works="guessing yes" -else - gl_cv_func_iswcntrl_works="guessing no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - /* Tru64 with Desktop Toolkit C has a bug: must be - included before . - BSD/OS 4.0.1 has a bug: , and - must be included before . */ - #include - #include - #include - #include - #include - int main () { return iswprint ('x') == 0; } -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_iswcntrl_works=yes -else - gl_cv_func_iswcntrl_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_iswcntrl_works" >&5 -$as_echo "$gl_cv_func_iswcntrl_works" >&6; } - fi - HAVE_WCTYPE_H=1 - else - HAVE_WCTYPE_H=0 - fi + gl_LIBOBJS="$gl_LIBOBJS fstat.$ac_objext" - if test $GNULIB_OVERRIDES_WINT_T = 1; then - REPLACE_ISWCNTRL=1 - else - case "$gl_cv_func_iswcntrl_works" in - *yes) REPLACE_ISWCNTRL=0 ;; - *) REPLACE_ISWCNTRL=1 ;; - esac - fi + case "$host_os" in + mingw*) - if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then - : - fi - if test $REPLACE_ISWCNTRL = 1; then - REPLACE_TOWLOWER=1 - else - for ac_func in towlower -do : - ac_fn_c_check_func "$LINENO" "towlower" "ac_cv_func_towlower" -if test "x$ac_cv_func_towlower" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_TOWLOWER 1 -_ACEOF -fi -done - if test $ac_cv_func_towlower = yes; then - REPLACE_TOWLOWER=0 - else - ac_fn_c_check_decl "$LINENO" "towlower" "ac_cv_have_decl_towlower" "/* Tru64 with Desktop Toolkit C has a bug: must be - included before . - BSD/OS 4.0.1 has a bug: , and - must be included before . */ - #include - #include - #include - #include - #if HAVE_WCTYPE_H - # include - #endif -" -if test "x$ac_cv_have_decl_towlower" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_TOWLOWER $ac_have_decl -_ACEOF - if test $ac_cv_have_decl_towlower = yes; then - REPLACE_TOWLOWER=1 - else - REPLACE_TOWLOWER=0 - fi - fi - fi + gl_LIBOBJS="$gl_LIBOBJS stat-w32.$ac_objext" + ;; + esac - if test $HAVE_ISWCNTRL = 0 || test $REPLACE_TOWLOWER = 1; then - : - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wctype_t" >&5 -$as_echo_n "checking for wctype_t... " >&6; } -if ${gl_cv_type_wctype_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Tru64 with Desktop Toolkit C has a bug: must be - included before . - BSD/OS 4.0.1 has a bug: , and - must be included before . */ - #include - #include - #include - #include - #if HAVE_WCTYPE_H - # include - #endif - wctype_t a; -int -main () -{ + : - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_type_wctype_t=yes -else - gl_cv_type_wctype_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wctype_t" >&5 -$as_echo "$gl_cv_type_wctype_t" >&6; } - if test $gl_cv_type_wctype_t = no; then - HAVE_WCTYPE_T=0 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wctrans_t" >&5 -$as_echo_n "checking for wctrans_t... " >&6; } -if ${gl_cv_type_wctrans_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Tru64 with Desktop Toolkit C has a bug: must be - included before . - BSD/OS 4.0.1 has a bug: , and - must be included before . */ - #include - #include - #include - #include - #include - wctrans_t a; -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_type_wctrans_t=yes -else - gl_cv_type_wctrans_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wctrans_t" >&5 -$as_echo "$gl_cv_type_wctrans_t" >&6; } - if test $gl_cv_type_wctrans_t = no; then - HAVE_WCTRANS_T=0 - fi + GL_GNULIB_FSTAT=1 +printf "%s\n" "#define GNULIB_TEST_FSTAT 1" >>confdefs.h + gl_gnulib_enabled_fstat=true + if test $REPLACE_FSTAT = 1; then + func_gl_gnulib_m4code_0137e3d3638b33e5819d132d0b23165c + fi + fi + } + func_gl_gnulib_m4code_fstatat () + { + if ! $gl_gnulib_enabled_fstatat; then - ac_fn_c_check_decl "$LINENO" "wcwidth" "ac_cv_have_decl_wcwidth" " -/* AIX 3.2.5 declares wcwidth in . */ -#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be included - before . */ -#include -#include -#include -#include -" -if test "x$ac_cv_have_decl_wcwidth" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_WCWIDTH $ac_have_decl -_ACEOF - if test $ac_cv_have_decl_wcwidth != yes; then - HAVE_DECL_WCWIDTH=0 - fi + if test $ac_cv_func_fstatat = no; then + HAVE_FSTATAT=0 + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fstatat (..., 0) works" >&5 +printf %s "checking whether fstatat (..., 0) works... " >&6; } +if test ${gl_cv_func_fstatat_zero_flag+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + aix*) gl_cv_func_fstatat_zero_flag="guessing no";; + *) gl_cv_func_fstatat_zero_flag="guessing yes";; + esac - if test $ac_cv_func_wcwidth != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether wcwidth is a macro" >&5 -$as_echo_n "checking whether wcwidth is a macro... " >&6; } -if ${gl_cv_func_wcwidth_macro+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#ifdef wcwidth - wchar_header_defines_wcwidth -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "wchar_header_defines_wcwidth" >/dev/null 2>&1; then : - gl_cv_func_wcwidth_macro=yes -else - gl_cv_func_wcwidth_macro=no -fi -rm -f conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_wcwidth_macro" >&5 -$as_echo "$gl_cv_func_wcwidth_macro" >&6; } - fi - - if test $ac_cv_func_wcwidth = yes || test $gl_cv_func_wcwidth_macro = yes; then - HAVE_WCWIDTH=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether wcwidth works reasonably in UTF-8 locales" >&5 -$as_echo_n "checking whether wcwidth works reasonably in UTF-8 locales... " >&6; } -if ${gl_cv_func_wcwidth_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test "$cross_compiling" = yes; then : - - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_wcwidth_works="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_wcwidth_works="guessing yes";; - # Guess yes on AIX 7 systems. - aix[7-9]*) gl_cv_func_wcwidth_works="guessing yes";; - *) gl_cv_func_wcwidth_works="$gl_cross_guess_normal";; - esac - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + #include + #include + int + main (void) + { + struct stat a; + return fstatat (AT_FDCWD, ".", &a, 0) != 0; + } -#include -/* AIX 3.2.5 declares wcwidth in . */ -#include -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be included - before . */ -#include -#include -#include -#include -#if !HAVE_DECL_WCWIDTH -extern -# ifdef __cplusplus -"C" -# endif -int wcwidth (int); -#endif -int main () -{ - int result = 0; - if (setlocale (LC_ALL, "en_US.UTF-8") != NULL) - { - if (wcwidth (0x0301) > 0) - result |= 1; - if (wcwidth (0x05B0) > 0) - result |= 2; - if (wcwidth (0x200B) > 0) - result |= 4; - if (wcwidth (0xFF1A) == 0) - result |= 8; - if (wcwidth (0x2202) > 1) - result |= 16; - } - return result; -} _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_wcwidth_works=yes -else - gl_cv_func_wcwidth_works=no +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_fstatat_zero_flag=yes +else $as_nop + gl_cv_func_fstatat_zero_flag=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -41375,333 +51762,297 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_wcwidth_works" >&5 -$as_echo "$gl_cv_func_wcwidth_works" >&6; } - case "$gl_cv_func_wcwidth_works" in - *yes) ;; - *no) REPLACE_WCWIDTH=1 ;; - esac - else - HAVE_WCWIDTH=0 - fi - - if test $HAVE_WCWIDTH = 0 || test $REPLACE_WCWIDTH = 1; then - - - - +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fstatat_zero_flag" >&5 +printf "%s\n" "$gl_cv_func_fstatat_zero_flag" >&6; } + case $gl_cv_func_fstatat_zero_flag+$gl_cv_func_lstat_dereferences_slashed_symlink in + *yes+*yes) ;; + *) REPLACE_FSTATAT=1 ;; + esac + case $host_os in + solaris*) + REPLACE_FSTATAT=1 ;; + esac + case $REPLACE_FSTATAT,$gl_cv_func_fstatat_zero_flag in + 1,*yes) - gl_LIBOBJS="$gl_LIBOBJS wcwidth.$ac_objext" +printf "%s\n" "#define HAVE_WORKING_FSTATAT_ZERO_FLAG 1" >>confdefs.h + ;; + esac + fi + if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then - : - fi - GNULIB_WCWIDTH=1 + gl_LIBOBJS="$gl_LIBOBJS fstatat.$ac_objext" + fi -$as_echo "#define GNULIB_TEST_WCWIDTH 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether use of TIOCGWINSZ requires sys/ioctl.h" >&5 -$as_echo_n "checking whether use of TIOCGWINSZ requires sys/ioctl.h... " >&6; } -if ${gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no - if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -# include -# ifdef TIOCGWINSZ - yes -# endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then : - gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes -fi -rm -f conftest* + GL_GNULIB_FSTATAT=1 - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h" >&5 -$as_echo "$gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h" >&6; } - if test $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then -$as_echo "#define GWINSZ_IN_SYS_IOCTL 1" >>confdefs.h - fi +printf "%s\n" "#define GNULIB_TEST_FSTATAT 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether use of TIOCGWINSZ requires termios.h" >&5 -$as_echo_n "checking whether use of TIOCGWINSZ requires termios.h... " >&6; } -if ${gl_cv_sys_tiocgwinsz_needs_termios_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_sys_tiocgwinsz_needs_termios_h=no - if test $ac_cv_sys_posix_termios = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -# include -# ifdef TIOCGWINSZ - yes -# endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then : - gl_cv_sys_tiocgwinsz_needs_termios_h=yes -fi -rm -f conftest* + gl_gnulib_enabled_fstatat=true + if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then + func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b + fi + if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then + func_gl_gnulib_m4code_fchdir + fi + if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then + func_gl_gnulib_m4code_lstat + fi + if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then + func_gl_gnulib_m4code_1840129d490f3a00c8a098316d0fa345 + fi + if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then + func_gl_gnulib_m4code_03e0aaad4cb89ca757653bd367a6ccb7 + fi + if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then + func_gl_gnulib_m4code_d4850532688ba16d685f036076611f21 + fi + if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then + func_gl_gnulib_m4code_0137e3d3638b33e5819d132d0b23165c + fi + fi + } + func_gl_gnulib_m4code_3d094ef542bfdd238a5194e172bfe5f6 () + { + if ! $gl_gnulib_enabled_3d094ef542bfdd238a5194e172bfe5f6; then - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_tiocgwinsz_needs_termios_h" >&5 -$as_echo "$gl_cv_sys_tiocgwinsz_needs_termios_h" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether use of struct winsize requires sys/ptem.h" >&5 -$as_echo_n "checking whether use of struct winsize requires sys/ptem.h... " >&6; } -if ${gl_cv_sys_struct_winsize_needs_sys_ptem_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_sys_struct_winsize_needs_sys_ptem_h=yes - if test $ac_cv_sys_posix_termios = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -struct winsize x; - if (sizeof x > 0) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_sys_struct_winsize_needs_sys_ptem_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $gl_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -struct winsize x; - if (sizeof x > 0) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : + case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_posix_signature in + *yes,yes) ;; + *) + REPLACE_GETCWD=1 + ;; + esac -else - gl_cv_sys_struct_winsize_needs_sys_ptem_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_winsize_needs_sys_ptem_h" >&5 -$as_echo "$gl_cv_sys_struct_winsize_needs_sys_ptem_h" >&6; } - if test $gl_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then + if test $REPLACE_GETCWD = 1; then -$as_echo "#define WINSIZE_IN_PTEM 1" >>confdefs.h - fi - : - for ac_header in stdint.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" -if test "x$ac_cv_header_stdint_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDINT_H 1 -_ACEOF -fi -done + gl_LIBOBJS="$gl_LIBOBJS getcwd-lgpl.$ac_objext" + fi - : - gl_gnulib_enabled_chdir=false - gl_gnulib_enabled_43fe87a341d9b4b93c47c3ad819a5239=false - gl_gnulib_enabled_fseterr=false - gl_gnulib_enabled_fstat=false - gl_gnulib_enabled_getdtablesize=false - gl_gnulib_enabled_30838f5439487421042f2225bed3af76=false - gl_gnulib_enabled_3f0e593033d1fc2c127581960f641b66=false - gl_gnulib_enabled_ldexp=false - gl_gnulib_enabled_21ee726a3540c09237a8e70c0baf7467=false - gl_gnulib_enabled_locale=false - gl_gnulib_enabled_2049e887c7e5308faad27b3f894bb8c9=false - gl_gnulib_enabled_lstat=false - gl_gnulib_enabled_malloca=false - gl_gnulib_enabled_332607f759618fb73dfc3076748afea7=false - gl_gnulib_enabled_rawmemchr=false - gl_gnulib_enabled_rmdir=false - gl_gnulib_enabled_9bc5f216d57e231e4834049d67d0db62=false - gl_gnulib_enabled_e7e881d32ca02f1c997b13c737c64bbd=false - gl_gnulib_enabled_cdeb0f2aaf9d280baa6526bfa1b07f70=false - gl_gnulib_enabled_stat=false - gl_gnulib_enabled_0137e3d3638b33e5819d132d0b23165c=false - gl_gnulib_enabled_strchrnul=false - gl_gnulib_enabled_dbb57f49352be8fb86869629a254fb72=false - gl_gnulib_enabled_1f32594a85e6221ba15f884daeee8c2a=false - gl_gnulib_enabled_strnlen=false - gl_gnulib_enabled_sys_stat=false - gl_gnulib_enabled_ed5616be3593d355b981ffab56b9f37b=false - gl_gnulib_enabled_503a4cb75d69c787103d0aa2ab7d8440=false - gl_gnulib_enabled_68a4501daeca58988392c7e60b4917ab=false - gl_gnulib_enabled_f0efff84a70f4afba30902bb8ffe9354=false - gl_gnulib_enabled_8bb827fe37eaccf1b97feb0c87bc92ef=false - gl_gnulib_enabled_48b2271240803e4879464b755748a89d=false - func_gl_gnulib_m4code_chdir () - { - if ! $gl_gnulib_enabled_chdir; then - GNULIB_CHDIR=1 + GL_GNULIB_GETCWD=1 -$as_echo "#define GNULIB_TEST_CHDIR 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_GETCWD 1" >>confdefs.h - gl_gnulib_enabled_chdir=true - fi - } - func_gl_gnulib_m4code_43fe87a341d9b4b93c47c3ad819a5239 () - { - if ! $gl_gnulib_enabled_43fe87a341d9b4b93c47c3ad819a5239; then - gl_gnulib_enabled_43fe87a341d9b4b93c47c3ad819a5239=true + gl_gnulib_enabled_3d094ef542bfdd238a5194e172bfe5f6=true fi } - func_gl_gnulib_m4code_fseterr () + func_gl_gnulib_m4code_getdelim () { - if ! $gl_gnulib_enabled_fseterr; then - + if ! $gl_gnulib_enabled_getdelim; then - if test $ac_cv_func___fseterr = no; then - + if test $ac_cv_func_getdelim = yes; then + HAVE_GETDELIM=1 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working getdelim function" >&5 +printf %s "checking for working getdelim function... " >&6; } +if test ${gl_cv_func_working_getdelim+y} +then : + printf %s "(cached) " >&6 +else $as_nop + echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data + if test "$cross_compiling" = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - gl_LIBOBJS="$gl_LIBOBJS fseterr.$ac_objext" +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ + Lucky GNU user + #endif +#endif - fi - gl_gnulib_enabled_fseterr=true - fi - } - func_gl_gnulib_m4code_fstat () - { - if ! $gl_gnulib_enabled_fstat; then +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Lucky GNU user" >/dev/null 2>&1 +then : + gl_cv_func_working_getdelim="guessing yes" +else $as_nop + case "$host_os" in + *-musl*) gl_cv_func_working_getdelim="guessing yes" ;; + *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; + esac +fi +rm -rf conftest* +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - case "$host_os" in - mingw* | solaris*) - REPLACE_FSTAT=1 - ;; - esac +# include +# include +# include + int main () + { + FILE *in = fopen ("./conftest.data", "r"); + if (!in) + return 1; + { + /* Test result for a NULL buffer and a zero size. + Based on a test program from Karl Heuer. */ + char *line = NULL; + size_t siz = 0; + int len = getdelim (&line, &siz, '\n', in); + if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) + { free (line); fclose (in); return 2; } + free (line); + } + { + /* Test result for a NULL buffer and a non-zero size. + This crashes on FreeBSD 8.0. */ + char *line = NULL; + size_t siz = (size_t)(~0) / 4; + if (getdelim (&line, &siz, '\n', in) == -1) + { fclose (in); return 3; } + free (line); + } + fclose (in); + return 0; + } +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_working_getdelim=yes +else $as_nop + gl_cv_func_working_getdelim=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - if test $REPLACE_FSTAT = 1; then +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_working_getdelim" >&5 +printf "%s\n" "$gl_cv_func_working_getdelim" >&6; } + case "$gl_cv_func_working_getdelim" in + *yes) ;; + *) REPLACE_GETDELIM=1 ;; + esac + else + HAVE_GETDELIM=0 + fi + if test $ac_cv_have_decl_getdelim = no; then + HAVE_DECL_GETDELIM=0 + fi + if test $HAVE_GETDELIM = 0 || test $REPLACE_GETDELIM = 1; then - gl_LIBOBJS="$gl_LIBOBJS fstat.$ac_objext" - case "$host_os" in - mingw*) + gl_LIBOBJS="$gl_LIBOBJS getdelim.$ac_objext" + ac_fn_c_check_func "$LINENO" "flockfile" "ac_cv_func_flockfile" +if test "x$ac_cv_func_flockfile" = xyes +then : + printf "%s\n" "#define HAVE_FLOCKFILE 1" >>confdefs.h +fi +ac_fn_c_check_func "$LINENO" "funlockfile" "ac_cv_func_funlockfile" +if test "x$ac_cv_func_funlockfile" = xyes +then : + printf "%s\n" "#define HAVE_FUNLOCKFILE 1" >>confdefs.h +fi + ac_fn_check_decl "$LINENO" "getc_unlocked" "ac_cv_have_decl_getc_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_getc_unlocked" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_GETC_UNLOCKED $ac_have_decl" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS stat-w32.$ac_objext" + fi - ;; - esac - : - fi - GNULIB_FSTAT=1 + GL_GNULIB_GETDELIM=1 -$as_echo "#define GNULIB_TEST_FSTAT 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_GETDELIM 1" >>confdefs.h - gl_gnulib_enabled_fstat=true - if test $REPLACE_FSTAT = 1; then - func_gl_gnulib_m4code_0137e3d3638b33e5819d132d0b23165c - fi - func_gl_gnulib_m4code_sys_stat + gl_gnulib_enabled_getdelim=true fi } func_gl_gnulib_m4code_getdtablesize () @@ -41714,42 +52065,50 @@ if test $ac_cv_func_getdtablesize = yes && test $ac_cv_have_decl_getdtablesize = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getdtablesize works" >&5 -$as_echo_n "checking whether getdtablesize works... " >&6; } -if ${gl_cv_func_getdtablesize_works+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether getdtablesize works" >&5 +printf %s "checking whether getdtablesize works... " >&6; } +if test ${gl_cv_func_getdtablesize_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop case "$host_os" in vms*) gl_cv_func_getdtablesize_works="no (limitation)" ;; *) - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes +then : case "$host_os" in cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows gl_cv_func_getdtablesize_works="guessing no" ;; *) gl_cv_func_getdtablesize_works="guessing yes" ;; esac -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include + + +$gl_mda_defines + + int -main () +main (void) { int size = getdtablesize(); - if (dup2 (0, getdtablesize()) != -1) - return 1; - if (size != getdtablesize()) - return 2; + if (dup2 (0, getdtablesize()) != -1) + return 1; + if (size != getdtablesize()) + return 2; ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : gl_cv_func_getdtablesize_works=yes -else +else $as_nop gl_cv_func_getdtablesize_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -41760,8 +52119,8 @@ esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getdtablesize_works" >&5 -$as_echo "$gl_cv_func_getdtablesize_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getdtablesize_works" >&5 +printf "%s\n" "$gl_cv_func_getdtablesize_works" >&6; } case "$gl_cv_func_getdtablesize_works" in *yes | "no (limitation)") ;; *) REPLACE_GETDTABLESIZE=1 ;; @@ -41788,19 +52147,180 @@ - GNULIB_GETDTABLESIZE=1 + GL_GNULIB_GETDTABLESIZE=1 + + + -$as_echo "#define GNULIB_TEST_GETDTABLESIZE 1" >>confdefs.h + +printf "%s\n" "#define GNULIB_TEST_GETDTABLESIZE 1" >>confdefs.h gl_gnulib_enabled_getdtablesize=true fi } + func_gl_gnulib_m4code_getline () + { + if ! $gl_gnulib_enabled_getline; then + + + + + + + + gl_getline_needs_run_time_check=no + ac_fn_c_check_func "$LINENO" "getline" "ac_cv_func_getline" +if test "x$ac_cv_func_getline" = xyes +then : + gl_getline_needs_run_time_check=yes +else $as_nop + am_cv_func_working_getline=no +fi + + if test $gl_getline_needs_run_time_check = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working getline function" >&5 +printf %s "checking for working getline function... " >&6; } +if test ${am_cv_func_working_getline+y} +then : + printf %s "(cached) " >&6 +else $as_nop + echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data + if test "$cross_compiling" = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ + Lucky GNU user + #endif +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Lucky GNU user" >/dev/null 2>&1 +then : + am_cv_func_working_getline="guessing yes" +else $as_nop + case "$host_os" in + *-musl*) am_cv_func_working_getline="guessing yes" ;; + *) am_cv_func_working_getline="$gl_cross_guess_normal" ;; + esac + +fi +rm -rf conftest* + + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# include +# include +# include + int main () + { + FILE *in = fopen ("./conftest.data", "r"); + if (!in) + return 1; + { + /* Test result for a NULL buffer and a zero size. + Based on a test program from Karl Heuer. */ + char *line = NULL; + size_t siz = 0; + int len = getline (&line, &siz, in); + if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) + { free (line); fclose (in); return 2; } + free (line); + } + { + /* Test result for a NULL buffer and a non-zero size. + This crashes on FreeBSD 8.0. */ + char *line = NULL; + size_t siz = (size_t)(~0) / 4; + if (getline (&line, &siz, in) == -1) + { fclose (in); return 3; } + free (line); + } + fclose (in); + return 0; + } + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + am_cv_func_working_getline=yes +else $as_nop + am_cv_func_working_getline=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_working_getline" >&5 +printf "%s\n" "$am_cv_func_working_getline" >&6; } + fi + + if test $ac_cv_have_decl_getline = no; then + HAVE_DECL_GETLINE=0 + fi + + case "$am_cv_func_working_getline" in + *yes) ;; + *) + REPLACE_GETLINE=1 + ;; + esac + + if test $REPLACE_GETLINE = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS getline.$ac_objext" + + + : + + fi + + + + + + + + + + GL_GNULIB_GETLINE=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_GETLINE 1" >>confdefs.h + + + + gl_gnulib_enabled_getline=true + if test $REPLACE_GETLINE = 1; then + func_gl_gnulib_m4code_getdelim + fi + fi + } func_gl_gnulib_m4code_30838f5439487421042f2225bed3af76 () { if ! $gl_gnulib_enabled_30838f5439487421042f2225bed3af76; then @@ -41816,54 +52336,58 @@ if ! $gl_gnulib_enabled_3f0e593033d1fc2c127581960f641b66; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) can be used without linking with libm" >&5 -$as_echo_n "checking whether isnan(float) can be used without linking with libm... " >&6; } -if ${gl_cv_func_isnanf_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) can be used without linking with libm" >&5 +printf %s "checking whether isnan(float) can be used without linking with libm... " >&6; } +if test ${gl_cv_func_isnanf_no_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include - #if __GNUC__ >= 4 + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) # undef isnanf - # define isnanf(x) __builtin_isnanf ((float)(x)) + # define isnanf(x) __builtin_isnan ((float)(x)) #elif defined isnan # undef isnanf # define isnanf(x) isnan ((float)(x)) #endif float x; int -main () +main (void) { return isnanf (x); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : gl_cv_func_isnanf_no_libm=yes -else +else $as_nop gl_cv_func_isnanf_no_libm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_no_libm" >&5 -$as_echo "$gl_cv_func_isnanf_no_libm" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_no_libm" >&5 +printf "%s\n" "$gl_cv_func_isnanf_no_libm" >&6; } if test $gl_cv_func_isnanf_no_libm = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) works" >&5 -$as_echo_n "checking whether isnan(float) works... " >&6; } -if ${gl_cv_func_isnanf_works+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) works" >&5 +printf %s "checking whether isnan(float) works... " >&6; } +if test ${gl_cv_func_isnanf_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes +then : case "$host_os" in irix* | solaris*) gl_cv_func_isnanf_works="guessing no" ;; mingw*) # Guess yes on mingw, no on MSVC. @@ -41876,25 +52400,26 @@ _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : + $EGREP "Known" >/dev/null 2>&1 +then : gl_cv_func_isnanf_works="guessing yes" -else +else $as_nop gl_cv_func_isnanf_works="guessing no" fi -rm -f conftest* +rm -rf conftest* ;; *) gl_cv_func_isnanf_works="guessing yes" ;; esac -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include -#if __GNUC__ >= 4 +#if (__GNUC__ >= 4) || (__clang_major__ >= 4) # undef isnanf -# define isnanf(x) __builtin_isnanf ((float)(x)) +# define isnanf(x) __builtin_isnan ((float)(x)) #elif defined isnan # undef isnanf # define isnanf(x) isnan ((float)(x)) @@ -41934,7 +52459,7 @@ m.value = NaN (); /* Set the bits below the exponent to 01111...111. */ m.word[0] &= -1U << FLT_EXPBIT0_BIT; - m.word[0] |= 1U << (FLT_EXPBIT0_BIT - 1) - 1; + m.word[0] |= (1U << (FLT_EXPBIT0_BIT - 1)) - 1; if (!isnanf (m.value)) result |= 4; } @@ -41943,9 +52468,10 @@ return result; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : gl_cv_func_isnanf_works=yes -else +else $as_nop gl_cv_func_isnanf_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -41954,8 +52480,8 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_works" >&5 -$as_echo "$gl_cv_func_isnanf_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_isnanf_works" >&5 +printf "%s\n" "$gl_cv_func_isnanf_works" >&6; } fi if test $gl_cv_func_isnanf_no_libm = yes \ @@ -41966,7 +52492,7 @@ }; then gl_func_isnanf_no_libm=yes -$as_echo "#define HAVE_ISNANF_IN_LIBC 1" >>confdefs.h +printf "%s\n" "#define HAVE_ISNANF_IN_LIBC 1" >>confdefs.h else gl_func_isnanf_no_libm=no @@ -41985,15 +52511,17 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'float'" >&5 -$as_echo_n "checking where to find the exponent in a 'float'... " >&6; } -if ${gl_cv_cc_float_expbit0+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'float'" >&5 +printf %s "checking where to find the exponent in a 'float'... " >&6; } +if test ${gl_cv_cc_float_expbit0+y} +then : + printf %s "(cached) " >&6 +else $as_nop - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes +then : gl_cv_cc_float_expbit0="word 0 bit 23" -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -42062,9 +52590,10 @@ } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : gl_cv_cc_float_expbit0=`cat conftest.out` -else +else $as_nop gl_cv_cc_float_expbit0="unknown" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -42074,21 +52603,17 @@ rm -f conftest.out fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_float_expbit0" >&5 -$as_echo "$gl_cv_cc_float_expbit0" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_float_expbit0" >&5 +printf "%s\n" "$gl_cv_cc_float_expbit0" >&6; } case "$gl_cv_cc_float_expbit0" in word*bit*) word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` -cat >>confdefs.h <<_ACEOF -#define FLT_EXPBIT0_WORD $word -_ACEOF +printf "%s\n" "#define FLT_EXPBIT0_WORD $word" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define FLT_EXPBIT0_BIT $bit -_ACEOF +printf "%s\n" "#define FLT_EXPBIT0_BIT $bit" >>confdefs.h ;; esac @@ -42105,11 +52630,12 @@ LDEXP_LIBM= if test $gl_cv_func_ldexp_no_libm = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ldexp() can be used with libm" >&5 -$as_echo_n "checking whether ldexp() can be used with libm... " >&6; } -if ${gl_cv_func_ldexp_in_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ldexp() can be used with libm" >&5 +printf %s "checking whether ldexp() can be used with libm... " >&6; } +if test ${gl_cv_func_ldexp_in_libm+y} +then : + printf %s "(cached) " >&6 +else $as_nop save_LIBS="$LIBS" LIBS="$LIBS -lm" @@ -42122,25 +52648,26 @@ double (*funcptr) (double, int) = ldexp; double x; int -main () +main (void) { return ldexp (x, -1) > 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : gl_cv_func_ldexp_in_libm=yes -else +else $as_nop gl_cv_func_ldexp_in_libm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$save_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexp_in_libm" >&5 -$as_echo "$gl_cv_func_ldexp_in_libm" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ldexp_in_libm" >&5 +printf "%s\n" "$gl_cv_func_ldexp_in_libm" >&6; } if test $gl_cv_func_ldexp_in_libm = yes; then LDEXP_LIBM=-lm fi @@ -42150,306 +52677,308 @@ gl_gnulib_enabled_ldexp=true fi } - func_gl_gnulib_m4code_21ee726a3540c09237a8e70c0baf7467 () + func_gl_gnulib_m4code_locale () { - if ! $gl_gnulib_enabled_21ee726a3540c09237a8e70c0baf7467; then + if ! $gl_gnulib_enabled_locale; then + - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the __inline keyword" >&5 -$as_echo_n "checking whether the compiler supports the __inline keyword... " >&6; } -if ${gl_cv_c___inline+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -typedef int foo_t; - static __inline foo_t foo (void) { return 0; } -int -main () -{ -return foo (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_c___inline=yes -else - gl_cv_c___inline=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c___inline" >&5 -$as_echo "$gl_cv_c___inline" >&6; } - if test $gl_cv_c___inline = yes; then -$as_echo "#define HAVE___INLINE 1" >>confdefs.h - fi - gl_gnulib_enabled_21ee726a3540c09237a8e70c0baf7467=true + + gl_gnulib_enabled_locale=true fi } - func_gl_gnulib_m4code_locale () + func_gl_gnulib_m4code_lstat () { - if ! $gl_gnulib_enabled_locale; then + if ! $gl_gnulib_enabled_lstat; then + if test $ac_cv_func_lstat = yes; then + case $host_os,$gl_cv_func_lstat_dereferences_slashed_symlink in + solaris* | *no) + REPLACE_LSTAT=1 + ;; + esac + else + HAVE_LSTAT=0 + fi + if test $REPLACE_LSTAT = 1; then - case "$host_os" in - solaris*) -$as_echo "#define _LCONV_C99 1" >>confdefs.h - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether locale.h conforms to POSIX:2001" >&5 -$as_echo_n "checking whether locale.h conforms to POSIX:2001... " >&6; } -if ${gl_cv_header_locale_h_posix2001+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - int x = LC_MESSAGES; - int y = sizeof (((struct lconv *) 0)->decimal_point); -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_locale_h_posix2001=yes -else - gl_cv_header_locale_h_posix2001=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_locale_h_posix2001" >&5 -$as_echo "$gl_cv_header_locale_h_posix2001" >&6; } + gl_LIBOBJS="$gl_LIBOBJS lstat.$ac_objext" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct lconv is properly defined" >&5 -$as_echo_n "checking whether struct lconv is properly defined... " >&6; } -if ${gl_cv_sys_struct_lconv_ok+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - struct lconv l; - int x = sizeof (l.decimal_point); - int y = sizeof (l.int_p_cs_precedes); -int -main () -{ + : + fi - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_sys_struct_lconv_ok=yes -else - gl_cv_sys_struct_lconv_ok=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_lconv_ok" >&5 -$as_echo "$gl_cv_sys_struct_lconv_ok" >&6; } - if test $gl_cv_sys_struct_lconv_ok = no; then - case "$host_os" in - mingw*) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef _MSC_VER - Special -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Special" >/dev/null 2>&1; then : -else - REPLACE_STRUCT_LCONV=1 -fi -rm -f conftest* - ;; - *) REPLACE_STRUCT_LCONV=1 ;; - esac + + + + GL_GNULIB_LSTAT=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_LSTAT 1" >>confdefs.h + + + + gl_gnulib_enabled_lstat=true + if test $REPLACE_LSTAT = 1; then + func_gl_gnulib_m4code_0137e3d3638b33e5819d132d0b23165c + fi + fi + } + func_gl_gnulib_m4code_malloca () + { + if ! $gl_gnulib_enabled_malloca; then + + + + gl_gnulib_enabled_malloca=true + fi + } + func_gl_gnulib_m4code_memrchr () + { + if ! $gl_gnulib_enabled_memrchr; then + + + + + + if test $ac_cv_have_decl_memrchr = no; then + HAVE_DECL_MEMRCHR=0 fi + ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr" +if test "x$ac_cv_func_memrchr" = xyes +then : + printf "%s\n" "#define HAVE_MEMRCHR 1" >>confdefs.h +fi + if test $ac_cv_func_memrchr = no; then - if test $gl_cv_have_include_next = yes; then - gl_cv_next_locale_h='<'locale.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_locale_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac + gl_LIBOBJS="$gl_LIBOBJS memrchr.$ac_objext" - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; + : + fi + + + + + + + + + + GL_GNULIB_MEMRCHR=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_MEMRCHR 1" >>confdefs.h + + + + gl_gnulib_enabled_memrchr=true + fi + } + func_gl_gnulib_m4code_openat () + { + if ! $gl_gnulib_enabled_openat; then + + + + + + + case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink+$gl_cv_macro_O_CLOEXEC in + yes+*yes+yes) + ;; + yes+*) + # Solaris 10 lacks O_CLOEXEC. + # Solaris 9 has *at functions, but uniformly mishandles trailing + # slash in all of them. + REPLACE_OPENAT=1 + ;; + *) + HAVE_OPENAT=0 + ;; esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'locale.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - gl_cv_absolute_locale_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` + if test $HAVE_OPENAT = 0 || test $REPLACE_OPENAT = 1; then + + + + + + + - gl_header=$gl_cv_absolute_locale_h - gl_cv_next_locale_h='"'$gl_header'"' + gl_LIBOBJS="$gl_LIBOBJS openat.$ac_objext" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_locale_h" >&5 -$as_echo "$gl_cv_next_locale_h" >&6; } - fi - NEXT_LOCALE_H=$gl_cv_next_locale_h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'locale.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_locale_h - fi - NEXT_AS_FIRST_DIRECTIVE_LOCALE_H=$gl_next_as_first_directive + : + fi +printf "%s\n" "#define GNULIB_OPENAT 1" >>confdefs.h + - gl_gnulib_enabled_locale=true - fi - } - func_gl_gnulib_m4code_2049e887c7e5308faad27b3f894bb8c9 () - { - if ! $gl_gnulib_enabled_2049e887c7e5308faad27b3f894bb8c9; then + GL_GNULIB_OPENAT=1 +printf "%s\n" "#define GNULIB_TEST_OPENAT 1" >>confdefs.h - gl_LIBOBJS="$gl_LIBOBJS localtime-buffer.$ac_objext" - gl_gnulib_enabled_2049e887c7e5308faad27b3f894bb8c9=true + + gl_gnulib_enabled_openat=true + if test $HAVE_OPENAT = 0; then + func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b + fi + if test $HAVE_OPENAT = 0; then + func_gl_gnulib_m4code_fchdir + fi + if test $REPLACE_OPENAT = 1; then + func_gl_gnulib_m4code_fstat + fi + if test $HAVE_OPENAT = 0; then + func_gl_gnulib_m4code_1840129d490f3a00c8a098316d0fa345 + fi + if test $HAVE_OPENAT = 0 || test $REPLACE_OPENAT = 1; then + func_gl_gnulib_m4code_03e0aaad4cb89ca757653bd367a6ccb7 + fi + if test $HAVE_OPENAT = 0; then + func_gl_gnulib_m4code_d4850532688ba16d685f036076611f21 + fi fi } - func_gl_gnulib_m4code_lstat () + func_gl_gnulib_m4code_1840129d490f3a00c8a098316d0fa345 () { - if ! $gl_gnulib_enabled_lstat; then + if ! $gl_gnulib_enabled_1840129d490f3a00c8a098316d0fa345; then + gl_gnulib_enabled_1840129d490f3a00c8a098316d0fa345=true + func_gl_gnulib_m4code_03e0aaad4cb89ca757653bd367a6ccb7 + fi + } + func_gl_gnulib_m4code_03e0aaad4cb89ca757653bd367a6ccb7 () + { + if ! $gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7; then + gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7=true + fi + } + func_gl_gnulib_m4code_opendir () + { + if ! $gl_gnulib_enabled_opendir; then + ac_fn_c_check_func "$LINENO" "opendir" "ac_cv_func_opendir" +if test "x$ac_cv_func_opendir" = xyes +then : + printf "%s\n" "#define HAVE_OPENDIR 1" >>confdefs.h - if test $ac_cv_func_lstat = yes; then +fi - case $host_os,$gl_cv_func_lstat_dereferences_slashed_symlink in - solaris* | *no) - REPLACE_LSTAT=1 - ;; - esac - else - HAVE_LSTAT=0 + if test $ac_cv_func_opendir = no; then + HAVE_OPENDIR=0 fi - if test $REPLACE_LSTAT = 1; then + if test $ac_cv_func_fchdir = no; then + HAVE_FCHDIR=0 + fi + + if test $HAVE_FCHDIR = 0; then + if test $HAVE_OPENDIR = 1; then + REPLACE_OPENDIR=1 + fi + fi + + case $host_os,$HAVE_OPENDIR in + os2*,1) + REPLACE_OPENDIR=1;; + esac + if test $HAVE_OPENDIR = 0 || test $REPLACE_OPENDIR = 1; then - gl_LIBOBJS="$gl_LIBOBJS lstat.$ac_objext" - : + + + + gl_LIBOBJS="$gl_LIBOBJS opendir.$ac_objext" + fi - GNULIB_LSTAT=1 + GL_GNULIB_OPENDIR=1 -$as_echo "#define GNULIB_TEST_LSTAT 1" >>confdefs.h - gl_gnulib_enabled_lstat=true - if test $REPLACE_LSTAT = 1; then - func_gl_gnulib_m4code_stat - fi - if test $REPLACE_LSTAT = 1; then - func_gl_gnulib_m4code_0137e3d3638b33e5819d132d0b23165c - fi - func_gl_gnulib_m4code_sys_stat - fi - } - func_gl_gnulib_m4code_malloca () - { - if ! $gl_gnulib_enabled_malloca; then +printf "%s\n" "#define GNULIB_TEST_OPENDIR 1" >>confdefs.h - gl_gnulib_enabled_malloca=true + + gl_gnulib_enabled_opendir=true + if test $HAVE_OPENDIR = 0 || test $REPLACE_OPENDIR = 1; then + func_gl_gnulib_m4code_closedir + fi + func_gl_gnulib_m4code_dirent + if test $HAVE_OPENDIR = 0 || test $REPLACE_OPENDIR = 1; then + func_gl_gnulib_m4code_dirfd + fi fi } func_gl_gnulib_m4code_332607f759618fb73dfc3076748afea7 () @@ -42470,60 +52999,130 @@ gl_LIBOBJS="$gl_LIBOBJS spawni.$ac_objext" - for ac_header in paths.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "paths.h" "ac_cv_header_paths_h" "$ac_includes_default" -if test "x$ac_cv_header_paths_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PATHS_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "paths.h" "ac_cv_header_paths_h" "$ac_includes_default" +if test "x$ac_cv_header_paths_h" = xyes +then : + printf "%s\n" "#define HAVE_PATHS_H 1" >>confdefs.h fi -done + ac_fn_c_check_func "$LINENO" "confstr" "ac_cv_func_confstr" +if test "x$ac_cv_func_confstr" = xyes +then : + printf "%s\n" "#define HAVE_CONFSTR 1" >>confdefs.h - for ac_func in confstr sched_setparam sched_setscheduler setegid seteuid vfork -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_func "$LINENO" "sched_setparam" "ac_cv_func_sched_setparam" +if test "x$ac_cv_func_sched_setparam" = xyes +then : + printf "%s\n" "#define HAVE_SCHED_SETPARAM 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sched_setscheduler" "ac_cv_func_sched_setscheduler" +if test "x$ac_cv_func_sched_setscheduler" = xyes +then : + printf "%s\n" "#define HAVE_SCHED_SETSCHEDULER 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "setegid" "ac_cv_func_setegid" +if test "x$ac_cv_func_setegid" = xyes +then : + printf "%s\n" "#define HAVE_SETEGID 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "seteuid" "ac_cv_func_seteuid" +if test "x$ac_cv_func_seteuid" = xyes +then : + printf "%s\n" "#define HAVE_SETEUID 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "vfork" "ac_cv_func_vfork" +if test "x$ac_cv_func_vfork" = xyes +then : + printf "%s\n" "#define HAVE_VFORK 1" >>confdefs.h fi -done fi gl_gnulib_enabled_332607f759618fb73dfc3076748afea7=true + if test $HAVE_POSIX_SPAWN = 0; then + func_gl_gnulib_m4code_malloca + fi func_gl_gnulib_m4code_cdeb0f2aaf9d280baa6526bfa1b07f70 func_gl_gnulib_m4code_strchrnul fi } - func_gl_gnulib_m4code_rawmemchr () + func_gl_gnulib_m4code_readdir () { - if ! $gl_gnulib_enabled_rawmemchr; then + if ! $gl_gnulib_enabled_readdir; then + ac_fn_c_check_func "$LINENO" "readdir" "ac_cv_func_readdir" +if test "x$ac_cv_func_readdir" = xyes +then : + printf "%s\n" "#define HAVE_READDIR 1" >>confdefs.h - for ac_func in rawmemchr -do : - ac_fn_c_check_func "$LINENO" "rawmemchr" "ac_cv_func_rawmemchr" -if test "x$ac_cv_func_rawmemchr" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_RAWMEMCHR 1 -_ACEOF +fi + + if test $ac_cv_func_readdir = no; then + HAVE_READDIR=0 + fi + + if test $HAVE_READDIR = 0; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS readdir.$ac_objext" + + fi + + + + + + + + + + GL_GNULIB_READDIR=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_READDIR 1" >>confdefs.h + + + + gl_gnulib_enabled_readdir=true + func_gl_gnulib_m4code_dirent + fi + } + func_gl_gnulib_m4code_rewinddir () + { + if ! $gl_gnulib_enabled_rewinddir; then + + + + ac_fn_c_check_func "$LINENO" "rewinddir" "ac_cv_func_rewinddir" +if test "x$ac_cv_func_rewinddir" = xyes +then : + printf "%s\n" "#define HAVE_REWINDDIR 1" >>confdefs.h fi -done - if test $ac_cv_func_rawmemchr = no; then - HAVE_RAWMEMCHR=0 + if test $ac_cv_func_rewinddir = no; then + HAVE_REWINDDIR=0 fi - if test $HAVE_RAWMEMCHR = 0; then + if test $HAVE_REWINDDIR = 0; then @@ -42532,26 +53131,30 @@ - gl_LIBOBJS="$gl_LIBOBJS rawmemchr.$ac_objext" + gl_LIBOBJS="$gl_LIBOBJS rewinddir.$ac_objext" - : fi - GNULIB_RAWMEMCHR=1 + GL_GNULIB_REWINDDIR=1 -$as_echo "#define GNULIB_TEST_RAWMEMCHR 1" >>confdefs.h - gl_gnulib_enabled_rawmemchr=true + +printf "%s\n" "#define GNULIB_TEST_REWINDDIR 1" >>confdefs.h + + + + gl_gnulib_enabled_rewinddir=true + func_gl_gnulib_m4code_dirent fi } func_gl_gnulib_m4code_rmdir () @@ -42560,14 +53163,16 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether rmdir works" >&5 -$as_echo_n "checking whether rmdir works... " >&6; } -if ${gl_cv_func_rmdir_works+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether rmdir works" >&5 +printf %s "checking whether rmdir works... " >&6; } +if test ${gl_cv_func_rmdir_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop mkdir conftest.dir touch conftest.file - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes +then : case "$host_os" in # Guess yes on Linux systems. linux-* | linux) gl_cv_func_rmdir_works="guessing yes" ;; @@ -42579,7 +53184,7 @@ *) gl_cv_func_rmdir_works="$gl_cross_guess_normal" ;; esac -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -42590,25 +53195,29 @@ # include #endif + +$gl_mda_defines + int -main () +main (void) { int result = 0; - if (!rmdir ("conftest.file/")) - result |= 1; - else if (errno != ENOTDIR) - result |= 2; - if (!rmdir ("conftest.dir/./")) - result |= 4; - return result; + if (!rmdir ("conftest.file/")) + result |= 1; + else if (errno != ENOTDIR) + result |= 2; + if (!rmdir ("conftest.dir/./")) + result |= 4; + return result; ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : gl_cv_func_rmdir_works=yes -else +else $as_nop gl_cv_func_rmdir_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -42617,8 +53226,8 @@ rm -rf conftest.dir conftest.file fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_rmdir_works" >&5 -$as_echo "$gl_cv_func_rmdir_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_rmdir_works" >&5 +printf "%s\n" "$gl_cv_func_rmdir_works" >&6; } case "$gl_cv_func_rmdir_works" in *yes) ;; *) @@ -42643,26 +53252,33 @@ - GNULIB_RMDIR=1 + GL_GNULIB_RMDIR=1 + -$as_echo "#define GNULIB_TEST_RMDIR 1" >>confdefs.h + + + +printf "%s\n" "#define GNULIB_TEST_RMDIR 1" >>confdefs.h gl_gnulib_enabled_rmdir=true - if test $REPLACE_RMDIR = 1; then - func_gl_gnulib_m4code_sys_stat - fi fi } - func_gl_gnulib_m4code_9bc5f216d57e231e4834049d67d0db62 () + func_gl_gnulib_m4code_d4850532688ba16d685f036076611f21 () { - if ! $gl_gnulib_enabled_9bc5f216d57e231e4834049d67d0db62; then - gl_gnulib_enabled_9bc5f216d57e231e4834049d67d0db62=true + if ! $gl_gnulib_enabled_d4850532688ba16d685f036076611f21; then + + + + gl_gnulib_enabled_d4850532688ba16d685f036076611f21=true + func_gl_gnulib_m4code_8198daae261b932d64a998f8586f5005 + func_gl_gnulib_m4code_fchdir + func_gl_gnulib_m4code_3d094ef542bfdd238a5194e172bfe5f6 fi } func_gl_gnulib_m4code_e7e881d32ca02f1c997b13c737c64bbd () @@ -42673,14 +53289,15 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setlocale (LC_ALL, NULL) is multithread-safe" >&5 -$as_echo_n "checking whether setlocale (LC_ALL, NULL) is multithread-safe... " >&6; } -if ${gl_cv_func_setlocale_null_all_mtsafe+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether setlocale (LC_ALL, NULL) is multithread-safe" >&5 +printf %s "checking whether setlocale (LC_ALL, NULL) is multithread-safe... " >&6; } +if test ${gl_cv_func_setlocale_null_all_mtsafe+y} +then : + printf %s "(cached) " >&6 +else $as_nop case "$host_os" in # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. - *-musl* | darwin* | freebsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) + *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) gl_cv_func_setlocale_null_all_mtsafe=no ;; # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) @@ -42691,8 +53308,8 @@ esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_all_mtsafe" >&5 -$as_echo "$gl_cv_func_setlocale_null_all_mtsafe" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_all_mtsafe" >&5 +printf "%s\n" "$gl_cv_func_setlocale_null_all_mtsafe" >&6; } case "$host_os" in mingw*) ;; *) @@ -42706,22 +53323,21 @@ *) SETLOCALE_NULL_ALL_MTSAFE=0 ;; esac -cat >>confdefs.h <<_ACEOF -#define SETLOCALE_NULL_ALL_MTSAFE $SETLOCALE_NULL_ALL_MTSAFE -_ACEOF +printf "%s\n" "#define SETLOCALE_NULL_ALL_MTSAFE $SETLOCALE_NULL_ALL_MTSAFE" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setlocale (category, NULL) is multithread-safe" >&5 -$as_echo_n "checking whether setlocale (category, NULL) is multithread-safe... " >&6; } -if ${gl_cv_func_setlocale_null_one_mtsafe+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether setlocale (category, NULL) is multithread-safe" >&5 +printf %s "checking whether setlocale (category, NULL) is multithread-safe... " >&6; } +if test ${gl_cv_func_setlocale_null_one_mtsafe+y} +then : + printf %s "(cached) " >&6 +else $as_nop case "$host_os" in # Guess no on OpenBSD, AIX. openbsd* | aix*) gl_cv_func_setlocale_null_one_mtsafe=no ;; # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. - *-gnu* | gnu* | *-musl* | darwin* | freebsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) + *-gnu* | gnu* | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) gl_cv_func_setlocale_null_one_mtsafe=yes ;; # If we don't know, obey --enable-cross-guesses. *) @@ -42729,8 +53345,8 @@ esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_one_mtsafe" >&5 -$as_echo "$gl_cv_func_setlocale_null_one_mtsafe" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_one_mtsafe" >&5 +printf "%s\n" "$gl_cv_func_setlocale_null_one_mtsafe" >&6; } case "$host_os" in mingw*) ;; *) @@ -42744,9 +53360,7 @@ *) SETLOCALE_NULL_ONE_MTSAFE=0 ;; esac -cat >>confdefs.h <<_ACEOF -#define SETLOCALE_NULL_ONE_MTSAFE $SETLOCALE_NULL_ONE_MTSAFE -_ACEOF +printf "%s\n" "#define SETLOCALE_NULL_ONE_MTSAFE $SETLOCALE_NULL_ONE_MTSAFE" >>confdefs.h if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then @@ -42754,48 +53368,58 @@ mingw*) LIB_SETLOCALE_NULL= ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 -$as_echo_n "checking whether imported symbols can be declared weak... " >&6; } -if ${gl_cv_have_weak+:} false; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_have_weak=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 +printf %s "checking whether imported symbols can be declared weak... " >&6; } +if test ${gl_cv_have_weak+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + cygwin*) + gl_cv_have_weak="guessing no" + ;; + *) + gl_cv_have_weak=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern void xyzzy (); #pragma weak xyzzy int -main () +main (void) { xyzzy(); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : gl_cv_have_weak=maybe fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - if test $gl_cv_have_weak = maybe; then - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $gl_cv_have_weak = maybe; then + if test "$cross_compiling" = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ELF__ - Extensible Linking Format - #endif + Extensible Linking Format + #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Extensible Linking Format" >/dev/null 2>&1; then : + $EGREP "Extensible Linking Format" >/dev/null 2>&1 +then : gl_cv_have_weak="guessing yes" -else +else $as_nop gl_cv_have_weak="guessing no" fi -rm -f conftest* +rm -rf conftest* -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -42806,27 +53430,51 @@ return (fputs == NULL); } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : gl_cv_have_weak=yes -else +else $as_nop gl_cv_have_weak=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi + fi + ;; + esac case " $LDFLAGS " in *" -static "*) gl_cv_have_weak=no ;; esac + case "$gl_cv_have_weak" in + *yes) + case "$host_os" in + freebsd* | dragonfly* | midnightbsd*) + : > conftest1.c + $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 + cat < conftest2.c +#include +#pragma weak pthread_mutexattr_gettype +int main () +{ + return (pthread_mutexattr_gettype != NULL); +} +EOF + $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ + || gl_cv_have_weak=no + rm -f conftest1.c libempty.so conftest2.c conftest + ;; + esac + ;; + esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 -$as_echo "$gl_cv_have_weak" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 +printf "%s\n" "$gl_cv_have_weak" >&6; } case "$gl_cv_have_weak" in *yes) -$as_echo "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h +printf "%s\n" "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h ;; esac @@ -42859,40 +53507,43 @@ CFLAG_VISIBILITY= HAVE_VISIBILITY=0 if test -n "$GCC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5 -$as_echo_n "checking whether the -Werror option is usable... " >&6; } -if ${gl_cv_cc_vis_werror+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5 +printf %s "checking whether the -Werror option is usable... " >&6; } +if test ${gl_cv_cc_vis_werror+y} +then : + printf %s "(cached) " >&6 +else $as_nop gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : gl_cv_cc_vis_werror=yes -else +else $as_nop gl_cv_cc_vis_werror=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$gl_save_CFLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5 -$as_echo "$gl_cv_cc_vis_werror" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5 -$as_echo_n "checking for simple visibility declarations... " >&6; } -if ${gl_cv_cc_visibility+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5 +printf "%s\n" "$gl_cv_cc_vis_werror" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5 +printf %s "checking for simple visibility declarations... " >&6; } +if test ${gl_cv_cc_visibility+y} +then : + printf %s "(cached) " >&6 +else $as_nop gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fvisibility=hidden" if test $gl_cv_cc_vis_werror = yes; then @@ -42904,27 +53555,33 @@ extern __attribute__((__visibility__("default"))) int exportedvar; extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); extern __attribute__((__visibility__("default"))) int exportedfunc (void); + void dummyfunc (void); + int hiddenvar; + int exportedvar; + int hiddenfunc (void) { return 51; } + int exportedfunc (void) { return 1225736919; } void dummyfunc (void) {} int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : gl_cv_cc_visibility=yes -else +else $as_nop gl_cv_cc_visibility=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$gl_save_CFLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5 -$as_echo "$gl_cv_cc_visibility" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5 +printf "%s\n" "$gl_cv_cc_visibility" >&6; } if test $gl_cv_cc_visibility = yes; then CFLAG_VISIBILITY="-fvisibility=hidden" HAVE_VISIBILITY=1 @@ -42933,9 +53590,7 @@ -cat >>confdefs.h <<_ACEOF -#define HAVE_VISIBILITY $HAVE_VISIBILITY -_ACEOF +printf "%s\n" "#define HAVE_VISIBILITY $HAVE_VISIBILITY" >>confdefs.h @@ -42945,13 +53600,17 @@ - GNULIB_SETLOCALE_NULL=1 + GL_GNULIB_SETLOCALE_NULL=1 -$as_echo "#define GNULIB_TEST_SETLOCALE_NULL 1" >>confdefs.h + + + + +printf "%s\n" "#define GNULIB_TEST_SETLOCALE_NULL 1" >>confdefs.h @@ -42968,142 +53627,6 @@ gl_gnulib_enabled_cdeb0f2aaf9d280baa6526bfa1b07f70=true fi } - func_gl_gnulib_m4code_stat () - { - if ! $gl_gnulib_enabled_stat; then - - - - - case "$host_os" in - mingw*) - REPLACE_STAT=1 - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat handles trailing slashes on files" >&5 -$as_echo_n "checking whether stat handles trailing slashes on files... " >&6; } -if ${gl_cv_func_stat_file_slash+:} false; then : - $as_echo_n "(cached) " >&6 -else - touch conftest.tmp - # Assume that if we have lstat, we can also check symlinks. - if test $ac_cv_func_lstat = yes; then - ln -s conftest.tmp conftest.lnk - fi - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on Linux systems. - linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_stat_file_slash="$gl_cross_guess_normal" ;; - esac - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -int result = 0; - struct stat st; - if (!stat ("conftest.tmp/", &st)) - result |= 1; -#if HAVE_LSTAT - if (!stat ("conftest.lnk/", &st)) - result |= 2; -#endif - return result; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_stat_file_slash=yes -else - gl_cv_func_stat_file_slash=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - rm -f conftest.tmp conftest.lnk -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_stat_file_slash" >&5 -$as_echo "$gl_cv_func_stat_file_slash" >&6; } - case $gl_cv_func_stat_file_slash in - *no) - REPLACE_STAT=1 - -$as_echo "#define REPLACE_FUNC_STAT_FILE 1" >>confdefs.h -;; - esac - case $host_os in - solaris*) - REPLACE_FSTAT=1 ;; - esac - ;; - esac - - if test $REPLACE_STAT = 1; then - - - - - - - - - gl_LIBOBJS="$gl_LIBOBJS stat.$ac_objext" - - case "$host_os" in - mingw*) - - - - - - - - - gl_LIBOBJS="$gl_LIBOBJS stat-w32.$ac_objext" - - ;; - esac - - - : - - fi - - - - - - GNULIB_STAT=1 - - - - - -$as_echo "#define GNULIB_TEST_STAT 1" >>confdefs.h - - - - gl_gnulib_enabled_stat=true - if test $REPLACE_STAT = 1; then - func_gl_gnulib_m4code_malloca - fi - if test $REPLACE_STAT = 1; then - func_gl_gnulib_m4code_0137e3d3638b33e5819d132d0b23165c - fi - func_gl_gnulib_m4code_sys_stat - fi - } func_gl_gnulib_m4code_0137e3d3638b33e5819d132d0b23165c () { if ! $gl_gnulib_enabled_0137e3d3638b33e5819d132d0b23165c; then @@ -43114,17 +53637,17 @@ ac_fn_c_check_member "$LINENO" "struct stat" "st_atim.tv_nsec" "ac_cv_member_struct_stat_st_atim_tv_nsec" "#include #include " -if test "x$ac_cv_member_struct_stat_st_atim_tv_nsec" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_atim_tv_nsec" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1" >>confdefs.h -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct stat.st_atim is of type struct timespec" >&5 -$as_echo_n "checking whether struct stat.st_atim is of type struct timespec... " >&6; } -if ${ac_cv_typeof_struct_stat_st_atim_is_struct_timespec+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether struct stat.st_atim is of type struct timespec" >&5 +printf %s "checking whether struct stat.st_atim is of type struct timespec... " >&6; } +if test ${ac_cv_typeof_struct_stat_st_atim_is_struct_timespec+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -43138,7 +53661,7 @@ struct stat st; int -main () +main (void) { st.st_atim = ts; @@ -43147,51 +53670,49 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes -else +else $as_nop ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec" >&5 -$as_echo "$ac_cv_typeof_struct_stat_st_atim_is_struct_timespec" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec" >&5 +printf "%s\n" "$ac_cv_typeof_struct_stat_st_atim_is_struct_timespec" >&6; } if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then -$as_echo "#define TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC 1" >>confdefs.h +printf "%s\n" "#define TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC 1" >>confdefs.h fi -else +else $as_nop ac_fn_c_check_member "$LINENO" "struct stat" "st_atimespec.tv_nsec" "ac_cv_member_struct_stat_st_atimespec_tv_nsec" "#include #include " -if test "x$ac_cv_member_struct_stat_st_atimespec_tv_nsec" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_atimespec_tv_nsec" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC 1" >>confdefs.h -else +else $as_nop ac_fn_c_check_member "$LINENO" "struct stat" "st_atimensec" "ac_cv_member_struct_stat_st_atimensec" "#include #include " -if test "x$ac_cv_member_struct_stat_st_atimensec" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_atimensec" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1" >>confdefs.h -else +else $as_nop ac_fn_c_check_member "$LINENO" "struct stat" "st_atim.st__tim.tv_nsec" "ac_cv_member_struct_stat_st_atim_st__tim_tv_nsec" "#include #include " -if test "x$ac_cv_member_struct_stat_st_atim_st__tim_tv_nsec" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_atim_st__tim_tv_nsec" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC 1" >>confdefs.h fi @@ -43209,33 +53730,30 @@ ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtimespec.tv_nsec" "ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" "#include #include " -if test "x$ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1" >>confdefs.h -else +else $as_nop ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtimensec" "ac_cv_member_struct_stat_st_birthtimensec" "#include #include " -if test "x$ac_cv_member_struct_stat_st_birthtimensec" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_birthtimensec" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC 1" >>confdefs.h -else +else $as_nop ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtim.tv_nsec" "ac_cv_member_struct_stat_st_birthtim_tv_nsec" "#include #include " -if test "x$ac_cv_member_struct_stat_st_birthtim_tv_nsec" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_birthtim_tv_nsec" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC 1" >>confdefs.h fi @@ -43255,26 +53773,24 @@ - for ac_func in strchrnul -do : ac_fn_c_check_func "$LINENO" "strchrnul" "ac_cv_func_strchrnul" -if test "x$ac_cv_func_strchrnul" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRCHRNUL 1 -_ACEOF +if test "x$ac_cv_func_strchrnul" = xyes +then : + printf "%s\n" "#define HAVE_STRCHRNUL 1" >>confdefs.h fi -done if test $ac_cv_func_strchrnul = no; then HAVE_STRCHRNUL=0 else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strchrnul works" >&5 -$as_echo_n "checking whether strchrnul works... " >&6; } -if ${gl_cv_func_strchrnul_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strchrnul works" >&5 +printf %s "checking whether strchrnul works... " >&6; } +if test ${gl_cv_func_strchrnul_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -43289,22 +53805,23 @@ _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Lucky user" >/dev/null 2>&1; then : + $EGREP "Lucky user" >/dev/null 2>&1 +then : gl_cv_func_strchrnul_works="guessing yes" -else +else $as_nop gl_cv_func_strchrnul_works="guessing no" fi -rm -f conftest* +rm -rf conftest* -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* for strchrnul */ int -main () +main (void) { const char *buf = "a"; return strchrnul (buf, 'b') != buf + 1; @@ -43313,9 +53830,10 @@ return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : gl_cv_func_strchrnul_works=yes -else +else $as_nop gl_cv_func_strchrnul_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -43324,8 +53842,8 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strchrnul_works" >&5 -$as_echo "$gl_cv_func_strchrnul_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strchrnul_works" >&5 +printf "%s\n" "$gl_cv_func_strchrnul_works" >&6; } case "$gl_cv_func_strchrnul_works" in *yes) ;; *) REPLACE_STRCHRNUL=1 ;; @@ -43350,20 +53868,21 @@ - GNULIB_STRCHRNUL=1 + + + + + GL_GNULIB_STRCHRNUL=1 -$as_echo "#define GNULIB_TEST_STRCHRNUL 1" >>confdefs.h +printf "%s\n" "#define GNULIB_TEST_STRCHRNUL 1" >>confdefs.h gl_gnulib_enabled_strchrnul=true - if test $HAVE_STRCHRNUL = 0 || test $REPLACE_STRCHRNUL = 1; then - func_gl_gnulib_m4code_rawmemchr - fi fi } func_gl_gnulib_m4code_dbb57f49352be8fb86869629a254fb72 () @@ -43387,18 +53906,13 @@ if test $ac_cv_header_sys_socket_h != yes; then - for ac_header in winsock2.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" -if test "x$ac_cv_header_winsock2_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_WINSOCK2_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" +if test "x$ac_cv_header_winsock2_h" = xyes +then : + printf "%s\n" "#define HAVE_WINSOCK2_H 1" >>confdefs.h fi -done - fi if test "$ac_cv_header_winsock2_h" = yes; then HAVE_WINSOCK2_H=1 @@ -43421,8 +53935,6 @@ - - if test $ac_cv_have_decl_strerror_r = no; then HAVE_DECL_STRERROR_R=0 fi @@ -43441,7 +53953,9 @@ fi fi - if test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1; then + if test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1 +then : + @@ -43457,27 +53971,31 @@ - fi +fi + - GNULIB_STRERROR_R=1 -$as_echo "#define GNULIB_TEST_STRERROR_R 1" >>confdefs.h + GL_GNULIB_STRERROR_R=1 -cat >>confdefs.h <<_ACEOF -#define GNULIB_STRERROR_R_POSIX 1 -_ACEOF +printf "%s\n" "#define GNULIB_TEST_STRERROR_R 1" >>confdefs.h + + + + + +printf "%s\n" "#define GNULIB_STRERROR_R_POSIX 1" >>confdefs.h gl_gnulib_enabled_1f32594a85e6221ba15f884daeee8c2a=true @@ -43486,6 +54004,18 @@ fi fi } + func_gl_gnulib_m4code_strings () + { + if ! $gl_gnulib_enabled_strings; then + + + + + + + gl_gnulib_enabled_strings=true + fi + } func_gl_gnulib_m4code_strnlen () { if ! $gl_gnulib_enabled_strnlen; then @@ -43499,23 +54029,25 @@ HAVE_DECL_STRNLEN=0 else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strnlen" >&5 -$as_echo_n "checking for working strnlen... " >&6; } -if ${ac_cv_func_strnlen_working+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working strnlen" >&5 +printf %s "checking for working strnlen... " >&6; } +if test ${ac_cv_func_strnlen_working+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : # Guess no on AIX systems, yes otherwise. case "$host_os" in aix*) ac_cv_func_strnlen_working=no;; *) ac_cv_func_strnlen_working=yes;; esac -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int -main () +main (void) { #define S "foobar" @@ -43537,9 +54069,10 @@ return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_strnlen_working=yes -else +else $as_nop ac_cv_func_strnlen_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -43547,8 +54080,8 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strnlen_working" >&5 -$as_echo "$ac_cv_func_strnlen_working" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strnlen_working" >&5 +printf "%s\n" "$ac_cv_func_strnlen_working" >&6; } test $ac_cv_func_strnlen_working = no && : @@ -43575,136 +54108,21 @@ - GNULIB_STRNLEN=1 - - - - - -$as_echo "#define GNULIB_TEST_STRNLEN 1" >>confdefs.h - - - - gl_gnulib_enabled_strnlen=true - fi - } - func_gl_gnulib_m4code_sys_stat () - { - if ! $gl_gnulib_enabled_sys_stat; then - - - - - - - - - - - - - - - if test $gl_cv_have_include_next = yes; then - gl_cv_next_sys_stat_h='<'sys/stat.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_sys_stat_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test $ac_cv_header_sys_stat_h = yes; then - - - - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'sys/stat.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - - gl_cv_absolute_sys_stat_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - - gl_header=$gl_cv_absolute_sys_stat_h - gl_cv_next_sys_stat_h='"'$gl_header'"' - else - gl_cv_next_sys_stat_h='<'sys/stat.h'>' - fi - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_stat_h" >&5 -$as_echo "$gl_cv_next_sys_stat_h" >&6; } - fi - NEXT_SYS_STAT_H=$gl_cv_next_sys_stat_h - - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'sys/stat.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_sys_stat_h - fi - NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H=$gl_next_as_first_directive - - - - - - - - - WINDOWS_STAT_TIMESPEC=0 - - - - - - ac_fn_c_check_type "$LINENO" "nlink_t" "ac_cv_type_nlink_t" "#include - #include -" -if test "x$ac_cv_type_nlink_t" = xyes; then : - -else -$as_echo "#define nlink_t int" >>confdefs.h + GL_GNULIB_STRNLEN=1 -fi +printf "%s\n" "#define GNULIB_TEST_STRNLEN 1" >>confdefs.h - gl_gnulib_enabled_sys_stat=true + gl_gnulib_enabled_strnlen=true fi } func_gl_gnulib_m4code_ed5616be3593d355b981ffab56b9f37b () @@ -43794,7 +54212,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_INFINITE_DOUBLE 1" >>confdefs.h ;; esac @@ -43809,7 +54227,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1" >>confdefs.h ;; esac @@ -43823,18 +54241,14 @@ ;; *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_A 1" >>confdefs.h - for ac_func in nl_langinfo -do : - ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" -if test "x$ac_cv_func_nl_langinfo" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_NL_LANGINFO 1 -_ACEOF + ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" +if test "x$ac_cv_func_nl_langinfo" = xyes +then : + printf "%s\n" "#define HAVE_NL_LANGINFO 1" >>confdefs.h fi -done ;; esac @@ -43846,7 +54260,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_F 1" >>confdefs.h ;; esac @@ -43858,7 +54272,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DIRECTIVE_LS 1" >>confdefs.h ;; esac @@ -43870,7 +54284,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_FLAG_GROUPING 1" >>confdefs.h ;; esac @@ -43882,7 +54296,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_FLAG_LEFTADJUST 1" >>confdefs.h ;; esac @@ -43894,7 +54308,7 @@ ;; *) -$as_echo "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_FLAG_ZERO 1" >>confdefs.h ;; esac @@ -43906,13 +54320,13 @@ ;; *) -$as_echo "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_UNBOUNDED_PRECISION 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h ;; esac @@ -43924,13 +54338,13 @@ ;; *) -$as_echo "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_ENOMEM 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_DOUBLE 1" >>confdefs.h -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h +printf "%s\n" "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h ;; esac @@ -43979,7 +54393,7 @@ if test $ac_cv_func_vasnprintf = yes; then -$as_echo "#define REPLACE_VASNPRINTF 1" >>confdefs.h +printf "%s\n" "#define REPLACE_VASNPRINTF 1" >>confdefs.h fi @@ -43992,11 +54406,12 @@ ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" -if test "x$ac_cv_type_ptrdiff_t" = xyes; then : +if test "x$ac_cv_type_ptrdiff_t" = xyes +then : -else +else $as_nop -$as_echo "#define ptrdiff_t long" >>confdefs.h +printf "%s\n" "#define ptrdiff_t long" >>confdefs.h fi @@ -44021,7 +54436,7 @@ REPLACE_VFPRINTF=1 -$as_echo "#define REPLACE_VFPRINTF_POSIX 1" >>confdefs.h +printf "%s\n" "#define REPLACE_VFPRINTF_POSIX 1" >>confdefs.h : @@ -44032,14 +54447,23 @@ - GNULIB_VFPRINTF_POSIX=1 + GL_GNULIB_VFPRINTF_POSIX=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_VFPRINTF_POSIX 1" >>confdefs.h + + + -$as_echo "#define GNULIB_TEST_VFPRINTF_POSIX 1" >>confdefs.h +printf "%s\n" "#define GNULIB_VFPRINTF_POSIX 1" >>confdefs.h gl_gnulib_enabled_ed5616be3593d355b981ffab56b9f37b=true @@ -44154,29 +54578,47 @@ func_gl_gnulib_m4code_68a4501daeca58988392c7e60b4917ab fi } - if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then - func_gl_gnulib_m4code_lstat - fi - if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then - func_gl_gnulib_m4code_malloca - fi - if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then - func_gl_gnulib_m4code_sys_stat - fi if test $REPLACE_CLOSE = 1; then func_gl_gnulib_m4code_43fe87a341d9b4b93c47c3ad819a5239 fi if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then func_gl_gnulib_m4code_getdtablesize fi + if test $HAVE_FFSL = 0; then + func_gl_gnulib_m4code_ffs + fi if test $REPLACE_FOPEN = 1; then func_gl_gnulib_m4code_fstat fi if test $REPLACE_FPRINTF = 1; then func_gl_gnulib_m4code_fseterr fi - if test $NEED_LOCALTIME_BUFFER = 1; then - func_gl_gnulib_m4code_2049e887c7e5308faad27b3f894bb8c9 + if test $REPLACE_GETCWD = 1; then + func_gl_gnulib_m4code_closedir + fi + if test $REPLACE_GETCWD = 1; then + func_gl_gnulib_m4code_75c65a2c014cf8235dd95289676302a4 + fi + if test $REPLACE_GETCWD = 1; then + func_gl_gnulib_m4code_fdopendir + fi + if test $REPLACE_GETCWD = 1; then + func_gl_gnulib_m4code_fstat + fi + if test $REPLACE_GETCWD = 1; then + func_gl_gnulib_m4code_fstatat + fi + if test $REPLACE_GETCWD = 1; then + func_gl_gnulib_m4code_openat + fi + if test $REPLACE_GETCWD = 1; then + func_gl_gnulib_m4code_opendir + fi + if test $REPLACE_GETCWD = 1; then + func_gl_gnulib_m4code_readdir + fi + if test $REPLACE_GETCWD = 1; then + func_gl_gnulib_m4code_rewinddir fi if { test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then func_gl_gnulib_m4code_ldexp @@ -44199,15 +54641,15 @@ if test $REPLACE_OPEN = 1; then func_gl_gnulib_m4code_fstat fi - if test $REPLACE_OPEN = 1; then - func_gl_gnulib_m4code_stat - fi if test $REPLACE_PERROR = 1; then func_gl_gnulib_m4code_dbb57f49352be8fb86869629a254fb72 fi if test $REPLACE_PERROR = 1; then func_gl_gnulib_m4code_1f32594a85e6221ba15f884daeee8c2a fi + if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then + func_gl_gnulib_m4code_332607f759618fb73dfc3076748afea7 + fi if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1 || test $REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE = 1; then func_gl_gnulib_m4code_getdtablesize fi @@ -44223,8 +54665,8 @@ if test $REPLACE_PRINTF = 1; then func_gl_gnulib_m4code_ed5616be3593d355b981ffab56b9f37b fi - if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then - func_gl_gnulib_m4code_stat + if test "$gl_cv_lib_readline" = no; then + func_gl_gnulib_m4code_getline fi if test $REPLACE_RENAME = 1; then func_gl_gnulib_m4code_chdir @@ -44235,21 +54677,21 @@ if test $REPLACE_RENAME = 1; then func_gl_gnulib_m4code_rmdir fi - if test $REPLACE_RENAME = 1; then - func_gl_gnulib_m4code_9bc5f216d57e231e4834049d67d0db62 - fi if test $REPLACE_SIGNBIT = 1; then func_gl_gnulib_m4code_3f0e593033d1fc2c127581960f641b66 fi + if test $REPLACE_STAT = 1; then + func_gl_gnulib_m4code_malloca + fi + if test $REPLACE_STAT = 1; then + func_gl_gnulib_m4code_0137e3d3638b33e5819d132d0b23165c + fi if test $REPLACE_STRERROR = 1; then func_gl_gnulib_m4code_dbb57f49352be8fb86869629a254fb72 fi if test $HAVE_STRNDUP = 0 || test $REPLACE_STRNDUP = 1; then func_gl_gnulib_m4code_strnlen fi - if test $HAVE_STRVERSCMP = 0; then - func_gl_gnulib_m4code_21ee726a3540c09237a8e70c0baf7467 - fi if test $gl_threads_api = windows; then func_gl_gnulib_m4code_48b2271240803e4879464b755748a89d fi @@ -44257,6 +54699,14 @@ func_gl_gnulib_m4code_lstat fi + if $gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b; then + gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b_TRUE= + gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b_FALSE='#' +else + gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b_TRUE='#' + gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b_FALSE= +fi + if $gl_gnulib_enabled_chdir; then gl_GNULIB_ENABLED_chdir_TRUE= gl_GNULIB_ENABLED_chdir_FALSE='#' @@ -44265,6 +54715,62 @@ gl_GNULIB_ENABLED_chdir_FALSE= fi + if $gl_gnulib_enabled_8198daae261b932d64a998f8586f5005; then + gl_GNULIB_ENABLED_8198daae261b932d64a998f8586f5005_TRUE= + gl_GNULIB_ENABLED_8198daae261b932d64a998f8586f5005_FALSE='#' +else + gl_GNULIB_ENABLED_8198daae261b932d64a998f8586f5005_TRUE='#' + gl_GNULIB_ENABLED_8198daae261b932d64a998f8586f5005_FALSE= +fi + + if $gl_gnulib_enabled_closedir; then + gl_GNULIB_ENABLED_closedir_TRUE= + gl_GNULIB_ENABLED_closedir_FALSE='#' +else + gl_GNULIB_ENABLED_closedir_TRUE='#' + gl_GNULIB_ENABLED_closedir_FALSE= +fi + + if $gl_gnulib_enabled_75c65a2c014cf8235dd95289676302a4; then + gl_GNULIB_ENABLED_75c65a2c014cf8235dd95289676302a4_TRUE= + gl_GNULIB_ENABLED_75c65a2c014cf8235dd95289676302a4_FALSE='#' +else + gl_GNULIB_ENABLED_75c65a2c014cf8235dd95289676302a4_TRUE='#' + gl_GNULIB_ENABLED_75c65a2c014cf8235dd95289676302a4_FALSE= +fi + + if $gl_gnulib_enabled_dirent; then + gl_GNULIB_ENABLED_dirent_TRUE= + gl_GNULIB_ENABLED_dirent_FALSE='#' +else + gl_GNULIB_ENABLED_dirent_TRUE='#' + gl_GNULIB_ENABLED_dirent_FALSE= +fi + + if $gl_gnulib_enabled_dirfd; then + gl_GNULIB_ENABLED_dirfd_TRUE= + gl_GNULIB_ENABLED_dirfd_FALSE='#' +else + gl_GNULIB_ENABLED_dirfd_TRUE='#' + gl_GNULIB_ENABLED_dirfd_FALSE= +fi + + if $gl_gnulib_enabled_dup; then + gl_GNULIB_ENABLED_dup_TRUE= + gl_GNULIB_ENABLED_dup_FALSE='#' +else + gl_GNULIB_ENABLED_dup_TRUE='#' + gl_GNULIB_ENABLED_dup_FALSE= +fi + + if $gl_gnulib_enabled_fchdir; then + gl_GNULIB_ENABLED_fchdir_TRUE= + gl_GNULIB_ENABLED_fchdir_FALSE='#' +else + gl_GNULIB_ENABLED_fchdir_TRUE='#' + gl_GNULIB_ENABLED_fchdir_FALSE= +fi + if $gl_gnulib_enabled_43fe87a341d9b4b93c47c3ad819a5239; then gl_GNULIB_ENABLED_43fe87a341d9b4b93c47c3ad819a5239_TRUE= gl_GNULIB_ENABLED_43fe87a341d9b4b93c47c3ad819a5239_FALSE='#' @@ -44273,6 +54779,30 @@ gl_GNULIB_ENABLED_43fe87a341d9b4b93c47c3ad819a5239_FALSE= fi + if $gl_gnulib_enabled_fdopendir; then + gl_GNULIB_ENABLED_fdopendir_TRUE= + gl_GNULIB_ENABLED_fdopendir_FALSE='#' +else + gl_GNULIB_ENABLED_fdopendir_TRUE='#' + gl_GNULIB_ENABLED_fdopendir_FALSE= +fi + + if $gl_gnulib_enabled_ffs; then + gl_GNULIB_ENABLED_ffs_TRUE= + gl_GNULIB_ENABLED_ffs_FALSE='#' +else + gl_GNULIB_ENABLED_ffs_TRUE='#' + gl_GNULIB_ENABLED_ffs_FALSE= +fi + + if $gl_gnulib_enabled_fca9852db2a43bb33f02f0fbdbc174f6; then + gl_GNULIB_ENABLED_fca9852db2a43bb33f02f0fbdbc174f6_TRUE= + gl_GNULIB_ENABLED_fca9852db2a43bb33f02f0fbdbc174f6_FALSE='#' +else + gl_GNULIB_ENABLED_fca9852db2a43bb33f02f0fbdbc174f6_TRUE='#' + gl_GNULIB_ENABLED_fca9852db2a43bb33f02f0fbdbc174f6_FALSE= +fi + if $gl_gnulib_enabled_fseterr; then gl_GNULIB_ENABLED_fseterr_TRUE= gl_GNULIB_ENABLED_fseterr_FALSE='#' @@ -44289,6 +54819,30 @@ gl_GNULIB_ENABLED_fstat_FALSE= fi + if $gl_gnulib_enabled_fstatat; then + gl_GNULIB_ENABLED_fstatat_TRUE= + gl_GNULIB_ENABLED_fstatat_FALSE='#' +else + gl_GNULIB_ENABLED_fstatat_TRUE='#' + gl_GNULIB_ENABLED_fstatat_FALSE= +fi + + if $gl_gnulib_enabled_3d094ef542bfdd238a5194e172bfe5f6; then + gl_GNULIB_ENABLED_3d094ef542bfdd238a5194e172bfe5f6_TRUE= + gl_GNULIB_ENABLED_3d094ef542bfdd238a5194e172bfe5f6_FALSE='#' +else + gl_GNULIB_ENABLED_3d094ef542bfdd238a5194e172bfe5f6_TRUE='#' + gl_GNULIB_ENABLED_3d094ef542bfdd238a5194e172bfe5f6_FALSE= +fi + + if $gl_gnulib_enabled_getdelim; then + gl_GNULIB_ENABLED_getdelim_TRUE= + gl_GNULIB_ENABLED_getdelim_FALSE='#' +else + gl_GNULIB_ENABLED_getdelim_TRUE='#' + gl_GNULIB_ENABLED_getdelim_FALSE= +fi + if $gl_gnulib_enabled_getdtablesize; then gl_GNULIB_ENABLED_getdtablesize_TRUE= gl_GNULIB_ENABLED_getdtablesize_FALSE='#' @@ -44297,6 +54851,14 @@ gl_GNULIB_ENABLED_getdtablesize_FALSE= fi + if $gl_gnulib_enabled_getline; then + gl_GNULIB_ENABLED_getline_TRUE= + gl_GNULIB_ENABLED_getline_FALSE='#' +else + gl_GNULIB_ENABLED_getline_TRUE='#' + gl_GNULIB_ENABLED_getline_FALSE= +fi + if $gl_gnulib_enabled_30838f5439487421042f2225bed3af76; then gl_GNULIB_ENABLED_30838f5439487421042f2225bed3af76_TRUE= gl_GNULIB_ENABLED_30838f5439487421042f2225bed3af76_FALSE='#' @@ -44321,14 +54883,6 @@ gl_GNULIB_ENABLED_ldexp_FALSE= fi - if $gl_gnulib_enabled_21ee726a3540c09237a8e70c0baf7467; then - gl_GNULIB_ENABLED_21ee726a3540c09237a8e70c0baf7467_TRUE= - gl_GNULIB_ENABLED_21ee726a3540c09237a8e70c0baf7467_FALSE='#' -else - gl_GNULIB_ENABLED_21ee726a3540c09237a8e70c0baf7467_TRUE='#' - gl_GNULIB_ENABLED_21ee726a3540c09237a8e70c0baf7467_FALSE= -fi - if $gl_gnulib_enabled_locale; then gl_GNULIB_ENABLED_locale_TRUE= gl_GNULIB_ENABLED_locale_FALSE='#' @@ -44337,14 +54891,6 @@ gl_GNULIB_ENABLED_locale_FALSE= fi - if $gl_gnulib_enabled_2049e887c7e5308faad27b3f894bb8c9; then - gl_GNULIB_ENABLED_2049e887c7e5308faad27b3f894bb8c9_TRUE= - gl_GNULIB_ENABLED_2049e887c7e5308faad27b3f894bb8c9_FALSE='#' -else - gl_GNULIB_ENABLED_2049e887c7e5308faad27b3f894bb8c9_TRUE='#' - gl_GNULIB_ENABLED_2049e887c7e5308faad27b3f894bb8c9_FALSE= -fi - if $gl_gnulib_enabled_lstat; then gl_GNULIB_ENABLED_lstat_TRUE= gl_GNULIB_ENABLED_lstat_FALSE='#' @@ -44361,6 +54907,46 @@ gl_GNULIB_ENABLED_malloca_FALSE= fi + if $gl_gnulib_enabled_memrchr; then + gl_GNULIB_ENABLED_memrchr_TRUE= + gl_GNULIB_ENABLED_memrchr_FALSE='#' +else + gl_GNULIB_ENABLED_memrchr_TRUE='#' + gl_GNULIB_ENABLED_memrchr_FALSE= +fi + + if $gl_gnulib_enabled_openat; then + gl_GNULIB_ENABLED_openat_TRUE= + gl_GNULIB_ENABLED_openat_FALSE='#' +else + gl_GNULIB_ENABLED_openat_TRUE='#' + gl_GNULIB_ENABLED_openat_FALSE= +fi + + if $gl_gnulib_enabled_1840129d490f3a00c8a098316d0fa345; then + gl_GNULIB_ENABLED_1840129d490f3a00c8a098316d0fa345_TRUE= + gl_GNULIB_ENABLED_1840129d490f3a00c8a098316d0fa345_FALSE='#' +else + gl_GNULIB_ENABLED_1840129d490f3a00c8a098316d0fa345_TRUE='#' + gl_GNULIB_ENABLED_1840129d490f3a00c8a098316d0fa345_FALSE= +fi + + if $gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7; then + gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7_TRUE= + gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7_FALSE='#' +else + gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7_TRUE='#' + gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7_FALSE= +fi + + if $gl_gnulib_enabled_opendir; then + gl_GNULIB_ENABLED_opendir_TRUE= + gl_GNULIB_ENABLED_opendir_FALSE='#' +else + gl_GNULIB_ENABLED_opendir_TRUE='#' + gl_GNULIB_ENABLED_opendir_FALSE= +fi + if $gl_gnulib_enabled_332607f759618fb73dfc3076748afea7; then gl_GNULIB_ENABLED_332607f759618fb73dfc3076748afea7_TRUE= gl_GNULIB_ENABLED_332607f759618fb73dfc3076748afea7_FALSE='#' @@ -44369,12 +54955,20 @@ gl_GNULIB_ENABLED_332607f759618fb73dfc3076748afea7_FALSE= fi - if $gl_gnulib_enabled_rawmemchr; then - gl_GNULIB_ENABLED_rawmemchr_TRUE= - gl_GNULIB_ENABLED_rawmemchr_FALSE='#' + if $gl_gnulib_enabled_readdir; then + gl_GNULIB_ENABLED_readdir_TRUE= + gl_GNULIB_ENABLED_readdir_FALSE='#' +else + gl_GNULIB_ENABLED_readdir_TRUE='#' + gl_GNULIB_ENABLED_readdir_FALSE= +fi + + if $gl_gnulib_enabled_rewinddir; then + gl_GNULIB_ENABLED_rewinddir_TRUE= + gl_GNULIB_ENABLED_rewinddir_FALSE='#' else - gl_GNULIB_ENABLED_rawmemchr_TRUE='#' - gl_GNULIB_ENABLED_rawmemchr_FALSE= + gl_GNULIB_ENABLED_rewinddir_TRUE='#' + gl_GNULIB_ENABLED_rewinddir_FALSE= fi if $gl_gnulib_enabled_rmdir; then @@ -44385,12 +54979,12 @@ gl_GNULIB_ENABLED_rmdir_FALSE= fi - if $gl_gnulib_enabled_9bc5f216d57e231e4834049d67d0db62; then - gl_GNULIB_ENABLED_9bc5f216d57e231e4834049d67d0db62_TRUE= - gl_GNULIB_ENABLED_9bc5f216d57e231e4834049d67d0db62_FALSE='#' + if $gl_gnulib_enabled_d4850532688ba16d685f036076611f21; then + gl_GNULIB_ENABLED_d4850532688ba16d685f036076611f21_TRUE= + gl_GNULIB_ENABLED_d4850532688ba16d685f036076611f21_FALSE='#' else - gl_GNULIB_ENABLED_9bc5f216d57e231e4834049d67d0db62_TRUE='#' - gl_GNULIB_ENABLED_9bc5f216d57e231e4834049d67d0db62_FALSE= + gl_GNULIB_ENABLED_d4850532688ba16d685f036076611f21_TRUE='#' + gl_GNULIB_ENABLED_d4850532688ba16d685f036076611f21_FALSE= fi if $gl_gnulib_enabled_e7e881d32ca02f1c997b13c737c64bbd; then @@ -44409,14 +55003,6 @@ gl_GNULIB_ENABLED_cdeb0f2aaf9d280baa6526bfa1b07f70_FALSE= fi - if $gl_gnulib_enabled_stat; then - gl_GNULIB_ENABLED_stat_TRUE= - gl_GNULIB_ENABLED_stat_FALSE='#' -else - gl_GNULIB_ENABLED_stat_TRUE='#' - gl_GNULIB_ENABLED_stat_FALSE= -fi - if $gl_gnulib_enabled_0137e3d3638b33e5819d132d0b23165c; then gl_GNULIB_ENABLED_0137e3d3638b33e5819d132d0b23165c_TRUE= gl_GNULIB_ENABLED_0137e3d3638b33e5819d132d0b23165c_FALSE='#' @@ -44449,6 +55035,14 @@ gl_GNULIB_ENABLED_1f32594a85e6221ba15f884daeee8c2a_FALSE= fi + if $gl_gnulib_enabled_strings; then + gl_GNULIB_ENABLED_strings_TRUE= + gl_GNULIB_ENABLED_strings_FALSE='#' +else + gl_GNULIB_ENABLED_strings_TRUE='#' + gl_GNULIB_ENABLED_strings_FALSE= +fi + if $gl_gnulib_enabled_strnlen; then gl_GNULIB_ENABLED_strnlen_TRUE= gl_GNULIB_ENABLED_strnlen_FALSE='#' @@ -44457,14 +55051,6 @@ gl_GNULIB_ENABLED_strnlen_FALSE= fi - if $gl_gnulib_enabled_sys_stat; then - gl_GNULIB_ENABLED_sys_stat_TRUE= - gl_GNULIB_ENABLED_sys_stat_FALSE='#' -else - gl_GNULIB_ENABLED_sys_stat_TRUE='#' - gl_GNULIB_ENABLED_sys_stat_FALSE= -fi - if $gl_gnulib_enabled_ed5616be3593d355b981ffab56b9f37b; then gl_GNULIB_ENABLED_ed5616be3593d355b981ffab56b9f37b_TRUE= gl_GNULIB_ENABLED_ed5616be3593d355b981ffab56b9f37b_FALSE='#' @@ -44523,6 +55109,8 @@ + + gltests_libdeps= gltests_ltlibdeps= @@ -44534,6 +55122,9 @@ + + + gl_source_base='tests' gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS @@ -44548,6 +55139,8 @@ + + LIBBISON_LIBDEPS="$gl_libdeps" LIBBISON_LTLIBDEPS="$gl_ltlibdeps" @@ -44558,22 +55151,22 @@ - # Gettext. # We use gnulib, which is only guaranteed to work properly with the # latest Gettext. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 -$as_echo_n "checking whether NLS is requested... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 +printf %s "checking whether NLS is requested... " >&6; } # Check whether --enable-nls was given. -if test "${enable_nls+set}" = set; then : +if test ${enable_nls+y} +then : enableval=$enable_nls; USE_NLS=$enableval -else +else $as_nop USE_NLS=yes fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 -$as_echo "$USE_NLS" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +printf "%s\n" "$USE_NLS" >&6; } @@ -44612,11 +55205,12 @@ # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_MSGFMT+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_MSGFMT+y} +then : + printf %s "(cached) " >&6 +else $as_nop case "$MSGFMT" in [\\/]* | ?:[\\/]*) ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. @@ -44644,20 +55238,21 @@ fi MSGFMT="$ac_cv_path_MSGFMT" if test "$MSGFMT" != ":"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 -$as_echo "$MSGFMT" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 +printf "%s\n" "$MSGFMT" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_GMSGFMT+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_GMSGFMT+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $GMSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. @@ -44667,11 +55262,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -44684,11 +55283,11 @@ fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 -$as_echo "$GMSGFMT" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 +printf "%s\n" "$GMSGFMT" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -44701,652 +55300,164 @@ case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; *) GMSGFMT_015=$GMSGFMT ;; - esac - - - -# Prepare PATH_SEPARATOR. -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which - # contains only /bin. Note that ksh looks also at the FPATH variable, - # so we have to set that as well for the test. - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - || PATH_SEPARATOR=';' - } -fi - -# Find out how to test for executable files. Don't use a zero-byte file, -# as systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - ac_executable_p="test -x" -else - ac_executable_p="test -f" -fi -rm -f conf$$.file - -# Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_XGETTEXT+:} false; then : - $as_echo_n "(cached) " >&6 -else - case "$XGETTEXT" in - [\\/]* | ?:[\\/]*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$ac_save_IFS" - test -z "$ac_dir" && ac_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - echo "$as_me: trying $ac_dir/$ac_word..." >&5 - if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && - (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" - break 2 - fi - fi - done - done - IFS="$ac_save_IFS" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test "$XGETTEXT" != ":"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 -$as_echo "$XGETTEXT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - rm -f messages.po - - case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in - '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; - *) XGETTEXT_015=$XGETTEXT ;; - esac - - - -# Prepare PATH_SEPARATOR. -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which - # contains only /bin. Note that ksh looks also at the FPATH variable, - # so we have to set that as well for the test. - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - || PATH_SEPARATOR=';' - } -fi - -# Find out how to test for executable files. Don't use a zero-byte file, -# as systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - ac_executable_p="test -x" -else - ac_executable_p="test -f" -fi -rm -f conf$$.file - -# Extract the first word of "msgmerge", so it can be a program name with args. -set dummy msgmerge; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_MSGMERGE+:} false; then : - $as_echo_n "(cached) " >&6 -else - case "$MSGMERGE" in - [\\/]* | ?:[\\/]*) - ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. - ;; - *) - ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$ac_save_IFS" - test -z "$ac_dir" && ac_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - echo "$as_me: trying $ac_dir/$ac_word..." >&5 - if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then - ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" - break 2 - fi - fi - done - done - IFS="$ac_save_IFS" - test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" - ;; -esac -fi -MSGMERGE="$ac_cv_path_MSGMERGE" -if test "$MSGMERGE" != ":"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5 -$as_echo "$MSGMERGE" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$localedir" || localedir='${datadir}/locale' - - - test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= - - - ac_config_commands="$ac_config_commands po-directories" - - - - - - - - - - - - - use_additional=yes - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" - eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - -# Check whether --with-libiconv-prefix was given. -if test "${with_libiconv_prefix+set}" = set; then : - withval=$with_libiconv_prefix; - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" - eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - additional_libdir2="$withval/$acl_libdirstem2" - additional_libdir3="$withval/$acl_libdirstem3" - fi - fi - -fi - - if test "X$additional_libdir2" = "X$additional_libdir"; then - additional_libdir2= - fi - if test "X$additional_libdir3" = "X$additional_libdir"; then - additional_libdir3= - fi - LIBICONV= - LTLIBICONV= - INCICONV= - LIBICONV_PREFIX= - HAVE_LIBICONV= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='iconv ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - eval libname=\"$acl_libname_spec\" # typically: libname=lib$name - if test -n "$acl_shlibext"; then - shrext=".$acl_shlibext" # typically: shrext=.so - else - shrext= - fi - if test $use_additional = yes; then - for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do - if test "X$found_dir" = "X"; then - eval dir=\$$additional_libdir_variable - if test -n "$dir"; then - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - fi - done - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "$enable_rpath" = no \ - || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$acl_hardcode_direct" = yes; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBICONV; do + esac - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" - fi - if test "$acl_hardcode_minus_L" != no; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */$acl_libdirstem | */$acl_libdirstem/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = 'iconv'; then - LIBICONV_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem2 | */$acl_libdirstem2/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = 'iconv'; then - LIBICONV_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem3 | */$acl_libdirstem3/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` - if test "$name" = 'iconv'; then - LIBICONV_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCICONV; do - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ - && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then - haveit= - if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ - || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBICONV; do +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +# Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_XGETTEXT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$XGETTEXT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 +printf "%s\n" "$XGETTEXT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi - if test "X$x" = "X-L$dependency_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$dependency_libdir"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$dependency_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBICONV; do + rm -f messages.po - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac - if test "X$x" = "X-L$dependency_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$dependency_libdir"; then - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$dependency_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" - ;; - esac - done - fi - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_MSGMERGE+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$MSGMERGE" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" + break 2 fi fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$acl_hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" - else - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" done - fi - fi - if test "X$ltrpathdirs" != "X"; then - for found_dir in $ltrpathdirs; do - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" done - fi + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" + ;; +esac +fi +MSGMERGE="$ac_cv_path_MSGMERGE" +if test "$MSGMERGE" != ":"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5 +printf "%s\n" "$MSGMERGE" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + test -n "$localedir" || localedir='${datadir}/locale' + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + ac_config_commands="$ac_config_commands po-directories" @@ -45371,72 +55482,78 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 -$as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; } -if ${gt_cv_func_CFPreferencesCopyAppValue+:} false; then : - $as_echo_n "(cached) " >&6 -else + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 +printf %s "checking for CFPreferencesCopyAppValue... " >&6; } +if test ${gt_cv_func_CFPreferencesCopyAppValue+y} +then : + printf %s "(cached) " >&6 +else $as_nop gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { CFPreferencesCopyAppValue(NULL, NULL) ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : gt_cv_func_CFPreferencesCopyAppValue=yes -else +else $as_nop gt_cv_func_CFPreferencesCopyAppValue=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 -$as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 +printf "%s\n" "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then -$as_echo "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h +printf "%s\n" "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyCurrent" >&5 -$as_echo_n "checking for CFLocaleCopyCurrent... " >&6; } -if ${gt_cv_func_CFLocaleCopyCurrent+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyCurrent" >&5 +printf %s "checking for CFLocaleCopyCurrent... " >&6; } +if test ${gt_cv_func_CFLocaleCopyCurrent+y} +then : + printf %s "(cached) " >&6 +else $as_nop gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { CFLocaleCopyCurrent(); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : gt_cv_func_CFLocaleCopyCurrent=yes -else +else $as_nop gt_cv_func_CFLocaleCopyCurrent=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 -$as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 +printf "%s\n" "$gt_cv_func_CFLocaleCopyCurrent" >&6; } if test $gt_cv_func_CFLocaleCopyCurrent = yes; then -$as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h +printf "%s\n" "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h fi INTL_MACOSX_LIBS= @@ -45481,11 +55598,12 @@ gt_expression_test_code= fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5 -$as_echo_n "checking for GNU gettext in libc... " >&6; } -if eval \${$gt_func_gnugettext_libc+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5 +printf %s "checking for GNU gettext in libc... " >&6; } +if eval test \${$gt_func_gnugettext_libc+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -45495,7 +55613,7 @@ extern int *_nl_domain_bindings; int -main () +main (void) { bindtextdomain ("", ""); @@ -45505,17 +55623,18 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : eval "$gt_func_gnugettext_libc=yes" -else +else $as_nop eval "$gt_func_gnugettext_libc=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$gt_func_gnugettext_libc - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then @@ -45548,11 +55667,12 @@ done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 -$as_echo_n "checking for iconv... " >&6; } -if ${am_cv_func_iconv+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 +printf %s "checking for iconv... " >&6; } +if test ${am_cv_func_iconv+y} +then : + printf %s "(cached) " >&6 +else $as_nop am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no @@ -45563,7 +55683,7 @@ #include int -main () +main (void) { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); @@ -45572,10 +55692,11 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : am_cv_func_iconv=yes fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" @@ -45587,7 +55708,7 @@ #include int -main () +main (void) { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); @@ -45596,59 +55717,69 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : am_cv_lib_iconv=yes am_cv_func_iconv=yes fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 -$as_echo "$am_cv_func_iconv" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 +printf "%s\n" "$am_cv_func_iconv" >&6; } if test "$am_cv_func_iconv" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 -$as_echo_n "checking for working iconv... " >&6; } -if ${am_cv_func_iconv_works+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 +printf %s "checking for working iconv... " >&6; } +if test ${am_cv_func_iconv_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi - if test "$cross_compiling" = yes; then : - - case "$host_os" in - aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; - *) am_cv_func_iconv_works="guessing yes" ;; - esac - -else + am_cv_func_iconv_works=no + for ac_iconv_const in '' 'const'; do + if test "$cross_compiling" = yes +then : + case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -int main () + +#ifndef ICONV_CONST +# define ICONV_CONST $ac_iconv_const +#endif + +int +main (void) { - int result = 0; - /* Test against AIX 5.1 bug: Failures are not distinguishable from successful - returns. */ +int result = 0; + /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from + successful returns. This is even documented in + */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { - static const char input[] = "\342\202\254"; /* EURO SIGN */ + static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; - const char *inptr = input; + ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, - (char **) &inptr, &inbytesleft, + &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 1; @@ -45661,14 +55792,14 @@ iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); if (cd_ascii_to_88591 != (iconv_t)(-1)) { - static const char input[] = "\263"; + static ICONV_CONST char input[] = "\263"; char buf[10]; - const char *inptr = input; + ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_ascii_to_88591, - (char **) &inptr, &inbytesleft, + &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 2; @@ -45680,14 +55811,14 @@ iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { - static const char input[] = "\304"; + static ICONV_CONST char input[] = "\304"; static char buf[2] = { (char)0xDE, (char)0xAD }; - const char *inptr = input; + ICONV_CONST char *inptr = input; size_t inbytesleft = 1; char *outptr = buf; size_t outbytesleft = 1; size_t res = iconv (cd_88591_to_utf8, - (char **) &inptr, &inbytesleft, + &inptr, &inbytesleft, &outptr, &outbytesleft); if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) result |= 4; @@ -45700,14 +55831,14 @@ iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { - static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; - const char *inptr = input; + ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, - (char **) &inptr, &inbytesleft, + &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) result |= 8; @@ -45717,32 +55848,48 @@ #endif /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is provided. */ - if (/* Try standardized names. */ - iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) - /* Try IRIX, OSF/1 names. */ - && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) - /* Try AIX names. */ - && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) - /* Try HP-UX names. */ - && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) - result |= 16; + { + /* Try standardized names. */ + iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP"); + /* Try IRIX, OSF/1 names. */ + iconv_t cd2 = iconv_open ("UTF-8", "eucJP"); + /* Try AIX names. */ + iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP"); + /* Try HP-UX names. */ + iconv_t cd4 = iconv_open ("utf8", "eucJP"); + if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1) + && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1)) + result |= 16; + if (cd1 != (iconv_t)(-1)) + iconv_close (cd1); + if (cd2 != (iconv_t)(-1)) + iconv_close (cd2); + if (cd3 != (iconv_t)(-1)) + iconv_close (cd3); + if (cd4 != (iconv_t)(-1)) + iconv_close (cd4); + } return result; + + ; + return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : am_cv_func_iconv_works=yes -else - am_cv_func_iconv_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + test "$am_cv_func_iconv_works" = no || break + done LIBS="$am_save_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 -$as_echo "$am_cv_func_iconv_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 +printf "%s\n" "$am_cv_func_iconv_works" >&6; } case "$am_cv_func_iconv_works" in *no) am_func_iconv=no am_cv_lib_iconv=no ;; *) am_func_iconv=yes ;; @@ -45752,14 +55899,14 @@ fi if test "$am_func_iconv" = yes; then -$as_echo "#define HAVE_ICONV 1" >>confdefs.h +printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h fi if test "$am_cv_lib_iconv" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 -$as_echo_n "checking how to link with libiconv... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 -$as_echo "$LIBICONV" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 +printf %s "checking how to link with libiconv... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 +printf "%s\n" "$LIBICONV" >&6; } else CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= @@ -45792,7 +55939,8 @@ # Check whether --with-libintl-prefix was given. -if test "${with_libintl_prefix+set}" = set; then : +if test ${with_libintl_prefix+y} +then : withval=$with_libintl_prefix; if test "X$withval" = "Xno"; then use_additional=no @@ -46201,7 +56349,14 @@ fi ;; -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + dep=`echo "X$dep" | sed -e 's/^X-l//'` + if test "X$dep" != Xc \ + || case $host_os in + linux* | gnu* | k*bsd*-gnu) false ;; + *) true ;; + esac; then + names_next_round="$names_next_round $dep" + fi ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` @@ -46252,11 +56407,12 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5 -$as_echo_n "checking for GNU gettext in libintl... " >&6; } -if eval \${$gt_func_gnugettext_libintl+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5 +printf %s "checking for GNU gettext in libintl... " >&6; } +if eval test \${$gt_func_gnugettext_libintl+y} +then : + printf %s "(cached) " >&6 +else $as_nop gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $INCINTL" gt_save_LIBS="$LIBS" @@ -46274,7 +56430,7 @@ const char *_nl_expand_alias (const char *); int -main () +main (void) { bindtextdomain ("", ""); @@ -46284,12 +56440,13 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : eval "$gt_func_gnugettext_libintl=yes" -else +else $as_nop eval "$gt_func_gnugettext_libintl=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" @@ -46306,7 +56463,7 @@ const char *_nl_expand_alias (const char *); int -main () +main (void) { bindtextdomain ("", ""); @@ -46316,21 +56473,22 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : LIBINTL="$LIBINTL $LIBICONV" LTLIBINTL="$LTLIBINTL $LTLIBICONV" eval "$gt_func_gnugettext_libintl=yes" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS" fi eval ac_res=\$$gt_func_gnugettext_libintl - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } fi if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ @@ -46357,20 +56515,20 @@ if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then -$as_echo "#define ENABLE_NLS 1" >>confdefs.h +printf "%s\n" "#define ENABLE_NLS 1" >>confdefs.h else USE_NLS=no fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use NLS" >&5 -$as_echo_n "checking whether to use NLS... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 -$as_echo "$USE_NLS" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use NLS" >&5 +printf %s "checking whether to use NLS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +printf "%s\n" "$USE_NLS" >&6; } if test "$USE_NLS" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5 -$as_echo_n "checking where the gettext function comes from... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5 +printf %s "checking where the gettext function comes from... " >&6; } if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then gt_source="external libintl" @@ -46380,18 +56538,18 @@ else gt_source="included intl directory" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_source" >&5 -$as_echo "$gt_source" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_source" >&5 +printf "%s\n" "$gt_source" >&6; } fi if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5 -$as_echo_n "checking how to link with libintl... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5 -$as_echo "$LIBINTL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5 +printf %s "checking how to link with libintl... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5 +printf "%s\n" "$LIBINTL" >&6; } for element in $INCINTL; do haveit= @@ -46418,10 +56576,10 @@ fi -$as_echo "#define HAVE_GETTEXT 1" >>confdefs.h +printf "%s\n" "#define HAVE_GETTEXT 1" >>confdefs.h -$as_echo "#define HAVE_DCGETTEXT 1" >>confdefs.h +printf "%s\n" "#define HAVE_DCGETTEXT 1" >>confdefs.h fi @@ -46459,7 +56617,7 @@ fi if test $BISON_USE_NLS = yes; then -$as_echo "#define YYENABLE_NLS 1" >>confdefs.h +printf "%s\n" "#define YYENABLE_NLS 1" >>confdefs.h fi @@ -46489,11 +56647,12 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_VALGRIND+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_VALGRIND+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$VALGRIND"; then ac_cv_prog_VALGRIND="$VALGRIND" # Let the user override the test. else @@ -46501,11 +56660,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_VALGRIND="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -46516,11 +56679,11 @@ fi VALGRIND=$ac_cv_prog_VALGRIND if test -n "$VALGRIND"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VALGRIND" >&5 -$as_echo "$VALGRIND" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $VALGRIND" >&5 +printf "%s\n" "$VALGRIND" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -46542,10 +56705,10 @@ fi ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Valgrind suppression file" >&5 -$as_echo_n "checking Valgrind suppression file... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $suppfile" >&5 -$as_echo "$suppfile" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking Valgrind suppression file" >&5 +printf %s "checking Valgrind suppression file... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $suppfile" >&5 +printf "%s\n" "$suppfile" >&6; } # Whether we cannot run the compiled bison. if test "$cross_compiling" = yes; then @@ -46557,6 +56720,19 @@ fi +# Build bistromathic if we have the lib and both readline/readline.h +# and readline/history.h. + if test "$gl_cv_lib_readline" != no && + test "$ac_cv_header_readline_readline_h" = yes && + test "$ac_cv_header_readline_history_h" = yes; then + ENABLE_BISTROMATHIC_TRUE= + ENABLE_BISTROMATHIC_FALSE='#' +else + ENABLE_BISTROMATHIC_TRUE='#' + ENABLE_BISTROMATHIC_FALSE= +fi + + AUTOM4TE=${AUTOM4TE-"${am_missing_run}autom4te"} @@ -46598,8 +56774,8 @@ case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -46629,15 +56805,15 @@ /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -46651,8 +56827,8 @@ fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -46669,7 +56845,7 @@ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -46680,14 +56856,14 @@ LTLIBOBJS=$ac_ltlibobjs -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -46708,6 +56884,10 @@ as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${GL_GENERATE_TEXTSTYLE_H_TRUE}" && test -z "${GL_GENERATE_TEXTSTYLE_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_TEXTSTYLE_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ENABLE_CXX11_TRUE}" && test -z "${ENABLE_CXX11_FALSE}"; then as_fn_error $? "conditional \"ENABLE_CXX11\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -46763,6 +56943,18 @@ fi +if test -z "${GL_GENERATE_ICONV_H_TRUE}" && test -z "${GL_GENERATE_ICONV_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_ICONV_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GL_GENERATE_ICONV_H_TRUE}" && test -z "${GL_GENERATE_ICONV_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_ICONV_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GL_GENERATE_ICONV_H_TRUE}" && test -z "${GL_GENERATE_ICONV_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_ICONV_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${GL_GENERATE_LIMITS_H_TRUE}" && test -z "${GL_GENERATE_LIMITS_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_LIMITS_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -46775,10 +56967,6 @@ as_fn_error $? "conditional \"GL_GENERATE_STDINT_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${GL_GENERATE_TEXTSTYLE_H_TRUE}" && test -z "${GL_GENERATE_TEXTSTYLE_H_FALSE}"; then - as_fn_error $? "conditional \"GL_GENERATE_TEXTSTYLE_H\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi CONFIG_INCLUDE=lib/config.h @@ -46814,6 +57002,10 @@ as_fn_error $? "conditional \"RELOCATABLE_VIA_WRAPPER\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${GL_GENERATE_STDALIGN_H_TRUE}" && test -z "${GL_GENERATE_STDALIGN_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_STDALIGN_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${GL_GENERATE_STDBOOL_H_TRUE}" && test -z "${GL_GENERATE_STDBOOL_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_STDBOOL_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -46822,18 +57014,70 @@ as_fn_error $? "conditional \"GL_GENERATE_STDDEF_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_TRUE}" && test -z "${LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_FALSE}"; then + as_fn_error $? "conditional \"LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_TRUE}" && test -z "${LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_FALSE}"; then + as_fn_error $? "conditional \"LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE}" && test -z "${LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_FALSE}"; then as_fn_error $? "conditional \"LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b_TRUE}" && test -z "${gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${gl_GNULIB_ENABLED_chdir_TRUE}" && test -z "${gl_GNULIB_ENABLED_chdir_FALSE}"; then as_fn_error $? "conditional \"gl_GNULIB_ENABLED_chdir\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${gl_GNULIB_ENABLED_8198daae261b932d64a998f8586f5005_TRUE}" && test -z "${gl_GNULIB_ENABLED_8198daae261b932d64a998f8586f5005_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_8198daae261b932d64a998f8586f5005\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_closedir_TRUE}" && test -z "${gl_GNULIB_ENABLED_closedir_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_closedir\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_75c65a2c014cf8235dd95289676302a4_TRUE}" && test -z "${gl_GNULIB_ENABLED_75c65a2c014cf8235dd95289676302a4_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_75c65a2c014cf8235dd95289676302a4\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_dirent_TRUE}" && test -z "${gl_GNULIB_ENABLED_dirent_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_dirent\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_dirfd_TRUE}" && test -z "${gl_GNULIB_ENABLED_dirfd_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_dirfd\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_dup_TRUE}" && test -z "${gl_GNULIB_ENABLED_dup_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_dup\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_fchdir_TRUE}" && test -z "${gl_GNULIB_ENABLED_fchdir_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_fchdir\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${gl_GNULIB_ENABLED_43fe87a341d9b4b93c47c3ad819a5239_TRUE}" && test -z "${gl_GNULIB_ENABLED_43fe87a341d9b4b93c47c3ad819a5239_FALSE}"; then as_fn_error $? "conditional \"gl_GNULIB_ENABLED_43fe87a341d9b4b93c47c3ad819a5239\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${gl_GNULIB_ENABLED_fdopendir_TRUE}" && test -z "${gl_GNULIB_ENABLED_fdopendir_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_fdopendir\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_ffs_TRUE}" && test -z "${gl_GNULIB_ENABLED_ffs_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_ffs\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_fca9852db2a43bb33f02f0fbdbc174f6_TRUE}" && test -z "${gl_GNULIB_ENABLED_fca9852db2a43bb33f02f0fbdbc174f6_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_fca9852db2a43bb33f02f0fbdbc174f6\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${gl_GNULIB_ENABLED_fseterr_TRUE}" && test -z "${gl_GNULIB_ENABLED_fseterr_FALSE}"; then as_fn_error $? "conditional \"gl_GNULIB_ENABLED_fseterr\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -46842,10 +57086,26 @@ as_fn_error $? "conditional \"gl_GNULIB_ENABLED_fstat\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${gl_GNULIB_ENABLED_fstatat_TRUE}" && test -z "${gl_GNULIB_ENABLED_fstatat_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_fstatat\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_3d094ef542bfdd238a5194e172bfe5f6_TRUE}" && test -z "${gl_GNULIB_ENABLED_3d094ef542bfdd238a5194e172bfe5f6_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_3d094ef542bfdd238a5194e172bfe5f6\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_getdelim_TRUE}" && test -z "${gl_GNULIB_ENABLED_getdelim_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_getdelim\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${gl_GNULIB_ENABLED_getdtablesize_TRUE}" && test -z "${gl_GNULIB_ENABLED_getdtablesize_FALSE}"; then as_fn_error $? "conditional \"gl_GNULIB_ENABLED_getdtablesize\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${gl_GNULIB_ENABLED_getline_TRUE}" && test -z "${gl_GNULIB_ENABLED_getline_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_getline\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${gl_GNULIB_ENABLED_30838f5439487421042f2225bed3af76_TRUE}" && test -z "${gl_GNULIB_ENABLED_30838f5439487421042f2225bed3af76_FALSE}"; then as_fn_error $? "conditional \"gl_GNULIB_ENABLED_30838f5439487421042f2225bed3af76\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -46858,18 +57118,10 @@ as_fn_error $? "conditional \"gl_GNULIB_ENABLED_ldexp\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${gl_GNULIB_ENABLED_21ee726a3540c09237a8e70c0baf7467_TRUE}" && test -z "${gl_GNULIB_ENABLED_21ee726a3540c09237a8e70c0baf7467_FALSE}"; then - as_fn_error $? "conditional \"gl_GNULIB_ENABLED_21ee726a3540c09237a8e70c0baf7467\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${gl_GNULIB_ENABLED_locale_TRUE}" && test -z "${gl_GNULIB_ENABLED_locale_FALSE}"; then as_fn_error $? "conditional \"gl_GNULIB_ENABLED_locale\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${gl_GNULIB_ENABLED_2049e887c7e5308faad27b3f894bb8c9_TRUE}" && test -z "${gl_GNULIB_ENABLED_2049e887c7e5308faad27b3f894bb8c9_FALSE}"; then - as_fn_error $? "conditional \"gl_GNULIB_ENABLED_2049e887c7e5308faad27b3f894bb8c9\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${gl_GNULIB_ENABLED_lstat_TRUE}" && test -z "${gl_GNULIB_ENABLED_lstat_FALSE}"; then as_fn_error $? "conditional \"gl_GNULIB_ENABLED_lstat\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -46878,20 +57130,44 @@ as_fn_error $? "conditional \"gl_GNULIB_ENABLED_malloca\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${gl_GNULIB_ENABLED_memrchr_TRUE}" && test -z "${gl_GNULIB_ENABLED_memrchr_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_memrchr\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_openat_TRUE}" && test -z "${gl_GNULIB_ENABLED_openat_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_openat\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_1840129d490f3a00c8a098316d0fa345_TRUE}" && test -z "${gl_GNULIB_ENABLED_1840129d490f3a00c8a098316d0fa345_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_1840129d490f3a00c8a098316d0fa345\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7_TRUE}" && test -z "${gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_opendir_TRUE}" && test -z "${gl_GNULIB_ENABLED_opendir_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_opendir\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${gl_GNULIB_ENABLED_332607f759618fb73dfc3076748afea7_TRUE}" && test -z "${gl_GNULIB_ENABLED_332607f759618fb73dfc3076748afea7_FALSE}"; then as_fn_error $? "conditional \"gl_GNULIB_ENABLED_332607f759618fb73dfc3076748afea7\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${gl_GNULIB_ENABLED_rawmemchr_TRUE}" && test -z "${gl_GNULIB_ENABLED_rawmemchr_FALSE}"; then - as_fn_error $? "conditional \"gl_GNULIB_ENABLED_rawmemchr\" was never defined. +if test -z "${gl_GNULIB_ENABLED_readdir_TRUE}" && test -z "${gl_GNULIB_ENABLED_readdir_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_readdir\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${gl_GNULIB_ENABLED_rewinddir_TRUE}" && test -z "${gl_GNULIB_ENABLED_rewinddir_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_rewinddir\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${gl_GNULIB_ENABLED_rmdir_TRUE}" && test -z "${gl_GNULIB_ENABLED_rmdir_FALSE}"; then as_fn_error $? "conditional \"gl_GNULIB_ENABLED_rmdir\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${gl_GNULIB_ENABLED_9bc5f216d57e231e4834049d67d0db62_TRUE}" && test -z "${gl_GNULIB_ENABLED_9bc5f216d57e231e4834049d67d0db62_FALSE}"; then - as_fn_error $? "conditional \"gl_GNULIB_ENABLED_9bc5f216d57e231e4834049d67d0db62\" was never defined. +if test -z "${gl_GNULIB_ENABLED_d4850532688ba16d685f036076611f21_TRUE}" && test -z "${gl_GNULIB_ENABLED_d4850532688ba16d685f036076611f21_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_d4850532688ba16d685f036076611f21\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${gl_GNULIB_ENABLED_e7e881d32ca02f1c997b13c737c64bbd_TRUE}" && test -z "${gl_GNULIB_ENABLED_e7e881d32ca02f1c997b13c737c64bbd_FALSE}"; then @@ -46902,10 +57178,6 @@ as_fn_error $? "conditional \"gl_GNULIB_ENABLED_cdeb0f2aaf9d280baa6526bfa1b07f70\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${gl_GNULIB_ENABLED_stat_TRUE}" && test -z "${gl_GNULIB_ENABLED_stat_FALSE}"; then - as_fn_error $? "conditional \"gl_GNULIB_ENABLED_stat\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${gl_GNULIB_ENABLED_0137e3d3638b33e5819d132d0b23165c_TRUE}" && test -z "${gl_GNULIB_ENABLED_0137e3d3638b33e5819d132d0b23165c_FALSE}"; then as_fn_error $? "conditional \"gl_GNULIB_ENABLED_0137e3d3638b33e5819d132d0b23165c\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -46922,12 +57194,12 @@ as_fn_error $? "conditional \"gl_GNULIB_ENABLED_1f32594a85e6221ba15f884daeee8c2a\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${gl_GNULIB_ENABLED_strnlen_TRUE}" && test -z "${gl_GNULIB_ENABLED_strnlen_FALSE}"; then - as_fn_error $? "conditional \"gl_GNULIB_ENABLED_strnlen\" was never defined. +if test -z "${gl_GNULIB_ENABLED_strings_TRUE}" && test -z "${gl_GNULIB_ENABLED_strings_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_strings\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${gl_GNULIB_ENABLED_sys_stat_TRUE}" && test -z "${gl_GNULIB_ENABLED_sys_stat_FALSE}"; then - as_fn_error $? "conditional \"gl_GNULIB_ENABLED_sys_stat\" was never defined. +if test -z "${gl_GNULIB_ENABLED_strnlen_TRUE}" && test -z "${gl_GNULIB_ENABLED_strnlen_FALSE}"; then + as_fn_error $? "conditional \"gl_GNULIB_ENABLED_strnlen\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${gl_GNULIB_ENABLED_ed5616be3593d355b981ffab56b9f37b_TRUE}" && test -z "${gl_GNULIB_ENABLED_ed5616be3593d355b981ffab56b9f37b_FALSE}"; then @@ -46990,6 +57262,10 @@ as_fn_error $? "conditional \"CROSS_COMPILING\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_BISTROMATHIC_TRUE}" && test -z "${ENABLE_BISTROMATHIC_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_BISTROMATHIC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi case $am__api_version in 1.14*|1.15*) gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, lib/, lib/lib_libbison_a-,g'`;; @@ -47001,8 +57277,8 @@ ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -47025,14 +57301,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -47042,46 +57320,46 @@ fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -47090,13 +57368,6 @@ fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -47105,8 +57376,12 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -47118,30 +57393,10 @@ as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -47154,13 +57409,14 @@ as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -47187,18 +57443,20 @@ { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -47210,12 +57468,13 @@ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -47246,7 +57505,7 @@ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -47268,6 +57527,10 @@ as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -47281,6 +57544,12 @@ ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -47322,7 +57591,7 @@ as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -47331,7 +57600,7 @@ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -47393,8 +57662,8 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by GNU Bison $as_me 3.5.1, which was -generated by GNU Autoconf 2.69. Invocation command line was +This file was extended by GNU Bison $as_me 3.8.2, which was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -47459,17 +57728,19 @@ Report bugs to . GNU Bison home page: . -General help using GNU software: ." +General help using GNU software: ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -GNU Bison config.status 3.5.1 -configured by $0, generated by GNU Autoconf 2.69, +GNU Bison config.status 3.8.2 +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -47509,15 +57780,15 @@ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -47525,7 +57796,7 @@ --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; @@ -47534,7 +57805,7 @@ as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -47562,7 +57833,7 @@ if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -47576,7 +57847,7 @@ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -47593,6 +57864,7 @@ # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" +ac_cv_exeext="$ac_cv_exeext" _ACEOF @@ -47630,10 +57902,10 @@ # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_LINKS+y} || CONFIG_LINKS=$config_links + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -48003,7 +58275,7 @@ esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -48011,17 +58283,17 @@ # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -48038,7 +58310,7 @@ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -48062,9 +58334,9 @@ case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -48126,8 +58398,8 @@ case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -48176,9 +58448,9 @@ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -48194,20 +58466,20 @@ # if test x"$ac_file" != x-; then { - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi @@ -48227,7 +58499,7 @@ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | +printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -48259,8 +58531,8 @@ ac_source=$srcdir/$ac_source fi - { $as_echo "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5 -$as_echo "$as_me: linking $ac_source to $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5 +printf "%s\n" "$as_me: linking $ac_source to $ac_file" >&6;} if test ! -r "$ac_source"; then as_fn_error $? "$ac_source: file not found" "$LINENO" 5 @@ -48278,8 +58550,8 @@ as_fn_error $? "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 fi ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -48305,7 +58577,7 @@ for am_mf do # Strip MF so we end up with the name of the file. - am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line @@ -48317,7 +58589,7 @@ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$am_mf" | +printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -48339,7 +58611,7 @@ $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$am_mf" | +printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -48364,10 +58636,12 @@ (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } @@ -48498,7 +58772,7 @@ "tests/atconfig":C) cat >tests/atconfig <&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + diff -Nru bison-3.5.1+dfsg/configure.ac bison-3.8.2+dfsg/configure.ac --- bison-3.5.1+dfsg/configure.ac 2020-01-19 13:07:51.000000000 +0000 +++ bison-3.8.2+dfsg/configure.ac 2021-09-14 04:54:14.000000000 +0000 @@ -1,6 +1,6 @@ # Configure template for GNU Bison. -*-Autoconf-*- # -# Copyright (C) 2001-2015, 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2015, 2018-2021 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,14 +13,9 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . -# In order for some versions of Sun Studio to compile our C++ test cases -# correctly, we need Autoconf 2.64 or better to handle the restrict -# keyword in at least string.h from gnulib. We need Autoconf 2.68 or -# better to avoid a typo in the 'configure --help' entry for the YACC -# environment variable. -AC_PREREQ([2.68]) +AC_PREREQ([2.71]) m4_pattern_forbid([^_?(gl_[A-Z]|AX_|BISON_)]) m4_pattern_allow([^BISON_USE_NLS$]) @@ -29,17 +24,15 @@ [bug-bison@gnu.org], [], [https://www.gnu.org/software/bison/]) -AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2020]) +AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2021]) AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR], [The copyright year for this package]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) -# We use Automake 1.14's %D% and %C%. -# # When we move to Automake 1.16, simplify examples/c/reccalc/local.mk. -# Our CI runs on Xenial, which has only Automake 1.15. +# Our CI build the packages on Bionic, which has only Automake 1.15. # # We want gnits strictness only when rolling a stable release. For # release candidates, we use version strings like 2.4.3_rc1, but gnits @@ -47,7 +40,7 @@ # releases, we want to be able run make dist without being required to # add a bogus NEWS entry. In that case, the version string # automatically contains a dash, which we also let disable gnits. -AM_INIT_AUTOMAKE([1.14 dist-xz nostdinc +AM_INIT_AUTOMAKE([1.15 dist-lzip dist-xz nostdinc color-tests parallel-tests silent-rules] m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]], @@ -56,12 +49,15 @@ AC_CONFIG_HEADERS([lib/config.h:lib/config.in.h]) # Checks for the compiler. -AC_PROG_CC_STDC +AC_PROG_CC AC_PROG_CXX # Gnulib (early checks). gl_EARLY +# We want ostream_printf and hyperlink support. +gl_LIBTEXTSTYLE_OPTIONAL([0.20.5]) + # Gnulib uses '#pragma GCC diagnostic push' to silence some # warnings, but older gcc doesn't support this. AC_CACHE_CHECK([whether pragma GCC diagnostic push works], @@ -83,7 +79,8 @@ BISON_CXXSTD([11]) BISON_CXXSTD([14]) BISON_CXXSTD([17]) -BISON_CXXSTD([2a]) +BISON_CXXSTD([20]) +BISON_CXXSTD([2b]) AM_CONDITIONAL([ENABLE_CXX11], [test x"$CXX11_CXXFLAGS" != x]) AM_CONDITIONAL([ENABLE_CXX14], [test x"$CXX14_CXXFLAGS" != x]) AC_LANG_POP([C++]) @@ -132,12 +129,14 @@ warn_common='-Wall -Wextra -Wcast-align -Wchar-subscripts -fparse-all-comments -Wdocumentation - -Wformat -Wimplicit-fallthrough -Wnull-dereference + -Wformat -Wimplicit-fallthrough -Wmismatched-dealloc -Wnull-dereference -Wno-sign-compare -Wno-tautological-constant-out-of-range-compare - -Wpointer-arith -Wshadow + -Wpointer-arith -Wshadow -Wstrict-aliasing -Wwrite-strings -wr188 -wr2259 -wr3179' - warn_c='-Wbad-function-cast -Wstrict-prototypes' + warn_c='-Wbad-function-cast + -Wmissing-prototypes + -Wstrict-prototypes' warn_cxx='-Wextra-semi -Wnoexcept -Wold-style-cast -Wundefined-func-template -Wweak-vtables' # Warnings for the test suite only. @@ -248,7 +247,7 @@ AC_ARG_ENABLE([yacc], - [AC_HELP_STRING([--disable-yacc], + [AS_HELP_STRING([--disable-yacc], [do not build a yacc command or an -ly library])], , [enable_yacc=yes]) AM_CONDITIONAL([ENABLE_YACC], [test "$enable_yacc" = yes]) @@ -261,9 +260,9 @@ AC_MSG_WARN([bypassing lex because flex is required]) LEX=: fi -AM_CONDITIONAL([FLEX_WORKS], [$LEX_IS_FLEX]) +AM_CONDITIONAL([FLEX_WORKS], [$LEX_IS_FLEX && $FLEX_SUPPORTS_HEADER_OPT]) AM_CONDITIONAL([FLEX_CXX_WORKS], - [$LEX_IS_FLEX && test $bison_cv_cxx_works = yes]) + [$LEX_IS_FLEX && $FLEX_SUPPORTS_HEADER_OPT && test $bison_cv_cxx_works = yes]) AC_PROG_YACC AC_PROG_RANLIB AC_PROG_GNU_M4 @@ -332,6 +331,13 @@ # Whether we cannot run the compiled bison. AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes]) +# Build bistromathic if we have the lib and both readline/readline.h +# and readline/history.h. +AM_CONDITIONAL([ENABLE_BISTROMATHIC], +[test "$gl_cv_lib_readline" != no && + test "$ac_cv_header_readline_readline_h" = yes && + test "$ac_cv_header_readline_history_h" = yes]) + AM_MISSING_PROG([AUTOM4TE], [autom4te]) # Needed by tests/atlocal.in. AC_SUBST([GCC]) diff -Nru bison-3.5.1+dfsg/COPYING bison-3.8.2+dfsg/COPYING --- bison-3.5.1+dfsg/COPYING 2018-12-21 05:47:58.000000000 +0000 +++ bison-3.8.2+dfsg/COPYING 2021-06-23 04:48:48.000000000 +0000 @@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -645,7 +645,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -664,11 +664,11 @@ You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. diff -Nru bison-3.5.1+dfsg/data/bison-default.css bison-3.8.2+dfsg/data/bison-default.css --- bison-3.5.1+dfsg/data/bison-default.css 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/bison-default.css 2021-06-23 04:48:48.000000000 +0000 @@ -1,5 +1,5 @@ /* Default styling rules for Bison when doing terminal output. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,3 +29,33 @@ /* "Sections" in traces (--trace). */ .trace0 { color: green; } + +/* Syntax error messages. */ +.expected { color: green; } +.unexpected { color: red; } + + +/* Counterexamples. */ + +/* Cex: point in rule. */ +.cex-dot { color: red; } + +/* Cex: coloring various rules. */ +.cex-0 { color: yellow; } +.cex-1 { color: green; } +.cex-2 { color: blue; } +.cex-3 { color: purple; } +.cex-4 { color: violet; } +.cex-5 { color: orange; } +.cex-6 { color: brown; } +.cex-7 { color: mauve; } +.cex-8 { color: #013220; } /* Dark green. */ +.cex-9 { color: #e75480; } /* Dark pink. */ +.cex-10 { color: cyan; } +.cex-11 { color: orange; } + +/* Cex: derivation rewriting steps. */ +.cex-step { font-style: italic; } + +/* Cex: leaves of a derivation. */ +.cex-leaf { font-weight: 600; } diff -Nru bison-3.5.1+dfsg/data/local.mk bison-3.8.2+dfsg/data/local.mk --- bison-3.5.1+dfsg/data/local.mk 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/local.mk 2021-06-23 04:48:48.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2002, 2005-2015, 2018-2020 Free Software Foundation, +## Copyright (C) 2002, 2005-2015, 2018-2021 Free Software Foundation, ## Inc. ## This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License -## along with this program. If not, see . +## along with this program. If not, see . dist_pkgdata_DATA = \ data/README.md \ @@ -28,18 +28,19 @@ data/skeletons/c.m4 \ data/skeletons/glr.c \ data/skeletons/glr.cc \ + data/skeletons/glr2.cc \ data/skeletons/java-skel.m4 \ data/skeletons/java.m4 \ data/skeletons/lalr1.cc \ data/skeletons/lalr1.java \ data/skeletons/location.cc \ data/skeletons/stack.hh \ + data/skeletons/traceon.m4 \ data/skeletons/variant.hh \ data/skeletons/yacc.c # Experimental support for the D language. dist_skeletons_DATA += \ - data/skeletons/README-D.txt \ data/skeletons/d-skel.m4 \ data/skeletons/d.m4 \ data/skeletons/lalr1.d diff -Nru bison-3.5.1+dfsg/data/m4sugar/foreach.m4 bison-3.8.2+dfsg/data/m4sugar/foreach.m4 --- bison-3.5.1+dfsg/data/m4sugar/foreach.m4 2018-09-02 15:56:00.000000000 +0000 +++ bison-3.8.2+dfsg/data/m4sugar/foreach.m4 2021-01-23 08:28:56.000000000 +0000 @@ -4,7 +4,7 @@ # Speeds up GNU M4 1.4.x by avoiding quadratic $@ recursion, but penalizes # GNU M4 1.6 by requiring more memory and macro expansions. # -# Copyright (C) 2008-2017 Free Software Foundation, Inc. +# Copyright (C) 2008-2017, 2020 Free Software Foundation, Inc. # This file is part of Autoconf. This program is free # software; you can redistribute it and/or modify it under the diff -Nru bison-3.5.1+dfsg/data/m4sugar/m4sugar.m4 bison-3.8.2+dfsg/data/m4sugar/m4sugar.m4 --- bison-3.5.1+dfsg/data/m4sugar/m4sugar.m4 2018-09-02 15:56:00.000000000 +0000 +++ bison-3.8.2+dfsg/data/m4sugar/m4sugar.m4 2021-01-23 08:28:56.000000000 +0000 @@ -3,7 +3,7 @@ # Base M4 layer. # Requires GNU M4. # -# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Copyright (C) 1999-2017, 2020 Free Software Foundation, Inc. # This file is part of Autoconf. This program is free # software; you can redistribute it and/or modify it under the @@ -2412,6 +2412,27 @@ [m4_strip(m4_flatten([$1]))]) +# m4_validate_w(STRING) +# --------------------- +# Expands into m4_normalize(m4_expand([STRING])), but if that is not +# the same as just m4_normalize([STRING]), issue a warning. +# +# This is used in several Autoconf macros that take a +# whitespace-separated list of symbols as an argument. Ideally that +# list would not be expanded before use, but several packages used +# `dnl' to put comments inside those lists, so they must be expanded +# for compatibility's sake. +m4_define([m4_validate_w], +[_m4_validate_w(m4_normalize([$1]), m4_normalize(m4_expand([$1])))]) + +m4_define([_m4_validate_w], +[m4_if([$1], [$2], [], + [m4_warn([obsolete], [whitespace-separated list contains macros; +in a future version of Autoconf they will not be expanded]dnl +m4_if(m4_bregexp([$1], [\bdn[l]\b]), -1, [], [ +note: `dn@&t@l' is a macro]))])dnl +[$2]]) + # m4_join(SEP, ARG1, ARG2...) # --------------------------- diff -Nru bison-3.5.1+dfsg/data/README.md bison-3.8.2+dfsg/data/README.md --- bison-3.5.1+dfsg/data/README.md 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/README.md 2021-08-09 05:17:19.000000000 +0000 @@ -1,6 +1,6 @@ This directory contains data needed by Bison. -# Directory content +# Directory Content ## Skeletons Bison skeletons: the general shapes of the different parser kinds, that are specialized for specific grammars by the bison program. @@ -48,7 +48,7 @@ - xml2xhtml.xsl Conversion into XHTML. -# Implementation note about the skeletons +# Implementation Notes About the Skeletons "Skeleton" in Bison parlance means "backend": a skeleton is fed by the bison executable with LR tables, facts about the symbols, etc. and they generate @@ -73,36 +73,63 @@ your language. Overall, be sure to follow the same patterns as the existing skeletons. +## Vocabulary + +We use "formal arguments", or "formals" for short, to denote the declared +parameters of a function (e.g., `int argc, const char **argv`). Yes, this +is somewhat contradictory with `param` in the `%param` directives. + +We use "effective arguments", or "args" for short, to denote the values +passed in function calls (e.g., `argc, argv`). + ## Symbols ### `b4_symbol(NUM, FIELD)` In order to unify the handling of the various aspects of symbols (tag, type name, whether terminal, etc.), bison.exe defines one macro per (token, field), where field can `has_id`, `id`, etc.: see -`prepare_symbols_definitions()` in `src/output.c`. - -The macro `b4_symbol(NUM, FIELD)` gives access to the following FIELDS: - -- `has_id`: 0 or 1. +`prepare_symbol_definitions()` in `src/output.c`. - Whether the symbol has an id. +NUM can be: +- `empty` to denote the "empty" pseudo-symbol when it exists, +- `eof`, `error`, or `undef` +- a symbol number. + +FIELD can be: + +- `has_id`: 0 or 1 + Whether the symbol has an `id`. + +- `id`: string (e.g., `exp`, `NUM`, or `TOK_NUM` with api.token.prefix) + If `has_id`, the name of the token kind (prefixed by api.token.prefix if + defined), otherwise empty. Guaranteed to be usable as a C identifier. + This is used to define the token kind (i.e., the enum used by the return + value of yylex). Should be named `token_kind`. + +- `tag`: string + A human readable representation of the symbol. Can be `'foo'`, + `'foo.id'`, `'"foo"'` etc. -- `id`: string - If has_id, the id (prefixed by api.token.prefix if defined), otherwise - defined as empty. Guaranteed to be usable as a C identifier. - -- `tag`: string. - A representation of the symbol. Can be 'foo', 'foo.id', '"foo"' etc. - -- `user_number`: integer +- `code`: integer + The token code associated to the token kind `id`. The external number as used by yylex. Can be ASCII code when a character, - some number chosen by bison, or some user number in the case of - %token FOO . Corresponds to yychar in yacc.c. + some number chosen by bison, or some user number in the case of `%token + FOO `. Corresponds to `yychar` in `yacc.c`. - `is_token`: 0 or 1 Whether this is a terminal symbol. +- `kind_base`: string (e.g., `YYSYMBOL_exp`, `YYSYMBOL_NUM`) + The base of the symbol kind, i.e., the enumerator of this symbol (token or + nonterminal) which is mapped to its `number`. + +- `kind`: string + Same as `kind_base`, but possibly with a prefix in some languages. E.g., + EOF's `kind_base` and `kind` are `YYSYMBOL_YYEOF` in C, but are + `S_YYEMPTY` and `symbol_kind::S_YYEMPTY` in C++. + - `number`: integer + The code associated to the `kind`. The internal number (computed from the external number by yytranslate). Corresponds to yytoken in yacc.c. This is the same number that serves as key in b4_symbol(NUM, FIELD). @@ -129,11 +156,17 @@ When api.value.type=union, the generated name for the union member. yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc. -- `type` +- `type`: string If it has a semantic value, its type tag, or, if variant are used, its type. In the case of api.value.type=union, type is the real type (e.g. int). +- `slot`: string + If it has a semantic value, the name of the union member (i.e., bounces to + either `type_tag` or `type`). It would be better to fix our mess and + always use `type` for the true type of the member, and `type_tag` for the + name of the union member. + - `has_printer`: 0, 1 - `printer`: string - `printer_file`: string @@ -166,7 +199,7 @@ Expansion of `$POS`, where the current rule has `RULE-LENGTH` symbols on RHS. ------ + diff -Nru bison-3.5.1+dfsg/data/skeletons/bison.m4 bison-3.8.2+dfsg/data/skeletons/bison.m4 --- bison-3.5.1+dfsg/data/skeletons/bison.m4 2020-01-19 13:07:51.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/bison.m4 2021-09-14 04:58:44.000000000 +0000 @@ -2,7 +2,7 @@ # Language-independent M4 Macros for Bison. -# Copyright (C) 2002, 2004-2015, 2018-2020 Free Software Foundation, +# Copyright (C) 2002, 2004-2015, 2018-2021 Free Software Foundation, # Inc. # This program is free software: you can redistribute it and/or modify @@ -16,7 +16,30 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . + + + +# m4_gsub(STRING, RE1, SUBST1, RE2, SUBST2, ...) +# ---------------------------------------------- +# m4 equivalent of +# +# $_ = STRING; +# s/RE1/SUBST1/g; +# s/RE2/SUBST2/g; +# ... +# +# Really similar to m4_bpatsubsts, but behaves properly with quotes. +# See m4.at's "Generating Comments". Super inelegant, but so far, I +# did not find any better solution. +m4_define([b4_gsub], +[m4_bpatsubst(m4_bpatsubst(m4_bpatsubst([[[[$1]]]], + [$2], [$3]), + [$4], [$5]), + [$6], [$7])]) + +# m4_shift2 and m4_shift3 are provided by m4sugar. +m4_define([m4_shift4], [m4_shift(m4_shift(m4_shift(m4_shift($@))))]) ## ---------------- ## @@ -26,7 +49,7 @@ # b4_generated_by # --------------- m4_define([b4_generated_by], -[b4_comment([A Bison parser, made by GNU Bison b4_version.]) +[b4_comment([A Bison parser, made by GNU Bison b4_version_string.]) ]) # b4_copyright(TITLE, [YEARS]) @@ -51,7 +74,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see .]) +along with this program. If not, see .]) b4_comment([As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -72,8 +95,9 @@ # ------------- # Issue a warning about private implementation details. m4_define([b4_disclaimer], -[b4_comment([Undocumented macros, especially those whose name start with YY_, -are private implementation details. Do not rely on them.]) +[b4_comment([DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, +especially those whose name start with YY_ or yy_. They are +private implementation details that can be changed or removed.]) ]) @@ -161,7 +185,7 @@ [b4_cat([[@complain][(]$1[@,]$2[@,]$3[@,]$4[]]dnl [m4_if([$#], [4], [], [m4_foreach([b4_arg], - m4_dquote(m4_shift(m4_shift(m4_shift(m4_shift($@))))), + m4_dquote(m4_shift4($@)), [[@,]b4_arg])])[@)]])]) # b4_warn(FORMAT, [ARG1], [ARG2], ...) @@ -237,6 +261,13 @@ [b4_error([[fatal]], $@)dnl m4_exit(1)]) +# b4_canary(MSG) +# -------------- +# Issue a warning on stderr and in the output. Used in the test suite +# to catch spurious m4 evaluations. +m4_define([b4_canary], +[m4_errprintn([dead canary: $1])DEAD CANARY($1)]) + ## ------------ ## ## Data Types. ## @@ -308,14 +339,14 @@ $1([check], [b4_check]) $1([stos], [b4_stos], - [[YYSTOS[STATE-NUM] -- The (internal number of the) accessing -symbol of state STATE-NUM.]]) + [[YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of +state STATE-NUM.]]) $1([r1], [b4_r1], - [[YYR1[YYN] -- Symbol number of symbol that rule YYN derives.]]) + [[YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.]]) $1([r2], [b4_r2], - [[YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.]]) + [[YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.]]) ]) @@ -367,8 +398,9 @@ # b4_FLAG_if(IF-TRUE, IF-FALSE) # ----------------------------- # Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise. -b4_define_flag_if([defines]) # Whether headers are requested. b4_define_flag_if([glr]) # Whether a GLR parser is requested. +b4_define_flag_if([has_translations]) # Whether some tokens are internationalized. +b4_define_flag_if([header]) # Whether a header is requested. b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled. b4_define_flag_if([token_table]) # Whether yytoken_table is demanded. b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated. @@ -379,43 +411,100 @@ m4_define([b4_glr_cc_if], [m4_if(b4_skeleton, ["glr.cc"], $@)]) +# b4_glr2_cc_if([IF-TRUE], [IF-FALSE]) +# ------------------------------------ +m4_define([b4_glr2_cc_if], + [m4_if(b4_skeleton, ["glr2.cc"], $@)]) ## --------- ## ## Symbols. ## ## --------- ## -# For a description of the Symbol handling, see README. +# For a description of the Symbol handling, see README.md. # # The following macros provide access to symbol related values. # __b4_symbol(NUM, FIELD) # ----------------------- -# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if -# undefined. +# Fetch FIELD of symbol #NUM. Fail if undefined. m4_define([__b4_symbol], [m4_indir([b4_symbol($1, $2)])]) # _b4_symbol(NUM, FIELD) # ---------------------- -# Recover a FIELD about symbol #NUM (or "orig NUM"). Fails if -# undefined. +# Fetch FIELD of symbol #NUM (or "orig NUM", see README.md). +# Fail if undefined. m4_define([_b4_symbol], [m4_ifdef([b4_symbol($1, number)], [__b4_symbol(m4_indir([b4_symbol($1, number)]), $2)], [__b4_symbol([$1], [$2])])]) +# b4_symbol_token_kind(NUM) +# ------------------------- +# The token kind of this symbol. +m4_define([b4_symbol_token_kind], +[b4_percent_define_get([api.token.prefix])dnl +_b4_symbol([$1], [id])]) + + +# b4_symbol_kind_base(NUM) +# ------------------------ +# Build the name of the kind of this symbol. It must always exist, +# otherwise some symbols might not be represented in the enum, which +# might be compiled into too small a type to contain all the symbol +# numbers. +m4_define([b4_symbol_prefix], [b4_percent_define_get([api.symbol.prefix])]) +m4_define([b4_symbol_kind_base], +[b4_percent_define_get([api.symbol.prefix])dnl +m4_case([$1], + [-2], [[YYEMPTY]], + [0], [[YYEOF]], + [1], [[YYerror]], + [2], [[YYUNDEF]], + [m4_case(b4_symbol([$1], [tag]), + [$accept], [[YYACCEPT]], + [b4_symbol_if([$1], [has_id], _b4_symbol([$1], [id]), + [m4_bpatsubst([$1-][]_b4_symbol([$1], [tag]), [[^a-zA-Z_0-9]+], [_])])])])]) + + +# b4_symbol_kind(NUM) +# ------------------- +# Same as b4_symbol_kind, but possibly with a prefix in some +# languages. E.g., EOF's kind_base and kind are YYSYMBOL_YYEOF in C, +# but are S_YYEMPTY and symbol_kind::S_YYEMPTY in C++. +m4_copy([b4_symbol_kind_base], [b4_symbol_kind]) + + +# b4_symbol_slot(NUM) +# ------------------- +# The name of union member that contains the value of these symbols. +# Currently, we are messy, this should actually be type_tag, but type_tag +# has several meanings. +m4_define([b4_symbol_slot], +[m4_case(b4_percent_define_get([[api.value.type]]), + [union], [b4_symbol([$1], [type_tag])], + [variant], [b4_symbol([$1], [type_tag])], + [b4_symbol([$1], [type])])]) + # b4_symbol(NUM, FIELD) # --------------------- -# Recover a FIELD about symbol #NUM (or "orig NUM"). Fails if -# undefined. If FIELD = id, prepend the token prefix. +# Fetch FIELD of symbol #NUM (or "orig NUM", or "empty"). Fail if undefined. +# +# If FIELD = id, prepend the token prefix. m4_define([b4_symbol], -[m4_case([$2], - [id], [m4_do([b4_percent_define_get([api.token.prefix])], - [_b4_symbol([$1], [id])])], - [_b4_symbol($@)])]) +[m4_if([$1], [empty], [b4_symbol([-2], [$2])], + [$1], [eof], [b4_symbol([0], [$2])], + [$1], [error], [b4_symbol([1], [$2])], + [$1], [undef], [b4_symbol([2], [$2])], + [m4_case([$2], + [id], [b4_symbol_token_kind([$1])], + [kind_base], [b4_symbol_kind_base([$1])], + [kind], [b4_symbol_kind([$1])], + [slot], [b4_symbol_slot([$1])], + [_b4_symbol($@)])])]) # b4_symbol_if(NUM, FIELD, IF-TRUE, IF-FALSE) @@ -437,9 +526,9 @@ ]) -# b4_symbol_action(SYMBOL-NUM, KIND) -# ---------------------------------- -# Run the action KIND (destructor or printer) for SYMBOL-NUM. +# b4_symbol_action(SYMBOL-NUM, ACTION) +# ------------------------------------ +# Run the action ACTION ("destructor" or "printer") for SYMBOL-NUM. m4_define([b4_symbol_action], [b4_symbol_if([$1], [has_$2], [b4_dollar_pushdef([(*yyvaluep)], @@ -463,21 +552,21 @@ m4_define([b4_symbol_printer], [b4_symbol_action([$1], [printer])]) -# b4_symbol_actions(KIND, [TYPE = yytype]) -# ---------------------------------------- -# Emit the symbol actions for KIND ("printer" or "destructor"). -# Dispatch on TYPE. +# b4_symbol_actions(ACTION, [KIND = yykind]) +# ------------------------------------------ +# Emit the symbol actions for ACTION ("destructor" or "printer"). +# Dispatch on KIND. m4_define([b4_symbol_actions], [m4_pushdef([b4_actions_], m4_expand([b4_symbol_foreach([b4_symbol_$1])]))dnl m4_ifval(m4_defn([b4_actions_]), -[switch (m4_default([$2], [yytype])) +[switch (m4_default([$2], [yykind])) { m4_defn([b4_actions_])[]dnl default: break; }dnl ], -[YYUSE (m4_default([$2], [yytype]));])dnl +[b4_use(m4_default([$2], [yykind]));])dnl m4_popdef([b4_actions_])dnl ]) @@ -487,7 +576,7 @@ # easier to use with m4_map, but then, use []dnl to suppress the last # one. m4_define([_b4_symbol_case], -[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])]) +[case b4_symbol([$1], [kind]): b4_symbol_tag_comment([$1])]) ]) @@ -507,13 +596,14 @@ # b4_token_visible_if(NUM, IF-TRUE, IF-FALSE) # ------------------------------------------- -# Whether NUM denotes a token that has an exported definition (i.e., -# shows in enum yytokentype). +# Whether NUM denotes a token kind that has an exported definition +# (i.e., shows in enum yytokentype). m4_define([b4_token_visible_if], [b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id], [$2], [$3])], [$3])]) + # b4_token_has_definition(NUM) # ---------------------------- # 1 if NUM is visible, nothing otherwise. @@ -530,12 +620,26 @@ # b4_token_format(FORMAT, NUM) # ---------------------------- +# If token NUM has a visible ID, format FORMAT with ID, USER_NUMBER. m4_define([b4_token_format], [b4_token_visible_if([$2], -[m4_quote(m4_format([$1], - [b4_symbol([$2], [id])], - [b4_symbol([$2], b4_api_token_raw_if([[number]], [[user_number]]))]))])]) - +[m4_format([[$1]], + b4_symbol([$2], [id]), + b4_symbol([$2], b4_api_token_raw_if([[number]], [[code]])))])]) + + +# b4_last_enum_token +# ------------------ +# The code of the last token visible token. +m4_define([_b4_last_enum_token], +[b4_token_visible_if([$1], + [m4_define([b4_last_enum_token], [$1])])]) +b4_symbol_foreach([_b4_last_enum_token]) + +# b4_last_symbol +# -------------- +# The code of the last symbol. +m4_define([b4_last_symbol], m4_eval(b4_tokens_number + b4_nterms_number - 1)) ## ------- ## ## Types. ## @@ -558,11 +662,11 @@ ])]) -# b4_type_foreach(MACRO) -# ---------------------- +# b4_type_foreach(MACRO, [SEP]) +# ----------------------------- # Invoke MACRO(SYMBOL-NUMS) for each set of SYMBOL-NUMS for each type set. m4_define([b4_type_foreach], - [m4_map([$1], m4_defn([b4_type_names]))]) + [m4_map_sep([$1], [$2], m4_defn([b4_type_names]))]) @@ -603,7 +707,7 @@ # This generates dependencies on the Bison skeletons hence lots of # useless 'git diff'. This location is useless for the regular # user (who does not care about the skeletons) and is actually not -# useful for Bison developpers too (I, Akim, never used this to locate +# useful for Bison developers too (I, Akim, never used this to locate # the code in skeletons that generated output). So disable it # completely. If someone thinks this was actually useful, a %define # variable should be provided to control the level of verbosity of @@ -683,7 +787,7 @@ [m4_pushdef([b4_occurrence], b4_occurrence)dnl m4_pushdef([b4_user_name], m4_car(b4_occurrence))dnl m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))dnl -m4_pushdef([b4_end], m4_shift(m4_shift(b4_occurrence)))dnl +m4_pushdef([b4_end], m4_shift2(b4_occurrence))dnl m4_ifndef($3[(]m4_quote(b4_user_name)[)], [b4_complain_at([b4_start], [b4_end], [[%s '%s' is not used]], @@ -878,15 +982,18 @@ # For example: # # b4_percent_define_default([[foo]], [[default value]]) +m4_define([_b4_percent_define_define], +[m4_define([b4_percent_define(]$1[)], [$2])dnl +m4_define([b4_percent_define_kind(]$1[)], + [m4_default([$3], [keyword])])dnl +m4_define([b4_percent_define_loc(]$1[)], + [[[[:-1.-1]], + [[:-1.-1]]]])dnl +m4_define([b4_percent_define_syncline(]$1[)], [[]])]) + m4_define([b4_percent_define_default], [_b4_percent_define_ifdef([$1], [], - [m4_define([b4_percent_define(]$1[)], [$2])dnl - m4_define([b4_percent_define_kind(]$1[)], - [m4_default([$3], [keyword])])dnl - m4_define([b4_percent_define_loc(]$1[)], - [[[[:-1.-1]], - [[:-1.-1]]]])dnl - m4_define([b4_percent_define_syncline(]$1[)], [[]])])]) + [_b4_percent_define_define($@)])]) # b4_percent_define_if_define(NAME, [VARIABLE = NAME]) @@ -896,11 +1003,12 @@ # to '_'. m4_define([_b4_percent_define_if_define], [m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]), - [b4_percent_define_flag_if(m4_default([$2], [$1]), - [$3], [$4])])]) + [b4_percent_define_default([m4_default([$2], [$1])], [[false]])dnl +b4_percent_define_flag_if(m4_default([$2], [$1]), + [$3], [$4])])]) + m4_define([b4_percent_define_if_define], -[b4_percent_define_default([m4_default([$2], [$1])], [[false]]) -_b4_percent_define_if_define([$1], [$2], $[1], $[2])]) +[_b4_percent_define_if_define([$1], [$2], $[1], $[2])]) # b4_percent_define_check_kind(VARIABLE, KIND, [DIAGNOSTIC = complain]) @@ -1006,6 +1114,7 @@ b4_percent_define_if_define([locations]) # Whether locations are tracked. b4_percent_define_if_define([parse.assert]) b4_percent_define_if_define([parse.trace]) +b4_percent_define_if_define([posix]) # b4_bison_locations_if([IF-TRUE]) @@ -1016,31 +1125,37 @@ [b4_locations_if([b4_percent_define_ifdef([[api.location.type]], [], [$1])])]) -# b4_error_verbose_if([IF-ERRORS-ARE-VERBOSE], [IF-NOT]) + +# %define parse.error "(custom|detailed|simple|verbose)" # ------------------------------------------------------ -# Map %define parse.error "(simple|verbose)" to b4_error_verbose_if and -# b4_error_verbose_flag. b4_percent_define_default([[parse.error]], [[simple]]) b4_percent_define_check_values([[[[parse.error]], - [[simple]], [[verbose]]]]) -m4_define([b4_error_verbose_flag], - [m4_case(b4_percent_define_get([[parse.error]]), - [simple], [[0]], - [verbose], [[1]])]) -b4_define_flag_if([error_verbose]) + [[custom]], [[detailed]], [[simple]], [[verbose]]]]) + +# b4_parse_error_case(CASE1, THEN1, CASE2, THEN2, ..., ELSE) +# ---------------------------------------------------------- +m4_define([b4_parse_error_case], +[m4_case(b4_percent_define_get([[parse.error]]), $@)]) + +# b4_parse_error_bmatch(PATTERN1, THEN1, PATTERN2, THEN2, ..., ELSE) +# ------------------------------------------------------------------ +m4_define([b4_parse_error_bmatch], +[m4_bmatch(b4_percent_define_get([[parse.error]]), $@)]) -# yytoken_table is needed to support verbose errors. -b4_error_verbose_if([m4_define([b4_token_table_flag], [1])]) +# b4_union_if([IF-UNION-ARE-USED], [IF-NOT]) # b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT]) # ---------------------------------------------- -b4_percent_define_if_define([variant]) +# Depend on whether api.value.type is union, or variant. +m4_define([b4_union_flag], [[0]]) m4_define([b4_variant_flag], [[0]]) b4_percent_define_ifdef([[api.value.type]], [m4_case(b4_percent_define_get_kind([[api.value.type]]), [keyword], - [m4_case(b4_percent_define_get([[api.value.type]]), [variant], - [m4_define([b4_variant_flag], [[1]])])])]) + [m4_case(b4_percent_define_get([[api.value.type]]), + [union], [m4_define([b4_union_flag], [[1]])], + [variant], [m4_define([b4_variant_flag], [[1]])])])]) +b4_define_flag_if([union]) b4_define_flag_if([variant]) @@ -1116,3 +1231,11 @@ # api.value.union.name. b4_percent_define_check_kind([api.value.union.name], [keyword]) + +# parse.error (custom|detailed) >< token-table. +b4_token_table_if( +[b4_parse_error_bmatch([custom\|detailed], +[b4_complain_at(b4_percent_define_get_loc([parse.error]), + [['%s' and '%s' cannot be used together]], + [%token-table], + [%define parse.error (custom|detailed)])])]) diff -Nru bison-3.5.1+dfsg/data/skeletons/c-like.m4 bison-3.8.2+dfsg/data/skeletons/c-like.m4 --- bison-3.5.1+dfsg/data/skeletons/c-like.m4 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/c-like.m4 2021-06-23 04:48:48.000000000 +0000 @@ -2,7 +2,7 @@ # Common code for C-like languages (C, C++, Java, etc.) -# Copyright (C) 2012-2015, 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2012-2015, 2018-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,17 +15,23 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . + # _b4_comment(TEXT, OPEN, CONTINUE, END) # -------------------------------------- # Put TEXT in comment. Avoid trailing spaces: don't indent empty lines. # Avoid adding indentation to the first line, as the indentation comes # from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]). +# Turn "*/" in TEXT into "* /" so that we don't unexpectedly close +# the comments before its end. # # Prefix all the output lines with PREFIX. m4_define([_b4_comment], -[$2[]m4_bpatsubst(m4_expand([[$1]]), [ +[$2[]b4_gsub(m4_expand([$1]), + [[*]/], [*\\/], + [/[*]], [/\\*], + [ \(.\)], [ $3\1])$4]) diff -Nru bison-3.5.1+dfsg/data/skeletons/c.m4 bison-3.8.2+dfsg/data/skeletons/c.m4 --- bison-3.5.1+dfsg/data/skeletons/c.m4 2020-01-19 09:55:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/c.m4 2021-08-11 16:01:12.000000000 +0000 @@ -2,7 +2,7 @@ # C M4 Macros for Bison. -# Copyright (C) 2002, 2004-2015, 2018-2020 Free Software Foundation, +# Copyright (C) 2002, 2004-2015, 2018-2021 Free Software Foundation, # Inc. # This program is free software: you can redistribute it and/or modify @@ -16,7 +16,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . m4_include(b4_skeletonsdir/[c-like.m4]) @@ -58,11 +58,11 @@ # b4_pull_flag if they use the values of the %define variables api.pure or # api.push-pull. m4_define([b4_identification], -[[/* Identify Bison output. */ -#define YYBISON 1 +[[/* Identify Bison output, and Bison version. */ +#define YYBISON ]b4_version[ -/* Bison version. */ -#define YYBISON_VERSION "]b4_version[" +/* Bison version string. */ +#define YYBISON_VERSION "]b4_version_string[" /* Skeleton name. */ #define YYSKELETON_NAME ]b4_skeleton[]m4_ifdef([b4_pure_flag], [[ @@ -101,32 +101,45 @@ b4_percent_define_default([[api.value.union.name]], [b4_api_PREFIX[][STYPE]]) +b4_percent_define_default([[api.symbol.prefix]], [[YYSYMBOL_]]) ## ------------------------ ## ## Pure/impure interfaces. ## ## ------------------------ ## -# b4_lex_formals -# -------------- +# b4_yylex_formals +# ---------------- # All the yylex formal arguments. # b4_lex_param arrives quoted twice, but we want to keep only one level. -m4_define([b4_lex_formals], -[b4_pure_if([[[[YYSTYPE *yylvalp]], [[&yylval]]][]dnl -b4_locations_if([, [[YYLTYPE *yyllocp], [&yylloc]]])])dnl +m4_define([b4_yylex_formals], +[b4_pure_if([[[b4_api_PREFIX[STYPE *yylvalp]], [[&yylval]]][]dnl +b4_locations_if([, [b4_api_PREFIX[LTYPE *yyllocp], [&yylloc]]])])dnl m4_ifdef([b4_lex_param], [, ]b4_lex_param)]) -# b4_lex -# ------ +# b4_yylex +# -------- # Call yylex. -m4_define([b4_lex], -[b4_function_call([yylex], [int], b4_lex_formals)]) +m4_define([b4_yylex], +[b4_function_call([yylex], [int], b4_yylex_formals)]) # b4_user_args # ------------ m4_define([b4_user_args], -[m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])]) +[m4_ifset([b4_parse_param], [, b4_user_args_no_comma])]) + +# b4_user_args_no_comma +# --------------------- +m4_define([b4_user_args_no_comma], +[m4_ifset([b4_parse_param], [b4_args(b4_parse_param)])]) + + +# b4_user_formals +# --------------- +# The possible parse-params formal arguments preceded by a comma. +m4_define([b4_user_formals], +[m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])]) # b4_parse_param @@ -150,13 +163,20 @@ m4_popdef([$1])dnl ])]) + +# b4_use(EXPR) +# ------------ +# Pacify the compiler about some maybe unused value. +m4_define([b4_use], +[YY_USE ($1)]) + # b4_parse_param_use([VAL], [LOC]) # -------------------------------- -# 'YYUSE' VAL, LOC if locations are enabled, and all the parse-params. +# 'YY_USE' VAL, LOC if locations are enabled, and all the parse-params. m4_define([b4_parse_param_use], -[m4_ifvaln([$1], [ YYUSE ([$1]);])dnl -b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl -b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal); +[m4_ifvaln([$1], [ b4_use([$1]);])dnl +b4_locations_if([m4_ifvaln([$2], [ b4_use([$2]);])])dnl +b4_parse_param_for([Decl], [Formal], [ b4_use(Formal); ])dnl ]) @@ -197,7 +217,11 @@ # Define private types suitable for holding small integers in C99 or later. m4_define([b4_c99_int_type_define], [m4_copy_force([b4_c99_int_type], [b4_int_type])dnl -[/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure +[#ifdef short +# undef short +#endif + +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure and (if available) are included so that the code can choose integer types of a good width. */ @@ -230,6 +254,18 @@ typedef short yytype_int16; #endif +/* Work around bug in HP-UX 11.23, which defines these macros + incorrectly for preprocessor constants. This workaround can likely + be removed in 2023, as HPE has promised support for HP-UX 11.23 + (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of + . */ +#ifdef __hpux +# undef UINT_LEAST8_MAX +# undef UINT_LEAST16_MAX +# define UINT_LEAST8_MAX 255 +# define UINT_LEAST16_MAX 65535 +#endif + #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ typedef __UINT_LEAST8_TYPE__ yytype_uint8; #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ @@ -253,6 +289,50 @@ #endif]]) +# b4_sizes_types_define +# --------------------- +# Define YYPTRDIFF_T/YYPTRDIFF_MAXIMUM, YYSIZE_T/YYSIZE_MAXIMUM, +# and YYSIZEOF. +m4_define([b4_sizes_types_define], +[[#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned +# endif +#endif + +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) +]]) + + # b4_int_type_for(NAME) # --------------------- # Return a narrow int type able to handle numbers ranging from @@ -299,17 +379,27 @@ #endif ]m4_bmatch([$1], [\bnoreturn\b], [[/* The _Noreturn keyword of C11. */ -]dnl This is an exact copy of lib/_Noreturn.h. +]dnl This is close to lib/_Noreturn.h, except that we do enable +dnl the use of [[noreturn]], because _Noreturn is used in places +dnl where [[noreturn]] works in C++. We need this in particular +dnl because of glr.cc which compiles code from glr.c in C++. +dnl And the C++ compiler chokes on _Noreturn. Also, we do not +dnl use C' _Noreturn in C++, to avoid -Wc11-extensions warnings. [#ifndef _Noreturn # if (defined __cplusplus \ && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ || (defined _MSC_VER && 1900 <= _MSC_VER))) # define _Noreturn [[noreturn]] # elif ((!defined __cplusplus || defined __clang__) \ - && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ - || 4 < __GNUC__ + (7 <= __GNUC_MINOR__))) + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ + || (!defined __STRICT_ANSI__ \ + && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \ + || (defined __apple_build_version__ \ + ? 6000000 <= __apple_build_version__ \ + : 3 < __clang_major__ + (5 <= __clang_minor__)))))) /* _Noreturn works as-is. */ -# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C +# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \ + || 0x5110 <= __SUNPRO_C) # define _Noreturn __attribute__ ((__noreturn__)) # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # define _Noreturn __declspec (noreturn) @@ -320,17 +410,23 @@ ]])[/* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YY_USE(E) ((void) (E)) #else -# define YYUSE(E) /* empty */ +# define YY_USE(E) /* empty */ #endif -#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ +#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ +# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") +# else +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# endif # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else @@ -410,7 +506,7 @@ # ------------------------------------------------------------- # Define "yy" whose contents is CONTENT. m4_define([b4_integral_parser_table_define], -[m4_ifvaln([$3], [b4_comment([$3], [ ])])dnl +[m4_ifvaln([$3], [b4_comment([$3])])dnl static const b4_int_type_for([$2]) yy$1[[]] = { $2 @@ -418,9 +514,22 @@ ]) -## ------------------------- ## -## Assigning token numbers. ## -## ------------------------- ## +## ------------- ## +## Token kinds. ## +## ------------- ## + +# Because C enums are not scoped, because tokens are exposed in the +# header, and because these tokens are common to all the parsers, we +# need to make sure their names don't collide: use the api.prefix. +# YYEOF is special, since the user may give it a different name. +m4_define([b4_symbol(-2, id)], [b4_api_PREFIX[][EMPTY]]) +m4_define([b4_symbol(-2, tag)], [[No symbol.]]) + +m4_if(b4_symbol(eof, id), [YYEOF], + [m4_define([b4_symbol(0, id)], [b4_api_PREFIX[][EOF]])]) +m4_define([b4_symbol(1, id)], [b4_api_PREFIX[][error]]) +m4_define([b4_symbol(2, id)], [b4_api_PREFIX[][UNDEF]]) + # b4_token_define(TOKEN-NUM) # -------------------------- @@ -432,44 +541,92 @@ # ---------------- # Output the definition of the tokens. m4_define([b4_token_defines], -[b4_any_token_visible_if([/* Tokens. */ -m4_join([ +[[/* Token kinds. */ +#define ]b4_symbol(empty, [id])[ -2 +]m4_join([ ], b4_symbol_map([b4_token_define])) -])]) +]) # b4_token_enum(TOKEN-NUM) # ------------------------ # Output the definition of this token as an enum. m4_define([b4_token_enum], -[b4_token_format([%s = %s], [$1])]) +[b4_token_visible_if([$1], + [m4_format([ %-30s %s], + m4_format([[%s = %s%s%s]], + b4_symbol([$1], [id]), + b4_symbol([$1], b4_api_token_raw_if([[number]], [[code]])), + m4_if([$1], b4_last_enum_token, [], [[,]])), + [b4_symbol_tag_comment([$1])])])]) # b4_token_enums # -------------- -# Output the definition of the tokens (if there are) as enums. +# The definition of the token kinds. m4_define([b4_token_enums], -[b4_any_token_visible_if([[/* Token type. */ +[b4_any_token_visible_if([[/* Token kinds. */ #ifndef ]b4_api_PREFIX[TOKENTYPE # define ]b4_api_PREFIX[TOKENTYPE enum ]b4_api_prefix[tokentype { - ]m4_join([, - ], - b4_symbol_map([b4_token_enum]))[ - }; + ]b4_symbol(empty, [id])[ = -2, +]b4_symbol_foreach([b4_token_enum])dnl +[ }; + typedef enum ]b4_api_prefix[tokentype ]b4_api_prefix[token_kind_t; #endif ]])]) # b4_token_enums_defines # ---------------------- -# Output the definition of the tokens (if there are any) as enums and, +# The definition of the tokens (if there are any) as enums and, # if POSIX Yacc is enabled, as #defines. m4_define([b4_token_enums_defines], [b4_token_enums[]b4_yacc_if([b4_token_defines])]) +# b4_symbol_translate(STRING) +# --------------------------- +# Used by "bison" in the array of symbol names to mark those that +# require translation. +m4_define([b4_symbol_translate], +[[N_($1)]]) + + + +## -------------- ## +## Symbol kinds. ## +## -------------- ## + +# b4_symbol_enum(SYMBOL-NUM) +# -------------------------- +# Output the definition of this symbol as an enum. +m4_define([b4_symbol_enum], +[m4_format([ %-40s %s], + m4_format([[%s = %s%s%s]], + b4_symbol([$1], [kind_base]), + [$1], + m4_if([$1], b4_last_symbol, [], [[,]])), + [b4_symbol_tag_comment([$1])])]) + + +# b4_declare_symbol_enum +# ---------------------- +# The definition of the symbol internal numbers as an enum. +# Defining YYEMPTY here is important: it forces the compiler +# to use a signed type, which matters for yytoken. +m4_define([b4_declare_symbol_enum], +[[/* Symbol kind. */ +enum yysymbol_kind_t +{ + ]b4_symbol(empty, [kind_base])[ = -2, +]b4_symbol_foreach([b4_symbol_enum])dnl +[}; +typedef enum yysymbol_kind_t yysymbol_kind_t; +]])]) + + ## ----------------- ## ## Semantic Values. ## ## ----------------- ## @@ -493,15 +650,6 @@ ## ---------------------- ## -# b4_function_define(NAME, RETURN-VALUE, [DECL1, NAME1], ...) -# ----------------------------------------------------------- -# Declare the function NAME in C. -m4_define([b4_function_define], -[$2 -$1 (b4_formals(m4_shift2($@)))[]dnl -]) - - # b4_formals([DECL1, NAME1], ...) # ------------------------------- # The formal arguments of a C function definition. @@ -514,12 +662,6 @@ [$1]) - -## ----------------------- ## -## Declaring C functions. ## -## ----------------------- ## - - # b4_function_declare(NAME, RETURN-VALUE, [DECL1, NAME1], ...) # ------------------------------------------------------------ # Declare the function NAME. @@ -529,7 +671,6 @@ - ## --------------------- ## ## Calling C functions. ## ## --------------------- ## @@ -566,10 +707,10 @@ ## User actions. ## ## -------------- ## -# b4_case(LABEL, STATEMENTS) -# -------------------------- +# b4_case(LABEL, STATEMENTS, [COMMENTS]) +# -------------------------------------- m4_define([b4_case], -[ case $1: +[ case $1:m4_ifval([$3], [ b4_comment([$3])]) $2 b4_syncline([@oline@], [@ofile@])dnl break;]) @@ -593,18 +734,15 @@ | Release the memory associated to this symbol. | `-----------------------------------------------*/ -]b4_function_define([yydestruct], - [static void], - [[const char *yymsg], [yymsg]], - [[int yytype], [yytype]], - [[YYSTYPE *yyvaluep], [yyvaluep]][]dnl -b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl -m4_ifset([b4_parse_param], [, b4_parse_param]))[ +static void +yydestruct (const char *yymsg, + yysymbol_kind_t yykind, YYSTYPE *yyvaluep]b4_locations_if(dnl +[[, YYLTYPE *yylocationp]])[]b4_user_formals[) { ]b4_parse_param_use([yyvaluep], [yylocationp])dnl [ if (!yymsg) yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN ]b4_symbol_actions([destructor])[ @@ -622,25 +760,15 @@ | Print this symbol's value on YYO. | `-----------------------------------*/ -]b4_function_define([yy_symbol_value_print], - [static void], - [[FILE *yyo], [yyo]], - [[int yytype], [yytype]], - [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl -b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl -m4_ifset([b4_parse_param], [, b4_parse_param]))[ +static void +yy_symbol_value_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep]b4_locations_if(dnl +[[, YYLTYPE const * const yylocationp]])[]b4_user_formals[) { FILE *yyoutput = yyo; ]b4_parse_param_use([yyoutput], [yylocationp])dnl [ if (!yyvaluep) return;] -dnl glr.c does not feature yytoknum. -m4_if(b4_skeleton, ["yacc.c"], -[[# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyo, yytoknum[yytype], *yyvaluep); -# endif -]])dnl b4_percent_code_get([[pre-printer]])dnl YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN b4_symbol_actions([printer]) @@ -653,21 +781,18 @@ | Print this symbol on YYO. | `---------------------------*/ -]b4_function_define([yy_symbol_print], - [static void], - [[FILE *yyo], [yyo]], - [[int yytype], [yytype]], - [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl -b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl -m4_ifset([b4_parse_param], [, b4_parse_param]))[ +static void +yy_symbol_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep]b4_locations_if(dnl +[[, YYLTYPE const * const yylocationp]])[]b4_user_formals[) { YYFPRINTF (yyo, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); -]b4_locations_if([ YY_LOCATION_PRINT (yyo, *yylocationp); +]b4_locations_if([ YYLOCATION_PRINT (yyo, yylocationp); YYFPRINTF (yyo, ": "); ])dnl -[ yy_symbol_value_print (yyo, yytype, yyvaluep]dnl +[ yy_symbol_value_print (yyo, yykind, yyvaluep]dnl b4_locations_if([, yylocationp])[]b4_user_args[); YYFPRINTF (yyo, ")"); }]dnl @@ -693,11 +818,11 @@ [m4_define([b4_symbol($1, type_tag)], [b4_symbol_if([$1], [has_id], [b4_symbol([$1], [id])], - [yytype_[]b4_symbol([$1], [number])])])dnl + [yykind_[]b4_symbol([$1], [number])])])dnl m4_append([b4_union_members], -m4_expand([ - b4_symbol_tag_comment([$1])dnl - b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);])) +m4_expand([m4_format([ %-40s %s], + m4_expand([b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]), + [b4_symbol_tag_comment([$1])])])) ]) @@ -851,7 +976,7 @@ # b4_declare_yylstype # ------------------- -# Declarations that might either go into the header (if --defines) or +# Declarations that might either go into the header (if --header) or # in the parser body. Declare YYSTYPE/YYLTYPE, and yylval/yylloc. m4_define([b4_declare_yylstype], [b4_value_type_define[]b4_locations_if([ @@ -921,25 +1046,30 @@ #endif ]]) -# b4_yy_location_print_define -# --------------------------- -# Define YY_LOCATION_PRINT. -m4_define([b4_yy_location_print_define], +# b4_yylocation_print_define +# -------------------------- +# Define YYLOCATION_PRINT. +m4_define([b4_yylocation_print_define], [b4_locations_if([[ -/* YY_LOCATION_PRINT -- Print the location on the stream. +/* YYLOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ -#ifndef YY_LOCATION_PRINT -# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL +# ifndef YYLOCATION_PRINT + +# if defined YY_LOCATION_PRINT + + /* Temporary convenience wrapper in case some people defined the + undocumented and private YY_LOCATION_PRINT macros. */ +# define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc)) + +# elif defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ YY_ATTRIBUTE_UNUSED -]b4_function_define([yy_location_print_], - [static int], - [[FILE *yyo], [yyo]], - [[YYLTYPE const * const yylocp], [yylocp]])[ +static int +yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; @@ -961,19 +1091,23 @@ res += YYFPRINTF (yyo, "-%d", end_col); } return res; - } +} -# define YY_LOCATION_PRINT(File, Loc) \ - yy_location_print_ (File, &(Loc)) +# define YYLOCATION_PRINT yy_location_print_ -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif]], -[[/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif]]) + /* Temporary convenience wrapper in case some people defined the + undocumented and private YY_LOCATION_PRINT macros. */ +# define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc)) + +# else + +# define YYLOCATION_PRINT(File, Loc) ((void) 0) + /* Temporary convenience wrapper in case some people defined the + undocumented and private YY_LOCATION_PRINT macros. */ +# define YY_LOCATION_PRINT YYLOCATION_PRINT + +# endif +# endif /* !defined YYLOCATION_PRINT */]]) ]) # b4_yyloc_default diff -Nru bison-3.5.1+dfsg/data/skeletons/c++.m4 bison-3.8.2+dfsg/data/skeletons/c++.m4 --- bison-3.5.1+dfsg/data/skeletons/c++.m4 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/c++.m4 2021-09-18 06:01:55.000000000 +0000 @@ -2,7 +2,7 @@ # C++ skeleton for Bison -# Copyright (C) 2002-2020 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,13 +15,15 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # Sanity checks, before defaults installed by c.m4. b4_percent_define_ifdef([[api.value.union.name]], [b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]), [named %union is invalid in C++])]) +b4_percent_define_default([[api.symbol.prefix]], [[S_]]) + m4_include(b4_skeletonsdir/[c.m4]) b4_percent_define_check_kind([api.namespace], [code], [deprecated]) @@ -103,11 +105,10 @@ # # b4_percent_define_default([[api.location.type]], [[location]]) -b4_percent_define_default([[filename_type]], [[std::string]]) +b4_percent_define_default([[api.filename.type]], [[const std::string]]) # Make it a warning for those who used betas of Bison 3.0. b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix])) -b4_percent_define_default([[global_tokens_and_yystype]], [[false]]) b4_percent_define_default([[define_location_comparison]], [m4_if(b4_percent_define_get([[filename_type]]), [std::string], [[true]], [[false]])]) @@ -160,20 +161,42 @@ [::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])]) +## ------------- ## +## Token kinds. ## +## ------------- ## + + # b4_token_enums # -------------- -# Output the definition of the tokens as enums. +# Output the definition of the token kinds. m4_define([b4_token_enums], -[[enum yytokentype +[[enum token_kind_type { - ]m4_join([, - ], - b4_symbol_map([b4_token_enum]))[ - };]dnl + ]b4_symbol([-2], [id])[ = -2, +]b4_symbol_foreach([b4_token_enum])dnl +[ };]dnl ]) +## -------------- ## +## Symbol kinds. ## +## -------------- ## + +# b4_declare_symbol_enum +# ---------------------- +# The definition of the symbol internal numbers as an enum. +# Defining YYEMPTY here is important: it forces the compiler +# to use a signed type, which matters for yytoken. +m4_define([b4_declare_symbol_enum], +[[enum symbol_kind_type + { + YYNTOKENS = ]b4_tokens_number[, ///< Number of tokens. + ]b4_symbol(empty, kind_base)[ = -2, +]b4_symbol_foreach([ b4_symbol_enum])dnl +[ };]]) + + ## ----------------- ## ## Semantic Values. ## @@ -183,16 +206,16 @@ # b4_value_type_declare # --------------------- -# Declare semantic_type. +# Declare value_type. m4_define([b4_value_type_declare], [b4_value_type_setup[]dnl [ /// Symbol semantic values. ]m4_bmatch(b4_percent_define_get_kind([[api.value.type]]), [code], -[[ typedef ]b4_percent_define_get([[api.value.type]])[ semantic_type;]], +[[ typedef ]b4_percent_define_get([[api.value.type]])[ value_type;]], [m4_bmatch(b4_percent_define_get([[api.value.type]]), [union\|union-directive], -[[ union semantic_type +[[ union value_type { ]b4_user_union_members[ };]])])dnl @@ -204,11 +227,19 @@ # Define the public types: token, semantic value, location, and so forth. # Depending on %define token_lex, may be output in the header or source file. m4_define([b4_public_types_declare], -[[#ifndef ]b4_api_PREFIX[STYPE -]b4_value_type_declare[ +[b4_glr2_cc_if( +[b4_value_type_declare], +[[#ifdef ]b4_api_PREFIX[STYPE +# ifdef __GNUC__ +# pragma GCC message "bison: do not #define ]b4_api_PREFIX[STYPE in C++, use %define api.value.type" +# endif + typedef ]b4_api_PREFIX[STYPE value_type; #else - typedef ]b4_api_PREFIX[STYPE semantic_type; -#endif]b4_locations_if([ +]b4_value_type_declare[ +#endif + /// Backward compatibility (Bison 3.8). + typedef value_type semantic_type; +]])[]b4_locations_if([ /// Symbol locations. typedef b4_percent_define_get([[api.location.type]], [[location]]) location_type;])[ @@ -231,23 +262,31 @@ location_type location;])[ }; - /// Tokens. + /// Token kinds. struct token { - ]b4_token_enums[ + ]b4_token_enums[]b4_glr2_cc_if([], [[ + /// Backward compatibility alias (Bison 3.6). + typedef token_kind_type yytokentype;]])[ }; - /// (External) token type, as returned by yylex. - typedef token::yytokentype token_type; + /// Token kind, as returned by yylex. + typedef token::token_kind_type token_kind_type;]b4_glr2_cc_if([], [[ + + /// Backward compatibility alias (Bison 3.6). + typedef token_kind_type token_type;]])[ - /// Symbol type: an internal symbol number. - typedef int symbol_number_type; + /// Symbol kinds. + struct symbol_kind + { + ]b4_declare_symbol_enum[ + }; - /// The symbol type number to denote an empty symbol. - enum { empty_symbol = -2 }; + /// (Internal) symbol kind. + typedef symbol_kind::symbol_kind_type symbol_kind_type; - /// Internal symbol number for tokens (subsumed by symbol_number_type). - typedef ]b4_int_type_for([b4_translate])[ token_number_type; + /// The number of tokens. + static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS; ]]) @@ -258,8 +297,8 @@ m4_define([b4_symbol_type_define], [[ /// A complete symbol. /// - /// Expects its Base type to provide access to the symbol type - /// via type_get (). + /// Expects its Base type to provide access to the symbol kind + /// via kind (). /// /// Provide access to semantic value]b4_locations_if([ and location])[. template @@ -269,28 +308,36 @@ typedef Base super_type; /// Default constructor. - basic_symbol () + basic_symbol () YY_NOEXCEPT : value ()]b4_locations_if([ , location ()])[ {} #if 201103L <= YY_CPLUSPLUS /// Move constructor. - basic_symbol (basic_symbol&& that); + basic_symbol (basic_symbol&& that) + : Base (std::move (that)) + , value (]b4_variant_if([], [std::move (that.value)]))b4_locations_if([ + , location (std::move (that.location))])[ + {]b4_variant_if([ + b4_symbol_variant([this->kind ()], [value], [move], + [std::move (that.value)]) + ])[} #endif /// Copy constructor. basic_symbol (const basic_symbol& that);]b4_variant_if([[ - /// Constructor for valueless symbols, and symbols from each type. -]b4_type_foreach([b4_basic_symbol_constructor_define])], [[ + /// Constructors for typed symbols. +]b4_type_foreach([b4_basic_symbol_constructor_define], [ +])], [[ /// Constructor for valueless symbols. basic_symbol (typename Base::kind_type t]b4_locations_if([, YY_MOVE_REF (location_type) l])[); /// Constructor for symbols with semantic value. basic_symbol (typename Base::kind_type t, - YY_RVREF (semantic_type) v]b4_locations_if([, + YY_RVREF (value_type) v]b4_locations_if([, YY_RVREF (location_type) l])[); ]])[ /// Destroy the symbol. @@ -299,25 +346,75 @@ clear (); } +]b4_glr2_cc_if([[ + /// Copy assignment. + basic_symbol& operator= (const basic_symbol& that) + { + Base::operator= (that);]b4_variant_if([[ + ]b4_symbol_variant([this->kind ()], [value], [copy], + [that.value])], [[ + value = that.value]])[;]b4_locations_if([[ + location = that.location;]])[ + return *this; + } + + /// Move assignment. + basic_symbol& operator= (basic_symbol&& that) + { + Base::operator= (std::move (that));]b4_variant_if([[ + ]b4_symbol_variant([this->kind ()], [value], [move], + [std::move (that.value)])], [[ + value = std::move (that.value)]])[;]b4_locations_if([[ + location = std::move (that.location);]])[ + return *this; + } +]])[ + /// Destroy contents, and record that is empty. - void clear () + void clear () YY_NOEXCEPT {]b4_variant_if([[ // User destructor. - symbol_number_type yytype = this->type_get (); + symbol_kind_type yykind = this->kind (); basic_symbol& yysym = *this; (void) yysym; - switch (yytype) + switch (yykind) { ]b4_symbol_foreach([b4_symbol_destructor])dnl [ default: break; } - // Type destructor. -]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[ + // Value type destructor. +]b4_symbol_variant([[yykind]], [[value]], [[template destroy]])])[ Base::clear (); } +]b4_parse_error_bmatch( +[custom\|detailed], +[[ /// The user-facing name of this symbol. + const char *name () const YY_NOEXCEPT + { + return ]b4_parser_class[::symbol_name (this->kind ()); + }]], +[simple], +[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[ + /// The user-facing name of this symbol. + const char *name () const YY_NOEXCEPT + { + return ]b4_parser_class[::symbol_name (this->kind ()); + } +#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[ +]], +[verbose], +[[ /// The user-facing name of this symbol. + std::string name () const YY_NOEXCEPT + { + return ]b4_parser_class[::symbol_name (this->kind ()); + }]])[]b4_glr2_cc_if([], [[ + + /// Backward compatibility (Bison 3.6). + symbol_kind_type type_get () const YY_NOEXCEPT;]])[ + /// Whether empty. bool empty () const YY_NOEXCEPT; @@ -325,7 +422,7 @@ void move (basic_symbol& s); /// The semantic value. - semantic_type value;]b4_locations_if([ + value_type value;]b4_locations_if([ /// The location. location_type location;])[ @@ -338,52 +435,65 @@ }; /// Type access provider for token (enum) based symbols. - struct by_type + struct by_kind { + /// The symbol kind as needed by the constructor. + typedef token_kind_type kind_type; + /// Default constructor. - by_type (); + by_kind () YY_NOEXCEPT; #if 201103L <= YY_CPLUSPLUS /// Move constructor. - by_type (by_type&& that); + by_kind (by_kind&& that) YY_NOEXCEPT; #endif /// Copy constructor. - by_type (const by_type& that); - - /// The symbol type as needed by the constructor. - typedef token_type kind_type; + by_kind (const by_kind& that) YY_NOEXCEPT; /// Constructor from (external) token numbers. - by_type (kind_type t); + by_kind (kind_type t) YY_NOEXCEPT; + +]b4_glr2_cc_if([[ + /// Copy assignment. + by_kind& operator= (const by_kind& that); + + /// Move assignment. + by_kind& operator= (by_kind&& that); +]])[ /// Record that this symbol is empty. - void clear (); + void clear () YY_NOEXCEPT; - /// Steal the symbol type from \a that. - void move (by_type& that); + /// Steal the symbol kind from \a that. + void move (by_kind& that); /// The (internal) type number (corresponding to \a type). /// \a empty when empty. - symbol_number_type type_get () const YY_NOEXCEPT; + symbol_kind_type kind () const YY_NOEXCEPT;]b4_glr2_cc_if([], [[ - /// The symbol type. - /// \a empty_symbol when empty. - /// An int, not token_number_type, to be able to store empty_symbol. - int type; - }; + /// Backward compatibility (Bison 3.6). + symbol_kind_type type_get () const YY_NOEXCEPT;]])[ + + /// The symbol kind. + /// \a ]b4_symbol_prefix[YYEMPTY when empty. + symbol_kind_type kind_; + };]b4_glr2_cc_if([], [[ + + /// Backward compatibility for a private implementation detail (Bison 3.6). + typedef by_kind by_type;]])[ /// "External" symbols: returned by the scanner. - struct symbol_type : basic_symbol + struct symbol_type : basic_symbol {]b4_variant_if([[ /// Superclass. - typedef basic_symbol super_type; + typedef basic_symbol super_type; /// Empty symbol. - symbol_type () {} + symbol_type () YY_NOEXCEPT {} /// Constructor for valueless symbols, and symbols from each type. -]b4_type_foreach([_b4_token_constructor_define])dnl +]b4_type_foreach([_b4_symbol_constructor_define])dnl ])[}; ]]) @@ -393,25 +503,13 @@ # Provide the implementation needed by the public types. m4_define([b4_public_types_define], [[ // basic_symbol. -#if 201103L <= YY_CPLUSPLUS - template - ]b4_parser_class[::basic_symbol::basic_symbol (basic_symbol&& that) - : Base (std::move (that)) - , value (]b4_variant_if([], [std::move (that.value)]))b4_locations_if([ - , location (std::move (that.location))])[ - {]b4_variant_if([ - b4_symbol_variant([this->type_get ()], [value], [move], - [std::move (that.value)]) - ])[} -#endif - template ]b4_parser_class[::basic_symbol::basic_symbol (const basic_symbol& that) : Base (that) , value (]b4_variant_if([], [that.value]))b4_locations_if([ , location (that.location)])[ {]b4_variant_if([ - b4_symbol_variant([this->type_get ()], [value], [copy], + b4_symbol_variant([this->kind ()], [value], [copy], [YY_MOVE (that.value)]) ])[} @@ -429,20 +527,29 @@ template ]b4_parser_class[::basic_symbol::basic_symbol (]b4_join( [typename Base::kind_type t], - [YY_RVREF (semantic_type) v], + [YY_RVREF (value_type) v], b4_locations_if([YY_RVREF (location_type) l]))[) : Base (t) , value (]b4_variant_if([], [YY_MOVE (v)])[)]b4_locations_if([ , location (YY_MOVE (l))])[ {]b4_variant_if([[ (void) v; - ]b4_symbol_variant([this->type_get ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[ + ]b4_symbol_variant([this->kind ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[ + +]b4_glr2_cc_if([], [[ + template + ]b4_parser_class[::symbol_kind_type + ]b4_parser_class[::basic_symbol::type_get () const YY_NOEXCEPT + { + return this->kind (); + } +]])[ template bool ]b4_parser_class[::basic_symbol::empty () const YY_NOEXCEPT { - return Base::type_get () == empty_symbol; + return this->kind () == ]b4_symbol(empty, kind)[; } template @@ -450,57 +557,82 @@ ]b4_parser_class[::basic_symbol::move (basic_symbol& s) { super_type::move (s); - ]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move], + ]b4_variant_if([b4_symbol_variant([this->kind ()], [value], [move], [YY_MOVE (s.value)])], [value = YY_MOVE (s.value);])[]b4_locations_if([ location = YY_MOVE (s.location);])[ } - // by_type. - ]b4_inline([$1])b4_parser_class[::by_type::by_type () - : type (empty_symbol) + // by_kind. + ]b4_inline([$1])b4_parser_class[::by_kind::by_kind () YY_NOEXCEPT + : kind_ (]b4_symbol(empty, kind)[) {} #if 201103L <= YY_CPLUSPLUS - ]b4_inline([$1])b4_parser_class[::by_type::by_type (by_type&& that) - : type (that.type) + ]b4_inline([$1])b4_parser_class[::by_kind::by_kind (by_kind&& that) YY_NOEXCEPT + : kind_ (that.kind_) { that.clear (); } #endif - ]b4_inline([$1])b4_parser_class[::by_type::by_type (const by_type& that) - : type (that.type) + ]b4_inline([$1])b4_parser_class[::by_kind::by_kind (const by_kind& that) YY_NOEXCEPT + : kind_ (that.kind_) {} - ]b4_inline([$1])b4_parser_class[::by_type::by_type (token_type t) - : type (yytranslate_ (t)) + ]b4_inline([$1])b4_parser_class[::by_kind::by_kind (token_kind_type t) YY_NOEXCEPT + : kind_ (yytranslate_ (t)) {} +]b4_glr2_cc_if([[ + ]b4_inline([$1])]b4_parser_class[::by_kind& + b4_parser_class[::by_kind::by_kind::operator= (const by_kind& that) + { + kind_ = that.kind_; + return *this; + } + + ]b4_inline([$1])]b4_parser_class[::by_kind& + b4_parser_class[::by_kind::by_kind::operator= (by_kind&& that) + { + kind_ = that.kind_; + that.clear (); + return *this; + } +]])[ + ]b4_inline([$1])[void - ]b4_parser_class[::by_type::clear () + ]b4_parser_class[::by_kind::clear () YY_NOEXCEPT { - type = empty_symbol; + kind_ = ]b4_symbol(empty, kind)[; } ]b4_inline([$1])[void - ]b4_parser_class[::by_type::move (by_type& that) + ]b4_parser_class[::by_kind::move (by_kind& that) { - type = that.type; + kind_ = that.kind_; that.clear (); } - ]b4_inline([$1])[int - ]b4_parser_class[::by_type::type_get () const YY_NOEXCEPT + ]b4_inline([$1])[]b4_parser_class[::symbol_kind_type + ]b4_parser_class[::by_kind::kind () const YY_NOEXCEPT { - return type; + return kind_; } + +]b4_glr2_cc_if([], [[ + ]b4_inline([$1])[]b4_parser_class[::symbol_kind_type + ]b4_parser_class[::by_kind::type_get () const YY_NOEXCEPT + { + return this->kind (); + } +]])[ ]]) # b4_token_constructor_define # ---------------------------- -# Define symbol constructors for all the value types. +# Define make_FOO for all the token kinds. # Use at class-level. Redefined in variant.hh. m4_define([b4_token_constructor_define], []) @@ -510,27 +642,28 @@ # Define yytranslate_. Sometimes used in the header file ($1=hh), # sometimes in the cc file. m4_define([b4_yytranslate_define], -[ b4_inline([$1])b4_parser_class[::token_number_type - ]b4_parser_class[::yytranslate_ (int t) +[ b4_inline([$1])b4_parser_class[::symbol_kind_type + ]b4_parser_class[::yytranslate_ (int t) YY_NOEXCEPT { ]b4_api_token_raw_if( -[[ return static_cast (t);]], +[[ return static_cast (t);]], [[ // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to // TOKEN-NUM as returned by yylex. static - const token_number_type + const ]b4_int_type_for([b4_translate])[ translate_table[] = { ]b4_translate[ }; - const int user_token_number_max_ = ]b4_user_token_number_max[; + // Last valid token kind. + const int code_max = ]b4_code_max[; if (t <= 0) - return yyeof_; - else if (t <= user_token_number_max_) - return translate_table[t]; + return symbol_kind::]b4_symbol_prefix[YYEOF; + else if (t <= code_max) + return static_cast (translate_table[t]); else - return yy_undef_token_;]])[ + return symbol_kind::]b4_symbol_prefix[YYUNDEF;]])[ } ]]) diff -Nru bison-3.5.1+dfsg/data/skeletons/c-skel.m4 bison-3.8.2+dfsg/data/skeletons/c-skel.m4 --- bison-3.5.1+dfsg/data/skeletons/c-skel.m4 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/c-skel.m4 2021-06-23 04:48:48.000000000 +0000 @@ -2,7 +2,7 @@ # C skeleton dispatching for Bison. -# Copyright (C) 2006-2007, 2009-2015, 2018-2020 Free Software +# Copyright (C) 2006-2007, 2009-2015, 2018-2021 Free Software # Foundation, Inc. # This program is free software: you can redistribute it and/or modify @@ -16,7 +16,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . b4_glr_if( [m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])]) b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])]) diff -Nru bison-3.5.1+dfsg/data/skeletons/c++-skel.m4 bison-3.8.2+dfsg/data/skeletons/c++-skel.m4 --- bison-3.5.1+dfsg/data/skeletons/c++-skel.m4 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/c++-skel.m4 2021-06-23 04:48:48.000000000 +0000 @@ -2,7 +2,7 @@ # C++ skeleton dispatching for Bison. -# Copyright (C) 2006-2007, 2009-2015, 2018-2020 Free Software +# Copyright (C) 2006-2007, 2009-2015, 2018-2021 Free Software # Foundation, Inc. # This program is free software: you can redistribute it and/or modify @@ -16,7 +16,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . b4_glr_if( [m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])]) b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])]) diff -Nru bison-3.5.1+dfsg/data/skeletons/d.m4 bison-3.8.2+dfsg/data/skeletons/d.m4 --- bison-3.5.1+dfsg/data/skeletons/d.m4 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/d.m4 2021-08-08 06:59:01.000000000 +0000 @@ -2,7 +2,7 @@ # D language support for Bison -# Copyright (C) 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2018-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,27 +15,36 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . -# _b4_comment(TEXT, OPEN, CONTINUE, END) -# -------------------------------------- -# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines. -# Avoid adding indentation to the first line, as the indentation comes -# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]). -# -# Prefix all the output lines with PREFIX. -m4_define([_b4_comment], -[$2[]m4_bpatsubst(m4_expand([[$1]]), [ -\(.\)], [ -$3\1])$4]) +m4_include(b4_skeletonsdir/[c-like.m4]) -# b4_comment(TEXT, [PREFIX]) -# -------------------------- -# Put TEXT in comment. Prefix all the output lines with PREFIX. -m4_define([b4_comment], -[_b4_comment([$1], [$2/* ], [$2 ], [ */])]) +# b4_symbol_action(SYMBOL-NUM, ACTION) +# ------------------------------------ +# Run the action ACTION ("destructor" or "printer") for SYMBOL-NUM. +m4_define([b4_symbol_action], +[b4_symbol_if([$1], [has_$2], +[b4_dollar_pushdef([yyval], + [$1], + [], + [yyloc])dnl + _b4_symbol_case([$1])[]dnl +b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])dnl +b4_symbol([$1], [$2]) +b4_syncline([@oline@], [@ofile@])dnl + break; + +b4_dollar_popdef[]dnl +])]) + + +# b4_use(EXPR) +# ------------ +# Pacify the compiler about some maybe unused value. +m4_define([b4_use], +[]) # b4_sync_start(LINE, FILE) @@ -58,6 +67,23 @@ [m4_ifval(m4_quote(b4_percent_define_get([$1])), [$2[]b4_percent_define_get([$1])[]$3], [$4])]) +# b4_percent_define_if_get2(ARG1, ARG2, DEF, NOT) +# ----------------------------------------------- +# Expand to the value of DEF if ARG1 or ARG2 are %define'ed, +# otherwise NOT. +m4_define([b4_percent_define_if_get2], + [m4_ifval(m4_quote(b4_percent_define_get([$1])), + [$3], [m4_ifval(m4_quote(b4_percent_define_get([$2])), + [$3], [$4])])]) + +# b4_percent_define_class_before_interface(CLASS, INTERFACE) +# ---------------------------------------------------------- +# Expand to a ', ' if both a class and an interface have been %define'ed +m4_define([b4_percent_define_class_before_interface], + [m4_ifval(m4_quote(b4_percent_define_get([$1])), + [m4_ifval(m4_quote(b4_percent_define_get([$2])), + [, ])])]) + # b4_flag_value(BOOLEAN-FLAG) # --------------------------- @@ -78,8 +104,10 @@ b4_percent_define_flag_if([api.parser.abstract], [abstract ])dnl b4_percent_define_flag_if([api.parser.final], [final ])dnl [class ]b4_parser_class[]dnl -b4_percent_define_get3([api.parser.extends], [ extends ])dnl -b4_percent_define_get3([api.parser.implements], [ implements ])]) +b4_percent_define_if_get2([api.parser.extends], [api.parser.implements], [ : ])dnl +b4_percent_define_get([api.parser.extends])dnl +b4_percent_define_class_before_interface([api.parser.extends], [api.parser.implements])dnl +b4_percent_define_get([api.parser.implements])]) # b4_lexer_if(TRUE, FALSE) @@ -103,12 +131,12 @@ # b4_identification # ----------------- m4_define([b4_identification], -[/** Version number for the Bison executable that generated this parser. */ - public static immutable string yy_bison_version = "b4_version"; +[[/** Version number for the Bison executable that generated this parser. */ + public static immutable string yy_bison_version = "]b4_version_string["; /** Name of the skeleton that generated this parser. */ - public static immutable string yy_bison_skeleton = b4_skeleton; -]) + public static immutable string yy_bison_skeleton = ]b4_skeleton[; +]]) ## ------------ ## @@ -148,9 +176,12 @@ ]) -## ------------------------- ## -## Assigning token numbers. ## -## ------------------------- ## +## ------------- ## +## Token kinds. ## +## ------------- ## + +m4_define([b4_symbol(-2, id)], [[YYEMPTY]]) +b4_percent_define_default([[api.token.raw]], [[true]]) # b4_token_enum(TOKEN-NAME, TOKEN-NUMBER) # --------------------------------------- @@ -159,22 +190,121 @@ [b4_token_format([ %s = %s, ], [$1])]) -# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) -# ----------------------------------------------------- +# b4_token_enums +# -------------- # Output the definition of the tokens as enums. m4_define([b4_token_enums], -[/* Tokens. */ -public enum YYTokenType { - - /** Token returned by the scanner to signal the end of its input. */ - EOF = 0, -b4_symbol_foreach([b4_token_enum]) +[/* Token kinds. */ +public enum TokenKind { + ]b4_symbol(empty, id)[ = -2, +b4_symbol_foreach([b4_token_enum])dnl } ]) -# b4-case(ID, CODE) -# ----------------- -m4_define([b4_case], [ case $1: +# b4_symbol_translate(STRING) +# --------------------------- +# Used by "bison" in the array of symbol names to mark those that +# require translation. +m4_define([b4_symbol_translate], +[[_($1)]]) + + +# _b4_token_constructor_define(SYMBOL-NUM) +# ---------------------------------------- +# Define Symbol.FOO for SYMBOL-NUM. +m4_define([_b4_token_constructor_define], +[b4_token_visible_if([$1], +[[ + static auto ]b4_symbol([$1], [id])[(]b4_symbol_if([$1], [has_type], +[b4_union_if([b4_symbol([$1], [type]], +[[typeof(YYSemanticType.]b4_symbol([$1], [type])[]])) [val]])dnl +[]b4_locations_if([b4_symbol_if([$1], [has_type], [[, ]])[Location l]])[) + { + return Symbol(TokenKind.]b4_symbol([$1], [id])[]b4_symbol_if([$1], [has_type], + [[, val]])[]b4_locations_if([[, l]])[); + }]])]) + +# b4_token_constructor_define +# --------------------------- +# Define Symbol.FOO for each token kind FOO. +m4_define([b4_token_constructor_define], +[[ + /* Implementation of token constructors for each symbol type visible to + * the user. The code generates static methods that have the same names + * as the TokenKinds. + */]b4_symbol_foreach([_b4_token_constructor_define])dnl +]) + +## -------------- ## +## Symbol kinds. ## +## -------------- ## + +# b4_symbol_kind(NUM) +# ------------------- +m4_define([b4_symbol_kind], +[SymbolKind.b4_symbol_kind_base($@)]) + + +# b4_symbol_enum(SYMBOL-NUM) +# -------------------------- +# Output the definition of this symbol as an enum. +m4_define([b4_symbol_enum], +[m4_format([ %-30s %s], + m4_format([[%s = %s,]], + b4_symbol([$1], [kind_base]), + [$1]), + [b4_symbol_tag_comment([$1])])]) + + +# b4_declare_symbol_enum +# ---------------------- +# The definition of the symbol internal numbers as an enum. +# Defining YYEMPTY here is important: it forces the compiler +# to use a signed type, which matters for yytoken. +m4_define([b4_declare_symbol_enum], +[[ /* Symbol kinds. */ + struct SymbolKind + { + enum + { + ]b4_symbol(empty, kind_base)[ = -2, /* No symbol. */ +]b4_symbol_foreach([b4_symbol_enum])dnl +[ } + + private int yycode_; + alias yycode_ this; + + this(int code) + { + yycode_ = code; + } + + /* Return YYSTR after stripping away unnecessary quotes and + backslashes, so that it's suitable for yyerror. The heuristic is + that double-quoting is unnecessary unless the string contains an + apostrophe, a comma, or backslash (other than backslash-backslash). + YYSTR is taken from yytname. */ + final void toString(W)(W sink) const + if (isOutputRange!(W, char)) + { + immutable string[] yy_sname = @{ + ]b4_symbol_names[ + @};]b4_has_translations_if([[ + /* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is + internationalizable. */ + immutable ]b4_int_type_for([b4_translatable])[[] yytranslatable = @{ + ]b4_translatable[ + @};]])[ + + put(sink, yy_sname[yycode_]); + } + } +]]) + + +# b4_case(ID, CODE, [COMMENTS]) +# ----------------------------- +m4_define([b4_case], [ case $1:m4_ifval([$3], [ b4_comment([$3])]) $2 break;]) @@ -199,6 +329,109 @@ m4_define([b4_position_type], b4_percent_define_ifdef([[position_type]],[b4_percent_define_get([[position_type]])],[YYPosition])) +## ---------------- ## +## api.value.type. ## +## ---------------- ## + + +# ---------------------- # +# api.value.type=union. # +# ---------------------- # + +# b4_symbol_type_register(SYMBOL-NUM) +# ----------------------------------- +# Symbol SYMBOL-NUM has a type (for union) instead of a type-tag. +# Extend the definition of %union's body (b4_union_members) with a +# field of that type, and extend the symbol's "type" field to point to +# the field name, instead of the type name. +m4_define([b4_symbol_type_register], +[m4_define([b4_symbol($1, type_tag)], + [b4_symbol_if([$1], [has_id], + [b4_symbol([$1], [id])], + [yykind_[]b4_symbol([$1], [number])])])dnl +m4_append([b4_union_members], +m4_expand([m4_format([ %-40s %s], + m4_expand([b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]), + [b4_symbol_tag_comment([$1])])])) +]) + + +# b4_type_define_tag(SYMBOL1-NUM, ...) +# ------------------------------------ +# For the batch of symbols SYMBOL1-NUM... (which all have the same +# type), enhance the %union definition for each of them, and set +# there "type" field to the field tag name, instead of the type name. +m4_define([b4_type_define_tag], +[b4_symbol_if([$1], [has_type], + [m4_map([b4_symbol_type_register], [$@])]) +]) + + +# b4_symbol_value_union(VAL, SYMBOL-NUM, [TYPE]) +# ---------------------------------------------- +# Same of b4_symbol_value, but when api.value.type=union. +m4_define([b4_symbol_value_union], +[m4_ifval([$3], + [(*($3*)(&$1))], + [m4_ifval([$2], + [b4_symbol_if([$2], [has_type], + [($1.b4_symbol([$2], [type_tag]))], + [$1])], + [$1])])]) + + +# b4_value_type_setup_union +# ------------------------- +# Setup support for api.value.type=union. Symbols are defined with a +# type instead of a union member name: build the corresponding union, +# and give the symbols their tag. +m4_define([b4_value_type_setup_union], +[m4_define([b4_union_members]) +b4_type_foreach([b4_type_define_tag]) +m4_copy_force([b4_symbol_value_union], [b4_symbol_value]) +]) + + +# _b4_value_type_setup_keyword +# ---------------------------- +# api.value.type is defined with a keyword/string syntax. Check if +# that is properly defined, and prepare its use. +m4_define([_b4_value_type_setup_keyword], +[b4_percent_define_check_values([[[[api.value.type]], + [[none]], + [[union]], + [[union-directive]], + [[yystype]]]])dnl +m4_case(b4_percent_define_get([[api.value.type]]), + [union], [b4_value_type_setup_union])]) + + +# b4_value_type_setup +# ------------------- +# Check if api.value.type is properly defined, and possibly prepare +# its use. +b4_define_silent([b4_value_type_setup], +[ +# Define default value. +b4_percent_define_ifdef([[api.value.type]], [], +[# %union => api.value.type=union-directive +m4_ifdef([b4_union_members], +[m4_define([b4_percent_define_kind(api.value.type)], [keyword]) +m4_define([b4_percent_define(api.value.type)], [union-directive])], +[# no tag seen => api.value.type={int} +m4_if(b4_tag_seen_flag, 0, +[m4_define([b4_percent_define_kind(api.value.type)], [code]) +m4_define([b4_percent_define(api.value.type)], [int])], +[# otherwise api.value.type=yystype +m4_define([b4_percent_define_kind(api.value.type)], [keyword]) +m4_define([b4_percent_define(api.value.type)], [yystype])])])]) + +# Set up. +m4_bmatch(b4_percent_define_get_kind([[api.value.type]]), + [keyword], [_b4_value_type_setup_keyword]) +]) + + ## ----------------- ## ## Semantic Values. ## ## ----------------- ## @@ -245,7 +478,7 @@ # Expansion of @POS, where the current rule has RULE-LENGTH symbols # on RHS. m4_define([b4_rhs_location], -[yystack.locationAt ([$1], [$2])]) +[yystack.locationAt (b4_subtract($@))]) # b4_lex_param @@ -330,3 +563,66 @@ ], [$@])]) m4_define([b4_var_decl], [ protected $1;]) + + +# b4_public_types_declare +# ----------------------- +# Define the public types: token, semantic value, location, and so forth. +# Depending on %define token_lex, may be output in the header or source file. +m4_define([b4_public_types_declare], +[[ +alias Symbol = ]b4_parser_class[.Symbol; +alias Value = ]b4_yystype[;]b4_locations_if([[ +alias Location = ]b4_location_type[; +alias Position = ]b4_position_type[;]b4_push_if([[ +alias PUSH_MORE = ]b4_parser_class[.YYPUSH_MORE; +alias ABORT = ]b4_parser_class[.YYABORT; +alias ACCEPT = ]b4_parser_class[.YYACCEPT;]])[]])[ +]]) + + +# b4_basic_symbol_constructor_define +# ---------------------------------- +# Create Symbol struct constructors for all the visible types. +m4_define([b4_basic_symbol_constructor_define], +[b4_token_visible_if([$1], +[[ this(TokenKind token]b4_symbol_if([$1], [has_type], +[[, ]b4_union_if([], [[typeof(YYSemanticType.]])b4_symbol([$1], [type])dnl +[]b4_union_if([], [[) ]])[ val]])[]b4_locations_if([[, Location loc]])[) + { + kind = yytranslate_(token);]b4_union_if([b4_symbol_if([$1], [has_type], [[ + static foreach (member; __traits(allMembers, YYSemanticType)) + { + static if (is(typeof(mixin("value_." ~ member)) == ]b4_symbol([$1], [type])[)) + { + mixin("value_." ~ member ~ " = val;"); + } + }]])], [b4_symbol_if([$1], [has_type], [[ + value_.]b4_symbol([$1], [type])[ = val;]])])[]b4_locations_if([ + location_ = loc;])[ + } +]])]) + + +# b4_symbol_type_define +# --------------------- +# Define symbol_type, the external type for symbols used for symbol +# constructors. +m4_define([b4_symbol_type_define], +[[ + /** + * A complete symbol + */ + struct Symbol + { + private SymbolKind kind; + private Value value_;]b4_locations_if([[ + private Location location_;]])[ + +]b4_type_foreach([b4_basic_symbol_constructor_define])[ + SymbolKind token() { return kind; } + Value value() { return value_; }]b4_locations_if([[ + Location location() { return location_; }]])[ +]b4_token_ctor_if([b4_token_constructor_define])[ + } +]]) diff -Nru bison-3.5.1+dfsg/data/skeletons/d-skel.m4 bison-3.8.2+dfsg/data/skeletons/d-skel.m4 --- bison-3.5.1+dfsg/data/skeletons/d-skel.m4 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/d-skel.m4 2021-06-23 04:48:48.000000000 +0000 @@ -2,7 +2,7 @@ # D skeleton dispatching for Bison. -# Copyright (C) 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2018-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . b4_glr_if( [b4_complain([%%glr-parser not supported for D])]) b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for D])]) diff -Nru bison-3.5.1+dfsg/data/skeletons/glr2.cc bison-3.8.2+dfsg/data/skeletons/glr2.cc --- bison-3.5.1+dfsg/data/skeletons/glr2.cc 1970-01-01 00:00:00.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/glr2.cc 2021-09-18 05:56:44.000000000 +0000 @@ -0,0 +1,3533 @@ +# C++ GLR skeleton for Bison + +# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +m4_include(b4_skeletonsdir/[c++.m4]) + +# api.value.type=variant is valid. +m4_define([b4_value_type_setup_variant]) + +# b4_tname_if(TNAME-NEEDED, TNAME-NOT-NEEDED) +# ------------------------------------------- +m4_define([b4_tname_if], +[m4_case(b4_percent_define_get([[parse.error]]), + [verbose], [$1], + [b4_token_table_if([$1], + [$2])])]) + +b4_bison_locations_if([ + m4_define([b4_location_constructors]) + m4_include(b4_skeletonsdir/[location.cc])]) +b4_variant_if([m4_include(b4_skeletonsdir/[variant.hh])]) + +m4_define([b4_parser_class], + [b4_percent_define_get([[api.parser.class]])]) + +]m4_define([b4_define_symbol_kind], +[m4_format([#define %-15s %s], + b4_symbol($][1, kind_base), + b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol($1, kind_base)) +]) + + +# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT) +# ------------------------------------------------------------- +# Define "yy" whose contents is CONTENT. Does not use "static", +# should be in unnamed namespace. +m4_define([b4_integral_parser_table_define], +[m4_ifvaln([$3], [ b4_comment([$3])])dnl + const b4_int_type_for([$2]) yy$1[[]] = + { + $2 + };dnl +]) + + +## ---------------- ## +## Default values. ## +## ---------------- ## + +# Stack parameters. +m4_define_default([b4_stack_depth_max], [10000]) +m4_define_default([b4_stack_depth_init], [200]) + + + +## ------------ ## +## Interfaces. ## +## ------------ ## + +# b4_user_formals +# --------------- +# The possible parse-params formal arguments preceded by a comma. +# +# This is not shared with yacc.c in c.m4 because GLR relies on ISO C +# formal argument declarations. +m4_define([b4_user_formals], +[m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])]) + + +# b4_symbol_kind(NUM) +# ------------------- +m4_define([b4_symbol_kind], +[symbol_kind::b4_symbol_kind_base($@)]) + + +## ----------------- ## +## Semantic Values. ## +## ----------------- ## + + +# b4_lhs_value(SYMBOL-NUM, [TYPE]) +# -------------------------------- +# See README. +m4_define([b4_lhs_value], +[b4_symbol_value([(*yyvalp)], [$1], [$2])]) + + +# b4_rhs_data(RULE-LENGTH, POS) +# ----------------------------- +# See README. +m4_define([b4_rhs_data], +[(static_cast(yyvsp))@{YYFILL (b4_subtract([$2], [$1]))@}.getState()]) + + +# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE]) +# -------------------------------------------------- +# Expansion of $$ or $$, for symbol SYMBOL-NUM. +m4_define([b4_rhs_value], +[b4_symbol_value([b4_rhs_data([$1], [$2]).value ()], [$3], [$4])]) + + + +## ----------- ## +## Locations. ## +## ----------- ## + +# b4_lhs_location() +# ----------------- +# Expansion of @$. +m4_define([b4_lhs_location], +[(*yylocp)]) + + +# b4_rhs_location(RULE-LENGTH, NUM) +# --------------------------------- +# Expansion of @NUM, where the current rule has RULE-LENGTH symbols +# on RHS. +m4_define([b4_rhs_location], +[(b4_rhs_data([$1], [$2]).yyloc)]) + + +# b4_symbol_action(SYMBOL-NUM, KIND) +# ---------------------------------- +# Run the action KIND (destructor or printer) for SYMBOL-NUM. +# Same as in C, but using references instead of pointers. +# +# Currently we need two different b4_symbol_action: once for the +# self-contained symbols, and another time for yy_destroy_ and +# yy_symbol_value_print_, which don't use genuine symbols yet. +m4_define([b4_symbol_action], +[b4_symbol_if([$1], [has_$2], +[m4_pushdef([b4_symbol_value], m4_defn([b4_symbol_value_template]))[]dnl +b4_dollar_pushdef([yysym.value], + [$1], + [], + [yysym.location])dnl + _b4_symbol_case([$1])[]dnl +b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])dnl + b4_symbol([$1], [$2]) +b4_syncline([@oline@], [@ofile@])dnl + break; + +m4_popdef([b4_symbol_value])[]dnl +b4_dollar_popdef[]dnl +])]) + + +# b4_symbol_action_for_yyval(SYMBOL-NUM, KIND) +# -------------------------------------------- +# Run the action KIND (destructor or printer) for SYMBOL-NUM. +# Same as in C, but using references instead of pointers. +m4_define([b4_symbol_action_for_yyval], +[b4_symbol_if([$1], [has_$2], +[b4_dollar_pushdef([yyval], + [$1], + [], + [yyloc])dnl + _b4_symbol_case([$1])[]dnl +b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])dnl + b4_symbol([$1], [$2]) +b4_syncline([@oline@], [@ofile@])dnl + break; + +b4_dollar_popdef[]dnl +])]) + + +# b4_call_merger(MERGER-NUM, MERGER-NAME, SYMBOL-SUM) +# --------------------------------------------------- +m4_define([b4_call_merger], +[b4_case([$1], + [ b4_symbol_if([$3], [has_type], + [b4_variant_if([yy0.as< b4_symbol($3, type) > () = $2 (yy0.as< b4_symbol($3, type) >(), yy1.as< b4_symbol($3, type) >());], + [yy0.b4_symbol($3, slot) = $2 (yy0, yy1);])], + [yy0 = $2 (yy0, yy1);])])]) + +# b4_yylex +# -------- +# Call yylex. +m4_define([b4_yylex], +[b4_token_ctor_if( +[b4_function_call([yylex], + [symbol_type], m4_ifdef([b4_lex_param], b4_lex_param))], +[b4_function_call([yylex], [int], + [[value_type *], [&this->yyla.value]][]dnl +b4_locations_if([, [[location_type *], [&this->yyla.location]]])dnl +m4_ifdef([b4_lex_param], [, ]b4_lex_param))])]) + + +# b4_shared_declarations(hh|cc) +# ----------------------------- +# Declaration that might either go into the header (if --header, $1 = hh) +# or in the implementation file. +m4_define([b4_shared_declarations], +[b4_percent_code_get([[requires]])[ +#include +#include // ptrdiff_t +#include // memcpy +#include +#include +#include +#include +#include +#include +#include + +]b4_cxx_portability[ +]m4_ifdef([b4_location_include], + [[# include ]b4_location_include])[ +]b4_variant_if([b4_variant_includes])[ + +]b4_YYDEBUG_define[ + +]b4_namespace_open[ + +]b4_bison_locations_if([m4_ifndef([b4_location_file], + [b4_location_define])])[ + + /// A Bison parser. + class ]b4_parser_class[ + { + public: +]b4_public_types_declare[ +]b4_symbol_type_define[ + + // FIXME: should be private eventually. + class glr_stack; + class glr_state; + + /// Build a parser object. + ]b4_parser_class[ (]b4_parse_param_decl[); + ~]b4_parser_class[ (); + + /// Parse. An alias for parse (). + /// \returns 0 iff parsing succeeded. + int operator() (); + + /// Parse. + /// \returns 0 iff parsing succeeded. + int parse (); + +#if ]b4_api_PREFIX[DEBUG + /// The current debugging stream. + std::ostream& debug_stream () const; + /// Set the current debugging stream. + void set_debug_stream (std::ostream &); + + /// Type for debugging levels. + using debug_level_type = int; + /// The current debugging level. + debug_level_type debug_level () const; + /// Set the current debugging level. + void set_debug_level (debug_level_type l); +#endif + + /// Report a syntax error.]b4_locations_if([[ + /// \param loc where the syntax error is found.]])[ + /// \param msg a description of the syntax error. + void error (]b4_locations_if([[const location_type& loc, ]])[const std::string& msg); + +]b4_parse_error_bmatch( +[custom\|detailed], +[[ /// The user-facing name of the symbol whose (internal) number is + /// YYSYMBOL. No bounds checking. + static const char *symbol_name (symbol_kind_type yysymbol);]], +[simple], +[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[ + /// The user-facing name of the symbol whose (internal) number is + /// YYSYMBOL. No bounds checking. + static const char *symbol_name (symbol_kind_type yysymbol); +#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[ +]], +[verbose], +[[ /// The user-facing name of the symbol whose (internal) number is + /// YYSYMBOL. No bounds checking. + static std::string symbol_name (symbol_kind_type yysymbol);]])[ + +]b4_token_constructor_define[ +]b4_parse_error_bmatch([custom\|detailed\|verbose], [[ + class context + { + public: + context (glr_stack& yystack, const symbol_type& yyla); + const symbol_type& lookahead () const YY_NOEXCEPT { return yyla_; } + symbol_kind_type token () const YY_NOEXCEPT { return yyla_.kind (); }]b4_locations_if([[ + const location_type& location () const YY_NOEXCEPT { return yyla_.location; } +]])[ + /// Put in YYARG at most YYARGN of the expected tokens, and return the + /// number of tokens stored in YYARG. If YYARG is null, return the + /// number of expected tokens (guaranteed to be less than YYNTOKENS). + int expected_tokens (symbol_kind_type yyarg[], int yyargn) const; + + private: + glr_stack& yystack_; + const symbol_type& yyla_; + }; +]])[ +# if ]b4_api_PREFIX[DEBUG + public: + /// \brief Report a symbol value on the debug stream. + /// \param yykind The symbol kind. + /// \param yyval Its semantic value.]b4_locations_if([[ + /// \param yyloc Its location.]])[ + void yy_symbol_value_print_ (symbol_kind_type yykind, + const value_type& yyval]b4_locations_if([[, + const location_type& yyloc]])[) const; + /// \brief Report a symbol on the debug stream. + /// \param yykind The symbol kind. + /// \param yyval Its semantic value.]b4_locations_if([[ + /// \param yyloc Its location.]])[ + void yy_symbol_print_ (symbol_kind_type yykind, + const value_type& yyval]b4_locations_if([[, + const location_type& yyloc]])[) const; + private: + /// Debug stream. + std::ostream* yycdebug_; +#endif + +]b4_parse_error_bmatch( +[custom], [[ + private: + /// Report a syntax error + /// \param yyctx the context in which the error occurred. + void report_syntax_error (const context& yyctx) const;]], +[detailed\|verbose], [[ + private: + /// The arguments of the error message. + int yy_syntax_error_arguments_ (const context& yyctx, + symbol_kind_type yyarg[], int yyargn) const; + + /// Generate an error message. + /// \param yyctx the context in which the error occurred. + virtual std::string yysyntax_error_ (const context& yyctx) const;]])[ + + /// Convert a scanner token kind \a t to a symbol kind. + /// In theory \a t should be a token_kind_type, but character literals + /// are valid, yet not members of the token_kind_type enum. + static symbol_kind_type yytranslate_ (int t) YY_NOEXCEPT; + +]b4_parse_error_bmatch( +[simple], +[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[ + /// For a symbol, its name in clear. + static const char* const yytname_[]; +#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[ +]], +[verbose], +[[ /// Convert the symbol name \a n to a form suitable for a diagnostic. + static std::string yytnamerr_ (const char *yystr); + + /// For a symbol, its name in clear. + static const char* const yytname_[]; +]])[ + + /// \brief Reclaim the memory associated to a symbol. + /// \param yymsg Why this token is reclaimed. + /// If null, print nothing. + /// \param yykind The symbol kind. + void yy_destroy_ (const char* yymsg, symbol_kind_type yykind, + value_type& yyval]b4_locations_if([[, + location_type& yyloc]])[); + +]b4_parse_param_vars[ + // Needs access to yy_destroy_, report_syntax_error, etc. + friend glr_stack; + }; + +]b4_token_ctor_if([b4_yytranslate_define([$1])[ +]b4_public_types_define([$1])])[ +]b4_namespace_close[ + +]b4_percent_code_get([[provides]])[ +]])[ + + +## -------------- ## +## Output files. ## +## -------------- ## + + +# ------------- # +# Header file. # +# ------------- # + +]b4_header_if([[ +]b4_output_begin([b4_spec_header_file])[ +]b4_copyright([Skeleton interface for Bison GLR parsers in C++], + [2002-2015, 2018-2021])[ +// C++ GLR parser skeleton written by Valentin Tolmer. + +]b4_disclaimer[ +]b4_cpp_guard_open([b4_spec_mapped_header_file])[ +]b4_shared_declarations([hh])[ +]b4_cpp_guard_close([b4_spec_mapped_header_file])[ +]b4_output_end])[ + + +# --------------------- # +# Implementation file. # +# --------------------- # + +]b4_output_begin([b4_parser_file_name])[ +]b4_copyright([Skeleton implementation for Bison GLR parsers in C], + [2002-2015, 2018-2021])[ +// C++ GLR parser skeleton written by Valentin Tolmer. + +]b4_disclaimer[ +]b4_identification[ + +]b4_percent_code_get([[top]])[ +]m4_if(b4_prefix, [yy], [], +[[/* Substitute the variable and function names. */ +#define yyparse ]b4_prefix[parse +#define yylex ]b4_prefix[lex +#define yyerror ]b4_prefix[error +#define yydebug ]b4_prefix[debug]])[ + +]b4_user_pre_prologue[ + +]b4_null_define[ + +]b4_header_if([[#include "@basename(]b4_spec_header_file[@)"]], + [b4_shared_declarations([cc])])[ + +namespace +{ + /* Default (constant) value used for initialization for null + right-hand sides. Unlike the standard yacc.c template, here we set + the default value of $$ to a zeroed-out value. Since the default + value is undefined, this behavior is technically correct. */ + ]b4_namespace_ref[::]b4_parser_class[::value_type yyval_default; +} + +]b4_user_post_prologue[ +]b4_percent_code_get[ + +#include +#include + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +// Whether we are compiled with exception support. +#ifndef YY_EXCEPTIONS +# if defined __GNUC__ && !defined __EXCEPTIONS +# define YY_EXCEPTIONS 0 +# else +# define YY_EXCEPTIONS 1 +# endif +#endif + +#ifndef YYFREE +# define YYFREE free +#endif +#ifndef YYMALLOC +# define YYMALLOC malloc +#endif + +#ifndef YYSETJMP +# include +# define YYJMP_BUF jmp_buf +# define YYSETJMP(Env) setjmp (Env) +/* Pacify Clang and ICC. */ +# define YYLONGJMP(Env, Val) \ + do { \ + longjmp (Env, Val); \ + YYASSERT (0); \ + } while (false) +#endif + +]b4_attribute_define([noreturn])[ + +#if defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_NULL_DEREFERENCE_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wnull-dereference\"") +# define YY_IGNORE_NULL_DEREFERENCE_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_IGNORE_NULL_DEREFERENCE_BEGIN +# define YY_IGNORE_NULL_DEREFERENCE_END +#endif + +]b4_null_define[ +]b4_cast_define[ + +// FIXME: Use the same conventions as lalr1.cc. +]b4_parse_assert_if[ +#ifndef YYASSERT +# define YYASSERT(Condition) ((void) ((Condition) || (abort (), 0))) +#endif + +#ifdef YYDEBUG +# define YYDASSERT(Condition) YYASSERT(Condition) +#else +# define YYDASSERT(Condition) +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL ]b4_final_state_number[ +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST ]b4_last[ + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS ]b4_tokens_number[ +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS ]b4_nterms_number[ +/* YYNRULES -- Number of rules. */ +#define YYNRULES ]b4_rules_number[ +/* YYNSTATES -- Number of states. */ +#define YYNSTATES ]b4_states_number[ +/* YYMAXRHS -- Maximum number of symbols on right-hand side of rule. */ +#define YYMAXRHS ]b4_r2_max[ +/* YYMAXLEFT -- Maximum number of symbols to the left of a handle + accessed by $0, $-1, etc., in any rule. */ +#define YYMAXLEFT ]b4_max_left_semantic_context[ + +namespace +{ +#if ]b4_api_PREFIX[DEBUG + /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + const ]b4_int_type_for([b4_rline])[ yyrline[] = + { + ]b4_rline[ + }; +#endif + +#define YYPACT_NINF ]b4_pact_ninf[ +#define YYTABLE_NINF ]b4_table_ninf[ + +]b4_parser_tables_define[ + + /* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none). */ + const ]b4_int_type_for([b4_dprec])[ yydprec[] = + { + ]b4_dprec[ + }; + + /* YYMERGER[RULE-NUM] -- Index of merging function for rule #RULE-NUM. */ + const ]b4_int_type_for([b4_merger])[ yymerger[] = + { + ]b4_merger[ + }; + + /* YYIMMEDIATE[RULE-NUM] -- True iff rule #RULE-NUM is not to be deferred, as + in the case of predicates. */ + const bool yyimmediate[] = + { + ]b4_immediate[ + }; + + /* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of + list of conflicting reductions corresponding to action entry for + state STATE-NUM in yytable. 0 means no conflicts. The list in + yyconfl is terminated by a rule number of 0. */ + const ]b4_int_type_for([b4_conflict_list_heads])[ yyconflp[] = + { + ]b4_conflict_list_heads[ + }; + + /* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by + 0, pointed into by YYCONFLP. */ + ]dnl Do not use b4_int_type_for here, since there are places where + dnl pointers onto yyconfl are taken, whose type is "short*". + dnl We probably ought to introduce a type for confl. + [const short yyconfl[] = + { + ]b4_conflicting_rules[ + }; +} // namespace + + +/* Error token number */ +#define YYTERROR 1 + +]b4_locations_if([[ +]b4_yylloc_default_define[ +# define YYRHSLOC(Rhs, K) ((Rhs)[K].getState().yyloc) +]])[ + +enum YYRESULTTAG { yyok, yyaccept, yyabort, yyerr }; + +#define YYCHK(YYE) \ + do { \ + YYRESULTTAG yychk_flag = YYE; \ + if (yychk_flag != yyok) \ + return yychk_flag; \ + } while (false) + +#if ]b4_api_PREFIX[DEBUG + +#define YYCDEBUG if (!yydebug) {} else std::cerr + +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ + do { \ + if (yydebug) \ + { \ + std::cerr << Title << ' '; \ + yyparser.yy_symbol_print_ (Kind, Value]b4_locations_if([, Location])[); \ + std::cerr << '\n'; \ + } \ + } while (false) + +# define YY_REDUCE_PRINT(Args) \ + do { \ + if (yydebug) \ + yystateStack.yy_reduce_print Args; \ + } while (false) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; + +namespace +{ + using glr_stack = ]b4_namespace_ref[::]b4_parser_class[::glr_stack; + using glr_state = ]b4_namespace_ref[::]b4_parser_class[::glr_state; + + void yypstack (const glr_stack& yystack, size_t yyk) + YY_ATTRIBUTE_UNUSED; + void yypdumpstack (const glr_stack& yystack) + YY_ATTRIBUTE_UNUSED; +} + +#else /* !]b4_api_PREFIX[DEBUG */ + +# define YYCDEBUG if (true) {} else std::cerr +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) {} +# define YY_REDUCE_PRINT(Args) {} + +#endif /* !]b4_api_PREFIX[DEBUG */ + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH ]b4_stack_depth_init[ +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + SIZE_MAX < YYMAXDEPTH * sizeof (GLRStackItem) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH ]b4_stack_depth_max[ +#endif + +/* Minimum number of free items on the stack allowed after an + allocation. This is to allow allocation and initialization + to be completed by functions that call yyexpandGLRStack before the + stack is expanded, thus insuring that all necessary pointers get + properly redirected to new data. */ +#define YYHEADROOM 2 + +#ifndef YYSTACKEXPANDABLE +# define YYSTACKEXPANDABLE 1 +#endif + +namespace +{ + template + class strong_index_alias + { + public: + static strong_index_alias create (std::ptrdiff_t value) + { + strong_index_alias result; + result.value_ = value; + return result; + } + + std::ptrdiff_t const& get () const { return value_; } + + size_t uget () const { return static_cast (value_); } + + strong_index_alias operator+ (std::ptrdiff_t other) const + { + return strong_index_alias (get () + other); + } + + void operator+= (std::ptrdiff_t other) + { + value_ += other; + } + + strong_index_alias operator- (std::ptrdiff_t other) + { + return strong_index_alias (get () - other); + } + + void operator-= (std::ptrdiff_t other) + { + value_ -= other; + } + + size_t operator- (strong_index_alias other) + { + return strong_index_alias (get () - other.get ()); + } + + strong_index_alias& operator++ () + { + ++value_; + return *this; + } + + bool isValid () const + { + return value_ != INVALID_INDEX; + } + + void setInvalid() + { + value_ = INVALID_INDEX; + } + + bool operator== (strong_index_alias other) + { + return get () == other.get (); + } + + bool operator!= (strong_index_alias other) + { + return get () != other.get (); + } + + bool operator< (strong_index_alias other) + { + return get () < other.get (); + } + + private: + static const std::ptrdiff_t INVALID_INDEX; + + // WARNING: 0-initialized. + std::ptrdiff_t value_; + }; // class strong_index_alias + + template + const std::ptrdiff_t strong_index_alias::INVALID_INDEX = + std::numeric_limits::max (); + + using state_set_index = strong_index_alias; + + state_set_index create_state_set_index (std::ptrdiff_t value) + { + return state_set_index::create (value); + } + + /** State numbers, as in LALR(1) machine */ + using state_num = int; + + /** Rule numbers, as in LALR(1) machine */ + using rule_num = int; + + using parser_type = ]b4_namespace_ref[::]b4_parser_class[; + using glr_state = parser_type::glr_state; + using symbol_kind = parser_type::symbol_kind; + using symbol_kind_type = parser_type::symbol_kind_type; + using symbol_type = parser_type::symbol_type; + using value_type = parser_type::value_type;]b4_locations_if([[ + using location_type = parser_type::location_type;]])[ + + // Forward declarations. + class glr_stack_item; + class semantic_option; +} // namespace + +namespace +{ + /** Accessing symbol of state YYSTATE. */ + inline symbol_kind_type + yy_accessing_symbol (state_num yystate) + { + return YY_CAST (symbol_kind_type, yystos[yystate]); + } + + /** Left-hand-side symbol for rule #YYRULE. */ + inline symbol_kind_type + yylhsNonterm (rule_num yyrule) + { + return static_cast(yyr1[yyrule]); + } + + /** Number of symbols composing the right hand side of rule #RULE. */ + inline int + yyrhsLength (rule_num yyrule) + { + return yyr2[yyrule]; + } +} + +namespace ]b4_namespace_ref[ +{ + class ]b4_parser_class[::glr_state + { + public: + glr_state () + : yyresolved (false) + , yylrState (0) + , yyposn (0) + , yypred (0) + , yyfirstVal (0)]b4_locations_if([[ + , yyloc ()]])[]b4_parse_assert_if([[ + , magic_ (MAGIC)]])[ + {} + + /// Build with a semantic value. + glr_state (state_num lrState, size_t posn, const value_type& val]b4_locations_if([[, const location_type& loc]])[) + : yyresolved (true) + , yylrState (lrState) + , yyposn (posn) + , yypred (0) + , yyval (]b4_variant_if([], [[val]])[)]b4_locations_if([[ + , yyloc (loc)]])[]b4_parse_assert_if([[ + , magic_ (MAGIC)]])[ + {]b4_variant_if([[ + ]b4_symbol_variant([yy_accessing_symbol (lrState)], + [yyval], [copy], [val])])[} + + /// Build with a semantic option. + glr_state (state_num lrState, size_t posn) + : yyresolved (false) + , yylrState (lrState) + , yyposn (posn) + , yypred (0) + , yyfirstVal (0)]b4_locations_if([[ + , yyloc ()]])[]b4_parse_assert_if([[ + , magic_ (MAGIC)]])[ + {} + + glr_state (const glr_state& other) + : yyresolved (other.yyresolved) + , yylrState (other.yylrState) + , yyposn (other.yyposn) + , yypred (0)]b4_locations_if([[ + , yyloc (other.yyloc)]])[]b4_parse_assert_if([[ + , magic_ (MAGIC)]])[ + { + setPred (other.pred ()); + if (other.yyresolved)]b4_variant_if([[ + { + new (&yyval) value_type (); + ]b4_symbol_variant([yy_accessing_symbol (other.yylrState)], + [yyval], [copy], [other.value ()])[ + }]], [[ + new (&yyval) value_type (other.value ());]])[ + else + { + yyfirstVal = 0; + setFirstVal (other.firstVal ()); + }]b4_parse_assert_if([[ + check_();]])[ + } + + ~glr_state () + {]b4_parse_assert_if([[ + check_ ();]])[ + if (yyresolved) + {]b4_variant_if([[ + symbol_kind_type yykind = yy_accessing_symbol (yylrState); + // FIXME: User destructors. + // Value type destructor. + ]b4_symbol_variant([[yykind]], [[yyval]], [[template destroy]])])[ + yyval.~value_type (); + }]b4_parse_assert_if([[ + magic_ = 0;]])[ + } + + glr_state& operator= (const glr_state& other) + {]b4_parse_assert_if([[ + check_ (); + other.check_ ();]])[ + if (!yyresolved && other.yyresolved) + new (&yyval) value_type; + yyresolved = other.yyresolved; + yylrState = other.yylrState; + yyposn = other.yyposn; + setPred (other.pred ()); + if (other.yyresolved)]b4_variant_if([[ + ]b4_symbol_variant([yy_accessing_symbol (other.yylrState)], + [yyval], [copy], [other.value ()])], [[ + value () = other.value ();]])[ + else + setFirstVal (other.firstVal ());]b4_locations_if([[ + yyloc = other.yyloc;]])[ + return *this; + } + + /** Type tag for the semantic value. If true, yyval applies, otherwise + * yyfirstVal applies. */ + bool yyresolved; + /** Number of corresponding LALR(1) machine state. */ + state_num yylrState; + /** Source position of the last token produced by my symbol */ + size_t yyposn; + + /// Only call pred() and setPred() on objects in yyitems, not temporaries. + glr_state* pred (); + const glr_state* pred () const; + void setPred (const glr_state* state); + + /// Only call firstVal() and setFirstVal() on objects in yyitems, not + /// temporaries. + semantic_option* firstVal (); + const semantic_option* firstVal () const; + void setFirstVal (const semantic_option* option); + + value_type& value () + {]b4_parse_assert_if([[ + check_ ();]])[ + return yyval; + } + + const value_type& value () const + {]b4_parse_assert_if([[ + check_ ();]])[ + return yyval; + } + + void + destroy (char const *yymsg, ]b4_namespace_ref[::]b4_parser_class[& yyparser); + + /* DEBUGGING ONLY */ + #if ]b4_api_PREFIX[DEBUG + void yy_yypstack () const + {]b4_parse_assert_if([[ + check_ ();]])[ + if (pred () != YY_NULLPTR) + { + pred ()->yy_yypstack (); + std::cerr << " -> "; + } + std::cerr << yylrState << "@@" << yyposn; + } + #endif + + std::ptrdiff_t indexIn (const glr_stack_item* array) const YY_ATTRIBUTE_UNUSED; + + glr_stack_item* asItem () + {]b4_parse_assert_if([[ + check_ ();]])[ + return asItem(this); + } + + const glr_stack_item* asItem () const + {]b4_parse_assert_if([[ + check_ ();]])[ + return asItem (this); + } + + private: + template + static const glr_stack_item* asItem (const T* state) + { + return reinterpret_cast(state); + } + template + static glr_stack_item* asItem (T* state) + { + return reinterpret_cast (state); + } + static const char *as_pointer_ (const glr_state *state) + { + return reinterpret_cast (state); + } + static char *as_pointer_ (glr_state *state) + { + return reinterpret_cast (state); + } + /** Preceding state in this stack */ + std::ptrdiff_t yypred; + union { + /** First in a chain of alternative reductions producing the + * nonterminal corresponding to this state, threaded through + * yyfirstVal. Value "0" means empty. */ + std::ptrdiff_t yyfirstVal; + /** Semantic value for this state. */ + value_type yyval; + };]b4_locations_if([[ + // FIXME: Why public? + public: + /** Source location for this state. */ + location_type yyloc;]])[ + +]b4_parse_assert_if([[ + public: + // Check invariants. + void check_ () const + { + YY_IGNORE_NULL_DEREFERENCE_BEGIN + YYASSERT (this->magic_ == MAGIC); + YY_IGNORE_NULL_DEREFERENCE_END + } + + // A magic number to check our pointer arithmetic is sane. + enum { MAGIC = 713705 }; + unsigned int magic_;]])[ + }; // class ]b4_parser_class[::glr_state +} // namespace ]b4_namespace_ref[ + + +namespace +{ + /** A stack of GLRState representing the different heads during + * nondeterministic evaluation. */ + class glr_state_set + { + public: + /** Initialize YYSET to a singleton set containing an empty stack. */ + glr_state_set () + : yylastDeleted (YY_NULLPTR) + { + yystates.push_back (YY_NULLPTR); + yylookaheadNeeds.push_back (false); + } + + // Behave like a vector of states. + glr_state*& operator[] (state_set_index index) + { + return yystates[index.uget()]; + } + + glr_state* operator[] (state_set_index index) const + { + return yystates[index.uget()]; + } + + size_t size () const + { + return yystates.size (); + } + + std::vector::iterator begin () + { + return yystates.begin (); + } + + std::vector::iterator end () + { + return yystates.end (); + } + + bool lookaheadNeeds (state_set_index index) const + { + return yylookaheadNeeds[index.uget ()]; + } + + bool setLookaheadNeeds (state_set_index index, bool value) + { + return yylookaheadNeeds[index.uget ()] = value; + } + + /** Invalidate stack #YYK. */ + void + yymarkStackDeleted (state_set_index yyk) + { + size_t k = yyk.uget (); + if (yystates[k] != YY_NULLPTR) + yylastDeleted = yystates[k]; + yystates[k] = YY_NULLPTR; + } + + /** Undelete the last stack in *this that was marked as deleted. Can + only be done once after a deletion, and only when all other stacks have + been deleted. */ + void + yyundeleteLastStack () + { + if (yylastDeleted == YY_NULLPTR || !yystates.empty ()) + return; + yystates.push_back (yylastDeleted); + YYCDEBUG << "Restoring last deleted stack as stack #0.\n"; + clearLastDeleted (); + } + + /** Remove the dead stacks (yystates[i] == YY_NULLPTR) and shift the later + * ones. */ + void + yyremoveDeletes () + { + size_t newsize = yystates.size (); + /* j is the number of live stacks we have seen. */ + for (size_t i = 0, j = 0; j < newsize; ++i) + { + if (yystates[i] == YY_NULLPTR) + { + if (i == j) + { + YYCDEBUG << "Removing dead stacks.\n"; + } + newsize -= 1; + } + else + { + yystates[j] = yystates[i]; + /* In the current implementation, it's unnecessary to copy + yylookaheadNeeds[i] since, after + yyremoveDeletes returns, the parser immediately either enters + deterministic operation or shifts a token. However, it doesn't + hurt, and the code might evolve to need it. */ + yylookaheadNeeds[j] = yylookaheadNeeds[i]; + if (j != i) + { + YYCDEBUG << "Rename stack " << i << " -> " << j << ".\n"; + } + j += 1; + } + } + yystates.resize (newsize); + yylookaheadNeeds.resize (newsize); + } + + + state_set_index + yysplitStack (state_set_index yyk) + { + const size_t k = yyk.uget (); + yystates.push_back (yystates[k]); + yylookaheadNeeds.push_back (yylookaheadNeeds[k]); + return create_state_set_index (static_cast (yystates.size () - 1)); + } + + void clearLastDeleted () + { + yylastDeleted = YY_NULLPTR; + } + + private: + + std::vector yystates; + /** During nondeterministic operation, yylookaheadNeeds tracks which + * stacks have actually needed the current lookahead. During deterministic + * operation, yylookaheadNeeds[0] is not maintained since it would merely + * duplicate !yyla.empty (). */ + std::vector yylookaheadNeeds; + + /** The last stack we invalidated. */ + glr_state* yylastDeleted; + }; // class glr_state_set +} // namespace + +namespace +{ + class semantic_option + { + public: + semantic_option () + : yyrule (0) + , yystate (0) + , yynext (0) + , yyla ()]b4_parse_assert_if([[ + , magic_ (MAGIC)]])[ + {} + + semantic_option (rule_num rule) + : yyrule (rule) + , yystate (0) + , yynext (0) + , yyla ()]b4_parse_assert_if([[ + , magic_ (MAGIC)]])[ + {} + + semantic_option (const semantic_option& that) + : yyrule (that.yyrule) + , yystate (that.yystate) + , yynext (that.yynext) + , yyla (that.yyla)]b4_parse_assert_if([[ + , magic_ (MAGIC)]])[ + {]b4_parse_assert_if([[ + that.check_ ();]])[ + } + + // Needed for the assignment in yynewSemanticOption. + semantic_option& operator= (const semantic_option& that) + {]b4_parse_assert_if([[ + check_ (); + that.check_ ();]])[ + yyrule = that.yyrule; + yystate = that.yystate; + yynext = that.yynext; + yyla = that.yyla; + return *this; + } + + /// Only call state() and setState() on objects in yyitems, not temporaries. + glr_state* state(); + const glr_state* state() const; + void setState(const glr_state* s); + + const semantic_option* next () const YY_ATTRIBUTE_UNUSED; + semantic_option* next (); + void setNext (const semantic_option* s); + + std::ptrdiff_t indexIn (const glr_stack_item* array) const YY_ATTRIBUTE_UNUSED; + + /** True iff YYY0 and YYY1 represent identical options at the top level. + * That is, they represent the same rule applied to RHS symbols + * that produce the same terminal symbols. */ + bool + isIdenticalTo (const semantic_option& yyy1) const + {]b4_parse_assert_if([[ + check_ (); + yyy1.check_ ();]])[ + if (this->yyrule == yyy1.yyrule) + { + const glr_state *yys0, *yys1; + int yyn; + for (yys0 = this->state(), + yys1 = yyy1.state(), + yyn = yyrhsLength (this->yyrule); + yyn > 0; + yys0 = yys0->pred(), + yys1 = yys1->pred(), yyn -= 1) + if (yys0->yyposn != yys1->yyposn) + return false; + return true; + } + else + return false; + } + + /** Assuming identicalOptions (YYY0,YYY1), destructively merge the + * alternative semantic values for the RHS-symbols of YYY1 and YYY0. */ + void + mergeWith (semantic_option& yyy1) + {]b4_parse_assert_if([[ + check_ (); + yyy1.check_ ();]])[ + glr_state *yys0 = this->state (); + glr_state *yys1 = yyy1.state (); + for (int yyn = yyrhsLength (this->yyrule); + yyn > 0; + yyn -= 1, yys0 = yys0->pred (), yys1 = yys1->pred ()) + { + if (yys0 == yys1) + break; + else if (yys0->yyresolved) + { + yys1->yyresolved = true;]b4_variant_if([[ + YYASSERT (yys1->yylrState == yys0->yylrState); + ]b4_symbol_variant([yy_accessing_symbol (yys0->yylrState)], + [yys1->value ()], [copy], [yys0->value ()])], [[ + yys1->value () = yys0->value ();]])[ + } + else if (yys1->yyresolved) + { + yys0->yyresolved = true;]b4_variant_if([[ + YYASSERT (yys0->yylrState == yys1->yylrState); + ]b4_symbol_variant([yy_accessing_symbol (yys1->yylrState)], + [yys0->value ()], [copy], [yys1->value ()])], [[ + yys0->value () = yys1->value ();]])[ + } + else + { + semantic_option* yyz0prev = YY_NULLPTR; + semantic_option* yyz0 = yys0->firstVal(); + semantic_option* yyz1 = yys1->firstVal(); + while (true) + { + if (yyz1 == yyz0 || yyz1 == YY_NULLPTR) + break; + else if (yyz0 == YY_NULLPTR) + { + if (yyz0prev != YY_NULLPTR) + yyz0prev->setNext (yyz1); + else + yys0->setFirstVal (yyz1); + break; + } + else if (yyz0 < yyz1) + { + semantic_option* yyz = yyz0; + if (yyz0prev != YY_NULLPTR) + yyz0prev->setNext(yyz1); + else + yys0->setFirstVal(yyz1); + yyz1 = yyz1->next(); + yyz0->setNext(yyz); + } + yyz0prev = yyz0; + yyz0 = yyz0->next(); + } + yys1->setFirstVal(yys0->firstVal()); + } + } + } + +#if ]b4_api_PREFIX[DEBUG + void yyreportTree (size_t yyindent = 2) const + {]b4_parse_assert_if([[ + check_ ();]])[ + int yynrhs = yyrhsLength (this->yyrule); + const glr_state* yystates[1 + YYMAXRHS]; + glr_state yyleftmost_state; + + { + const glr_state* yys = this->state(); + for (int yyi = yynrhs; 0 < yyi; yyi -= 1) + { + yystates[yyi] = yys; + yys = yys->pred(); + } + if (yys == YY_NULLPTR) + { + yyleftmost_state.yyposn = 0; + yystates[0] = &yyleftmost_state; + } + else + yystates[0] = yys; + } + + std::string yylhs = ]b4_namespace_ref[::]b4_parser_class[::symbol_name (yylhsNonterm (this->yyrule)); + YYASSERT(this->state()); + if (this->state()->yyposn < yystates[0]->yyposn + 1) + std::cerr << std::string(yyindent, ' ') << yylhs << " -> yyrule - 1 << ", empty>\n"; + else + std::cerr << std::string(yyindent, ' ') << yylhs << " -> yyrule - 1 << ", tokens " + << yystates[0]->yyposn + 1 << " .. " + << this->state()->yyposn << ">\n"; + for (int yyi = 1; yyi <= yynrhs; yyi += 1) + { + if (yystates[yyi]->yyresolved) + { + std::string yysym = ]b4_namespace_ref[::]b4_parser_class[::symbol_name (yy_accessing_symbol (yystates[yyi]->yylrState)); + if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn) + std::cerr << std::string(yyindent + 2, ' ') << yysym + << " \n"; + else + std::cerr << std::string(yyindent + 2, ' ') << yysym + << " yyposn + 1 + << " .. " << yystates[yyi]->yyposn << ">\n"; + } + else + yystates[yyi]->firstVal ()->yyreportTree (yyindent+2); + } + } +#endif + + /** Rule number for this reduction */ + rule_num yyrule; + + private: + template + static const glr_stack_item* asItem(const T* state) + { + return reinterpret_cast(state); + } + template + static glr_stack_item* asItem(T* state) + { + return reinterpret_cast(state); + } + /** The last RHS state in the list of states to be reduced. */ + std::ptrdiff_t yystate; + /** Next sibling in chain of options. To facilitate merging, + * options are chained in decreasing order by address. */ + std::ptrdiff_t yynext; + + public: + /** The lookahead for this reduction. */ + symbol_type yyla; + +]b4_parse_assert_if([[ + public: + // Check invariants. + void check_ () const + { + YY_IGNORE_NULL_DEREFERENCE_BEGIN + YYASSERT (this->magic_ == MAGIC); + YY_IGNORE_NULL_DEREFERENCE_END + } + + // A magic number to check our pointer arithmetic is sane. + enum { MAGIC = 0xeff1cace }; + unsigned int magic_;]])[ + }; // class semantic_option +} // namespace + +namespace +{ + /** Type of the items in the GLR stack. + * It can be either a glr_state or a semantic_option. The is_state_ field + * indicates which item of the union is valid. */ + class glr_stack_item + { + public: + glr_stack_item (bool state = true) + : is_state_ (state)]b4_parse_assert_if([[ + , magic_ (MAGIC)]])[ + { + if (is_state_) + new (&raw_) glr_state; + else + new (&raw_) semantic_option; + } + + glr_stack_item (const glr_stack_item& other) YY_NOEXCEPT YY_NOTHROW + : is_state_ (other.is_state_)]b4_parse_assert_if([[ + , magic_ (MAGIC)]])[ + {]b4_parse_assert_if([[ + other.check_ ();]])[ + std::memcpy (raw_, other.raw_, union_size); + } + + glr_stack_item& operator= (glr_stack_item other) + {]b4_parse_assert_if([[ + check_ (); + other.check_ ();]])[ + std::swap (is_state_, other.is_state_); + std::swap (raw_, other.raw_); + return *this; + } + + ~glr_stack_item () + {]b4_parse_assert_if([[ + check_ ();]])[ + if (is_state ()) + getState ().~glr_state (); + else + getOption ().~semantic_option (); + } + + void setState (const glr_state &state) + {]b4_parse_assert_if([[ + check_ (); + state.check_ ();]])[ + if (this != state.asItem ()) + { + if (is_state_) + getState ().~glr_state (); + else + getOption ().~semantic_option (); + new (&raw_) glr_state (state); + is_state_ = true; + } + } + + glr_state& getState () + {]b4_parse_assert_if([[ + check_ ();]])[ + YYDASSERT (is_state ()); + void *yyp = raw_; + glr_state& res = *static_cast (yyp);]b4_parse_assert_if([[ + res.check_ ();]])[ + return res; + } + + const glr_state& getState () const + {]b4_parse_assert_if([[ + check_ ();]])[ + YYDASSERT (is_state ()); + const void *yyp = raw_; + const glr_state& res = *static_cast (yyp);]b4_parse_assert_if([[ + res.check_ ();]])[ + return res; + } + + semantic_option& getOption () + {]b4_parse_assert_if([[ + check_ ();]])[ + YYDASSERT (!is_state ()); + void *yyp = raw_; + return *static_cast (yyp); + } + const semantic_option& getOption () const + {]b4_parse_assert_if([[ + check_ ();]])[ + YYDASSERT (!is_state ()); + const void *yyp = raw_; + return *static_cast (yyp); + } + bool is_state () const + {]b4_parse_assert_if([[ + check_ ();]])[ + return is_state_; + } + + private: + /// The possible contents of raw_. Since they have constructors, they cannot + /// be directly included in the union. + union contents + { + char yystate[sizeof (glr_state)]; + char yyoption[sizeof (semantic_option)]; + }; + enum { union_size = sizeof (contents) }; + union { + /// Strongest alignment constraints. + long double yyalign_me; + /// A buffer large enough to store the contents. + char raw_[union_size]; + }; + /** Type tag for the union. */ + bool is_state_; +]b4_parse_assert_if([[ + public: + // Check invariants. + void check_ () const + { + YYASSERT (this->magic_ == MAGIC); + YYASSERT (this->is_state_ == false || this->is_state_ == true); + } + // A magic number to check our pointer arithmetic is sane. + enum { MAGIC = 0xDEAD1ACC }; // 3735886540. + const unsigned int magic_;]])[ + }; // class glr_stack_item +} // namespace + +glr_state* glr_state::pred () +{]b4_parse_assert_if([[ + check_ ();]])[ + YY_IGNORE_NULL_DEREFERENCE_BEGIN + return yypred ? &asItem (as_pointer_ (this) - yypred)->getState () : YY_NULLPTR; + YY_IGNORE_NULL_DEREFERENCE_END +} + +const glr_state* glr_state::pred () const +{]b4_parse_assert_if([[ + check_ ();]])[ + YY_IGNORE_NULL_DEREFERENCE_BEGIN + return yypred ? &asItem (as_pointer_ (this) - yypred)->getState () : YY_NULLPTR; + YY_IGNORE_NULL_DEREFERENCE_END +} + +void glr_state::setPred (const glr_state* state) +{]b4_parse_assert_if([[ + check_ (); + if (state) + state->check_ ();]])[ + yypred = state ? as_pointer_ (this) - as_pointer_ (state) : 0; +} + +semantic_option* glr_state::firstVal () +{]b4_parse_assert_if([[ + check_ ();]])[ + return yyfirstVal ? &(asItem(this) - yyfirstVal)->getOption() : YY_NULLPTR; +} + +const semantic_option* glr_state::firstVal () const +{]b4_parse_assert_if([[ + check_ ();]])[ + return yyfirstVal ? &(asItem(this) - yyfirstVal)->getOption() : YY_NULLPTR; +} + +void glr_state::setFirstVal (const semantic_option* option) +{]b4_parse_assert_if([[ + check_ ();]])[ + yyfirstVal = option ? asItem(this) - asItem(option) : 0; +} + +std::ptrdiff_t glr_state::indexIn (const glr_stack_item* array) const +{]b4_parse_assert_if([[ + check_ ();]])[ + return asItem(this) - array; +} + +std::ptrdiff_t semantic_option::indexIn (const glr_stack_item* array) const +{ + return asItem(this) - array; +} + +glr_state* semantic_option::state () +{ + YY_IGNORE_NULL_DEREFERENCE_BEGIN + return yystate ? &(asItem(this) - yystate)->getState() : YY_NULLPTR; + YY_IGNORE_NULL_DEREFERENCE_END +} + +const glr_state* semantic_option::state () const +{ + return yystate ? &(asItem(this) - yystate)->getState() : YY_NULLPTR; +} + +void semantic_option::setState (const glr_state* s) +{ + yystate = s ? asItem(this) - asItem(s) : 0; +} + +const semantic_option* semantic_option::next () const +{ + return yynext ? &(asItem(this) - yynext)->getOption() : YY_NULLPTR; +} + +semantic_option* semantic_option::next () +{ + return yynext ? &(asItem(this) - yynext)->getOption() : YY_NULLPTR; +} + +void semantic_option::setNext (const semantic_option* s) +{ + yynext = s ? asItem(this) - asItem(s) : 0; +} + +void glr_state::destroy (char const* yymsg, ]b4_namespace_ref[::]b4_parser_class[& yyparser) +{]b4_parse_assert_if([[ + check_ ();]])[ + if (yyresolved) + yyparser.yy_destroy_ (yymsg, yy_accessing_symbol(yylrState), + value ()]b4_locations_if([, yyloc])[); + else + { +#if ]b4_api_PREFIX[DEBUG + YYCDEBUG << yymsg + << (firstVal() ? " unresolved " : " incomplete ") + << (yy_accessing_symbol (yylrState) < YYNTOKENS ? "token" : "nterm") + << ' ' << yyparser.symbol_name (yy_accessing_symbol (yylrState)) + << " ("]b4_locations_if([[ + << yyloc << ": "]])[ + << ")\n"; +#endif + if (firstVal() != YY_NULLPTR) + { + semantic_option& yyoption = *firstVal (); + glr_state *yyrh = yyoption.state (); + for (int yyn = yyrhsLength (yyoption.yyrule); yyn > 0; yyn -= 1) + { + yyrh->destroy (yymsg, yyparser); + yyrh = yyrh->pred(); + } + } + } +} + + +#undef YYFILL +#define YYFILL(N) yyfill (yyvsp, yylow, (N), yynormal) + +namespace +{ + class state_stack + { + public: + using parser_type = ]b4_namespace_ref[::]b4_parser_class[; + using symbol_kind = parser_type::symbol_kind; + using value_type = parser_type::value_type;]b4_locations_if([[ + using location_type = parser_type::location_type;]])[ + + /** Initialize to a single empty stack, with total maximum + * capacity for all stacks of YYSIZE. */ + state_stack (size_t yysize) + : yysplitPoint (YY_NULLPTR) + { + yyitems.reserve (yysize); + } + +#if YYSTACKEXPANDABLE + /** Returns false if it tried to expand but could not. */ + bool + yyexpandGLRStackIfNeeded () + { + return YYHEADROOM <= spaceLeft () || yyexpandGLRStack (); + } + + private: + /** If *this is expandable, extend it. WARNING: Pointers into the + stack from outside should be considered invalid after this call. + We always expand when there are 1 or fewer items left AFTER an + allocation, so that we can avoid having external pointers exist + across an allocation. */ + bool + yyexpandGLRStack () + { + const size_t oldsize = yyitems.size(); + if (YYMAXDEPTH - YYHEADROOM < oldsize) + return false; + const size_t yynewSize = YYMAXDEPTH < 2 * oldsize ? YYMAXDEPTH : 2 * oldsize; + const glr_stack_item *oldbase = &yyitems[0]; + + yyitems.reserve (yynewSize); + const glr_stack_item *newbase = &yyitems[0]; + + // Adjust the pointers. Perform raw pointer arithmetic, as there + // is no reason for objects to be aligned on their size. + const ptrdiff_t disp + = reinterpret_cast (newbase) - reinterpret_cast (oldbase); + if (yysplitPoint) + const_cast (yysplitPoint) + = reinterpret_cast (reinterpret_cast (const_cast (yysplitPoint)) + disp); + + for (std::vector::iterator + i = yytops.begin (), + yyend = yytops.end (); + i != yyend; ++i) + if (glr_state_not_null (*i)) + *i = reinterpret_cast(reinterpret_cast(*i) + disp); + + return true; + } + + public: +#else + bool yyexpandGLRStackIfNeeded () + { + return YYHEADROOM <= spaceLeft (); + } +#endif +#undef YYSTACKEXPANDABLE + + static bool glr_state_not_null (glr_state* s) + { + return s != YY_NULLPTR; + } + + bool + reduceToOneStack () + { + using iterator = std::vector::iterator; + const iterator yybegin = yytops.begin(); + const iterator yyend = yytops.end(); + const iterator yyit = std::find_if(yybegin, yyend, glr_state_not_null); + if (yyit == yyend) + return false; + for (state_set_index yyk = create_state_set_index(yyit + 1 - yybegin); + yyk.uget() != numTops(); ++yyk) + yytops.yymarkStackDeleted (yyk); + yytops.yyremoveDeletes (); + yycompressStack (); + return true; + } + + /** Called when returning to deterministic operation to clean up the extra + * stacks. */ + void + yycompressStack () + { + if (yytops.size() != 1 || !isSplit()) + return; + + // yyr is the state after the split point. + glr_state* yyr = YY_NULLPTR; + for (glr_state *yyp = firstTop(), *yyq = yyp->pred(); + yyp != yysplitPoint; + yyr = yyp, yyp = yyq, yyq = yyp->pred()) + yyp->setPred(yyr); + + // This const_cast is okay, since anyway we have access to the mutable + // yyitems into which yysplitPoint points. + glr_stack_item* nextFreeItem + = const_cast (yysplitPoint)->asItem () + 1; + yysplitPoint = YY_NULLPTR; + yytops.clearLastDeleted (); + + while (yyr != YY_NULLPTR) + { + nextFreeItem->setState (*yyr); + glr_state& nextFreeState = nextFreeItem->getState(); + yyr = yyr->pred(); + nextFreeState.setPred(&(nextFreeItem - 1)->getState()); + setFirstTop (&nextFreeState); + ++nextFreeItem; + } + yyitems.resize(static_cast(nextFreeItem - yyitems.data())); + } + + bool isSplit() const { + return yysplitPoint != YY_NULLPTR; + } + + // Present the interface of a vector of glr_stack_item. + std::vector::const_iterator begin () const + { + return yyitems.begin (); + } + + std::vector::const_iterator end () const + { + return yyitems.end (); + } + + size_t size() const + { + return yyitems.size (); + } + + glr_stack_item& operator[] (size_t i) + { + return yyitems[i]; + } + + glr_stack_item& stackItemAt (size_t index) + { + return yyitems[index]; + } + + size_t numTops () const + { + return yytops.size (); + } + + glr_state* firstTop () const + { + return yytops[create_state_set_index (0)]; + } + + glr_state* topAt (state_set_index i) const + { + return yytops[i]; + } + + void setFirstTop (glr_state* value) + { + yytops[create_state_set_index (0)] = value; + } + + void setTopAt (state_set_index i, glr_state* value) + { + yytops[i] = value; + } + + void pop_back () + { + yyitems.pop_back (); + } + + void pop_back (size_t n) + { + yyitems.resize (yyitems.size () - n); + } + + state_set_index + yysplitStack (state_set_index yyk) + { + if (!isSplit ()) + { + YYASSERT (yyk.get () == 0); + yysplitPoint = topAt (yyk); + } + return yytops.yysplitStack (yyk); + } + + /** Assuming that YYS is a GLRState somewhere on *this, update the + * splitpoint of *this, if needed, so that it is at least as deep as + * YYS. */ + void + yyupdateSplit (glr_state& yys) + { + if (isSplit() && &yys < yysplitPoint) + yysplitPoint = &yys; + } + + /** Return a fresh GLRState. + * Callers should call yyreserveStack afterwards to make sure there is + * sufficient headroom. */ + glr_state& yynewGLRState (const glr_state& newState) + { + glr_state& state = yyitems[yynewGLRStackItem (true)].getState (); +#if false && 201103L <= YY_CPLUSPLUS + state = std::move (newState); +#else + state = newState; +#endif + return state; + } + + /** Return a fresh SemanticOption. + * Callers should call yyreserveStack afterwards to make sure there is + * sufficient headroom. */ + semantic_option& yynewSemanticOption (semantic_option newOption) + { + semantic_option& option = yyitems[yynewGLRStackItem (false)].getOption (); + option = std::move (newOption); + return option; + } + + /* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in + * YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1. + * For convenience, always return YYLOW1. */ + int + yyfill (glr_stack_item *yyvsp, int &yylow, int yylow1, bool yynormal) + { + if (!yynormal && yylow1 < yylow) + { + yyfillin (yyvsp, yylow, yylow1); + yylow = yylow1; + } + return yylow1; + } + + /** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting + * at YYVSP[YYLOW0].getState().pred(). Leaves YYVSP[YYLOW1].getState().pred() + * containing the pointer to the next state in the chain. */ + void + yyfillin (glr_stack_item *yyvsp, int yylow0, int yylow1) + { + glr_state* s = yyvsp[yylow0].getState().pred(); + YYASSERT(s != YY_NULLPTR); + for (int i = yylow0-1; i >= yylow1; i -= 1, s = s->pred()) + { + glr_state& yys = yyvsp[i].getState(); +#if ]b4_api_PREFIX[DEBUG + yys.yylrState = s->yylrState; +#endif + yys.yyresolved = s->yyresolved; + if (s->yyresolved) + {]b4_variant_if([[ + new (&yys.value ()) value_type (); + ]b4_symbol_variant([yy_accessing_symbol (s->yylrState)], + [yys.value ()], [copy], [s->value ()])], [[ + new (&yys.value ()) value_type (s->value ());]])[ + } + else + /* The effect of using yyval or yyloc (in an immediate + * rule) is undefined. */ + yys.setFirstVal (YY_NULLPTR);]b4_locations_if([[ + yys.yyloc = s->yyloc;]])[ + yys.setPred(s->pred()); + } + } + +#if ]b4_api_PREFIX[DEBUG + + /*----------------------------------------------------------------------. + | Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. | + `----------------------------------------------------------------------*/ + + void + yy_reduce_print (bool yynormal, glr_stack_item* yyvsp, state_set_index yyk, + rule_num yyrule, parser_type& yyparser) + { + int yynrhs = yyrhsLength (yyrule);]b4_locations_if([ + int yylow = 1;])[ + int yyi; + std::cerr << "Reducing stack " << yyk.get() << " by rule " << yyrule - 1 + << " (line " << int (yyrline[yyrule]) << "):\n"; + if (! yynormal) + yyfillin (yyvsp, 1, -yynrhs); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + std::cerr << " $" << yyi + 1 << " = "; + yyparser.yy_symbol_print_ + (yy_accessing_symbol (yyvsp[yyi - yynrhs + 1].getState().yylrState), + yyvsp[yyi - yynrhs + 1].getState().value ()]b4_locations_if([[, + ]b4_rhs_location(yynrhs, yyi + 1)])[); + if (!yyvsp[yyi - yynrhs + 1].getState().yyresolved) + std::cerr << " (unresolved)"; + std::cerr << '\n'; + } + } + + +#define YYINDEX(YYX) \ + ((YYX) == YY_NULLPTR ? -1 : (YYX)->indexIn (yyitems.data ())) + + void + dumpStack () const + { + for (size_t yyi = 0; yyi < size(); ++yyi) + { + const glr_stack_item& item = yyitems[yyi]; + std::cerr << std::setw(3) << yyi << ". "; + if (item.is_state()) + { + std::cerr << "Res: " << item.getState().yyresolved + << ", LR State: " << item.getState().yylrState + << ", posn: " << item.getState().yyposn + << ", pred: " << YYINDEX(item.getState().pred()); + if (! item.getState().yyresolved) + std::cerr << ", firstVal: " + << YYINDEX(item.getState().firstVal()); + } + else + { + std::cerr << "Option. rule: " << item.getOption().yyrule - 1 + << ", state: " << YYINDEX(item.getOption().state()) + << ", next: " << YYINDEX(item.getOption().next()); + } + std::cerr << '\n'; + } + std::cerr << "Tops:"; + for (state_set_index yyi = create_state_set_index(0); yyi.uget() < numTops(); ++yyi) { + std::cerr << yyi.get() << ": " << YYINDEX(topAt(yyi)) << "; "; + } + std::cerr << '\n'; + } + +#undef YYINDEX +#endif + + YYRESULTTAG + yyreportAmbiguity (const semantic_option& yyx0, + const semantic_option& yyx1, parser_type& yyparser]b4_locations_if([, const location_type& yyloc])[) + { + YY_USE (yyx0); + YY_USE (yyx1); + +#if ]b4_api_PREFIX[DEBUG + std::cerr << "Ambiguity detected.\n" + "Option 1,\n"; + yyx0.yyreportTree (); + std::cerr << "\nOption 2,\n"; + yyx1.yyreportTree (); + std::cerr << '\n'; +#endif + + yyparser.error (]b4_locations_if([yyloc, ])[YY_("syntax is ambiguous")); + return yyabort; + } + +#if ]b4_api_PREFIX[DEBUG + /* Print YYS (possibly NULL) and its predecessors. */ + void + yypstates (const glr_state* yys) const + { + if (yys != YY_NULLPTR) + yys->yy_yypstack(); + else + std::cerr << ""; + std::cerr << '\n'; + } +#endif + + private: + size_t spaceLeft() const + { + return yyitems.capacity() - yyitems.size(); + } + + /** Return a fresh GLRStackItem in this. The item is an LR state + * if YYIS_STATE, and otherwise a semantic option. Callers should call + * yyreserveStack afterwards to make sure there is sufficient + * headroom. */ + size_t + yynewGLRStackItem (bool yyis_state) + { + YYDASSERT(yyitems.size() < yyitems.capacity()); + yyitems.push_back(glr_stack_item(yyis_state)); + return yyitems.size() - 1; + } + + + public: + std::vector yyitems; + // Where the stack splits. Anything below this address is deterministic. + const glr_state* yysplitPoint; + glr_state_set yytops; + }; // class state_stack +} // namespace + +#undef YYFILL +#define YYFILL(N) yystateStack.yyfill (yyvsp, yylow, (N), yynormal) + +namespace ]b4_namespace_ref[ +{ + class ]b4_parser_class[::glr_stack + { + public: +]b4_parse_error_bmatch([custom\|detailed\|verbose], [[ + // Needs access to yypact_value_is_default, etc. + friend context; +]])[ + + glr_stack (size_t yysize, parser_type& yyparser_yyarg]m4_ifset([b4_parse_param], [, b4_parse_param_decl])[) + : yyerrState (0) + , yystateStack (yysize) + , yyerrcnt (0) + , yyla () + , yyparser (yyparser_yyarg)]m4_ifset([b4_parse_param], [,b4_parse_param_cons])[ + {} + + ~glr_stack () + { + if (!this->yyla.empty ()) + yyparser.yy_destroy_ ("Cleanup: discarding lookahead", + this->yyla.kind (), this->yyla.value]b4_locations_if([, this->yyla.location])[); + popall_ (); + } + + int yyerrState; +]b4_locations_if([[ /* To compute the location of the error token. */ + glr_stack_item yyerror_range[3];]])[ + state_stack yystateStack; + int yyerrcnt; + symbol_type yyla; + YYJMP_BUF yyexception_buffer; + parser_type& yyparser; + + #define YYCHK1(YYE) \ + do { \ + switch (YYE) { \ + case yyok: \ + break; \ + case yyabort: \ + goto yyabortlab; \ + case yyaccept: \ + goto yyacceptlab; \ + case yyerr: \ + goto yyuser_error; \ + default: \ + goto yybuglab; \ + } \ + } while (false) + + int + parse () + { + int yyresult; + size_t yyposn; + + YYCDEBUG << "Starting parse\n"; + + this->yyla.clear (); +]m4_ifdef([b4_initial_action], [ +b4_dollar_pushdef([yyla.value], [], [], [yyla.location])dnl + b4_user_initial_action +b4_dollar_popdef])[]dnl +[ + switch (YYSETJMP (this->yyexception_buffer)) + { + case 0: break; + case 1: goto yyabortlab; + case 2: goto yyexhaustedlab; + default: goto yybuglab; + } + this->yyglrShift (create_state_set_index(0), 0, 0, this->yyla.value]b4_locations_if([, this->yyla.location])[); + yyposn = 0; + + while (true) + { + /* For efficiency, we have two loops, the first of which is + specialized to deterministic operation (single stack, no + potential ambiguity). */ + /* Standard mode */ + while (true) + { + const state_num yystate = this->firstTopState()->yylrState; + YYCDEBUG << "Entering state " << yystate << '\n'; + if (yystate == YYFINAL) + goto yyacceptlab; + if (yy_is_defaulted_state (yystate)) + { + const rule_num yyrule = yy_default_action (yystate); + if (yyrule == 0) + {]b4_locations_if([[ + this->yyerror_range[1].getState().yyloc = this->yyla.location;]])[ + this->yyreportSyntaxError (); + goto yyuser_error; + } + YYCHK1 (this->yyglrReduce (create_state_set_index(0), yyrule, true)); + } + else + { + yyget_token (); + const short* yyconflicts; + const int yyaction = yygetLRActions (yystate, this->yyla.kind (), yyconflicts); + if (*yyconflicts != 0) + break; + if (yy_is_shift_action (yyaction)) + { + YY_SYMBOL_PRINT ("Shifting", this->yyla.kind (), this->yyla.value, this->yyla.location); + yyposn += 1; + // FIXME: we should move yylval. + this->yyglrShift (create_state_set_index(0), yyaction, yyposn, this->yyla.value]b4_locations_if([, this->yyla.location])[); + yyla.clear (); + if (0 < this->yyerrState) + this->yyerrState -= 1; + } + else if (yy_is_error_action (yyaction)) + {]b4_locations_if([[ + this->yyerror_range[1].getState().yyloc = this->yyla.location;]])[ + /* Don't issue an error message again for exceptions + thrown from the scanner. */ + if (this->yyla.kind () != ]b4_symbol(error, kind)[) + this->yyreportSyntaxError (); + goto yyuser_error; + } + else + YYCHK1 (this->yyglrReduce (create_state_set_index(0), -yyaction, true)); + } + } + + while (true) + { + for (state_set_index yys = create_state_set_index(0); yys.uget() < this->yystateStack.numTops(); ++yys) + this->yystateStack.yytops.setLookaheadNeeds(yys, !this->yyla.empty ()); + + /* yyprocessOneStack returns one of three things: + + - An error flag. If the caller is yyprocessOneStack, it + immediately returns as well. When the caller is finally + yyparse, it jumps to an error label via YYCHK1. + + - yyok, but yyprocessOneStack has invoked yymarkStackDeleted + (yys), which sets the top state of yys to NULL. Thus, + yyparse's following invocation of yyremoveDeletes will remove + the stack. + + - yyok, when ready to shift a token. + + Except in the first case, yyparse will invoke yyremoveDeletes and + then shift the next token onto all remaining stacks. This + synchronization of the shift (that is, after all preceding + reductions on all stacks) helps prevent double destructor calls + on yylval in the event of memory exhaustion. */ + + for (state_set_index yys = create_state_set_index (0); yys.uget () < this->yystateStack.numTops (); ++yys) + YYCHK1 (this->yyprocessOneStack (yys, yyposn]b4_locations_if([, &this->yyla.location])[)); + this->yystateStack.yytops.yyremoveDeletes (); + if (this->yystateStack.yytops.size() == 0) + { + this->yystateStack.yytops.yyundeleteLastStack (); + if (this->yystateStack.yytops.size() == 0) + this->yyFail (]b4_locations_if([&this->yyla.location, ])[YY_("syntax error")); + YYCHK1 (this->yyresolveStack ()); + YYCDEBUG << "Returning to deterministic operation.\n";]b4_locations_if([[ + this->yyerror_range[1].getState ().yyloc = this->yyla.location;]])[ + this->yyreportSyntaxError (); + goto yyuser_error; + } + + /* If any yyglrShift call fails, it will fail after shifting. Thus, + a copy of yylval will already be on stack 0 in the event of a + failure in the following loop. Thus, yyla is emptied + before the loop to make sure the user destructor for yylval isn't + called twice. */ + symbol_kind_type yytoken_to_shift = this->yyla.kind (); + this->yyla.kind_ = ]b4_symbol(empty, kind)[; + yyposn += 1; + for (state_set_index yys = create_state_set_index (0); yys.uget () < this->yystateStack.numTops (); ++yys) + { + const state_num yystate = this->topState (yys)->yylrState; + const short* yyconflicts; + const int yyaction = yygetLRActions (yystate, yytoken_to_shift, yyconflicts); + /* Note that yyconflicts were handled by yyprocessOneStack. */ + YYCDEBUG << "On stack " << yys.get() << ", "; + YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, this->yyla.value, this->yyla.location); + this->yyglrShift (yys, yyaction, yyposn, this->yyla.value]b4_locations_if([, this->yyla.location])[); + YYCDEBUG << "Stack " << yys.get() << " now in state " + << this->topState(yys)->yylrState << '\n'; + } +]b4_variant_if([[ + // FIXME: User destructors. + // Value type destructor. + ]b4_symbol_variant([[yytoken_to_shift]], [[this->yyla.value]], [[template destroy]])])[ + + if (this->yystateStack.yytops.size () == 1) + { + YYCHK1 (this->yyresolveStack ()); + YYCDEBUG << "Returning to deterministic operation.\n"; + this->yystateStack.yycompressStack (); + break; + } + } + continue; + yyuser_error: + this->yyrecoverSyntaxError (]b4_locations_if([&this->yyla.location])[); + yyposn = this->firstTopState()->yyposn; + } + + yyacceptlab: + yyresult = 0; + goto yyreturn; + + yybuglab: + YYASSERT (false); + goto yyabortlab; + + yyabortlab: + yyresult = 1; + goto yyreturn; + + yyexhaustedlab: + yyparser.error (]b4_locations_if([this->yyla.location, ])[YY_("memory exhausted")); + yyresult = 2; + goto yyreturn; + + yyreturn: + return yyresult; + } + #undef YYCHK1 + + void yyreserveGlrStack () + { + if (!yystateStack.yyexpandGLRStackIfNeeded ()) + yyMemoryExhausted (); + } + + _Noreturn void + yyMemoryExhausted () + { + YYLONGJMP (yyexception_buffer, 2); + } + + _Noreturn void + yyFail (]b4_locations_if([location_type* yylocp, ])[const char* yymsg) + { + if (yymsg != YY_NULLPTR) + yyparser.error (]b4_locations_if([*yylocp, ])[yymsg); + YYLONGJMP (yyexception_buffer, 1); + } + + /* GLRStates */ + + + /** Add a new semantic action that will execute the action for rule + * YYRULE on the semantic values in YYRHS to the list of + * alternative actions for YYSTATE. Assumes that YYRHS comes from + * stack #YYK of *this. */ + void + yyaddDeferredAction (state_set_index yyk, glr_state* yystate, + glr_state* yyrhs, rule_num yyrule) + { + semantic_option& yyopt = yystateStack.yynewSemanticOption (semantic_option (yyrule)); + yyopt.setState (yyrhs); + yyopt.setNext (yystate->firstVal ()); + if (yystateStack.yytops.lookaheadNeeds (yyk)) + yyopt.yyla = this->yyla; + yystate->setFirstVal (&yyopt); + + yyreserveGlrStack (); + } + + #if ]b4_api_PREFIX[DEBUG + void yypdumpstack () const + { + yystateStack.dumpStack(); + } + #endif + + void + yyreportSyntaxError () + { + if (yyerrState != 0) + return; +]b4_parse_error_case( +[simple], [[ + std::string msg = YY_("syntax error"); + yyparser.error (]b4_join(b4_locations_if([yyla.location]), [[YY_MOVE (msg)]])[);]], +[custom], [[ + context yyctx (*this, yyla); + yyparser.report_syntax_error (yyctx);]], +[[ + context yyctx (*this, yyla); + std::string msg = yyparser.yysyntax_error_ (yyctx); + yyparser.error (]b4_join(b4_locations_if([yyla.location]), [[YY_MOVE (msg)]])[);]])[ + yyerrcnt += 1; + } + + /* Recover from a syntax error on this, assuming that yytoken, + yylval, and yylloc are the syntactic category, semantic value, and location + of the lookahead. */ + void + yyrecoverSyntaxError (]b4_locations_if([location_type* yylocp])[) + { + if (yyerrState == 3) + /* We just shifted the error token and (perhaps) took some + reductions. Skip tokens until we can proceed. */ + while (true) + { + if (this->yyla.kind () == ]b4_symbol(eof, kind)[) + yyFail (]b4_locations_if([yylocp, ])[YY_NULLPTR); + if (this->yyla.kind () != ]b4_symbol(empty, kind)[) + {]b4_locations_if([[ + /* We throw away the lookahead, but the error range + of the shifted error token must take it into account. */ + glr_state *yys = firstTopState(); + yyerror_range[1].getState().yyloc = yys->yyloc; + yyerror_range[2].getState().yyloc = this->yyla.location; + YYLLOC_DEFAULT ((yys->yyloc), yyerror_range, 2);]])[ + yyparser.yy_destroy_ ("Error: discarding", + this->yyla.kind (), this->yyla.value]b4_locations_if([, this->yyla.location])[);]b4_variant_if([[ + // Value type destructor. + ]b4_symbol_variant([[this->yyla.kind ()]], [[this->yyla.value]], [[template destroy]])])[ + this->yyla.kind_ = ]b4_symbol(empty, kind)[; + } + yyget_token (); + int yyj = yypact[firstTopState()->yylrState]; + if (yypact_value_is_default (yyj)) + return; + yyj += this->yyla.kind (); + if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != this->yyla.kind ()) + { + if (yydefact[firstTopState()->yylrState] != 0) + return; + } + else if (! yytable_value_is_error (yytable[yyj])) + return; + } + + if (!yystateStack.reduceToOneStack()) + yyFail (]b4_locations_if([yylocp, ])[YY_NULLPTR); + + /* Now pop stack until we find a state that shifts the error token. */ + yyerrState = 3; + while (firstTopState () != YY_NULLPTR) + { + glr_state *yys = firstTopState (); + int yyj = yypact[yys->yylrState]; + if (! yypact_value_is_default (yyj)) + { + yyj += YYTERROR; + if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR + && yy_is_shift_action (yytable[yyj])) + { + /* Shift the error token. */]b4_locations_if([[ + /* First adjust its location.*/ + location_type yyerrloc; + yyerror_range[2].getState().yyloc = this->yyla.location; + YYLLOC_DEFAULT (yyerrloc, (yyerror_range), 2);]])[ + YY_SYMBOL_PRINT ("Shifting", yy_accessing_symbol (yytable[yyj]), + this->yyla.value, yyerrloc); + yyglrShift (create_state_set_index(0), yytable[yyj], + yys->yyposn, yyla.value]b4_locations_if([, yyerrloc])[); + yys = firstTopState(); + break; + } + }]b4_locations_if([[ + yyerror_range[1].getState().yyloc = yys->yyloc;]])[ + if (yys->pred() != YY_NULLPTR) + yys->destroy ("Error: popping", yyparser); + yystateStack.setFirstTop(yys->pred()); + yystateStack.pop_back(); + } + if (firstTopState() == YY_NULLPTR) + yyFail (]b4_locations_if([yylocp, ])[YY_NULLPTR); + } + + YYRESULTTAG + yyprocessOneStack (state_set_index yyk, + size_t yyposn]b4_locations_if([, location_type* yylocp])[) + { + while (yystateStack.topAt(yyk) != YY_NULLPTR) + { + const state_num yystate = topState(yyk)->yylrState; + YYCDEBUG << "Stack " << yyk.get() + << " Entering state " << yystate << '\n'; + + YYASSERT (yystate != YYFINAL); + + if (yy_is_defaulted_state (yystate)) + { + const rule_num yyrule = yy_default_action (yystate); + if (yyrule == 0) + { + YYCDEBUG << "Stack " << yyk.get() << " dies.\n"; + yystateStack.yytops.yymarkStackDeleted (yyk); + return yyok; + } + const YYRESULTTAG yyflag + = yyglrReduce (yyk, yyrule, yyimmediate[yyrule]); + if (yyflag == yyerr) + { + YYCDEBUG << "Stack " << yyk.get() << " dies" + " (predicate failure or explicit user error).\n"; + yystateStack.yytops.yymarkStackDeleted (yyk); + return yyok; + } + if (yyflag != yyok) + return yyflag; + } + else + { + yystateStack.yytops.setLookaheadNeeds(yyk, true); + yyget_token (); + const short* yyconflicts; + const int yyaction = yygetLRActions (yystate, this->yyla.kind (), yyconflicts); + + for (; *yyconflicts != 0; ++yyconflicts) + { + state_set_index yynewStack = yystateStack.yysplitStack (yyk); + YYCDEBUG << "Splitting off stack " << yynewStack.get() + << " from " << yyk.get() << ".\n"; + YYRESULTTAG yyflag = + yyglrReduce (yynewStack, *yyconflicts, yyimmediate[*yyconflicts]); + if (yyflag == yyok) + YYCHK (yyprocessOneStack (yynewStack, + yyposn]b4_locations_if([, yylocp])[)); + else if (yyflag == yyerr) + { + YYCDEBUG << "Stack " << yynewStack.get() << " dies.\n"; + yystateStack.yytops.yymarkStackDeleted (yynewStack); + } + else + return yyflag; + } + + if (yy_is_shift_action (yyaction)) + break; + else if (yy_is_error_action (yyaction)) + { + YYCDEBUG << "Stack " << yyk.get() << " dies.\n"; + yystateStack.yytops.yymarkStackDeleted (yyk); + break; + } + else + { + YYRESULTTAG yyflag + = yyglrReduce (yyk, -yyaction, yyimmediate[-yyaction]); + if (yyflag == yyerr) + { + YYCDEBUG << "Stack " << yyk.get() << " dies" + " (predicate failure or explicit user error).\n"; + yystateStack.yytops.yymarkStackDeleted (yyk); + break; + } + else if (yyflag != yyok) + return yyflag; + } + } + } + return yyok; + } + + /** Perform user action for rule number YYN, with RHS length YYRHSLEN, + * and top stack item YYVSP. YYVALP points to place to put semantic + * value ($$), and yylocp points to place for location information + * (@@$). Returns yyok for normal return, yyaccept for YYACCEPT, + * yyerr for YYERROR, yyabort for YYABORT. */ + YYRESULTTAG + yyuserAction (rule_num yyrule, int yyrhslen, glr_stack_item* yyvsp, state_set_index yyk, + value_type* yyvalp]b4_locations_if([, location_type* yylocp])[) + { + bool yynormal YY_ATTRIBUTE_UNUSED = !yystateStack.isSplit(); + int yylow = 1; +]b4_parse_param_use([yyvalp], [yylocp])dnl +[ YY_USE (yyk); + YY_USE (yyrhslen); + # undef yyerrok + # define yyerrok (yyerrState = 0) + # undef YYACCEPT + # define YYACCEPT return yyaccept + # undef YYABORT + # define YYABORT return yyabort + # undef YYERROR + # define YYERROR return yyerrok, yyerr + # undef YYRECOVERING + # define YYRECOVERING() (yyerrState != 0) + # undef yytoken + # define yytoken this->yyla.kind_ + # undef yyclearin + # define yyclearin (yytoken = ]b4_symbol(empty, kind)[) + # undef YYBACKUP + # define YYBACKUP(Token, Value) \ + return yyparser.error (]b4_locations_if([*yylocp, ])[YY_("syntax error: cannot back up")), \ + yyerrok, yyerr + +]b4_variant_if([[ + /* Variants are always initialized to an empty instance of the + correct type. The default '$$ = $1' action is NOT applied + when using variants. */ + // However we really need to prepare yyvsp now if we want to get + // correct locations, so invoke YYFILL for $1 anyway. + (void) YYFILL (1-yyrhslen); + ]b4_symbol_variant([[yylhsNonterm (yyrule)]], [(*yyvalp)], [emplace])], [[ + if (yyrhslen == 0) + *yyvalp = yyval_default; + else + *yyvalp = yyvsp[YYFILL (1-yyrhslen)].getState().value ();]])[]b4_locations_if([[ + /* Default location. */ + YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen); + yyerror_range[1].getState().yyloc = *yylocp; +]])[ + /* If yyk == -1, we are running a deferred action on a temporary + stack. In that case, YY_REDUCE_PRINT must not play with YYFILL, + so pretend the stack is "normal". */ + YY_REDUCE_PRINT ((yynormal || yyk == create_state_set_index (-1), yyvsp, yyk, yyrule, yyparser)); + #if YY_EXCEPTIONS + try + { + #endif // YY_EXCEPTIONS + switch (yyrule) + { + ]b4_user_actions[ + default: break; + } + #if YY_EXCEPTIONS + } + catch (const syntax_error& yyexc) + { + YYCDEBUG << "Caught exception: " << yyexc.what() << '\n';]b4_locations_if([ + *yylocp = yyexc.location;])[ + yyparser.error (]b4_locations_if([*yylocp, ])[yyexc.what ()); + YYERROR; + } + #endif // YY_EXCEPTIONS + YY_SYMBOL_PRINT ("-> $$ =", yylhsNonterm (yyrule), *yyvalp, *yylocp); + + return yyok; + # undef yyerrok + # undef YYABORT + # undef YYACCEPT + # undef YYERROR + # undef YYBACKUP + # undef yytoken + # undef yyclearin + # undef YYRECOVERING + } + + YYRESULTTAG + yyresolveStack () + { + if (yystateStack.isSplit ()) + { + int yyn = 0; + for (glr_state* yys = firstTopState (); + yys != yystateStack.yysplitPoint; + yys = yys->pred ()) + yyn += 1; + YYCHK (yyresolveStates (*firstTopState (), yyn)); + } + return yyok; + } + + /** Pop the symbols consumed by reduction #YYRULE from the top of stack + * #YYK of *YYSTACKP, and perform the appropriate semantic action on their + * semantic values. Assumes that all ambiguities in semantic values + * have been previously resolved. Set *YYVALP to the resulting value, + * and *YYLOCP to the computed location (if any). Return value is as + * for userAction. */ + YYRESULTTAG + yydoAction (state_set_index yyk, rule_num yyrule, + value_type* yyvalp]b4_locations_if([, location_type* yylocp])[) + { + const int yynrhs = yyrhsLength (yyrule); + + if (!yystateStack.isSplit()) + { + /* Standard special case: single stack. */ + YYASSERT (yyk.get() == 0); + glr_stack_item* yyrhs = yystateStack.firstTop()->asItem(); + const YYRESULTTAG res + = yyuserAction (yyrule, yynrhs, yyrhs, yyk, yyvalp]b4_locations_if([, yylocp])[); + yystateStack.pop_back(static_cast(yynrhs)); + yystateStack.setFirstTop(&yystateStack[yystateStack.size() - 1].getState()); + return res; + } + else + { + glr_stack_item yyrhsVals[YYMAXRHS + YYMAXLEFT + 1]; + glr_state* yys = yystateStack.topAt(yyk); + yyrhsVals[YYMAXRHS + YYMAXLEFT].getState().setPred(yys);]b4_locations_if([[ + if (yynrhs == 0) + /* Set default location. */ + yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].getState().yyloc = yys->yyloc;]])[ + for (int yyi = 0; yyi < yynrhs; yyi += 1) + { + yys = yys->pred(); + YYASSERT (yys != YY_NULLPTR); + } + yystateStack.yyupdateSplit (*yys); + yystateStack.setTopAt(yyk, yys); + return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, + yyk, + yyvalp]b4_locations_if([, yylocp])[); + } + } + + /** Pop items off stack #YYK of *YYSTACKP according to grammar rule YYRULE, + * and push back on the resulting nonterminal symbol. Perform the + * semantic action associated with YYRULE and store its value with the + * newly pushed state, if YYFORCEEVAL or if *YYSTACKP is currently + * unambiguous. Otherwise, store the deferred semantic action with + * the new state. If the new state would have an identical input + * position, LR state, and predecessor to an existing state on the stack, + * it is identified with that existing state, eliminating stack #YYK from + * *YYSTACKP. In this case, the semantic value is + * added to the options for the existing state's semantic value. + */ + YYRESULTTAG + yyglrReduce (state_set_index yyk, rule_num yyrule, bool yyforceEval) + { + size_t yyposn = topState(yyk)->yyposn; + + if (yyforceEval || !yystateStack.isSplit()) + { + value_type val;]b4_locations_if([[ + location_type loc;]])[ + + YYRESULTTAG yyflag = yydoAction (yyk, yyrule, &val]b4_locations_if([, &loc])[); + if (yyflag == yyerr && yystateStack.isSplit()) + {]b4_parse_trace_if([[ + YYCDEBUG << "Parse on stack " << yyk.get () + << " rejected by rule " << yyrule - 1 + << " (line " << int (yyrline[yyrule]) << ").\n"; + ]])[} + if (yyflag != yyok) + return yyflag; + yyglrShift (yyk, + yyLRgotoState (topState(yyk)->yylrState, + yylhsNonterm (yyrule)), + yyposn, val]b4_locations_if([, loc])[);]b4_variant_if([[ + // FIXME: User destructors. + // Value type destructor. + ]b4_symbol_variant([[yylhsNonterm (yyrule)]], [[val]], [[template destroy]])])[ + } + else + { + glr_state *yys = yystateStack.topAt(yyk); + glr_state *yys0 = yys; + for (int yyn = yyrhsLength (yyrule); 0 < yyn; yyn -= 1) + { + yys = yys->pred(); + YYASSERT (yys != YY_NULLPTR); + } + yystateStack.yyupdateSplit (*yys); + state_num yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm (yyrule));]b4_parse_trace_if([[ + YYCDEBUG << "Reduced stack " << yyk.get () + << " by rule " << yyrule - 1 << " (line " << int (yyrline[yyrule]) + << "); action deferred. Now in state " << yynewLRState + << ".\n";]])[ + for (state_set_index yyi = create_state_set_index(0); yyi.uget() < yystateStack.numTops(); ++yyi) + if (yyi != yyk && yystateStack.topAt(yyi) != YY_NULLPTR) + { + const glr_state* yysplit = yystateStack.yysplitPoint; + glr_state* yyp = yystateStack.topAt(yyi); + while (yyp != yys && yyp != yysplit + && yyp->yyposn >= yyposn) + { + if (yyp->yylrState == yynewLRState + && yyp->pred() == yys) + { + yyaddDeferredAction (yyk, yyp, yys0, yyrule); + yystateStack.yytops.yymarkStackDeleted (yyk); + YYCDEBUG << "Merging stack " << yyk.get () + << " into stack " << yyi.get () << ".\n"; + return yyok; + } + yyp = yyp->pred(); + } + } + yystateStack.setTopAt(yyk, yys); + yyglrShiftDefer (yyk, yynewLRState, yyposn, yys0, yyrule); + } + return yyok; + } + + /** Shift stack #YYK of *YYSTACKP, to a new state corresponding to LR + * state YYLRSTATE, at input position YYPOSN, with the (unresolved) + * semantic value of YYRHS under the action for YYRULE. */ + void + yyglrShiftDefer (state_set_index yyk, state_num yylrState, + size_t yyposn, glr_state* yyrhs, rule_num yyrule) + { + glr_state& yynewState = yystateStack.yynewGLRState ( + glr_state (yylrState, yyposn)); + yynewState.setPred (yystateStack.topAt (yyk)); + yystateStack.setTopAt (yyk, &yynewState); + + /* Invokes yyreserveStack. */ + yyaddDeferredAction (yyk, &yynewState, yyrhs, yyrule); + } + + /** Shift to a new state on stack #YYK of *YYSTACKP, corresponding to LR + * state YYLRSTATE, at input position YYPOSN, with (resolved) semantic + * value YYVAL_ARG and source location YYLOC_ARG. */ + void + yyglrShift (state_set_index yyk, state_num yylrState, + size_t yyposn, + const value_type& yyval_arg]b4_locations_if([, const location_type& yyloc_arg])[) + { + glr_state& yynewState = yystateStack.yynewGLRState ( + glr_state (yylrState, yyposn, yyval_arg]b4_locations_if([, yyloc_arg])[)); + yynewState.setPred (yystateStack.topAt(yyk)); + yystateStack.setTopAt (yyk, &yynewState); + yyreserveGlrStack (); + } + +#if ]b4_api_PREFIX[DEBUG + void + yypstack (state_set_index yyk) const + { + yystateStack.yypstates (yystateStack.topAt (yyk)); + } +#endif + + glr_state* topState(state_set_index i) { + return yystateStack.topAt(i); + } + + glr_state* firstTopState() { + return yystateStack.firstTop(); + } + + private: + + void popall_ () + { + /* If the stack is well-formed, pop the stack until it is empty, + destroying its entries as we go. But free the stack regardless + of whether it is well-formed. */ + for (state_set_index k = create_state_set_index(0); k.uget() < yystateStack.numTops(); k += 1) + if (yystateStack.topAt(k) != YY_NULLPTR) + { + while (yystateStack.topAt(k) != YY_NULLPTR) + { + glr_state* state = topState(k);]b4_locations_if([[ + yyerror_range[1].getState().yyloc = state->yyloc;]])[ + if (state->pred() != YY_NULLPTR) + state->destroy ("Cleanup: popping", yyparser); + yystateStack.setTopAt(k, state->pred()); + yystateStack.pop_back(); + } + break; + } + } + + /** Resolve the previous YYN states starting at and including state YYS + * on *YYSTACKP. If result != yyok, some states may have been left + * unresolved possibly with empty semantic option chains. Regardless + * of whether result = yyok, each state has been left with consistent + * data so that destroy can be invoked if necessary. */ + YYRESULTTAG + yyresolveStates (glr_state& yys, int yyn) + { + if (0 < yyn) + { + YYASSERT (yys.pred() != YY_NULLPTR); + YYCHK (yyresolveStates (*yys.pred(), yyn-1)); + if (! yys.yyresolved) + YYCHK (yyresolveValue (yys)); + } + return yyok; + } + + static void + yyuserMerge (int yyn, value_type& yy0, value_type& yy1) + { + YY_USE (yy0); + YY_USE (yy1); + + switch (yyn) + { +]b4_mergers[ + default: break; + } + } + + /** Resolve the ambiguity represented in state YYS in *YYSTACKP, + * perform the indicated actions, and set the semantic value of YYS. + * If result != yyok, the chain of semantic options in YYS has been + * cleared instead or it has been left unmodified except that + * redundant options may have been removed. Regardless of whether + * result = yyok, YYS has been left with consistent data so that + * destroy can be invoked if necessary. */ + YYRESULTTAG + yyresolveValue (glr_state& yys) + { + semantic_option* yybest = yys.firstVal(); + YYASSERT(yybest != YY_NULLPTR); + bool yymerge = false; + YYRESULTTAG yyflag;]b4_locations_if([ + location_type *yylocp = &yys.yyloc;])[ + + semantic_option* yypPrev = yybest; + for (semantic_option* yyp = yybest->next(); + yyp != YY_NULLPTR; ) + { + if (yybest->isIdenticalTo (*yyp)) + { + yybest->mergeWith (*yyp); + yypPrev->setNext(yyp->next()); + yyp = yypPrev->next(); + } + else + { + switch (yypreference (*yybest, *yyp)) + { + case 0:]b4_locations_if([[ + yyresolveLocations (yys, 1);]])[ + return yystateStack.yyreportAmbiguity (*yybest, *yyp, yyparser]b4_locations_if([, *yylocp])[); + break; + case 1: + yymerge = true; + break; + case 2: + break; + case 3: + yybest = yyp; + yymerge = false; + break; + default: + /* This cannot happen so it is not worth a YYASSERT (false), + but some compilers complain if the default case is + omitted. */ + break; + } + yypPrev = yyp; + yyp = yyp->next(); + } + } + + value_type val; + if (yymerge) + { + int yyprec = yydprec[yybest->yyrule]; + yyflag = yyresolveAction (*yybest, &val]b4_locations_if([, yylocp])[); + if (yyflag == yyok) + for (semantic_option* yyp = yybest->next(); + yyp != YY_NULLPTR; + yyp = yyp->next()) + { + if (yyprec == yydprec[yyp->yyrule]) + { + value_type yyval_other;]b4_locations_if([ + location_type yydummy;])[ + yyflag = yyresolveAction (*yyp, &yyval_other]b4_locations_if([, &yydummy])[); + if (yyflag != yyok) + { + yyparser.yy_destroy_ ("Cleanup: discarding incompletely merged value for", + yy_accessing_symbol (yys.yylrState), + this->yyla.value]b4_locations_if([, *yylocp])[); + break; + } + yyuserMerge (yymerger[yyp->yyrule], val, yyval_other);]b4_variant_if([[ + // FIXME: User destructors. + // Value type destructor. + ]b4_symbol_variant([[yy_accessing_symbol (yys.yylrState)]], [[yyval_other]], [[template destroy]])])[ + } + } + } + else + yyflag = yyresolveAction (*yybest, &val]b4_locations_if([, yylocp])[); + + if (yyflag == yyok) + { + yys.yyresolved = true; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN]b4_variant_if([[ + new (&yys.value ()) value_type (); + ]b4_symbol_variant([yy_accessing_symbol (yys.yylrState)], + [yys.value ()], [copy], [val])], [[ + new (&yys.value ()) value_type (val);]])[ + + YY_IGNORE_MAYBE_UNINITIALIZED_END + } + else + yys.setFirstVal(YY_NULLPTR); +]b4_variant_if([[ + // FIXME: User destructors. + // Value type destructor. + ]b4_symbol_variant([[yy_accessing_symbol (yys.yylrState)]], [[val]], [[template destroy]])])[ + return yyflag; + } + + /** Resolve the states for the RHS of YYOPT on *YYSTACKP, perform its + * user action, and return the semantic value and location in *YYVALP + * and *YYLOCP. Regardless of whether result = yyok, all RHS states + * have been destroyed (assuming the user action destroys all RHS + * semantic values if invoked). */ + YYRESULTTAG + yyresolveAction (semantic_option& yyopt, value_type* yyvalp]b4_locations_if([, location_type* yylocp])[) + { + glr_state* yyoptState = yyopt.state(); + YYASSERT(yyoptState != YY_NULLPTR); + int yynrhs = yyrhsLength (yyopt.yyrule); + YYRESULTTAG yyflag = yyresolveStates (*yyoptState, yynrhs); + if (yyflag != yyok) + { + for (glr_state *yys = yyoptState; yynrhs > 0; yys = yys->pred(), yynrhs -= 1) + yys->destroy ("Cleanup: popping", yyparser); + return yyflag; + } + + glr_stack_item yyrhsVals[YYMAXRHS + YYMAXLEFT + 1]; + yyrhsVals[YYMAXRHS + YYMAXLEFT].getState().setPred(yyopt.state());]b4_locations_if([[ + if (yynrhs == 0) + /* Set default location. */ + yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].getState().yyloc = yyoptState->yyloc;]])[ + { + symbol_type yyla_current = std::move (this->yyla); + this->yyla = std::move (yyopt.yyla); + yyflag = yyuserAction (yyopt.yyrule, yynrhs, + yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, + create_state_set_index (-1), + yyvalp]b4_locations_if([, yylocp])[); + this->yyla = std::move (yyla_current); + } + return yyflag; + }]b4_locations_if([[ + + /** Resolve the locations for each of the YYN1 states in *YYSTACKP, + * ending at YYS1. Has no effect on previously resolved states. + * The first semantic option of a state is always chosen. */ + void + yyresolveLocations (glr_state &yys1, int yyn1) + { + if (0 < yyn1) + { + yyresolveLocations (*yys1.pred(), yyn1 - 1); + if (!yys1.yyresolved) + { + glr_stack_item yyrhsloc[1 + YYMAXRHS]; + YYASSERT (yys1.firstVal() != YY_NULLPTR); + semantic_option& yyoption = *yys1.firstVal(); + const int yynrhs = yyrhsLength (yyoption.yyrule); + if (0 < yynrhs) + { + yyresolveLocations (*yyoption.state(), yynrhs); + const glr_state *yys = yyoption.state(); + for (int yyn = yynrhs; yyn > 0; yyn -= 1) + { + yyrhsloc[yyn].getState().yyloc = yys->yyloc; + yys = yys->pred(); + } + } + else + { + /* Both yyresolveAction and yyresolveLocations traverse the GSS + in reverse rightmost order. It is only necessary to invoke + yyresolveLocations on a subforest for which yyresolveAction + would have been invoked next had an ambiguity not been + detected. Thus the location of the previous state (but not + necessarily the previous state itself) is guaranteed to be + resolved already. */ + YY_IGNORE_NULL_DEREFERENCE_BEGIN + yyrhsloc[0].getState().yyloc = yyoption.state()->yyloc; + YY_IGNORE_NULL_DEREFERENCE_END + } + YYLLOC_DEFAULT ((yys1.yyloc), yyrhsloc, yynrhs); + } + } + }]])[ + + /** If yytoken is empty, fetch the next token. */ + void + yyget_token () + { +]b4_parse_param_use()dnl +[ if (this->yyla.empty ()) + { + YYCDEBUG << "Reading a token\n"; +#if YY_EXCEPTIONS + try +#endif // YY_EXCEPTIONS + {]b4_token_ctor_if([[ + symbol_type yylookahead (]b4_yylex[); + yyla.move (yylookahead);]], [[ + yyla.kind_ = yyparser.yytranslate_ (]b4_yylex[);]])[ + } +#if YY_EXCEPTIONS + catch (const parser_type::syntax_error& yyexc) + { + YYCDEBUG << "Caught exception: " << yyexc.what () << '\n';]b4_locations_if([ + this->yyla.location = yyexc.location;])[ + yyparser.error (]b4_locations_if([this->yyla.location, ])[yyexc.what ()); + // Map errors caught in the scanner to the error token, so that error + // handling is started. + this->yyla.kind_ = ]b4_symbol(error, kind)[; + } + } +#endif // YY_EXCEPTIONS + if (this->yyla.kind () == ]b4_symbol(eof, kind)[) + YYCDEBUG << "Now at end of input.\n"; + else + YY_SYMBOL_PRINT ("Next token is", this->yyla.kind (), this->yyla.value, this->yyla.location); + } + + + /* Bison grammar-table manipulation. */ + + /** The action to take in YYSTATE on seeing YYTOKEN. + * Result R means + * R < 0: Reduce on rule -R. + * R = 0: Error. + * R > 0: Shift to state R. + * Set *YYCONFLICTS to a pointer into yyconfl to a 0-terminated list + * of conflicting reductions. + */ + static int + yygetLRActions (state_num yystate, symbol_kind_type yytoken, const short*& yyconflicts) + { + int yyindex = yypact[yystate] + yytoken; + if (yytoken == ]b4_symbol(error, kind)[) + { + // This is the error token. + yyconflicts = yyconfl; + return 0; + } + else if (yy_is_defaulted_state (yystate) + || yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken) + { + yyconflicts = yyconfl; + return -yydefact[yystate]; + } + else if (! yytable_value_is_error (yytable[yyindex])) + { + yyconflicts = yyconfl + yyconflp[yyindex]; + return yytable[yyindex]; + } + else + { + yyconflicts = yyconfl + yyconflp[yyindex]; + return 0; + } + } + + /** Compute post-reduction state. + * \param yystate the current state + * \param yysym the nonterminal to push on the stack + */ + static state_num + yyLRgotoState (state_num yystate, symbol_kind_type yysym) + { + const int yyr = yypgoto[yysym - YYNTOKENS] + yystate; + if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate) + return yytable[yyr]; + else + return yydefgoto[yysym - YYNTOKENS]; + } + + static bool + yypact_value_is_default (state_num yystate) + { + return ]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf], [YYPACT_NINF])[; + } + + static bool + yytable_value_is_error (int yytable_value YY_ATTRIBUTE_UNUSED) + { + return ]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf], [YYTABLE_NINF])[; + } + + static bool + yy_is_shift_action (int yyaction) YY_NOEXCEPT + { + return 0 < yyaction; + } + + static bool + yy_is_error_action (int yyaction) YY_NOEXCEPT + { + return yyaction == 0; + } + + /** Whether LR state YYSTATE has only a default reduction + * (regardless of token). */ + static bool + yy_is_defaulted_state (state_num yystate) + { + return yypact_value_is_default (yypact[yystate]); + } + + /** The default reduction for YYSTATE, assuming it has one. */ + static rule_num + yy_default_action (state_num yystate) + { + return yydefact[yystate]; + } + + /* GLRStacks */ + + /** Y0 and Y1 represent two possible actions to take in a given + * parsing state; return 0 if no combination is possible, + * 1 if user-mergeable, 2 if Y0 is preferred, 3 if Y1 is preferred. */ + static int + yypreference (const semantic_option& y0, const semantic_option& y1) + { + const rule_num r0 = y0.yyrule, r1 = y1.yyrule; + const int p0 = yydprec[r0], p1 = yydprec[r1]; + + if (p0 == p1) + { + if (yymerger[r0] == 0 || yymerger[r0] != yymerger[r1]) + return 0; + else + return 1; + } + else if (p0 == 0 || p1 == 0) + return 0; + else if (p0 < p1) + return 3; + else if (p1 < p0) + return 2; + else + return 0; + } + +]b4_parse_param_vars[ + }; // class ]b4_parser_class[::glr_stack +} // namespace ]b4_namespace_ref[ + + +#if ]b4_api_PREFIX[DEBUG +namespace +{ + void + yypstack (const glr_stack& yystack, size_t yyk) + { + yystack.yypstack (create_state_set_index (static_cast (yyk))); + } + + void + yypdumpstack (const glr_stack& yystack) + { + yystack.yypdumpstack (); + } +} +#endif + +]b4_namespace_open[ + /// Build a parser object. + ]b4_parser_class::b4_parser_class[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [ + :])[ +#if ]b4_api_PREFIX[DEBUG + ]m4_ifset([b4_parse_param], [ ], [ :])[yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[ +#endif]b4_parse_param_cons[ + {} + + ]b4_parser_class::~b4_parser_class[ () + {} + + ]b4_parser_class[::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW + {} + + int + ]b4_parser_class[::operator() () + { + return parse (); + } + + int + ]b4_parser_class[::parse () + { + glr_stack yystack(YYINITDEPTH, *this]b4_user_args[); + return yystack.parse (); + } + +]b4_parse_error_bmatch([custom\|detailed], +[[ const char * + ]b4_parser_class[::symbol_name (symbol_kind_type yysymbol) + { + static const char *const yy_sname[] = + { + ]b4_symbol_names[ + };]b4_has_translations_if([[ + /* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is + internationalizable. */ + static ]b4_int_type_for([b4_translatable])[ yytranslatable[] = + { + ]b4_translatable[ + }; + return (yysymbol < YYNTOKENS && yytranslatable[yysymbol] + ? _(yy_sname[yysymbol]) + : yy_sname[yysymbol]);]], [[ + return yy_sname[yysymbol];]])[ + } +]], +[simple], +[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[ + const char * + ]b4_parser_class[::symbol_name (symbol_kind_type yysymbol) + { + return yytname_[yysymbol]; + } +#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[ +]], +[verbose], +[[ /* Return YYSTR after stripping away unnecessary quotes and + backslashes, so that it's suitable for yyerror. The heuristic is + that double-quoting is unnecessary unless the string contains an + apostrophe, a comma, or backslash (other than backslash-backslash). + YYSTR is taken from yytname. */ + std::string + ]b4_parser_class[::yytnamerr_ (const char *yystr) + { + if (*yystr == '"') + { + std::string yyr; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + else + goto append; + + append: + default: + yyr += *yyp; + break; + + case '"': + return yyr; + } + do_not_strip_quotes: ; + } + + return yystr; + } + + std::string + ]b4_parser_class[::symbol_name (symbol_kind_type yysymbol) + { + return yytnamerr_ (yytname_[yysymbol]); + } +]])[ + +]b4_parse_error_bmatch([simple\|verbose], +[[#if ]b4_api_PREFIX[DEBUG]b4_tname_if([[ || 1]])[ + // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + // First, the terminals, then, starting at \a YYNTOKENS, nonterminals. + const char* + const ]b4_parser_class[::yytname_[] = + { + ]b4_tname[ + }; +#endif +]])[ + +]b4_parse_error_bmatch([custom\|detailed\|verbose], [[ + // ]b4_parser_class[::context. + ]b4_parser_class[::context::context (glr_stack& yystack, const symbol_type& yyla) + : yystack_ (yystack) + , yyla_ (yyla) + {} + + int + ]b4_parser_class[::context::expected_tokens (symbol_kind_type yyarg[], int yyargn) const + { + // Actual number of expected tokens + int yycount = 0; + const int yyn = yypact[yystack_.firstTopState()->yylrState]; + if (!yystack_.yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for this + state because they are default actions. */ + const int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + const int yychecklim = YYLAST - yyn + 1; + const int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + for (int yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[ + && !yystack_.yytable_value_is_error (yytable[yyx + yyn])) + { + if (!yyarg) + ++yycount; + else if (yycount == yyargn) + return 0; + else + yyarg[yycount++] = YY_CAST (symbol_kind_type, yyx); + } + } + if (yyarg && yycount == 0 && 0 < yyargn) + yyarg[0] = ]b4_symbol(empty, kind)[; + return yycount; + } + +]])[ + +]b4_parse_error_bmatch([detailed\|verbose], [[ + int + ]b4_parser_class[::yy_syntax_error_arguments_ (const context& yyctx, + symbol_kind_type yyarg[], int yyargn) const + { + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yyla) is + if this state is a consistent state with a default action. + Thus, detecting the absence of a lookahead is sufficient to + determine that there is no unexpected or expected token to + report. In that case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is + a consistent state with a default action. There might have + been a previous inconsistent state, consistent state with a + non-default action, or user semantic action that manipulated + yyla. (However, yyla is currently not documented for users.) + */ + + if (!yyctx.lookahead ().empty ()) + { + if (yyarg) + yyarg[0] = yyctx.token (); + int yyn = yyctx.expected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1); + return yyn + 1; + } + return 0; + } + + // Generate an error message. + std::string + ]b4_parser_class[::yysyntax_error_ (const context& yyctx) const + { + // Its maximum. + enum { YYARGS_MAX = 5 }; + // Arguments of yyformat. + symbol_kind_type yyarg[YYARGS_MAX]; + int yycount = yy_syntax_error_arguments_ (yyctx, yyarg, YYARGS_MAX); + + char const* yyformat = YY_NULLPTR; + switch (yycount) + { +#define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + default: // Avoid compiler warnings. + YYCASE_ (0, YY_("syntax error")); + YYCASE_ (1, YY_("syntax error, unexpected %s")); + YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +#undef YYCASE_ + } + + std::string yyres; + // Argument number. + std::ptrdiff_t yyi = 0; + for (char const* yyp = yyformat; *yyp; ++yyp) + if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) + { + yyres += symbol_name (yyarg[yyi++]); + ++yyp; + } + else + yyres += *yyp; + return yyres; + }]])[ + + void + ]b4_parser_class[::yy_destroy_ (const char* yymsg, symbol_kind_type yykind, + value_type& yyval]b4_locations_if([[, + location_type& yyloc]])[) + { + YY_USE (yyval);]b4_locations_if([[ + YY_USE (yyloc);]])[ + if (!yymsg) + yymsg = "Deleting"; + ]b4_parser_class[& yyparser = *this; + YY_USE (yyparser); + YY_SYMBOL_PRINT (yymsg, yykind, yyval, yyloc); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + ]m4_do([m4_pushdef([b4_symbol_action], m4_defn([b4_symbol_action_for_yyval]))], + [b4_symbol_actions([destructor])], + [m4_popdef([b4_symbol_action])])[ + YY_IGNORE_MAYBE_UNINITIALIZED_END + } + +#if ]b4_api_PREFIX[DEBUG + /*--------------------. + | Print this symbol. | + `--------------------*/ + + void + ]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yykind, + const value_type& yyval]b4_locations_if([[, + const location_type& yyloc]])[) const + {]b4_locations_if([[ + YY_USE (yyloc);]])[ + YY_USE (yyval); + std::ostream& yyo = debug_stream (); + YY_USE (yyo); + ]m4_do([m4_pushdef([b4_symbol_action], m4_defn([b4_symbol_action_for_yyval]))], + [b4_symbol_actions([printer])], + [m4_popdef([b4_symbol_action])])[ + } + + void + ]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yykind, + const value_type& yyval]b4_locations_if([[, + const location_type& yyloc]])[) const + { + *yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm") + << ' ' << symbol_name (yykind) << " ("]b4_locations_if([[ + << yyloc << ": "]])[; + yy_symbol_value_print_ (yykind, yyval]b4_locations_if([[, yyloc]])[); + *yycdebug_ << ')'; + } + + std::ostream& + ]b4_parser_class[::debug_stream () const + { + return *yycdebug_; + } + + void + ]b4_parser_class[::set_debug_stream (std::ostream& o) + { + yycdebug_ = &o; + } + + + ]b4_parser_class[::debug_level_type + ]b4_parser_class[::debug_level () const + { + return yydebug; + } + + void + ]b4_parser_class[::set_debug_level (debug_level_type l) + { + // Actually, it is yydebug which is really used. + yydebug = l; + } +#endif // ]b4_api_PREFIX[DEBUG + +]b4_token_ctor_if([], [b4_yytranslate_define([cc])])[ + +]b4_token_ctor_if([], [[ + /*---------. + | symbol. | + `---------*/ +]b4_public_types_define([cc])])[ +]b4_namespace_close[]dnl +b4_epilogue[]dnl +b4_output_end diff -Nru bison-3.5.1+dfsg/data/skeletons/glr.c bison-3.8.2+dfsg/data/skeletons/glr.c --- bison-3.5.1+dfsg/data/skeletons/glr.c 2020-01-19 13:07:51.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/glr.c 2021-08-29 14:09:23.000000000 +0000 @@ -1,8 +1,8 @@ - -*- C -*- +# -*- C -*- # GLR skeleton for Bison -# Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # If we are loaded by glr.cc, do not override c++.m4 definitions by @@ -32,7 +32,9 @@ m4_define_default([b4_stack_depth_max], [10000]) m4_define_default([b4_stack_depth_init], [200]) - +# Included header. +b4_percent_define_default([[api.header.include]], + [["@basename(]b4_spec_header_file[@)"]]) ## ------------------------ ## ## Pure/impure interfaces. ## @@ -46,16 +48,6 @@ m4_define([b4_pure_flag], [b4_percent_define_flag_if([[api.pure]], [[1]], [[0]])])]) -# b4_user_formals -# --------------- -# The possible parse-params formal arguments preceded by a comma. -# -# This is not shared with yacc.c in c.m4 because GLR relies on ISO C -# formal argument declarations. -m4_define([b4_user_formals], -[m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])]) - - # b4_yyerror_args # --------------- # Optional effective arguments passed to yyerror: user args plus yylloc, and @@ -132,7 +124,7 @@ # -------------------------------------------------- # Expansion of $$ or $$, for symbol SYMBOL-NUM. m4_define([b4_rhs_value], -[b4_symbol_value([b4_rhs_data([$1], [$2]).yysemantics.yysval], [$3], [$4])]) +[b4_symbol_value([b4_rhs_data([$1], [$2]).yysemantics.yyval], [$3], [$4])]) @@ -155,13 +147,22 @@ [(b4_rhs_data([$1], [$2]).yyloc)]) +# b4_call_merger(MERGER-NUM, MERGER-NAME, SYMBOL-SUM) +# --------------------------------------------------- +m4_define([b4_call_merger], +[b4_case([$1], + [ b4_symbol_if([$3], [has_type], + [yy0->b4_symbol($3, slot) = $2 (*yy0, *yy1);], + [*yy0 = $2 (*yy0, *yy1);])])]) + + ## -------------- ## ## Declarations. ## ## -------------- ## # b4_shared_declarations # ---------------------- -# Declaration that might either go into the header (if --defines) +# Declaration that might either go into the header (if --header) # or open coded in the parser body. glr.cc has its own definition. m4_if(b4_skeleton, ["glr.c"], [m4_define([b4_shared_declarations], @@ -169,7 +170,7 @@ ]b4_percent_code_get([[requires]])[ ]b4_token_enums[ ]b4_declare_yylstype[ -]b4_function_declare(b4_prefix[parse], [int], b4_parse_param)[ +int ]b4_prefix[parse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[); ]b4_percent_code_get([[provides]])[]dnl ]) ]) @@ -187,7 +188,7 @@ # members of this union. # # To avoid this issue, just generate the header before the -# implementation file. But we should also make them more independant. +# implementation file. But we should also make them more independent. # ----------------- # # The header file. # @@ -195,13 +196,13 @@ # glr.cc produces its own header. b4_glr_cc_if([], -[b4_defines_if( +[b4_header_if( [b4_output_begin([b4_spec_header_file]) b4_copyright([Skeleton interface for Bison GLR parsers in C], - [2002-2015, 2018-2020])[ -]b4_cpp_guard_open([b4_spec_header_file])[ + [2002-2015, 2018-2021])[ +]b4_cpp_guard_open([b4_spec_mapped_header_file])[ ]b4_shared_declarations[ -]b4_cpp_guard_close([b4_spec_header_file])[ +]b4_cpp_guard_close([b4_spec_mapped_header_file])[ ]b4_output_end[ ]])]) @@ -212,7 +213,7 @@ b4_output_begin([b4_parser_file_name]) b4_copyright([Skeleton implementation for Bison GLR parsers in C], - [2002-2015, 2018-2020])[ + [2002-2015, 2018-2021])[ /* C GLR parser skeleton written by Paul Hilfinger. */ ]b4_disclaimer[ @@ -225,7 +226,7 @@ #define YYLTYPE ]b4_api_PREFIX[LTYPE]])])[ ]m4_if(b4_prefix, [yy], [], [[/* Substitute the variable and function names. */ -#define yyparse ]b4_prefix[parse +#define ]b4_glr_cc_if([yy_parse_impl], [yyparse])[ ]b4_prefix[]b4_glr_cc_if([_parse_impl], [parse])[ #define yylex ]b4_prefix[lex #define yyerror ]b4_prefix[error #define yydebug ]b4_prefix[debug]]b4_pure_if([], [[ @@ -238,16 +239,11 @@ ]b4_cast_define[ ]b4_null_define[ -]b4_defines_if([[#include "@basename(]b4_spec_header_file[@)"]], - [b4_shared_declarations])[ +]b4_header_if([[#include ]b4_percent_define_get([[api.header.include]])], + [b4_shared_declarations])[ -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[ -#endif +]b4_glr_cc_if([b4_glr_cc_setup], + [b4_declare_symbol_enum])[ /* Default (constant) value used for initialization for null right-hand sides. Unlike the standard yacc.c template, here we set @@ -266,6 +262,7 @@ #include ]b4_c99_int_type_define[ +]b4_sizes_types_define[ #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -278,6 +275,11 @@ # define YY_(Msgid) Msgid # endif #endif +]b4_has_translations_if([ +#ifndef N_ +# define N_(Msgid) Msgid +#endif +])[ #ifndef YYFREE # define YYFREE free @@ -289,9 +291,6 @@ # define YYREALLOC realloc #endif -#define YYSIZEMAX \ - (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : YY_CAST (ptrdiff_t, SIZE_MAX)) - #ifdef __cplusplus typedef bool yybool; # define yytrue true @@ -345,21 +344,17 @@ accessed by $0, $-1, etc., in any rule. */ #define YYMAXLEFT ]b4_max_left_semantic_context[ -/* YYMAXUTOK -- Last valid token number (for yychar). */ -#define YYMAXUTOK ]b4_user_token_number_max[]b4_glr_cc_if([[ -/* YYFAULTYTOK -- Token number (for yychar) that denotes a - syntax_error thrown from the scanner. */ -#define YYFAULTYTOK (YYMAXUTOK + 1)]])[ -/* YYUNDEFTOK -- Symbol number (for yytoken) that denotes an unknown - token. */ -#define YYUNDEFTOK ]b4_undef_token_number[ +/* YYMAXUTOK -- Last valid token kind. */ +#define YYMAXUTOK ]b4_code_max[ /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. */ ]b4_api_token_raw_if(dnl -[[#define YYTRANSLATE(YYX) (YYX)]], -[[#define YYTRANSLATE(YYX) \ - (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) +[[#define YYTRANSLATE(YYX) YY_CAST (yysymbol_kind_t, YYX)]], +[[#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK \ + ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ + : ]b4_symbol_prefix[YYUNDEF) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex. */ @@ -376,15 +371,6 @@ }; #endif -#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[ -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - ]b4_tname[ -}; -#endif - #define YYPACT_NINF (]b4_pact_ninf[) #define YYTABLE_NINF (]b4_table_ninf[) @@ -428,9 +414,6 @@ ]b4_conflicting_rules[ }; -/* Error token number */ -#define YYTERROR 1 - ]b4_locations_if([[ ]b4_yylloc_default_define[ # define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc) @@ -457,10 +440,9 @@ int yynerrs; int yychar;])[ -static const int YYEOF = 0; -static const int YYEMPTY = -2; +enum { YYENOMEM = -2 }; -typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG; +typedef enum { yyok, yyaccept, yyabort, yyerr, yynomem } YYRESULTTAG; #define YYCHK(YYE) \ do { \ @@ -469,62 +451,6 @@ return yychk_flag; \ } while (0) -#if ]b4_api_PREFIX[DEBUG - -# ifndef YYFPRINTF -# define YYFPRINTF fprintf -# endif - -# define YY_FPRINTF \ - YY_IGNORE_USELESS_CAST_BEGIN YY_FPRINTF_ - -# define YY_FPRINTF_(Args) \ - do { \ - YYFPRINTF Args; \ - YY_IGNORE_USELESS_CAST_END \ - } while (0) - -# define YY_DPRINTF \ - YY_IGNORE_USELESS_CAST_BEGIN YY_DPRINTF_ - -# define YY_DPRINTF_(Args) \ - do { \ - if (yydebug) \ - YYFPRINTF Args; \ - YY_IGNORE_USELESS_CAST_END \ - } while (0) - -]b4_yy_location_print_define[ - -]b4_yy_symbol_print_define[ - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ - do { \ - if (yydebug) \ - { \ - YY_FPRINTF ((stderr, "%s ", Title)); \ - yy_symbol_print (stderr, Type, Value]b4_locuser_args([Location])[); \ - YY_FPRINTF ((stderr, "\n")); \ - } \ - } while (0) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; - -struct yyGLRStack; -static void yypstack (struct yyGLRStack* yystackp, ptrdiff_t yyk) - YY_ATTRIBUTE_UNUSED; -static void yypdumpstack (struct yyGLRStack* yystackp) - YY_ATTRIBUTE_UNUSED; - -#else /* !]b4_api_PREFIX[DEBUG */ - -# define YY_DPRINTF(Args) do {} while (yyfalse) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) - -#endif /* !]b4_api_PREFIX[DEBUG */ - /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH ]b4_stack_depth_init[ @@ -566,91 +492,12 @@ } while (0) #endif - -#if YYERROR_VERBOSE - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static ptrdiff_t -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - ptrdiff_t yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - else - goto append; - - append: - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (yyres) - return yystpcpy (yyres, yystr) - yyres; - else - return YY_CAST (ptrdiff_t, strlen (yystr)); -} -# endif - -#endif /* !YYERROR_VERBOSE */ - /** State numbers. */ -typedef int yyStateNum; +typedef int yy_state_t; /** Rule numbers. */ typedef int yyRuleNum; -/** Grammar symbol. */ -typedef int yySymbol; - /** Item references. */ typedef short yyItemNum; @@ -660,42 +507,45 @@ typedef union yyGLRStackItem yyGLRStackItem; typedef struct yyGLRStack yyGLRStack; -struct yyGLRState { +struct yyGLRState +{ /** Type tag: always true. */ yybool yyisState; - /** Type tag for yysemantics. If true, yysval applies, otherwise + /** Type tag for yysemantics. If true, yyval applies, otherwise * yyfirstVal applies. */ yybool yyresolved; /** Number of corresponding LALR(1) machine state. */ - yyStateNum yylrState; + yy_state_t yylrState; /** Preceding state in this stack */ yyGLRState* yypred; /** Source position of the last token produced by my symbol */ - ptrdiff_t yyposn; + YYPTRDIFF_T yyposn; union { /** First in a chain of alternative reductions producing the * nonterminal corresponding to this state, threaded through * yynext. */ yySemanticOption* yyfirstVal; /** Semantic value for this state. */ - YYSTYPE yysval; + YYSTYPE yyval; } yysemantics;]b4_locations_if([[ /** Source location for this state. */ YYLTYPE yyloc;]])[ }; -struct yyGLRStateSet { +struct yyGLRStateSet +{ yyGLRState** yystates; /** During nondeterministic operation, yylookaheadNeeds tracks which * stacks have actually needed the current lookahead. During deterministic * operation, yylookaheadNeeds[0] is not maintained since it would merely - * duplicate yychar != YYEMPTY. */ + * duplicate yychar != ]b4_symbol(empty, id)[. */ yybool* yylookaheadNeeds; - ptrdiff_t yysize; - ptrdiff_t yycapacity; + YYPTRDIFF_T yysize; + YYPTRDIFF_T yycapacity; }; -struct yySemanticOption { +struct yySemanticOption +{ /** Type tag: always false. */ yybool yyisState; /** Rule number for this reduction */ @@ -732,7 +582,7 @@ YYJMP_BUF yyexception_buffer; yyGLRStackItem* yyitems; yyGLRStackItem* yynextFree; - ptrdiff_t yyspaceLeft; + YYPTRDIFF_T yyspaceLeft; yyGLRState* yysplitPoint; yyGLRState* yylastDeleted; yyGLRStateSet yytops; @@ -756,15 +606,207 @@ YYLONGJMP (yystackp->yyexception_buffer, 2); } -#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE -/** A printable representation of TOKEN. */ -static inline const char* -yytokenName (yySymbol yytoken) +/** Accessing symbol of state YYSTATE. */ +static inline yysymbol_kind_t +yy_accessing_symbol (yy_state_t yystate) { - return yytoken == YYEMPTY ? "" : yytname[yytoken]; + return YY_CAST (yysymbol_kind_t, yystos[yystate]); } + +#if ]b4_parse_error_case([simple], [b4_api_PREFIX[DEBUG || ]b4_token_table_flag], [[1]])[ +/* The user-facing name of the symbol whose (internal) number is + YYSYMBOL. No bounds checking. */ +static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; + +]b4_parse_error_bmatch([simple\|verbose], +[[/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + ]b4_tname[ +}; + +static const char * +yysymbol_name (yysymbol_kind_t yysymbol) +{ + return yytname[yysymbol]; +}]], +[[static const char * +yysymbol_name (yysymbol_kind_t yysymbol) +{ + static const char *const yy_sname[] = + { + ]b4_symbol_names[ + };]b4_has_translations_if([[ + /* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is + internationalizable. */ + static ]b4_int_type_for([b4_translatable])[ yytranslatable[] = + { + ]b4_translatable[ + }; + return (yysymbol < YYNTOKENS && yytranslatable[yysymbol] + ? _(yy_sname[yysymbol]) + : yy_sname[yysymbol]);]], [[ + return yy_sname[yysymbol];]])[ +}]])[ #endif +/** Left-hand-side symbol for rule #YYRULE. */ +static inline yysymbol_kind_t +yylhsNonterm (yyRuleNum yyrule) +{ + return YY_CAST (yysymbol_kind_t, yyr1[yyrule]); +} + +#if ]b4_api_PREFIX[DEBUG + +# ifndef YYFPRINTF +# define YYFPRINTF fprintf +# endif + +# define YY_FPRINTF \ + YY_IGNORE_USELESS_CAST_BEGIN YY_FPRINTF_ + +# define YY_FPRINTF_(Args) \ + do { \ + YYFPRINTF Args; \ + YY_IGNORE_USELESS_CAST_END \ + } while (0) + +# define YY_DPRINTF \ + YY_IGNORE_USELESS_CAST_BEGIN YY_DPRINTF_ + +# define YY_DPRINTF_(Args) \ + do { \ + if (yydebug) \ + YYFPRINTF Args; \ + YY_IGNORE_USELESS_CAST_END \ + } while (0) + +]b4_yylocation_print_define[ + +]b4_yy_symbol_print_define[ + +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ + do { \ + if (yydebug) \ + { \ + YY_FPRINTF ((stderr, "%s ", Title)); \ + yy_symbol_print (stderr, Kind, Value]b4_locuser_args([Location])[); \ + YY_FPRINTF ((stderr, "\n")); \ + } \ + } while (0) + +static inline void +yy_reduce_print (yybool yynormal, yyGLRStackItem* yyvsp, YYPTRDIFF_T yyk, + yyRuleNum yyrule]b4_user_formals[); + +# define YY_REDUCE_PRINT(Args) \ + do { \ + if (yydebug) \ + yy_reduce_print Args; \ + } while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; + +static void yypstack (yyGLRStack* yystackp, YYPTRDIFF_T yyk) + YY_ATTRIBUTE_UNUSED; +static void yypdumpstack (yyGLRStack* yystackp) + YY_ATTRIBUTE_UNUSED; + +#else /* !]b4_api_PREFIX[DEBUG */ + +# define YY_DPRINTF(Args) do {} while (yyfalse) +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) +# define YY_REDUCE_PRINT(Args) + +#endif /* !]b4_api_PREFIX[DEBUG */ + +]b4_parse_error_case( + [simple], +[[]], +[[#ifndef yystrlen +# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) +#endif + +]b4_parse_error_bmatch( + [detailed\|verbose], +[[#ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +#endif]])[ + +]b4_parse_error_case( + [verbose], +[[#ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYPTRDIFF_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYPTRDIFF_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + else + goto append; + + append: + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (yyres) + return yystpcpy (yyres, yystr) - yyres; + else + return yystrlen (yystr); +} +#endif +]])])[ + /** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting * at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred * containing the pointer to the next state in the chain. */ @@ -781,9 +823,9 @@ #endif yyvsp[i].yystate.yyresolved = s->yyresolved; if (s->yyresolved) - yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval; + yyvsp[i].yystate.yysemantics.yyval = s->yysemantics.yyval; else - /* The effect of using yysval or yyloc (in an immediate rule) is + /* The effect of using yyval or yyloc (in an immediate rule) is * undefined. */ yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULLPTR;]b4_locations_if([[ yyvsp[i].yystate.yyloc = s->yyloc;]])[ @@ -794,19 +836,19 @@ ]m4_define([b4_yygetToken_call], [[yygetToken (&yychar][]b4_pure_if([, yystackp])[]b4_user_args[)]])[ /** If yychar is empty, fetch the next token. */ -static inline yySymbol +static inline yysymbol_kind_t yygetToken (int *yycharp][]b4_pure_if([, yyGLRStack* yystackp])[]b4_user_formals[) { - yySymbol yytoken; + yysymbol_kind_t yytoken; ]b4_parse_param_use()dnl -[ if (*yycharp == YYEMPTY) +[ if (*yycharp == ]b4_symbol(empty, id)[) { - YY_DPRINTF ((stderr, "Reading a token: "));]b4_glr_cc_if([[ + YY_DPRINTF ((stderr, "Reading a token\n"));]b4_glr_cc_if([[ #if YY_EXCEPTIONS try { #endif // YY_EXCEPTIONS - *yycharp = ]b4_lex[; + *yycharp = ]b4_yylex[; #if YY_EXCEPTIONS } catch (const ]b4_namespace_ref[::]b4_parser_class[::syntax_error& yyexc) @@ -814,17 +856,18 @@ YY_DPRINTF ((stderr, "Caught exception: %s\n", yyexc.what()));]b4_locations_if([ yylloc = yyexc.location;])[ yyerror (]b4_lyyerror_args[yyexc.what ()); - // Map errors caught in the scanner to the undefined token - // (YYUNDEFTOK), so that error handling is started. - // However, record this with this special value of yychar. - *yycharp = YYFAULTYTOK; + // Map errors caught in the scanner to the undefined token, + // so that error handling is started. However, record this + // with this special value of yychar. + *yycharp = ]b4_symbol(error, id)[; } #endif // YY_EXCEPTIONS]], [[ - *yycharp = ]b4_lex[;]])[ + *yycharp = ]b4_yylex[;]])[ } - if (*yycharp <= YYEOF) + if (*yycharp <= ]b4_symbol(eof, [id])[) { - *yycharp = yytoken = YYEOF; + *yycharp = ]b4_symbol(eof, [id])[; + yytoken = ]b4_symbol_prefix[YYEOF; YY_DPRINTF ((stderr, "Now at end of input.\n")); } else @@ -855,28 +898,31 @@ * and top stack item YYVSP. YYLVALP points to place to put semantic * value ($$), and yylocp points to place for location information * (@@$). Returns yyok for normal return, yyaccept for YYACCEPT, - * yyerr for YYERROR, yyabort for YYABORT. */ + * yyerr for YYERROR, yyabort for YYABORT, yynomem for YYNOMEM. */ static YYRESULTTAG -yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp, - yyGLRStack* yystackp, +yyuserAction (yyRuleNum yyrule, int yyrhslen, yyGLRStackItem* yyvsp, + yyGLRStack* yystackp, YYPTRDIFF_T yyk, YYSTYPE* yyvalp]b4_locuser_formals[) { - yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR; - int yylow; + const yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR; + int yylow = 1; ]b4_parse_param_use([yyvalp], [yylocp])dnl -[ YYUSE (yyrhslen); +[ YY_USE (yyk); + YY_USE (yyrhslen); # undef yyerrok # define yyerrok (yystackp->yyerrState = 0) # undef YYACCEPT # define YYACCEPT return yyaccept # undef YYABORT # define YYABORT return yyabort +# undef YYNOMEM +# define YYNOMEM return yynomem # undef YYERROR # define YYERROR return yyerrok, yyerr # undef YYRECOVERING # define YYRECOVERING() (yystackp->yyerrState != 0) # undef yyclearin -# define yyclearin (yychar = YYEMPTY) +# define yyclearin (yychar = ]b4_symbol(empty, id)[) # undef YYFILL # define YYFILL(N) yyfill (yyvsp, &yylow, (N), yynormal) # undef YYBACKUP @@ -884,21 +930,23 @@ return yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")), \ yyerrok, yyerr - yylow = 1; if (yyrhslen == 0) *yyvalp = yyval_default; else - *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;]b4_locations_if([[ + *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yyval;]b4_locations_if([[ /* Default location. */ YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen); - yystackp->yyerror_range[1].yystate.yyloc = *yylocp; -]])[]b4_glr_cc_if([[ + yystackp->yyerror_range[1].yystate.yyloc = *yylocp;]])[ + /* If yyk == -1, we are running a deferred action on a temporary + stack. In that case, YY_REDUCE_PRINT must not play with YYFILL, + so pretend the stack is "normal". */ + YY_REDUCE_PRINT ((yynormal || yyk == -1, yyvsp, yyk, yyrule]b4_user_args[));]b4_glr_cc_if([[ #if YY_EXCEPTIONS typedef ]b4_namespace_ref[::]b4_parser_class[::syntax_error syntax_error; try { #endif // YY_EXCEPTIONS]])[ - switch (yyn) + switch (yyrule) { ]b4_user_actions[ default: break; @@ -913,11 +961,13 @@ YYERROR; } #endif // YY_EXCEPTIONS]])[ + YY_SYMBOL_PRINT ("-> $$ =", yylhsNonterm (yyrule), yyvalp, yylocp); return yyok; # undef yyerrok # undef YYABORT # undef YYACCEPT +# undef YYNOMEM # undef YYERROR # undef YYBACKUP # undef yyclearin @@ -928,8 +978,8 @@ static void yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1) { - YYUSE (yy0); - YYUSE (yy1); + YY_USE (yy0); + YY_USE (yy1); switch (yyn) { @@ -953,8 +1003,8 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[) { if (yys->yyresolved) - yydestruct (yymsg, yystos[yys->yylrState], - &yys->yysemantics.yysval]b4_locuser_args([&yys->yyloc])[); + yydestruct (yymsg, yy_accessing_symbol (yys->yylrState), + &yys->yysemantics.yyval]b4_locuser_args([&yys->yyloc])[); else { #if ]b4_api_PREFIX[DEBUG @@ -964,7 +1014,7 @@ YY_FPRINTF ((stderr, "%s unresolved", yymsg)); else YY_FPRINTF ((stderr, "%s incomplete", yymsg)); - YY_SYMBOL_PRINT ("", yystos[yys->yylrState], YY_NULLPTR, &yys->yyloc); + YY_SYMBOL_PRINT ("", yy_accessing_symbol (yys->yylrState), YY_NULLPTR, &yys->yyloc); } #endif @@ -981,27 +1031,20 @@ } } -/** Left-hand-side symbol for rule #YYRULE. */ -static inline yySymbol -yylhsNonterm (yyRuleNum yyrule) -{ - return yyr1[yyrule]; -} - #define yypact_value_is_default(Yyn) \ ]b4_table_value_equals([[pact]], [[Yyn]], [b4_pact_ninf], [YYPACT_NINF])[ /** True iff LR state YYSTATE has only a default reduction (regardless * of token). */ static inline yybool -yyisDefaultedState (yyStateNum yystate) +yyisDefaultedState (yy_state_t yystate) { return yypact_value_is_default (yypact[yystate]); } /** The default reduction for YYSTATE, assuming it has one. */ static inline yyRuleNum -yydefaultAction (yyStateNum yystate) +yydefaultAction (yy_state_t yystate) { return yydefact[yystate]; } @@ -1018,11 +1061,17 @@ * of conflicting reductions. */ static inline int -yygetLRActions (yyStateNum yystate, yySymbol yytoken, const short** yyconflicts) +yygetLRActions (yy_state_t yystate, yysymbol_kind_t yytoken, const short** yyconflicts) { int yyindex = yypact[yystate] + yytoken; - if (yyisDefaultedState (yystate) - || yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken) + if (yytoken == ]b4_symbol(error, kind)[) + { + // This is the error token. + *yyconflicts = yyconfl; + return 0; + } + else if (yyisDefaultedState (yystate) + || yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken) { *yyconflicts = yyconfl; return -yydefact[yystate]; @@ -1043,8 +1092,8 @@ * \param yystate the current state * \param yysym the nonterminal to push on the stack */ -static inline yyStateNum -yyLRgotoState (yyStateNum yystate, yySymbol yysym) +static inline yy_state_t +yyLRgotoState (yy_state_t yystate, yysymbol_kind_t yysym) { int yyr = yypgoto[yysym - YYNTOKENS] + yystate; if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate) @@ -1087,7 +1136,7 @@ * alternative actions for YYSTATE. Assumes that YYRHS comes from * stack #YYK of *YYSTACKP. */ static void -yyaddDeferredAction (yyGLRStack* yystackp, ptrdiff_t yyk, yyGLRState* yystate, +yyaddDeferredAction (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyGLRState* yystate, yyGLRState* yyrhs, yyRuleNum yyrule) { yySemanticOption* yynewOption = @@ -1102,7 +1151,7 @@ yynewOption->yyloc = yylloc;])[ } else - yynewOption->yyrawchar = YYEMPTY; + yynewOption->yyrawchar = ]b4_symbol(empty, id)[; yynewOption->yynext = yystate->yysemantics.yyfirstVal; yystate->yysemantics.yyfirstVal = yynewOption; @@ -1119,14 +1168,14 @@ yyset->yycapacity = 16; yyset->yystates = YY_CAST (yyGLRState**, - YYMALLOC (YY_CAST (size_t, yyset->yycapacity) + YYMALLOC (YY_CAST (YYSIZE_T, yyset->yycapacity) * sizeof yyset->yystates[0])); if (! yyset->yystates) return yyfalse; yyset->yystates[0] = YY_NULLPTR; yyset->yylookaheadNeeds = YY_CAST (yybool*, - YYMALLOC (YY_CAST (size_t, yyset->yycapacity) + YYMALLOC (YY_CAST (YYSIZE_T, yyset->yycapacity) * sizeof yyset->yylookaheadNeeds[0])); if (! yyset->yylookaheadNeeds) { @@ -1135,7 +1184,7 @@ } memset (yyset->yylookaheadNeeds, 0, - YY_CAST (size_t, yyset->yycapacity) * sizeof yyset->yylookaheadNeeds[0]); + YY_CAST (YYSIZE_T, yyset->yycapacity) * sizeof yyset->yylookaheadNeeds[0]); return yytrue; } @@ -1148,14 +1197,14 @@ /** Initialize *YYSTACKP to a single empty stack, with total maximum * capacity for all stacks of YYSIZE. */ static yybool -yyinitGLRStack (yyGLRStack* yystackp, ptrdiff_t yysize) +yyinitGLRStack (yyGLRStack* yystackp, YYPTRDIFF_T yysize) { yystackp->yyerrState = 0; yynerrs = 0; yystackp->yyspaceLeft = yysize; yystackp->yyitems = YY_CAST (yyGLRStackItem*, - YYMALLOC (YY_CAST (size_t, yysize) + YYMALLOC (YY_CAST (YYSIZE_T, yysize) * sizeof yystackp->yynextFree[0])); if (!yystackp->yyitems) return yyfalse; @@ -1181,9 +1230,9 @@ { yyGLRStackItem* yynewItems; yyGLRStackItem* yyp0, *yyp1; - ptrdiff_t yynewSize; - ptrdiff_t yyn; - ptrdiff_t yysize = yystackp->yynextFree - yystackp->yyitems; + YYPTRDIFF_T yynewSize; + YYPTRDIFF_T yyn; + YYPTRDIFF_T yysize = yystackp->yynextFree - yystackp->yyitems; if (YYMAXDEPTH - YYHEADROOM < yysize) yyMemoryExhausted (yystackp); yynewSize = 2*yysize; @@ -1191,7 +1240,7 @@ yynewSize = YYMAXDEPTH; yynewItems = YY_CAST (yyGLRStackItem*, - YYMALLOC (YY_CAST (size_t, yynewSize) + YYMALLOC (YY_CAST (YYSIZE_T, yynewSize) * sizeof yynewItems[0])); if (! yynewItems) yyMemoryExhausted (yystackp); @@ -1256,7 +1305,7 @@ /** Invalidate stack #YYK in *YYSTACKP. */ static inline void -yymarkStackDeleted (yyGLRStack* yystackp, ptrdiff_t yyk) +yymarkStackDeleted (yyGLRStack* yystackp, YYPTRDIFF_T yyk) { if (yystackp->yytops.yystates[yyk] != YY_NULLPTR) yystackp->yylastDeleted = yystackp->yytops.yystates[yyk]; @@ -1280,7 +1329,7 @@ static inline void yyremoveDeletes (yyGLRStack* yystackp) { - ptrdiff_t yyi, yyj; + YYPTRDIFF_T yyi, yyj; yyi = yyj = 0; while (yyj < yystackp->yytops.yysize) { @@ -1313,8 +1362,8 @@ * state YYLRSTATE, at input position YYPOSN, with (resolved) semantic * value *YYVALP and source location *YYLOCP. */ static inline void -yyglrShift (yyGLRStack* yystackp, ptrdiff_t yyk, yyStateNum yylrState, - ptrdiff_t yyposn, +yyglrShift (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yy_state_t yylrState, + YYPTRDIFF_T yyposn, YYSTYPE* yyvalp]b4_locations_if([, YYLTYPE* yylocp])[) { yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate; @@ -1323,7 +1372,7 @@ yynewState->yyposn = yyposn; yynewState->yyresolved = yytrue; yynewState->yypred = yystackp->yytops.yystates[yyk]; - yynewState->yysemantics.yysval = *yyvalp;]b4_locations_if([ + yynewState->yysemantics.yyval = *yyvalp;]b4_locations_if([ yynewState->yyloc = *yylocp;])[ yystackp->yytops.yystates[yyk] = yynewState; @@ -1334,8 +1383,8 @@ * state YYLRSTATE, at input position YYPOSN, with the (unresolved) * semantic value of YYRHS under the action for YYRULE. */ static inline void -yyglrShiftDefer (yyGLRStack* yystackp, ptrdiff_t yyk, yyStateNum yylrState, - ptrdiff_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule) +yyglrShiftDefer (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yy_state_t yylrState, + YYPTRDIFF_T yyposn, yyGLRState* yyrhs, yyRuleNum yyrule) { yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate; YY_ASSERT (yynewState->yyisState); @@ -1351,21 +1400,14 @@ yyaddDeferredAction (yystackp, yyk, yynewState, yyrhs, yyrule); } -#if !]b4_api_PREFIX[DEBUG -# define YY_REDUCE_PRINT(Args) -#else -# define YY_REDUCE_PRINT(Args) \ - do { \ - if (yydebug) \ - yy_reduce_print Args; \ - } while (0) +#if ]b4_api_PREFIX[DEBUG /*----------------------------------------------------------------------. | Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. | `----------------------------------------------------------------------*/ static inline void -yy_reduce_print (yybool yynormal, yyGLRStackItem* yyvsp, ptrdiff_t yyk, +yy_reduce_print (yybool yynormal, yyGLRStackItem* yyvsp, YYPTRDIFF_T yyk, yyRuleNum yyrule]b4_user_formals[) { int yynrhs = yyrhsLength (yyrule);]b4_locations_if([ @@ -1380,8 +1422,8 @@ { YY_FPRINTF ((stderr, " $%d = ", yyi + 1)); yy_symbol_print (stderr, - yystos[yyvsp[yyi - yynrhs + 1].yystate.yylrState], - &yyvsp[yyi - yynrhs + 1].yystate.yysemantics.yysval]b4_locations_if([, + yy_accessing_symbol (yyvsp[yyi - yynrhs + 1].yystate.yylrState), + &yyvsp[yyi - yynrhs + 1].yystate.yysemantics.yyval]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl b4_user_args[); if (!yyvsp[yyi - yynrhs + 1].yystate.yyresolved) @@ -1398,7 +1440,7 @@ * and *YYLOCP to the computed location (if any). Return value is as * for userAction. */ static inline YYRESULTTAG -yydoAction (yyGLRStack* yystackp, ptrdiff_t yyk, yyRuleNum yyrule, +yydoAction (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule, YYSTYPE* yyvalp]b4_locuser_formals[) { int yynrhs = yyrhsLength (yyrule); @@ -1412,8 +1454,7 @@ yystackp->yynextFree -= yynrhs; yystackp->yyspaceLeft += yynrhs; yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate; - YY_REDUCE_PRINT ((yytrue, yyrhs, yyk, yyrule]b4_user_args[)); - return yyuserAction (yyrule, yynrhs, yyrhs, yystackp, + return yyuserAction (yyrule, yynrhs, yyrhs, yystackp, yyk, yyvalp]b4_locuser_args[); } else @@ -1432,9 +1473,8 @@ } yyupdateSplit (yystackp, yys); yystackp->yytops.yystates[yyk] = yys; - YY_REDUCE_PRINT ((yyfalse, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, yyk, yyrule]b4_user_args[)); return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, - yystackp, yyvalp]b4_locuser_args[); + yystackp, yyk, yyvalp]b4_locuser_args[); } } @@ -1450,35 +1490,34 @@ * added to the options for the existing state's semantic value. */ static inline YYRESULTTAG -yyglrReduce (yyGLRStack* yystackp, ptrdiff_t yyk, yyRuleNum yyrule, +yyglrReduce (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule, yybool yyforceEval]b4_user_formals[) { - ptrdiff_t yyposn = yystackp->yytops.yystates[yyk]->yyposn; + YYPTRDIFF_T yyposn = yystackp->yytops.yystates[yyk]->yyposn; if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR) { - YYSTYPE yysval;]b4_locations_if([[ + YYSTYPE yyval;]b4_locations_if([[ YYLTYPE yyloc;]])[ - YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[); + YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yyval]b4_locuser_args([&yyloc])[); if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR) YY_DPRINTF ((stderr, "Parse on stack %ld rejected by rule %d (line %d).\n", - YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule - 1])); + YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule])); if (yyflag != yyok) return yyflag; - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc); yyglrShift (yystackp, yyk, yyLRgotoState (yystackp->yytops.yystates[yyk]->yylrState, yylhsNonterm (yyrule)), - yyposn, &yysval]b4_locations_if([, &yyloc])[); + yyposn, &yyval]b4_locations_if([, &yyloc])[); } else { - ptrdiff_t yyi; + YYPTRDIFF_T yyi; int yyn; yyGLRState* yys, *yys0 = yystackp->yytops.yystates[yyk]; - yyStateNum yynewLRState; + yy_state_t yynewLRState; for (yys = yystackp->yytops.yystates[yyk], yyn = yyrhsLength (yyrule); 0 < yyn; yyn -= 1) @@ -1491,7 +1530,7 @@ YY_DPRINTF ((stderr, "Reduced stack %ld by rule %d (line %d); action deferred. " "Now in state %d.\n", - YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule - 1], + YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule], yynewLRState)); for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR) @@ -1517,8 +1556,8 @@ return yyok; } -static ptrdiff_t -yysplitStack (yyGLRStack* yystackp, ptrdiff_t yyk) +static YYPTRDIFF_T +yysplitStack (yyGLRStack* yystackp, YYPTRDIFF_T yyk) { if (yystackp->yysplitPoint == YY_NULLPTR) { @@ -1527,8 +1566,8 @@ } if (yystackp->yytops.yycapacity <= yystackp->yytops.yysize) { - ptrdiff_t state_size = sizeof yystackp->yytops.yystates[0]; - ptrdiff_t half_max_capacity = YYSIZEMAX / 2 / state_size; + YYPTRDIFF_T state_size = YYSIZEOF (yystackp->yytops.yystates[0]); + YYPTRDIFF_T half_max_capacity = YYSIZE_MAXIMUM / 2 / state_size; if (half_max_capacity < yystackp->yytops.yycapacity) yyMemoryExhausted (yystackp); yystackp->yytops.yycapacity *= 2; @@ -1537,7 +1576,7 @@ yyGLRState** yynewStates = YY_CAST (yyGLRState**, YYREALLOC (yystackp->yytops.yystates, - (YY_CAST (size_t, yystackp->yytops.yycapacity) + (YY_CAST (YYSIZE_T, yystackp->yytops.yycapacity) * sizeof yynewStates[0]))); if (yynewStates == YY_NULLPTR) yyMemoryExhausted (yystackp); @@ -1548,7 +1587,7 @@ yybool* yynewLookaheadNeeds = YY_CAST (yybool*, YYREALLOC (yystackp->yytops.yylookaheadNeeds, - (YY_CAST (size_t, yystackp->yytops.yycapacity) + (YY_CAST (YYSIZE_T, yystackp->yytops.yycapacity) * sizeof yynewLookaheadNeeds[0]))); if (yynewLookaheadNeeds == YY_NULLPTR) yyMemoryExhausted (yystackp); @@ -1602,12 +1641,12 @@ else if (yys0->yyresolved) { yys1->yyresolved = yytrue; - yys1->yysemantics.yysval = yys0->yysemantics.yysval; + yys1->yysemantics.yyval = yys0->yysemantics.yyval; } else if (yys1->yyresolved) { yys0->yyresolved = yytrue; - yys0->yysemantics.yysval = yys1->yysemantics.yysval; + yys0->yysemantics.yyval = yys1->yysemantics.yyval; } else { @@ -1661,8 +1700,8 @@ return 0; } -static YYRESULTTAG yyresolveValue (yyGLRState* yys, - yyGLRStack* yystackp]b4_user_formals[); +static YYRESULTTAG +yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[); /** Resolve the previous YYN states starting at and including state YYS @@ -1718,7 +1757,7 @@ yylloc = yyopt->yyloc;])[ yyflag = yyuserAction (yyopt->yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, - yystackp, yyvalp]b4_locuser_args[); + yystackp, -1, yyvalp]b4_locuser_args[); yychar = yychar_current; yylval = yylval_current;]b4_locations_if([ yylloc = yylloc_current;])[ @@ -1748,11 +1787,11 @@ if (yyx->yystate->yyposn < yys->yyposn + 1) YY_FPRINTF ((stderr, "%*s%s -> \n", - yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), + yyindent, "", yysymbol_name (yylhsNonterm (yyx->yyrule)), yyx->yyrule - 1)); else YY_FPRINTF ((stderr, "%*s%s -> \n", - yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), + yyindent, "", yysymbol_name (yylhsNonterm (yyx->yyrule)), yyx->yyrule - 1, YY_CAST (long, yys->yyposn + 1), YY_CAST (long, yyx->yystate->yyposn))); for (yyi = 1; yyi <= yynrhs; yyi += 1) @@ -1761,10 +1800,10 @@ { if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn) YY_FPRINTF ((stderr, "%*s%s \n", yyindent+2, "", - yytokenName (yystos[yystates[yyi]->yylrState]))); + yysymbol_name (yy_accessing_symbol (yystates[yyi]->yylrState)))); else YY_FPRINTF ((stderr, "%*s%s \n", yyindent+2, "", - yytokenName (yystos[yystates[yyi]->yylrState]), + yysymbol_name (yy_accessing_symbol (yystates[yyi]->yylrState)), YY_CAST (long, yystates[yyi-1]->yyposn + 1), YY_CAST (long, yystates[yyi]->yyposn))); } @@ -1778,8 +1817,8 @@ yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1]b4_pure_formals[) { - YYUSE (yyx0); - YYUSE (yyx1); + YY_USE (yyx0); + YY_USE (yyx1); #if ]b4_api_PREFIX[DEBUG YY_FPRINTF ((stderr, "Ambiguity detected.\n")); @@ -1853,7 +1892,7 @@ yySemanticOption* yybest = yyoptionList; yySemanticOption** yypp; yybool yymerge = yyfalse; - YYSTYPE yysval; + YYSTYPE yyval; YYRESULTTAG yyflag;]b4_locations_if([ YYLTYPE *yylocp = &yys->yyloc;])[ @@ -1897,33 +1936,33 @@ { yySemanticOption* yyp; int yyprec = yydprec[yybest->yyrule]; - yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args[); + yyflag = yyresolveAction (yybest, yystackp, &yyval]b4_locuser_args[); if (yyflag == yyok) for (yyp = yybest->yynext; yyp != YY_NULLPTR; yyp = yyp->yynext) { if (yyprec == yydprec[yyp->yyrule]) { - YYSTYPE yysval_other;]b4_locations_if([ + YYSTYPE yyval_other;]b4_locations_if([ YYLTYPE yydummy;])[ - yyflag = yyresolveAction (yyp, yystackp, &yysval_other]b4_locuser_args([&yydummy])[); + yyflag = yyresolveAction (yyp, yystackp, &yyval_other]b4_locuser_args([&yydummy])[); if (yyflag != yyok) { yydestruct ("Cleanup: discarding incompletely merged value for", - yystos[yys->yylrState], - &yysval]b4_locuser_args[); + yy_accessing_symbol (yys->yylrState), + &yyval]b4_locuser_args[); break; } - yyuserMerge (yymerger[yyp->yyrule], &yysval, &yysval_other); + yyuserMerge (yymerger[yyp->yyrule], &yyval, &yyval_other); } } } else - yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args([yylocp])[); + yyflag = yyresolveAction (yybest, yystackp, &yyval]b4_locuser_args([yylocp])[); if (yyflag == yyok) { yys->yyresolved = yytrue; - yys->yysemantics.yysval = yysval; + yys->yysemantics.yyval = yyval; } else yys->yysemantics.yyfirstVal = YY_NULLPTR; @@ -1948,18 +1987,24 @@ return yyok; } +/** Called when returning to deterministic operation to clean up the extra + * stacks. */ static void yycompressStack (yyGLRStack* yystackp) { - yyGLRState* yyp, *yyq, *yyr; + /* yyr is the state after the split point. */ + yyGLRState *yyr; if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULLPTR) return; - for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR; - yyp != yystackp->yysplitPoint; - yyr = yyp, yyp = yyq, yyq = yyp->yypred) - yyp->yypred = yyr; + { + yyGLRState *yyp, *yyq; + for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR; + yyp != yystackp->yysplitPoint; + yyr = yyp, yyp = yyq, yyq = yyp->yypred) + yyp->yypred = yyr; + } yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems; yystackp->yynextFree = YY_REINTERPRET_CAST (yyGLRStackItem*, yystackp->yysplitPoint) + 1; @@ -1979,12 +2024,12 @@ } static YYRESULTTAG -yyprocessOneStack (yyGLRStack* yystackp, ptrdiff_t yyk, - ptrdiff_t yyposn]b4_pure_formals[) +yyprocessOneStack (yyGLRStack* yystackp, YYPTRDIFF_T yyk, + YYPTRDIFF_T yyposn]b4_pure_formals[) { while (yystackp->yytops.yystates[yyk] != YY_NULLPTR) { - yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState; + yy_state_t yystate = yystackp->yytops.yystates[yyk]->yylrState; YY_DPRINTF ((stderr, "Stack %ld Entering state %d\n", YY_CAST (long, yyk), yystate)); @@ -2015,15 +2060,15 @@ } else { - yySymbol yytoken = ]b4_yygetToken_call[; + yysymbol_kind_t yytoken = ]b4_yygetToken_call[; const short* yyconflicts; const int yyaction = yygetLRActions (yystate, yytoken, &yyconflicts); yystackp->yytops.yylookaheadNeeds[yyk] = yytrue; - while (*yyconflicts != 0) + for (/* nothing */; *yyconflicts; yyconflicts += 1) { YYRESULTTAG yyflag; - ptrdiff_t yynewStack = yysplitStack (yystackp, yyk); + YYPTRDIFF_T yynewStack = yysplitStack (yystackp, yyk); YY_DPRINTF ((stderr, "Splitting off stack %ld from %ld.\n", YY_CAST (long, yynewStack), YY_CAST (long, yyk))); yyflag = yyglrReduce (yystackp, yynewStack, @@ -2039,7 +2084,6 @@ } else return yyflag; - yyconflicts += 1; } if (yyisShiftAction (yyaction)) @@ -2071,29 +2115,82 @@ return yyok; } -static void -yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) +]b4_parse_error_case([simple], [], +[[/* Put in YYARG at most YYARGN of the expected tokens given the + current YYSTACKP, and return the number of tokens stored in YYARG. If + YYARG is null, return the number of expected tokens (guaranteed to + be less than YYNTOKENS). */ +static int +yypcontext_expected_tokens (const yyGLRStack* yystackp, + yysymbol_kind_t yyarg[], int yyargn) { - if (yystackp->yyerrState != 0) - return; -#if ! YYERROR_VERBOSE - yyerror (]b4_lyyerror_args[YY_("syntax error")); -#else - { - yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - yybool yysize_overflow = yyfalse; - char* yymsg = YY_NULLPTR; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat: reported tokens (one for the "unexpected", - one per "expected"). */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Actual size of YYARG. */ int yycount = 0; - /* Cumulated lengths of YYARG. */ - ptrdiff_t yysize = 0; + int yyn = yypact[yystackp->yytops.yystates[0]->yylrState]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[ + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (!yyarg) + ++yycount; + else if (yycount == yyargn) + return 0; + else + yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx); + } + } + if (yyarg && yycount == 0 && 0 < yyargn) + yyarg[0] = ]b4_symbol(empty, kind)[; + return yycount; +}]])[ +]b4_parse_error_bmatch( + [custom], +[[/* User defined function to report a syntax error. */ +typedef yyGLRStack yypcontext_t; +static int +yyreport_syntax_error (const yyGLRStack* yystackp]b4_user_formals[); + +/* The kind of the lookahead of this context. */ +static yysymbol_kind_t +yypcontext_token (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED; + +static yysymbol_kind_t +yypcontext_token (const yyGLRStack *yystackp) +{ + YY_USE (yystackp); + yysymbol_kind_t yytoken = yychar == ]b4_symbol(empty, id)[ ? ]b4_symbol(empty, kind)[ : YYTRANSLATE (yychar); + return yytoken; +} + +]b4_locations_if([[/* The location of the lookahead of this context. */ +static const YYLTYPE * +yypcontext_location (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED; + +static const YYLTYPE * +yypcontext_location (const yyGLRStack *yystackp) +{ + YY_USE (yystackp); + return &yylloc; +}]])], + [detailed\|verbose], +[[static int +yy_syntax_error_arguments (const yyGLRStack* yystackp, + yysymbol_kind_t yyarg[], int yyargn) +{ + yysymbol_kind_t yytoken = yychar == ]b4_symbol(empty, id)[ ? ]b4_symbol(empty, kind)[ : YYTRANSLATE (yychar); + /* Actual size of YYARG. */ + int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action @@ -2117,43 +2214,52 @@ one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ - if (yytoken != YYEMPTY) + if (yytoken != ]b4_symbol(empty, kind)[) { - int yyn = yypact[yystackp->yytops.yystates[0]->yylrState]; - ptrdiff_t yysize0 = yytnamerr (YY_NULLPTR, yytokenName (yytoken)); - yysize = yysize0; - yyarg[yycount++] = yytokenName (yytoken); - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for this - state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytokenName (yyx); - { - ptrdiff_t yysz = yytnamerr (YY_NULLPTR, yytokenName (yyx)); - if (YYSIZEMAX - yysize < yysz) - yysize_overflow = yytrue; - else - yysize += yysz; - } - } - } + int yyn; + if (yyarg) + yyarg[yycount] = yytoken; + ++yycount; + yyn = yypcontext_expected_tokens (yystackp, + yyarg ? yyarg + 1 : yyarg, yyargn - 1); + if (yyn == YYENOMEM) + return YYENOMEM; + else + yycount += yyn; } + return yycount; +} +]])[ + + +static void +yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) +{ + if (yystackp->yyerrState != 0) + return; +]b4_parse_error_case( + [custom], +[[ if (yyreport_syntax_error (yystackp]b4_user_args[)) + yyMemoryExhausted (yystackp);]], + [simple], +[[ yyerror (]b4_lyyerror_args[YY_("syntax error"));]], +[[ { + yybool yysize_overflow = yyfalse; + char* yymsg = YY_NULLPTR; + enum { YYARGS_MAX = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat: reported tokens (one for the "unexpected", + one per "expected"). */ + yysymbol_kind_t yyarg[YYARGS_MAX]; + /* Cumulated lengths of YYARG. */ + YYPTRDIFF_T yysize = 0; + + /* Actual size of YYARG. */ + int yycount + = yy_syntax_error_arguments (yystackp, yyarg, YYARGS_MAX); + if (yycount == YYENOMEM) + yyMemoryExhausted (yystackp); switch (yycount) { @@ -2171,18 +2277,26 @@ #undef YYCASE_ } + /* Compute error message size. Don't count the "%s"s, but reserve + room for the terminator. */ + yysize = yystrlen (yyformat) - 2 * yycount + 1; { - /* Don't count the "%s"s in the final size, but reserve room for - the terminator. */ - ptrdiff_t yysz = YY_CAST (ptrdiff_t, strlen (yyformat)) - 2 * yycount + 1; - if (YYSIZEMAX - yysize < yysz) - yysize_overflow = yytrue; - else - yysize += yysz; + int yyi; + for (yyi = 0; yyi < yycount; ++yyi) + { + YYPTRDIFF_T yysz + = ]b4_parse_error_case( + [verbose], [[yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]])]], + [[yystrlen (yysymbol_name (yyarg[yyi]))]]);[ + if (YYSIZE_MAXIMUM - yysize < yysz) + yysize_overflow = yytrue; + else + yysize += yysz; + } } if (!yysize_overflow) - yymsg = YY_CAST (char *, YYMALLOC (YY_CAST (size_t, yysize))); + yymsg = YY_CAST (char *, YYMALLOC (YY_CAST (YYSIZE_T, yysize))); if (yymsg) { @@ -2191,8 +2305,9 @@ while ((*yyp = *yyformat)) { if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); + {]b4_parse_error_case([verbose], [[ + yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);]], [[ + yyp = yystpcpy (yyp, yysymbol_name (yyarg[yyi++]));]])[ yyformat += 2; } else @@ -2209,8 +2324,7 @@ yyerror (]b4_lyyerror_args[YY_("syntax error")); yyMemoryExhausted (yystackp); } - } -#endif /* YYERROR_VERBOSE */ + }]])[ yynerrs += 1; } @@ -2225,11 +2339,11 @@ reductions. Skip tokens until we can proceed. */ while (yytrue) { - yySymbol yytoken; + yysymbol_kind_t yytoken; int yyj; - if (yychar == YYEOF) + if (yychar == ]b4_symbol(eof, [id])[) yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR); - if (yychar != YYEMPTY) + if (yychar != ]b4_symbol(empty, id)[) {]b4_locations_if([[ /* We throw away the lookahead, but the error range of the shifted error token must take it into account. */ @@ -2241,7 +2355,7 @@ yytoken = YYTRANSLATE (yychar); yydestruct ("Error: discarding", yytoken, &yylval]b4_locuser_args([&yylloc])[); - yychar = YYEMPTY; + yychar = ]b4_symbol(empty, id)[; } yytoken = ]b4_yygetToken_call[; yyj = yypact[yystackp->yytops.yystates[0]->yylrState]; @@ -2259,7 +2373,7 @@ /* Reduce to one stack. */ { - ptrdiff_t yyk; + YYPTRDIFF_T yyk; for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1) if (yystackp->yytops.yystates[yyk] != YY_NULLPTR) break; @@ -2271,7 +2385,7 @@ yycompressStack (yystackp); } - /* Now pop stack until we find a state that shifts the error token. */ + /* Pop stack until we find a state that shifts the error token. */ yystackp->yyerrState = 3; while (yystackp->yytops.yystates[0] != YY_NULLPTR) { @@ -2279,8 +2393,8 @@ int yyj = yypact[yys->yylrState]; if (! yypact_value_is_default (yyj)) { - yyj += YYTERROR; - if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR + yyj += ]b4_symbol(error, kind)[; + if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == ]b4_symbol(error, kind)[ && yyisShiftAction (yytable[yyj])) { /* Shift the error token. */ @@ -2289,7 +2403,7 @@ YYLTYPE yyerrloc; yystackp->yyerror_range[2].yystate.yyloc = yylloc; YYLLOC_DEFAULT (yyerrloc, (yystackp->yyerror_range), 2);]])[ - YY_SYMBOL_PRINT ("Shifting", yystos[yyaction], + YY_SYMBOL_PRINT ("Shifting", yy_accessing_symbol (yyaction), &yylval, &yyerrloc); yyglrShift (yystackp, 0, yyaction, yys->yyposn, &yylval]b4_locations_if([, &yyerrloc])[); @@ -2308,36 +2422,33 @@ yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR); } -#define YYCHK1(YYE) \ - do { \ - switch (YYE) { \ - case yyok: \ - break; \ - case yyabort: \ - goto yyabortlab; \ - case yyaccept: \ - goto yyacceptlab; \ - case yyerr: \ - goto yyuser_error; \ - default: \ - goto yybuglab; \ - } \ +#define YYCHK1(YYE) \ + do { \ + switch (YYE) { \ + case yyok: break; \ + case yyabort: goto yyabortlab; \ + case yyaccept: goto yyacceptlab; \ + case yyerr: goto yyuser_error; \ + case yynomem: goto yyexhaustedlab; \ + default: goto yybuglab; \ + } \ } while (0) /*----------. | yyparse. | `----------*/ -]b4_function_define([yyparse], [int], b4_parse_param)[ +int +]b4_glr_cc_if([yy_parse_impl], [yyparse])[ (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[) { int yyresult; yyGLRStack yystack; yyGLRStack* const yystackp = &yystack; - ptrdiff_t yyposn; + YYPTRDIFF_T yyposn; YY_DPRINTF ((stderr, "Starting parse\n")); - yychar = YYEMPTY; + yychar = ]b4_symbol(empty, id)[; yylval = yyval_default;]b4_locations_if([ yylloc = yyloc_default;])[ ]m4_ifdef([b4_initial_action], [ @@ -2362,10 +2473,10 @@ /* For efficiency, we have two loops, the first of which is specialized to deterministic operation (single stack, no potential ambiguity). */ - /* Standard mode */ + /* Standard mode. */ while (yytrue) { - yyStateNum yystate = yystack.yytops.yystates[0]->yylrState; + yy_state_t yystate = yystack.yytops.yystates[0]->yylrState; YY_DPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) goto yyacceptlab; @@ -2382,15 +2493,16 @@ } else { - yySymbol yytoken = ]b4_yygetToken_call;[ + yysymbol_kind_t yytoken = ]b4_yygetToken_call;[ const short* yyconflicts; int yyaction = yygetLRActions (yystate, yytoken, &yyconflicts); - if (*yyconflicts != 0) + if (*yyconflicts) + /* Enter nondeterministic mode. */ break; if (yyisShiftAction (yyaction)) { YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - yychar = YYEMPTY; + yychar = ]b4_symbol(empty, id)[; yyposn += 1; yyglrShift (&yystack, 0, yyaction, yyposn, &yylval]b4_locations_if([, &yylloc])[); if (0 < yystack.yyerrState) @@ -2398,11 +2510,11 @@ } else if (yyisErrorAction (yyaction)) {]b4_locations_if([[ - yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[]b4_glr_cc_if([[ - /* Don't issue an error message again for exceptions - thrown from the scanner. */ - if (yychar != YYFAULTYTOK) - ]])[ yyreportSyntaxError (&yystack]b4_user_args[); + yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ + /* Issue an error message unless the scanner already + did. */ + if (yychar != ]b4_symbol(error, id)[) + yyreportSyntaxError (&yystack]b4_user_args[); goto yyuser_error; } else @@ -2410,13 +2522,14 @@ } } + /* Nondeterministic mode. */ while (yytrue) { - yySymbol yytoken_to_shift; - ptrdiff_t yys; + yysymbol_kind_t yytoken_to_shift; + YYPTRDIFF_T yys; for (yys = 0; yys < yystack.yytops.yysize; yys += 1) - yystackp->yytops.yylookaheadNeeds[yys] = yychar != YYEMPTY; + yystackp->yytops.yylookaheadNeeds[yys] = yychar != ]b4_symbol(empty, id)[; /* yyprocessOneStack returns one of three things: @@ -2454,15 +2567,15 @@ /* If any yyglrShift call fails, it will fail after shifting. Thus, a copy of yylval will already be on stack 0 in the event of a - failure in the following loop. Thus, yychar is set to YYEMPTY + failure in the following loop. Thus, yychar is set to ]b4_symbol(empty, id)[ before the loop to make sure the user destructor for yylval isn't called twice. */ yytoken_to_shift = YYTRANSLATE (yychar); - yychar = YYEMPTY; + yychar = ]b4_symbol(empty, id)[; yyposn += 1; for (yys = 0; yys < yystack.yytops.yysize; yys += 1) { - yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState; + yy_state_t yystate = yystack.yytops.yystates[yys]->yylrState; const short* yyconflicts; int yyaction = yygetLRActions (yystate, yytoken_to_shift, &yyconflicts); @@ -2471,7 +2584,7 @@ YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc); yyglrShift (&yystack, yys, yyaction, yyposn, &yylval]b4_locations_if([, &yylloc])[); - YY_DPRINTF ((stderr, "Stack %ld now in state #%d\n", + YY_DPRINTF ((stderr, "Stack %ld now in state %d\n", YY_CAST (long, yys), yystack.yytops.yystates[yys]->yylrState)); } @@ -2492,7 +2605,7 @@ yyacceptlab: yyresult = 0; - goto yyreturn; + goto yyreturnlab; yybuglab: YY_ASSERT (yyfalse); @@ -2500,15 +2613,15 @@ yyabortlab: yyresult = 1; - goto yyreturn; + goto yyreturnlab; yyexhaustedlab: yyerror (]b4_lyyerror_args[YY_("memory exhausted")); yyresult = 2; - goto yyreturn; + goto yyreturnlab; - yyreturn: - if (yychar != YYEMPTY) + yyreturnlab: + if (yychar != ]b4_symbol(empty, id)[) yydestruct ("Cleanup: discarding lookahead", YYTRANSLATE (yychar), &yylval]b4_locuser_args([&yylloc])[); @@ -2520,8 +2633,8 @@ yyGLRState** yystates = yystack.yytops.yystates; if (yystates) { - ptrdiff_t yysize = yystack.yytops.yysize; - ptrdiff_t yyk; + YYPTRDIFF_T yysize = yystack.yytops.yysize; + YYPTRDIFF_T yyk; for (yyk = 0; yyk < yysize; yyk += 1) if (yystates[yyk]) { @@ -2546,6 +2659,7 @@ /* DEBUGGING ONLY */ #if ]b4_api_PREFIX[DEBUG +/* Print *YYS and its predecessors. */ static void yy_yypstack (yyGLRState* yys) { @@ -2557,22 +2671,25 @@ YY_FPRINTF ((stderr, "%d@@%ld", yys->yylrState, YY_CAST (long, yys->yyposn))); } +/* Print YYS (possibly NULL) and its predecessors. */ static void -yypstates (yyGLRState* yyst) +yypstates (yyGLRState* yys) { - if (yyst == YY_NULLPTR) + if (yys == YY_NULLPTR) YY_FPRINTF ((stderr, "")); else - yy_yypstack (yyst); + yy_yypstack (yys); YY_FPRINTF ((stderr, "\n")); } +/* Print the stack #YYK. */ static void -yypstack (yyGLRStack* yystackp, ptrdiff_t yyk) +yypstack (yyGLRStack* yystackp, YYPTRDIFF_T yyk) { yypstates (yystackp->yytops.yystates[yyk]); } +/* Print all the stacks. */ static void yypdumpstack (yyGLRStack* yystackp) { @@ -2613,7 +2730,7 @@ YY_FPRINTF ((stderr, "Tops:")); { - ptrdiff_t yyi; + YYPTRDIFF_T yyi; for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) YY_FPRINTF ((stderr, "%ld: %ld; ", YY_CAST (long, yyi), YYINDEX (yystackp->yytops.yystates[yyi]))); @@ -2639,5 +2756,8 @@ #define yynerrs ]b4_prefix[nerrs]b4_locations_if([[ #define yylloc ]b4_prefix[lloc]])])[ -]b4_epilogue[]dnl +]b4_glr_cc_if([b4_glr_cc_pre_epilogue +b4_glr_cc_cleanup])[ +]b4_percent_code_get([[epilogue]])[]dnl +b4_epilogue[]dnl b4_output_end diff -Nru bison-3.5.1+dfsg/data/skeletons/glr.cc bison-3.8.2+dfsg/data/skeletons/glr.cc --- bison-3.5.1+dfsg/data/skeletons/glr.cc 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/glr.cc 2021-06-23 04:48:48.000000000 +0000 @@ -1,6 +1,6 @@ # C++ GLR skeleton for Bison -# Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # This skeleton produces a C++ class that encapsulates a C glr parser. @@ -72,24 +72,17 @@ # Bypass the default implementation to generate the "yy_symbol_print" # and "yy_symbol_value_print" functions. m4_define([b4_yy_symbol_print_define], -[[ -/*--------------------. +[[/*--------------------. | Print this symbol. | `--------------------*/ -]b4_function_define([yy_symbol_print], - [static void], - [[FILE *], []], - [[int yytype], [yytype]], - [[const ]b4_namespace_ref::b4_parser_class[::semantic_type *yyvaluep], - [yyvaluep]][]dnl -b4_locations_if([, - [[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp], - [yylocationp]]]), - b4_parse_param)[ +static void +yy_symbol_print (FILE *, ]b4_namespace_ref::b4_parser_class[::symbol_kind_type yytoken, + const ]b4_namespace_ref::b4_parser_class[::value_type *yyvaluep]b4_locations_if([[, + const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp]])[]b4_user_formals[) { ]b4_parse_param_use[]dnl -[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[); +[ yyparser.yy_symbol_print_ (yytoken, yyvaluep]b4_locations_if([, yylocationp])[); } ]])[ @@ -101,45 +94,24 @@ # Hijack the post prologue to declare yyerror. ]m4_append([b4_post_prologue], [b4_syncline([@oline@], [@ofile@])dnl -b4_function_declare([yyerror], - [static void],b4_locations_if([ - [[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp], - [yylocationp]],]) - b4_parse_param, - [[const char* msg], [msg]])])[ - - -#undef yynerrs -#undef yychar -#undef yylval]b4_locations_if([ -#undef yylloc]) - -m4_if(b4_prefix, [yy], [], -[[/* Substitute the variable and function names. */ -#define yyparse ]b4_prefix[parse -#define yylex ]b4_prefix[lex -#define yyerror ]b4_prefix[error -#define yydebug ]b4_prefix[debug]]b4_pure_if([], [[ -#define yylval ]b4_prefix[lval -#define yychar ]b4_prefix[char -#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[ -#define yylloc ]b4_prefix[lloc]])])) +[static void +yyerror (]b4_locations_if([[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp, + ]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param), + ])[const char* msg);]])[ -# Hijack the epilogue to define implementations (yyerror, parser member +# Inserted before the epilogue to define implementations (yyerror, parser member # functions etc.). -m4_append([b4_epilogue], +]m4_define([b4_glr_cc_pre_epilogue], [b4_syncline([@oline@], [@ofile@])dnl [ /*------------------. | Report an error. | `------------------*/ -]b4_function_define([yyerror], - [static void],b4_locations_if([ - [[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp], - [yylocationp]],]) - b4_parse_param, - [[const char* msg], [msg]])[ +static void +yyerror (]b4_locations_if([[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp, + ]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param), + ])[const char* msg) { ]b4_parse_param_use[]dnl [ yyparser.error (]b4_locations_if([[*yylocationp, ]])[msg); @@ -172,7 +144,7 @@ int ]b4_parser_class[::parse () { - return ::yyparse (*this]b4_user_args[); + return ::yy_parse_impl (*this]b4_user_args[); } #if ]b4_api_PREFIX[DEBUG @@ -181,28 +153,28 @@ `--------------------*/ void - ]b4_parser_class[::yy_symbol_value_print_ (int yytype, - const semantic_type* yyvaluep]b4_locations_if([[, - const location_type* yylocationp]])[) + ]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yykind, + const value_type* yyvaluep]b4_locations_if([[, + const location_type* yylocationp]])[) const {]b4_locations_if([[ - YYUSE (yylocationp);]])[ - YYUSE (yyvaluep); + YY_USE (yylocationp);]])[ + YY_USE (yyvaluep); std::ostream& yyo = debug_stream (); std::ostream& yyoutput = yyo; - YYUSE (yyoutput); + YY_USE (yyoutput); ]b4_symbol_actions([printer])[ } void - ]b4_parser_class[::yy_symbol_print_ (int yytype, - const semantic_type* yyvaluep]b4_locations_if([[, - const location_type* yylocationp]])[) + ]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yykind, + const value_type* yyvaluep]b4_locations_if([[, + const location_type* yylocationp]])[) const { - *yycdebug_ << (yytype < YYNTOKENS ? "token" : "nterm") - << ' ' << yytname[yytype] << " ("]b4_locations_if([[ + *yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm") + << ' ' << yysymbol_name (yykind) << " ("]b4_locations_if([[ << *yylocationp << ": "]])[; - yy_symbol_value_print_ (yytype, yyvaluep]b4_locations_if([[, yylocationp]])[); + yy_symbol_value_print_ (yykind, yyvaluep]b4_locations_if([[, yylocationp]])[); *yycdebug_ << ')'; } @@ -238,23 +210,18 @@ ]) -# b4_shared_declarations(hh|cc) -# ----------------------------- -# Declaration that might either go into the header (if --defines, $1 = hh) -# or in the implementation file. -m4_define([b4_shared_declarations], -[m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl -b4_percent_code_get([[requires]])[ -#include -#include -#include - -]b4_cxx_portability[ -]m4_ifdef([b4_location_include], - [[# include ]b4_location_include])[ -]b4_variant_if([b4_variant_includes])[ +m4_define([b4_define_symbol_kind], +[m4_format([#define %-15s %s], + b4_symbol($][1, kind_base), + b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol($1, kind_base)) +]) -]b4_attribute_define[ +# b4_glr_cc_setup +# --------------- +# Setup redirections for glr.c: Map the names used in c.m4 to the ones used +# in c++.m4. +m4_define([b4_glr_cc_setup], +[[]b4_attribute_define[ ]b4_null_define[ // This skeleton is based on C, yet compiles it as C++. @@ -272,6 +239,62 @@ # pragma clang diagnostic ignored "-Wc++11-long-long" #endif +#undef ]b4_symbol(empty, [id])[ +#define ]b4_symbol(empty, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(empty, [id])[ +#undef ]b4_symbol(eof, [id])[ +#define ]b4_symbol(eof, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(eof, [id])[ +#undef ]b4_symbol(error, [id])[ +#define ]b4_symbol(error, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(error, [id])[ + +#ifndef ]b4_api_PREFIX[STYPE +# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class[::value_type +#endif +#ifndef ]b4_api_PREFIX[LTYPE +# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class[::location_type +#endif + +typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind_type yysymbol_kind_t; + +// Expose C++ symbol kinds to C. +]b4_define_symbol_kind(-2)dnl +b4_symbol_foreach([b4_define_symbol_kind])])[ +]]) + + +m4_define([b4_undef_symbol_kind], +[[#undef ]b4_symbol($1, kind_base)[ +]]) + + +# b4_glr_cc_cleanup +# ----------------- +# Remove redirections for glr.c. +m4_define([b4_glr_cc_cleanup], +[[#undef ]b4_symbol(empty, [id])[ +#undef ]b4_symbol(eof, [id])[ +#undef ]b4_symbol(error, [id])[ + +]b4_undef_symbol_kind(-2)dnl +b4_symbol_foreach([b4_undef_symbol_kind])dnl +]) + + +# b4_shared_declarations(hh|cc) +# ----------------------------- +# Declaration that might either go into the header (if --header, $1 = hh) +# or in the implementation file. +m4_define([b4_shared_declarations], +[m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl +b4_percent_code_get([[requires]])[ +#include +#include +#include + +]b4_cxx_portability[ +]m4_ifdef([b4_location_include], + [[# include ]b4_location_include])[ +]b4_variant_if([b4_variant_includes])[ + // Whether we are compiled with exception support. #ifndef YY_EXCEPTIONS # if defined __GNUC__ && !defined __EXCEPTIONS @@ -328,53 +351,43 @@ # if ]b4_api_PREFIX[DEBUG public: /// \brief Report a symbol value on the debug stream. - /// \param yytype The token type. + /// \param yykind The symbol kind. /// \param yyvaluep Its semantic value.]b4_locations_if([[ /// \param yylocationp Its location.]])[ - virtual void yy_symbol_value_print_ (int yytype, - const semantic_type* yyvaluep]b4_locations_if([[, - const location_type* yylocationp]])[); + virtual void yy_symbol_value_print_ (symbol_kind_type yykind, + const value_type* yyvaluep]b4_locations_if([[, + const location_type* yylocationp]])[) const; /// \brief Report a symbol on the debug stream. - /// \param yytype The token type. + /// \param yykind The symbol kind. /// \param yyvaluep Its semantic value.]b4_locations_if([[ /// \param yylocationp Its location.]])[ - virtual void yy_symbol_print_ (int yytype, - const semantic_type* yyvaluep]b4_locations_if([[, - const location_type* yylocationp]])[); + virtual void yy_symbol_print_ (symbol_kind_type yykind, + const value_type* yyvaluep]b4_locations_if([[, + const location_type* yylocationp]])[) const; private: - // Debugging. + /// Debug stream. std::ostream* yycdebug_; #endif ]b4_parse_param_vars[ }; -]dnl Redirections for glr.c. -b4_percent_define_flag_if([[global_tokens_and_yystype]], -[b4_token_defines]) -[ -#ifndef ]b4_api_PREFIX[STYPE -# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class[::semantic_type -#endif -#ifndef ]b4_api_PREFIX[LTYPE -# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class[::location_type -#endif - ]b4_namespace_close[ + ]b4_percent_code_get([[provides]])[ ]m4_popdef([b4_parse_param])dnl -]) +])[ -b4_defines_if( +]b4_header_if( [b4_output_begin([b4_spec_header_file]) b4_copyright([Skeleton interface for Bison GLR parsers in C++], - [2002-2015, 2018-2020])[ + [2002-2015, 2018-2021])[ // C++ GLR parser skeleton written by Akim Demaille. ]b4_disclaimer[ -]b4_cpp_guard_open([b4_spec_header_file])[ +]b4_cpp_guard_open([b4_spec_mapped_header_file])[ ]b4_shared_declarations[ -]b4_cpp_guard_close([b4_spec_header_file])[ +]b4_cpp_guard_close([b4_spec_mapped_header_file])[ ]b4_output_end]) # Let glr.c (and b4_shared_declarations) believe that the user diff -Nru bison-3.5.1+dfsg/data/skeletons/java.m4 bison-3.8.2+dfsg/data/skeletons/java.m4 --- bison-3.5.1+dfsg/data/skeletons/java.m4 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/java.m4 2021-08-08 06:59:01.000000000 +0000 @@ -2,7 +2,7 @@ # Java language support for Bison -# Copyright (C) 2007-2015, 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . m4_include(b4_skeletonsdir/[c-like.m4]) @@ -71,12 +71,12 @@ # b4_identification # ----------------- m4_define([b4_identification], -[ /** Version number for the Bison executable that generated this parser. */ - public static final String bisonVersion = "b4_version"; +[[ /** Version number for the Bison executable that generated this parser. */ + public static final String bisonVersion = "]b4_version_string["; /** Name of the skeleton that generated this parser. */ - public static final String bisonSkeleton = b4_skeleton; -]) + public static final String bisonSkeleton = ]b4_skeleton[; +]]) ## ------------ ## @@ -106,10 +106,13 @@ # b4_typed_parser_table_define(TYPE, NAME, DATA, COMMENT) # ------------------------------------------------------- +# We use intermediate functions (e.g., yypact_init) to work around the +# 64KB limit for JVM methods. See +# https://lists.gnu.org/r/help-bison/2008-11/msg00004.html. m4_define([b4_typed_parser_table_define], [m4_ifval([$4], [b4_comment([$4]) ])dnl -[private static final ]$1[ yy$2_[] = yy$2_init(); +[private static final ]$1[[] yy$2_ = yy$2_init(); private static final ]$1[[] yy$2_init() { return new ]$1[[] @@ -125,40 +128,158 @@ [b4_typed_parser_table_define([b4_int_type_for([$2])], [$1], [$2], [$3])]) -## ------------------------- ## -## Assigning token numbers. ## -## ------------------------- ## +## ------------- ## +## Token kinds. ## +## ------------- ## + # b4_token_enum(TOKEN-NUM) # ------------------------ # Output the definition of this token as an enum. m4_define([b4_token_enum], -[b4_token_format([ /** Token number, to be returned by the scanner. */ - static final int %s = %s; -], [$1])]) +[b4_token_visible_if([$1], + [m4_format([[ /** Token %s, to be returned by the scanner. */ + static final int %s = %s%s; +]], + b4_symbol([$1], [tag]), + b4_symbol([$1], [id]), + b4_symbol([$1], b4_api_token_raw_if([[number]], [[code]])))])]) + # b4_token_enums # -------------- # Output the definition of the tokens (if there are) as enums. m4_define([b4_token_enums], -[b4_any_token_visible_if([/* Tokens. */ +[b4_any_token_visible_if([ /* Token kinds. */ b4_symbol_foreach([b4_token_enum])])]) -# b4-case(ID, CODE) -# ----------------- + + +## -------------- ## +## Symbol kinds. ## +## -------------- ## + + +# b4_symbol_kind(NUM) +# ------------------- +m4_define([b4_symbol_kind], +[SymbolKind.b4_symbol_kind_base($@)]) + + +# b4_symbol_enum(SYMBOL-NUM) +# -------------------------- +# Output the definition of this symbol as an enum. +m4_define([b4_symbol_enum], +[m4_format([ %-30s %s], + m4_format([[%s(%s)%s]], + b4_symbol([$1], [kind_base]), + [$1], + m4_if([$1], b4_last_symbol, [[;]], [[,]])), + [b4_symbol_tag_comment([$1])])]) + + +# b4_declare_symbol_enum +# ---------------------- +# The definition of the symbol internal numbers as an enum. +m4_define([b4_declare_symbol_enum], +[[ public enum SymbolKind + { +]b4_symbol_foreach([b4_symbol_enum])[ + + private final int yycode_; + + SymbolKind (int n) { + this.yycode_ = n; + } + + private static final SymbolKind[] values_ = { + ]m4_map_args_sep([b4_symbol_kind(], [)], [, + ], b4_symbol_numbers)[ + }; + + static final SymbolKind get(int code) { + return values_[code]; + } + + public final int getCode() { + return this.yycode_; + } + +]b4_parse_error_bmatch( +[simple\|verbose], +[[ /* Return YYSTR after stripping away unnecessary quotes and + backslashes, so that it's suitable for yyerror. The heuristic is + that double-quoting is unnecessary unless the string contains an + apostrophe, a comma, or backslash (other than backslash-backslash). + YYSTR is taken from yytname. */ + private static String yytnamerr_(String yystr) + { + if (yystr.charAt (0) == '"') + { + StringBuffer yyr = new StringBuffer(); + strip_quotes: for (int i = 1; i < yystr.length(); i++) + switch (yystr.charAt(i)) + { + case '\'': + case ',': + break strip_quotes; + + case '\\': + if (yystr.charAt(++i) != '\\') + break strip_quotes; + /* Fall through. */ + default: + yyr.append(yystr.charAt(i)); + break; + + case '"': + return yyr.toString(); + } + } + return yystr; + } + + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at \a YYNTOKENS_, nonterminals. */ + ]b4_typed_parser_table_define([String], [tname], [b4_tname])[ + + /* The user-facing name of this symbol. */ + public final String getName() { + return yytnamerr_(yytname_[yycode_]); + } +]], +[custom\|detailed], +[[ /* YYNAMES_[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at \a YYNTOKENS_, nonterminals. */ + ]b4_typed_parser_table_define([String], [names], [b4_symbol_names])[ + + /* The user-facing name of this symbol. */ + public final String getName() { + return yynames_[yycode_]; + }]])[ + }; +]])]) + + + +# b4_case(ID, CODE, [COMMENTS]) +# ----------------------------- # We need to fool Java's stupid unreachable code detection. -m4_define([b4_case], [ case $1: +m4_define([b4_case], +[ case $1:m4_ifval([$3], [ b4_comment([$3])]) if (yyn == $1) $2; break; - ]) +]) + # b4_predicate_case(LABEL, CONDITIONS) # ------------------------------------ -m4_define([b4_predicate_case], [ case $1: +m4_define([b4_predicate_case], +[ case $1: if (! ($2)) YYERROR; break; - ]) +]) ## -------- ## @@ -183,6 +304,7 @@ m4_define([b4_yystype], [b4_percent_define_get([[api.value.type]])]) b4_percent_define_default([[api.value.type]], [[Object]]) +b4_percent_define_default([[api.symbol.prefix]], [[S_]]) # b4_api_prefix, b4_api_PREFIX # ---------------------------- @@ -222,6 +344,22 @@ ## ----------------- ## +# b4_symbol_translate(STRING) +# --------------------------- +# Used by "bison" in the array of symbol names to mark those that +# require translation. +m4_define([b4_symbol_translate], +[[i18n($1)]]) + + +# b4_trans(STRING) +# ---------------- +# Translate a string if i18n is enabled. Avoid collision with b4_translate. +m4_define([b4_trans], +[b4_has_translations_if([i18n($1)], [$1])]) + + + # b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG]) # ---------------------------------------------- # See README. @@ -361,4 +499,4 @@ # ----------------------- # Expand to either an empty string or "throws THROWS". m4_define([b4_maybe_throws], - [m4_ifval($1, [throws $1])]) + [m4_ifval($1, [ throws $1])]) diff -Nru bison-3.5.1+dfsg/data/skeletons/java-skel.m4 bison-3.8.2+dfsg/data/skeletons/java-skel.m4 --- bison-3.5.1+dfsg/data/skeletons/java-skel.m4 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/java-skel.m4 2021-06-23 04:48:48.000000000 +0000 @@ -2,7 +2,7 @@ # Java skeleton dispatching for Bison. -# Copyright (C) 2007, 2009-2015, 2018-2020 Free Software Foundation, +# Copyright (C) 2007, 2009-2015, 2018-2021 Free Software Foundation, # Inc. # This program is free software: you can redistribute it and/or modify @@ -16,7 +16,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . b4_glr_if( [b4_complain([%%glr-parser not supported for Java])]) b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])]) diff -Nru bison-3.5.1+dfsg/data/skeletons/lalr1.cc bison-3.8.2+dfsg/data/skeletons/lalr1.cc --- bison-3.5.1+dfsg/data/skeletons/lalr1.cc 2020-01-19 13:07:51.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/lalr1.cc 2021-09-18 05:55:59.000000000 +0000 @@ -1,6 +1,6 @@ # C++ skeleton for Bison -# Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,22 +13,31 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . m4_include(b4_skeletonsdir/[c++.m4]) # api.value.type=variant is valid. m4_define([b4_value_type_setup_variant]) -# Check the value of %define parse.lac, where LAC stands for lookahead -# correction. +# parse.lac b4_percent_define_default([[parse.lac]], [[none]]) +b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]]) b4_define_flag_if([lac]) m4_define([b4_lac_flag], [m4_if(b4_percent_define_get([[parse.lac]]), [none], [[0]], [[1]])]) +# b4_tname_if(TNAME-NEEDED, TNAME-NOT-NEEDED) +# ------------------------------------------- +m4_define([b4_tname_if], +[m4_case(b4_percent_define_get([[parse.error]]), + [verbose], [$1], + [b4_token_table_if([$1], + [$2])])]) + + # b4_integral_parser_table_declare(TABLE-NAME, CONTENT, COMMENT) # -------------------------------------------------------------- # Declare "parser::yy_" whose contents is CONTENT. @@ -49,6 +58,13 @@ };dnl ]) + +# b4_symbol_kind(NUM) +# ------------------- +m4_define([b4_symbol_kind], +[symbol_kind::b4_symbol_kind_base($@)]) + + # b4_symbol_value_template(VAL, SYMBOL-NUM, [TYPE]) # ------------------------------------------------- # Same as b4_symbol_value, but used in a template method. It makes @@ -129,21 +145,21 @@ ])]) -# b4_lex -# ------ +# b4_yylex +# -------- # Call yylex. -m4_define([b4_lex], +m4_define([b4_yylex], [b4_token_ctor_if( [b4_function_call([yylex], [symbol_type], m4_ifdef([b4_lex_param], b4_lex_param))], [b4_function_call([yylex], [int], - [b4_api_PREFIX[STYPE*], [&yyla.value]][]dnl -b4_locations_if([, [[location*], [&yyla.location]]])dnl + [[value_type *], [&yyla.value]][]dnl +b4_locations_if([, [[location_type *], [&yyla.location]]])dnl m4_ifdef([b4_lex_param], [, ]b4_lex_param))])]) m4_pushdef([b4_copyright_years], - [2002-2015, 2018-2020]) + [2002-2015, 2018-2021]) m4_define([b4_parser_class], [b4_percent_define_get([[api.parser.class]])]) @@ -157,7 +173,7 @@ # b4_shared_declarations(hh|cc) # ----------------------------- -# Declaration that might either go into the header (if --defines, $1 = hh) +# Declaration that might either go into the header (if --header, $1 = hh) # or in the implementation file. m4_define([b4_shared_declarations], [b4_percent_code_get([[requires]])[ @@ -194,6 +210,13 @@ ]b4_parser_class[ (]b4_parse_param_decl[); virtual ~]b4_parser_class[ (); +#if 201103L <= YY_CPLUSPLUS + /// Non copyable. + ]b4_parser_class[ (const ]b4_parser_class[&) = delete; + /// Non copyable. + ]b4_parser_class[& operator= (const ]b4_parser_class[&) = delete; +#endif + /// Parse. An alias for parse (). /// \returns 0 iff parsing succeeded. int operator() (); @@ -224,19 +247,57 @@ /// Report a syntax error. void error (const syntax_error& err); -]b4_token_constructor_define[ +]b4_parse_error_bmatch( +[custom\|detailed], +[[ /// The user-facing name of the symbol whose (internal) number is + /// YYSYMBOL. No bounds checking. + static const char *symbol_name (symbol_kind_type yysymbol);]], +[simple], +[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[ + /// The user-facing name of the symbol whose (internal) number is + /// YYSYMBOL. No bounds checking. + static const char *symbol_name (symbol_kind_type yysymbol); +#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[ +]], +[verbose], +[[ /// The user-facing name of the symbol whose (internal) number is + /// YYSYMBOL. No bounds checking. + static std::string symbol_name (symbol_kind_type yysymbol);]])[ +]b4_token_constructor_define[ +]b4_parse_error_bmatch([custom\|detailed\|verbose], [[ + class context + { + public: + context (const ]b4_parser_class[& yyparser, const symbol_type& yyla); + const symbol_type& lookahead () const YY_NOEXCEPT { return yyla_; } + symbol_kind_type token () const YY_NOEXCEPT { return yyla_.kind (); }]b4_locations_if([[ + const location_type& location () const YY_NOEXCEPT { return yyla_.location; } +]])[ + /// Put in YYARG at most YYARGN of the expected tokens, and return the + /// number of tokens stored in YYARG. If YYARG is null, return the + /// number of expected tokens (guaranteed to be less than YYNTOKENS). + int expected_tokens (symbol_kind_type yyarg[], int yyargn) const; + + private: + const ]b4_parser_class[& yyparser_; + const symbol_type& yyla_; + }; +]])[ private: - /// This class is not copyable. +#if YY_CPLUSPLUS < 201103L + /// Non copyable. ]b4_parser_class[ (const ]b4_parser_class[&); - ]b4_parser_class[& operator= (const ]b4_parser_class[&);]b4_lac_if([[ - + /// Non copyable. + ]b4_parser_class[& operator= (const ]b4_parser_class[&); +#endif +]b4_lac_if([[ /// Check the lookahead yytoken. /// \returns true iff the token will be eventually shifted. - bool yy_lac_check_ (int yytoken) const; + bool yy_lac_check_ (symbol_kind_type yytoken) const; /// Establish the initial context if no initial context currently exists. /// \returns true iff the token will be eventually shifted. - bool yy_lac_establish_ (int yytoken); + bool yy_lac_establish_ (symbol_kind_type yytoken); /// Discard any previous initial lookahead context because of event. /// \param event the event which caused the lookahead to be discarded. /// Only used for debbuging output. @@ -244,13 +305,19 @@ /// Stored state numbers (used for stacks). typedef ]b4_int_type(0, m4_eval(b4_states_number - 1))[ state_type; +]b4_parse_error_bmatch( +[custom], [[ + /// Report a syntax error + /// \param yyctx the context in which the error occurred. + void report_syntax_error (const context& yyctx) const;]], +[detailed\|verbose], [[ + /// The arguments of the error message. + int yy_syntax_error_arguments_ (const context& yyctx, + symbol_kind_type yyarg[], int yyargn) const; /// Generate an error message. - /// \param yystate the state where the error occurred. - /// \param yyla the lookahead token. - virtual std::string yysyntax_error_ (state_type yystate, - const symbol_type& yyla) const; - + /// \param yyctx the context in which the error occurred. + virtual std::string yysyntax_error_ (const context& yyctx) const;]])[ /// Compute post-reduction state. /// \param yystate the current state /// \param yysym the nonterminal to push on the stack @@ -258,43 +325,52 @@ /// Whether the given \c yypact_ value indicates a defaulted state. /// \param yyvalue the value to check - static bool yy_pact_value_is_default_ (int yyvalue); + static bool yy_pact_value_is_default_ (int yyvalue) YY_NOEXCEPT; /// Whether the given \c yytable_ value indicates a syntax error. /// \param yyvalue the value to check - static bool yy_table_value_is_error_ (int yyvalue); + static bool yy_table_value_is_error_ (int yyvalue) YY_NOEXCEPT; static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_; static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_; - /// Convert a scanner token number \a t to a symbol number. - /// In theory \a t should be a token_type, but character literals - /// are valid, yet not members of the token_type enum. - static token_number_type yytranslate_ (int t); - - // Tables. -]b4_parser_tables_declare[]b4_error_verbose_if([ - - /// Convert the symbol name \a n to a form suitable for a diagnostic. - static std::string yytnamerr_ (const char *n);])[ + /// Convert a scanner token kind \a t to a symbol kind. + /// In theory \a t should be a token_kind_type, but character literals + /// are valid, yet not members of the token_kind_type enum. + static symbol_kind_type yytranslate_ (int t) YY_NOEXCEPT; + +]b4_parse_error_bmatch( +[simple], +[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[ + /// For a symbol, its name in clear. + static const char* const yytname_[]; +#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[ +]], +[verbose], +[[ /// Convert the symbol name \a n to a form suitable for a diagnostic. + static std::string yytnamerr_ (const char *yystr); -]b4_token_table_if([], [[#if ]b4_api_PREFIX[DEBUG]])[ /// For a symbol, its name in clear. static const char* const yytname_[]; -]b4_token_table_if([[#if ]b4_api_PREFIX[DEBUG]])[ +]])[ + + // Tables. +]b4_parser_tables_declare[ + +#if ]b4_api_PREFIX[DEBUG ]b4_integral_parser_table_declare([rline], [b4_rline], [[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[ /// Report on the debug stream that the rule \a r is going to be reduced. - virtual void yy_reduce_print_ (int r); + virtual void yy_reduce_print_ (int r) const; /// Print the state stack on the debug stream. - virtual void yystack_print_ (); + virtual void yy_stack_print_ () const; /// Debugging level. int yydebug_; /// Debug stream. std::ostream* yycdebug_; - /// \brief Display a symbol type, value and location. + /// \brief Display a symbol kind, value and location. /// \param yyo The output stream. /// \param yysym The symbol. template @@ -315,7 +391,7 @@ /// Default constructor. by_state () YY_NOEXCEPT; - /// The symbol type as needed by the constructor. + /// The symbol kind as needed by the constructor. typedef state_type kind_type; /// Constructor. @@ -327,12 +403,12 @@ /// Record that this symbol is empty. void clear () YY_NOEXCEPT; - /// Steal the symbol type from \a that. + /// Steal the symbol kind from \a that. void move (by_state& that); - /// The (internal) type number (corresponding to \a state). - /// \a empty_symbol when empty. - symbol_number_type type_get () const YY_NOEXCEPT; + /// The symbol kind (corresponding to \a state). + /// \a ]b4_symbol(empty, kind)[ when empty. + symbol_kind_type kind () const YY_NOEXCEPT; /// The state number used to denote an empty symbol. /// We use the initial state, as it does not have a value. @@ -398,64 +474,60 @@ void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym); /// Pop \a n symbols from the stack. - void yypop_ (int n = 1); - - /// Some specific tokens. - static const token_number_type yy_error_token_ = 1; - static const token_number_type yy_undef_token_ = ]b4_undef_token_number[; + void yypop_ (int n = 1) YY_NOEXCEPT; /// Constants. enum { - yyeof_ = 0, yylast_ = ]b4_last[, ///< Last index in yytable_. yynnts_ = ]b4_nterms_number[, ///< Number of nonterminal symbols. - yyfinal_ = ]b4_final_state_number[, ///< Termination state number. - yyntokens_ = ]b4_tokens_number[ ///< Number of tokens. + yyfinal_ = ]b4_final_state_number[ ///< Termination state number. }; ]b4_parse_param_vars[ +]b4_percent_code_get([[yy_bison_internal_hook]])[ }; ]b4_token_ctor_if([b4_yytranslate_define([$1])[ ]b4_public_types_define([$1])])[ ]b4_namespace_close[ -]b4_percent_define_flag_if([[global_tokens_and_yystype]], -[b4_token_defines - -#ifndef ]b4_api_PREFIX[STYPE - // Redirection for backward compatibility. -# define ]b4_api_PREFIX[STYPE b4_namespace_ref::b4_parser_class::semantic_type -#endif -])[ ]b4_percent_code_get([[provides]])[ -]]) +]])[ + ## -------------- ## ## Output files. ## ## -------------- ## -b4_defines_if( -[b4_output_begin([b4_spec_header_file]) -b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++]) -[ +# ------------- # +# Header file. # +# ------------- # + +]b4_header_if([[ +]b4_output_begin([b4_spec_header_file])[ +]b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])[ + /** - ** \file ]b4_spec_header_file[ + ** \file ]b4_spec_mapped_header_file[ ** Define the ]b4_namespace_ref[::parser class. */ // C++ LALR(1) parser skeleton written by Akim Demaille. ]b4_disclaimer[ -]b4_cpp_guard_open([b4_spec_header_file])[ +]b4_cpp_guard_open([b4_spec_mapped_header_file])[ ]b4_shared_declarations(hh)[ -]b4_cpp_guard_close([b4_spec_header_file])[ +]b4_cpp_guard_close([b4_spec_mapped_header_file])[ ]b4_output_end[ -]]) +]])[ + +# --------------------- # +# Implementation file. # +# --------------------- # -b4_output_begin([b4_parser_file_name])[ +]b4_output_begin([b4_parser_file_name])[ ]b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++])[ ]b4_disclaimer[ ]b4_percent_code_get([[top]])[]dnl @@ -466,7 +538,7 @@ ]b4_user_pre_prologue[ -]b4_defines_if([[#include "@basename(]b4_spec_header_file[@)"]], +]b4_header_if([[#include "@basename(]b4_spec_header_file[@)"]], [b4_shared_declarations([cc])])[ ]b4_user_post_prologue[ @@ -483,6 +555,11 @@ # define YY_(msgid) msgid # endif #endif +]b4_has_translations_if([ +#ifndef N_ +# define N_(Msgid) Msgid +#endif +])[ // Whether we are compiled with exception support. #ifndef YY_EXCEPTIONS @@ -522,13 +599,13 @@ # define YY_STACK_PRINT() \ do { \ if (yydebug_) \ - yystack_print_ (); \ + yy_stack_print_ (); \ } while (false) #else // !]b4_api_PREFIX[DEBUG # define YYCDEBUG if (false) std::cerr -# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol) +# define YY_SYMBOL_PRINT(Title, Symbol) YY_USE (Symbol) # define YY_REDUCE_PRINT(Rule) static_cast (0) # define YY_STACK_PRINT() static_cast (0) @@ -542,49 +619,7 @@ #define YYERROR goto yyerrorlab #define YYRECOVERING() (!!yyerrstatus_) -]b4_namespace_open[]b4_error_verbose_if([[ - - /* Return YYSTR after stripping away unnecessary quotes and - backslashes, so that it's suitable for yyerror. The heuristic is - that double-quoting is unnecessary unless the string contains an - apostrophe, a comma, or backslash (other than backslash-backslash). - YYSTR is taken from yytname. */ - std::string - ]b4_parser_class[::yytnamerr_ (const char *yystr) - { - if (*yystr == '"') - { - std::string yyr; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - else - goto append; - - append: - default: - yyr += *yyp; - break; - - case '"': - return yyr; - } - do_not_strip_quotes: ; - } - - return yystr; - } -]])[ - +]b4_namespace_open[ /// Build a parser object. ]b4_parser_class::b4_parser_class[ (]b4_parse_param_decl[) #if ]b4_api_PREFIX[DEBUG @@ -602,9 +637,9 @@ ]b4_parser_class[::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW {} - /*---------------. - | Symbol types. | - `---------------*/ + /*---------. + | symbol. | + `---------*/ ]b4_token_ctor_if([], [b4_public_types_define([cc])])[ @@ -634,13 +669,13 @@ : state (s) {} - ]b4_parser_class[::symbol_number_type - ]b4_parser_class[::by_state::type_get () const YY_NOEXCEPT + ]b4_parser_class[::symbol_kind_type + ]b4_parser_class[::by_state::kind () const YY_NOEXCEPT { if (state == empty_state) - return empty_symbol; + return ]b4_symbol(empty, kind)[; else - return yystos_[+state]; + return YY_CAST (symbol_kind_type, yystos_[+state]); } ]b4_parser_class[::stack_symbol_type::stack_symbol_type () @@ -649,7 +684,7 @@ ]b4_parser_class[::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that) : super_type (YY_MOVE (that.state)]b4_variant_if([], [, YY_MOVE (that.value)])b4_locations_if([, YY_MOVE (that.location)])[) {]b4_variant_if([ - b4_symbol_variant([that.type_get ()], + b4_symbol_variant([that.kind ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (that.value)])])[ #if 201103L <= YY_CPLUSPLUS // that is emptied. @@ -660,10 +695,10 @@ ]b4_parser_class[::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that) : super_type (s]b4_variant_if([], [, YY_MOVE (that.value)])[]b4_locations_if([, YY_MOVE (that.location)])[) {]b4_variant_if([ - b4_symbol_variant([that.type_get ()], + b4_symbol_variant([that.kind ()], [value], [move], [YY_MOVE (that.value)])])[ // that is emptied. - that.type = empty_symbol; + that.kind_ = ]b4_symbol(empty, kind)[; } #if YY_CPLUSPLUS < 201103L @@ -671,7 +706,7 @@ ]b4_parser_class[::stack_symbol_type::operator= (const stack_symbol_type& that) { state = that.state; - ]b4_variant_if([b4_symbol_variant([that.type_get ()], + ]b4_variant_if([b4_symbol_variant([that.kind ()], [value], [copy], [that.value])], [[value = that.value;]])[]b4_locations_if([ location = that.location;])[ @@ -682,7 +717,7 @@ ]b4_parser_class[::stack_symbol_type::operator= (stack_symbol_type& that) { state = that.state; - ]b4_variant_if([b4_symbol_variant([that.type_get ()], + ]b4_variant_if([b4_symbol_variant([that.kind ()], [value], [move], [that.value])], [[value = that.value;]])[]b4_locations_if([ location = that.location;])[ @@ -700,29 +735,27 @@ YY_SYMBOL_PRINT (yymsg, yysym);]b4_variant_if([], [ // User destructor. - b4_symbol_actions([destructor], [yysym.type_get ()])])[ + b4_symbol_actions([destructor], [yysym.kind ()])])[ } #if ]b4_api_PREFIX[DEBUG template void - ]b4_parser_class[::yy_print_ (std::ostream& yyo, - const basic_symbol& yysym) const + ]b4_parser_class[::yy_print_ (std::ostream& yyo, const basic_symbol& yysym) const { std::ostream& yyoutput = yyo; - YYUSE (yyoutput); - symbol_number_type yytype = yysym.type_get (); -#if defined __GNUC__ && ! defined __clang__ && ! defined __ICC && __GNUC__ * 100 + __GNUC_MINOR__ <= 408 - // Avoid a (spurious) G++ 4.8 warning about "array subscript is - // below array bounds". + YY_USE (yyoutput); if (yysym.empty ()) - std::abort (); -#endif - yyo << (yytype < yyntokens_ ? "token" : "nterm") - << ' ' << yytname_[yytype] << " ("]b4_locations_if([ - << yysym.location << ": "])[; - ]b4_symbol_actions([printer])[ - yyo << ')'; + yyo << "empty symbol"; + else + { + symbol_kind_type yykind = yysym.kind (); + yyo << (yykind < YYNTOKENS ? "token" : "nterm") + << ' ' << yysym.name () << " ("]b4_locations_if([ + << yysym.location << ": "])[; + ]b4_symbol_actions([printer])[ + yyo << ')'; + } } #endif @@ -746,7 +779,7 @@ } void - ]b4_parser_class[::yypop_ (int n) + ]b4_parser_class[::yypop_ (int n) YY_NOEXCEPT { yystack_.pop (n); } @@ -781,21 +814,21 @@ ]b4_parser_class[::state_type ]b4_parser_class[::yy_lr_goto_state_ (state_type yystate, int yysym) { - int yyr = yypgoto_[yysym - yyntokens_] + yystate; + int yyr = yypgoto_[yysym - YYNTOKENS] + yystate; if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate) return yytable_[yyr]; else - return yydefgoto_[yysym - yyntokens_]; + return yydefgoto_[yysym - YYNTOKENS]; } bool - ]b4_parser_class[::yy_pact_value_is_default_ (int yyvalue) + ]b4_parser_class[::yy_pact_value_is_default_ (int yyvalue) YY_NOEXCEPT { return yyvalue == yypact_ninf_; } bool - ]b4_parser_class[::yy_table_value_is_error_ (int yyvalue) + ]b4_parser_class[::yy_table_value_is_error_ (int yyvalue) YY_NOEXCEPT { return yyvalue == yytable_ninf_; } @@ -826,8 +859,8 @@ /// The return value of parse (). int yyresult;]b4_lac_if([[ - /// Discard the LAC context in case there still is one left from a - /// previous invocation. + // Discard the LAC context in case there still is one left from a + // previous invocation. yy_lac_discard_ ("init");]])[ #if YY_EXCEPTIONS @@ -853,6 +886,7 @@ `-----------------------------------------------*/ yynewstate: YYCDEBUG << "Entering state " << int (yystack_[0].state) << '\n'; + YY_STACK_PRINT (); // Accept? if (yystack_[0].state == yyfinal_) @@ -873,14 +907,14 @@ // Read a lookahead token. if (yyla.empty ()) { - YYCDEBUG << "Reading a token: "; + YYCDEBUG << "Reading a token\n"; #if YY_EXCEPTIONS try #endif // YY_EXCEPTIONS {]b4_token_ctor_if([[ - symbol_type yylookahead (]b4_lex[); + symbol_type yylookahead (]b4_yylex[); yyla.move (yylookahead);]], [[ - yyla.type = yytranslate_ (]b4_lex[);]])[ + yyla.kind_ = yytranslate_ (]b4_yylex[);]])[ } #if YY_EXCEPTIONS catch (const syntax_error& yyexc) @@ -893,13 +927,23 @@ } YY_SYMBOL_PRINT ("Next token is", yyla); + if (yyla.kind () == ]b4_symbol(error, kind)[) + { + // The scanner already issued an error message, process directly + // to error recovery. But do not keep the error token as + // lookahead, it is too special and may lead us to an endless + // loop in error recovery. */ + yyla.kind_ = ]b4_symbol(undef, kind)[; + goto yyerrlab1; + } + /* If the proper action on seeing token YYLA.TYPE is to reduce or to detect an error, take that action. */ - yyn += yyla.type_get (); - if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.type_get ()) + yyn += yyla.kind (); + if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.kind ()) {]b4_lac_if([[ - if (!yy_lac_establish_ (yyla.type_get ())) - goto yyerrlab;]])[ + if (!yy_lac_establish_ (yyla.kind ())) + goto yyerrlab;]])[ goto yydefault; } @@ -909,8 +953,8 @@ { if (yy_table_value_is_error_ (yyn)) goto yyerrlab;]b4_lac_if([[ - if (!yy_lac_establish_ (yyla.type_get ())) - goto yyerrlab; + if (!yy_lac_establish_ (yyla.kind ())) + goto yyerrlab; ]])[ yyn = -yyn; goto yyreduce; @@ -943,11 +987,11 @@ yylen = yyr2_[yyn]; { stack_symbol_type yylhs; - yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([ + yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([[ /* Variants are always initialized to an empty instance of the correct type. The default '$$ = $1' action is NOT applied when using variants. */ - b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [emplace])], [ + ]b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [emplace])], [[ /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, use the top of the stack. @@ -957,7 +1001,7 @@ if (yylen) yylhs.value = yystack_@{yylen - 1@}.value; else - yylhs.value = yystack_@{0@}.value;])[ + yylhs.value = yystack_@{0@}.value;]])[ ]b4_locations_if([dnl [ // Default location. @@ -991,7 +1035,6 @@ YY_SYMBOL_PRINT ("-> $$ =", yylhs); yypop_ (yylen); yylen = 0; - YY_STACK_PRINT (); // Shift the result of the reduction. yypush_ (YY_NULLPTR, YY_MOVE (yylhs)); @@ -1006,9 +1049,17 @@ // If not already recovering from an error, report this error. if (!yyerrstatus_) { - ++yynerrs_; - error (]b4_join(b4_locations_if([yyla.location]), - [[yysyntax_error_ (yystack_[0].state, yyla)]])[); + ++yynerrs_;]b4_parse_error_case( + [simple], [[ + std::string msg = YY_("syntax error"); + error (]b4_join(b4_locations_if([yyla.location]), [[YY_MOVE (msg)]])[);]], + [custom], [[ + context yyctx (*this, yyla); + report_syntax_error (yyctx);]], + [[ + context yyctx (*this, yyla); + std::string msg = yysyntax_error_ (yyctx); + error (]b4_join(b4_locations_if([yyla.location]), [[YY_MOVE (msg)]])[);]])[ } ]b4_locations_if([[ @@ -1019,7 +1070,7 @@ error, discard it. */ // Return failure if at end of input. - if (yyla.type_get () == yyeof_) + if (yyla.kind () == ]b4_symbol(eof, kind)[) YYABORT; else if (!yyla.empty ()) { @@ -1045,6 +1096,7 @@ this YYERROR. */ yypop_ (yylen); yylen = 0; + YY_STACK_PRINT (); goto yyerrlab1; @@ -1053,31 +1105,33 @@ `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus_ = 3; // Each real token shifted decrements this. - { - stack_symbol_type error_token; - for (;;) - { - yyn = yypact_[+yystack_[0].state]; - if (!yy_pact_value_is_default_ (yyn)) - { - yyn += yy_error_token_; - if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yy_error_token_) - { - yyn = yytable_[yyn]; - if (0 < yyn) - break; - } - } + // Pop stack until we find a state that shifts the error token. + for (;;) + { + yyn = yypact_[+yystack_[0].state]; + if (!yy_pact_value_is_default_ (yyn)) + { + yyn += ]b4_symbol(error, kind)[; + if (0 <= yyn && yyn <= yylast_ + && yycheck_[yyn] == ]b4_symbol(error, kind)[) + { + yyn = yytable_[yyn]; + if (0 < yyn) + break; + } + } - // Pop the current state because it cannot handle the error token. - if (yystack_.size () == 1) - YYABORT; + // Pop the current state because it cannot handle the error token. + if (yystack_.size () == 1) + YYABORT; ]b4_locations_if([[ - yyerror_range[1].location = yystack_[0].location;]])[ - yy_destroy_ ("Error: popping", yystack_[0]); - yypop_ (); - YY_STACK_PRINT (); - } + yyerror_range[1].location = yystack_[0].location;]])[ + yy_destroy_ ("Error: popping", yystack_[0]); + yypop_ (); + YY_STACK_PRINT (); + } + { + stack_symbol_type error_token; ]b4_locations_if([[ yyerror_range[2].location = yyla.location; YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);]])[ @@ -1116,6 +1170,7 @@ /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ yypop_ (yylen); + YY_STACK_PRINT (); while (1 < yystack_.size ()) { yy_destroy_ ("Cleanup: popping", yystack_[0]); @@ -1148,17 +1203,160 @@ { error (]b4_join(b4_locations_if([yyexc.location]), [[yyexc.what ()]])[); - }]b4_lac_if([[ + } + +]b4_parse_error_bmatch([custom\|detailed], +[[ const char * + ]b4_parser_class[::symbol_name (symbol_kind_type yysymbol) + { + static const char *const yy_sname[] = + { + ]b4_symbol_names[ + };]b4_has_translations_if([[ + /* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is + internationalizable. */ + static ]b4_int_type_for([b4_translatable])[ yytranslatable[] = + { + ]b4_translatable[ + }; + return (yysymbol < YYNTOKENS && yytranslatable[yysymbol] + ? _(yy_sname[yysymbol]) + : yy_sname[yysymbol]);]], [[ + return yy_sname[yysymbol];]])[ + } +]], +[simple], +[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[ + const char * + ]b4_parser_class[::symbol_name (symbol_kind_type yysymbol) + { + return yytname_[yysymbol]; + } +#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[ +]], +[verbose], +[[ /* Return YYSTR after stripping away unnecessary quotes and + backslashes, so that it's suitable for yyerror. The heuristic is + that double-quoting is unnecessary unless the string contains an + apostrophe, a comma, or backslash (other than backslash-backslash). + YYSTR is taken from yytname. */ + std::string + ]b4_parser_class[::yytnamerr_ (const char *yystr) + { + if (*yystr == '"') + { + std::string yyr; + char const *yyp = yystr; + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + else + goto append; + + append: + default: + yyr += *yyp; + break; + + case '"': + return yyr; + } + do_not_strip_quotes: ; + } + + return yystr; + } + + std::string + ]b4_parser_class[::symbol_name (symbol_kind_type yysymbol) + { + return yytnamerr_ (yytname_[yysymbol]); + } +]])[ + +]b4_parse_error_bmatch([custom\|detailed\|verbose], [[ + // ]b4_parser_class[::context. + ]b4_parser_class[::context::context (const ]b4_parser_class[& yyparser, const symbol_type& yyla) + : yyparser_ (yyparser) + , yyla_ (yyla) + {} + + int + ]b4_parser_class[::context::expected_tokens (symbol_kind_type yyarg[], int yyargn) const + { + // Actual number of expected tokens + int yycount = 0; +]b4_lac_if([[ +#if ]b4_api_PREFIX[DEBUG + // Execute LAC once. We don't care if it is successful, we + // only do it for the sake of debugging output. + if (!yyparser_.yy_lac_established_) + yyparser_.yy_lac_check_ (yyla_.kind ()); +#endif + + for (int yyx = 0; yyx < YYNTOKENS; ++yyx) + { + symbol_kind_type yysym = YY_CAST (symbol_kind_type, yyx); + if (yysym != ]b4_symbol(error, kind)[ + && yysym != ]b4_symbol(undef, kind)[ + && yyparser_.yy_lac_check_ (yysym)) + { + if (!yyarg) + ++yycount; + else if (yycount == yyargn) + return 0; + else + yyarg[yycount++] = yysym; + } + }]], [[ + const int yyn = yypact_[+yyparser_.yystack_[0].state]; + if (!yy_pact_value_is_default_ (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + const int yyxbegin = yyn < 0 ? -yyn : 0; + // Stay within bounds of both yycheck and yytname. + const int yychecklim = yylast_ - yyn + 1; + const int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + for (int yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck_[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[ + && !yy_table_value_is_error_ (yytable_[yyx + yyn])) + { + if (!yyarg) + ++yycount; + else if (yycount == yyargn) + return 0; + else + yyarg[yycount++] = YY_CAST (symbol_kind_type, yyx); + } + } +]])[ + if (yyarg && yycount == 0 && 0 < yyargn) + yyarg[0] = ]b4_symbol(empty, kind)[; + return yycount; + } + +]])[ + +]b4_lac_if([[ bool - ]b4_parser_class[::yy_lac_check_ (int yytoken) const + ]b4_parser_class[::yy_lac_check_ (symbol_kind_type yytoken) const { // Logically, the yylac_stack's lifetime is confined to this function. // Clear it, to get rid of potential left-overs from previous call. yylac_stack_.clear (); // Reduce until we encounter a shift and thereby accept the token. #if ]b4_api_PREFIX[DEBUG - YYCDEBUG << "LAC: checking lookahead " << yytname_[yytoken] << ':'; + YYCDEBUG << "LAC: checking lookahead " << symbol_name (yytoken) << ':'; #endif std::ptrdiff_t lac_top = 0; while (true) @@ -1222,14 +1420,14 @@ : yylac_stack_.back ()); // Push the resulting state of the reduction. state_type state = yy_lr_goto_state_ (top_state, yyr1_[yyrule]); - YYCDEBUG << " G" << state; + YYCDEBUG << " G" << int (state); yylac_stack_.push_back (state); } } // Establish the initial context if no initial context currently exists. bool - ]b4_parser_class[::yy_lac_establish_ (int yytoken) + ]b4_parser_class[::yy_lac_establish_ (symbol_kind_type yytoken) { /* Establish the initial context for the current lookahead if no initial context is currently established. @@ -1254,21 +1452,22 @@ follows. If no initial context is currently established for the current lookahead, then check if that lookahead can eventually be shifted if syntactic actions continue from the current context. */ - if (!yy_lac_established_) + if (yy_lac_established_) + return true; + else { #if ]b4_api_PREFIX[DEBUG YYCDEBUG << "LAC: initial context established for " - << yytname_[yytoken] << '\n'; + << symbol_name (yytoken) << '\n'; #endif yy_lac_established_ = true; return yy_lac_check_ (yytoken); } - return true; } // Discard any previous initial lookahead context. void - ]b4_parser_class[::yy_lac_discard_ (const char* evt) + ]b4_parser_class[::yy_lac_discard_ (const char* event) { /* Discard any previous initial lookahead context because of Event, which may be a lookahead change or an invalidation of the currently @@ -1284,25 +1483,16 @@ if (yy_lac_established_) { YYCDEBUG << "LAC: initial context discarded due to " - << evt << '\n'; + << event << '\n'; yy_lac_established_ = false; } }]])[ - // Generate an error message. - std::string - ]b4_parser_class[::yysyntax_error_ (]dnl -b4_error_verbose_if([state_type yystate, const symbol_type& yyla], - [state_type, const symbol_type&])[) const - {]b4_error_verbose_if([[ - // Number of reported tokens (one for the "unexpected", one per - // "expected"). - std::ptrdiff_t yycount = 0; - // Its maximum. - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - // Arguments of yyformat. - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - +]b4_parse_error_bmatch([detailed\|verbose], [[ + int + ]b4_parser_class[::yy_syntax_error_arguments_ (const context& yyctx, + symbol_kind_type yyarg[], int yyargn) const + { /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action @@ -1333,46 +1523,26 @@ one exception: it will still contain any token that will not be accepted due to an error action in a later state.]])[ */ - if (!yyla.empty ()) - { - symbol_number_type yytoken = yyla.type_get (); - yyarg[yycount++] = yytname_[yytoken];]b4_lac_if([[ - -#if ]b4_api_PREFIX[DEBUG - // Execute LAC once. We don't care if it is succesful, we - // only do it for the sake of debugging output. - if (!yy_lac_established_) - yy_lac_check_ (yytoken); -#endif]])[ - int yyn = yypact_[+yystate]; - if (!yy_pact_value_is_default_ (yyn)) - {]b4_lac_if([[ - for (int yyx = 0; yyx < yyntokens_; ++yyx) - if (yyx != yy_error_token_ && yyx != yy_undef_token_ - && yy_lac_check_ (yyx)) - {]], [[ - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - // Stay within bounds of both yycheck and yytname. - int yychecklim = yylast_ - yyn + 1; - int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; - for (int yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck_[yyx + yyn] == yyx && yyx != yy_error_token_ - && !yy_table_value_is_error_ (yytable_[yyx + yyn])) - {]])[ - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - break; - } - else - yyarg[yycount++] = yytname_[yyx]; - } - } + if (!yyctx.lookahead ().empty ()) + { + if (yyarg) + yyarg[0] = yyctx.token (); + int yyn = yyctx.expected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1); + return yyn + 1; } + return 0; + } + + // Generate an error message. + std::string + ]b4_parser_class[::yysyntax_error_ (const context& yyctx) const + { + // Its maximum. + enum { YYARGS_MAX = 5 }; + // Arguments of yyformat. + symbol_kind_type yyarg[YYARGS_MAX]; + int yycount = yy_syntax_error_arguments_ (yyctx, yyarg, YYARGS_MAX); char const* yyformat = YY_NULLPTR; switch (yycount) @@ -1397,14 +1567,13 @@ for (char const* yyp = yyformat; *yyp; ++yyp) if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) { - yyres += yytnamerr_ (yyarg[yyi++]); + yyres += symbol_name (yyarg[yyi++]); ++yyp; } else yyres += *yyp; - return yyres;]], [[ - return YY_("syntax error");]])[ - } + return yyres; + }]])[ const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) b4_parser_class::yypact_ninf_ = b4_pact_ninf[; @@ -1413,21 +1582,23 @@ ]b4_parser_tables_define[ -]b4_token_table_if([], [[#if ]b4_api_PREFIX[DEBUG]])[ +]b4_parse_error_bmatch([simple\|verbose], +[[#if ]b4_api_PREFIX[DEBUG]b4_tname_if([[ || 1]])[ // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - // First, the terminals, then, starting at \a yyntokens_, nonterminals. + // First, the terminals, then, starting at \a YYNTOKENS, nonterminals. const char* const ]b4_parser_class[::yytname_[] = { ]b4_tname[ }; +#endif +]])[ -]b4_token_table_if([[#if ]b4_api_PREFIX[DEBUG]])[ +#if ]b4_api_PREFIX[DEBUG][ ]b4_integral_parser_table_define([rline], [b4_rline])[ - // Print the state stack on the debug stream. void - ]b4_parser_class[::yystack_print_ () + ]b4_parser_class[::yy_stack_print_ () const { *yycdebug_ << "Stack now"; for (stack_type::const_iterator @@ -1438,9 +1609,8 @@ *yycdebug_ << '\n'; } - // Report on the debug stream that the rule \a yyrule is going to be reduced. void - ]b4_parser_class[::yy_reduce_print_ (int yyrule) + ]b4_parser_class[::yy_reduce_print_ (int yyrule) const { int yylno = yyrline_[yyrule]; int yynrhs = yyr2_[yyrule]; diff -Nru bison-3.5.1+dfsg/data/skeletons/lalr1.d bison-3.8.2+dfsg/data/skeletons/lalr1.d --- bison-3.5.1+dfsg/data/skeletons/lalr1.d 2020-01-19 13:07:51.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/lalr1.d 2021-08-08 06:59:01.000000000 +0000 @@ -1,6 +1,6 @@ # D skeleton for Bison -*- autoconf -*- -# Copyright (C) 2007-2012, 2019-2020 Free Software Foundation, Inc. +# Copyright (C) 2007-2012, 2019-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,15 +13,56 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . m4_include(b4_skeletonsdir/[d.m4]) +b4_header_if([b4_complain([%header/%defines does not make sense in D])]) +# parse.lac +b4_percent_define_default([[parse.lac]], [[none]]) +b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]]) +b4_define_flag_if([lac]) +m4_define([b4_lac_flag], + [m4_if(b4_percent_define_get([[parse.lac]]), + [none], [[0]], [[1]])]) + + +## --------------- ## +## api.push-pull. ## +## --------------- ## + +b4_percent_define_default([[api.push-pull]], [[pull]]) +b4_percent_define_check_values([[[[api.push-pull]], + [[pull]], [[push]], [[both]]]]) + +# Define m4 conditional macros that encode the value +# of the api.push-pull flag. +b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]]) +b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]]) +m4_case(b4_percent_define_get([[api.push-pull]]), + [pull], [m4_define([b4_push_flag], [[0]])], + [push], [m4_define([b4_pull_flag], [[0]])]) + +# Define a macro to be true when api.push-pull has the value "both". +m4_define([b4_both_if],[b4_push_if([b4_pull_if([$1],[$2])],[$2])]) + +# Handle BISON_USE_PUSH_FOR_PULL for the test suite. So that push parsing +# tests function as written, do not let BISON_USE_PUSH_FOR_PULL modify the +# behavior of Bison at all when push parsing is already requested. +b4_define_flag_if([use_push_for_pull]) +b4_use_push_for_pull_if([ + b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])], + [m4_define([b4_push_flag], [[1]])])]) + + +# Define a macro to encapsulate the parse state variables. This +# allows them to be defined either in parse() when doing pull parsing, +# or as class instance variable when doing push parsing. b4_output_begin([b4_parser_file_name]) b4_copyright([Skeleton implementation for Bison LALR(1) parsers in D], - [2007-2012, 2019-2020])[ - + [2007-2012, 2019-2021])[ +]b4_disclaimer[ ]b4_percent_define_ifdef([package], [module b4_percent_define_get([package]); ])[ version(D_Version2) { @@ -33,6 +74,29 @@ ]b4_user_post_prologue[ ]b4_percent_code_get([[imports]])[ import std.format; +import std.conv; + +/** + * Handle error message internationalisation. + */ +static if (!is(typeof(YY_))) { + version(YYENABLE_NLS) + { + version(ENABLE_NLS) + { + extern(C) char* dgettext(const char*, const char*); + string YY_(const char* s) + { + return to!string(dgettext("bison-runtime", s)); + } + } + } + static if (!is(typeof(YY_))) + { + pragma(inline, true) + string YY_(string msg) { return msg; } + } +} /** * A Bison parser, automatically generated from ]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[. @@ -46,29 +110,13 @@ * parser ]b4_parser_class[. */ public interface Lexer -{]b4_locations_if([[ - /** - * Method to retrieve the beginning position of the last scanned token. - * @@return the position at which the last scanned token starts. */ - @@property ]b4_position_type[ startPos (); - - /** - * Method to retrieve the ending position of the last scanned token. - * @@return the first position beyond the last scanned token. */ - @@property ]b4_position_type[ endPos (); - -]])[ - /** - * Method to retrieve the semantic value of the last scanned token. - * @@return the semantic value of the last scanned token. */ - @@property ]b4_yystype[ semanticVal (); - +{ /** * Entry point for the scanner. Returns the token identifier corresponding * to the next token and prepares to return the semantic value * ]b4_locations_if([and beginning/ending positions ])[of the token. * @@return the token identifier corresponding to the next token. */ - int yylex (); + Symbol yylex (); /** * Entry point for error reporting. Emits an error @@ -77,16 +125,26 @@ * @@param loc The location of the element to which the * error message is related]])[ * @@param s The string for the error message. */ - void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[string s); + void yyerror (]b4_locations_if([[const Location loc, ]])[string s); +]b4_parse_error_bmatch([custom], [[ + /** + * Build and emit a "syntax error" message in a user-defined way. + * + * @@param ctx The context of the error. + */ + void reportSyntaxError(]b4_parser_class[.Context ctx); +]])[ } +]b4_public_types_declare[ + ]b4_locations_if([b4_position_type_if([[ static assert(__traits(compiles, - (new ]b4_position_type[[1])[0]=(new ]b4_position_type[[1])[0]), - "struct/class ]b4_position_type[ must be default-constructible " + (new Position[1])[0]=(new Position[1])[0]), + "struct/class Position must be default-constructible " "and assignable"); -static assert(__traits(compiles, (new string[1])[0]=(new ]b4_position_type[).toString()), - "error: struct/class ]b4_position_type[ must have toString method"); +static assert(__traits(compiles, (new string[1])[0]=(new Position).toString()), + "error: struct/class Position must have toString method"); ]], [[ /** * A struct denoting a point in the input.*/ @@ -109,59 +167,65 @@ } } ]])b4_location_type_if([[ -static assert(__traits(compiles, (new ]b4_location_type[((new ]b4_position_type[[1])[0]))) && - __traits(compiles, (new ]b4_location_type[((new ]b4_position_type[[1])[0], (new ]b4_position_type[[1])[0]))), - "error: struct/class ]b4_location_type[ must have " - "default constructor and constructors this(]b4_position_type[) and this(]b4_position_type[, ]b4_position_type[)."); -static assert(__traits(compiles, (new ]b4_location_type[[1])[0].begin=(new ]b4_location_type[[1])[0].begin) && - __traits(compiles, (new ]b4_location_type[[1])[0].begin=(new ]b4_location_type[[1])[0].end) && - __traits(compiles, (new ]b4_location_type[[1])[0].end=(new ]b4_location_type[[1])[0].begin) && - __traits(compiles, (new ]b4_location_type[[1])[0].end=(new ]b4_location_type[[1])[0].end), - "error: struct/class ]b4_location_type[ must have assignment-compatible " +static assert(__traits(compiles, (new Location((new Position[1])[0]))) && + __traits(compiles, (new Location((new Position[1])[0], (new Position[1])[0]))), + "error: struct/class Location must have " + "default constructor and constructors this(Position) and this(Position, Position)."); +static assert(__traits(compiles, (new Location[1])[0].begin=(new Location[1])[0].begin) && + __traits(compiles, (new Location[1])[0].begin=(new Location[1])[0].end) && + __traits(compiles, (new Location[1])[0].end=(new Location[1])[0].begin) && + __traits(compiles, (new Location[1])[0].end=(new Location[1])[0].end), + "error: struct/class Location must have assignment-compatible " "members/properties 'begin' and 'end'."); -static assert(__traits(compiles, (new string[1])[0]=(new ]b4_location_type[[1])[0].toString()), - "error: struct/class ]b4_location_type[ must have toString method."); +static assert(__traits(compiles, (new string[1])[0]=(new Location[1])[0].toString()), + "error: struct/class Location must have toString method."); -private immutable bool yy_location_is_class = !__traits(compiles, *(new ]b4_location_type[((new ]b4_position_type[[1])[0])));]], [[ +private immutable bool yy_location_is_class = !__traits(compiles, *(new Location((new Position[1])[0])));]], [[ /** - * A class defining a pair of positions. Positions, defined by the - * ]b4_position_type[ class, denote a point in the input. + * A struct defining a pair of positions. Positions, defined by the + * Position struct, denote a point in the input. * Locations represent a part of the input through the beginning * and ending positions. */ -public class ]b4_location_type[ +public struct ]b4_location_type[ { /** The first, inclusive, position in the range. */ - public ]b4_position_type[ begin; + public Position begin; /** The first position beyond the range. */ - public ]b4_position_type[ end; + public Position end; /** - * Create a ]b4_location_type[ denoting an empty range located at + * Create a Location denoting an empty range located at * a given point. * @@param loc The position at which the range is anchored. */ - public this (]b4_position_type[ loc) { + public this(Position loc) + { this.begin = this.end = loc; } - public this () { - } - /** - * Create a ]b4_location_type[ from the endpoints of the range. + * Create a Location from the endpoints of the range. * @@param begin The first position included in the range. * @@param end The first position beyond the range. */ - public this (]b4_position_type[ begin, ]b4_position_type[ end) + public this(Position begin, Position end) { this.begin = begin; this.end = end; } /** - * A representation of the location. For this to be correct, - * ]b4_position_type[ should override the toString - * method. */ - public override string toString () const { + * Reset initial location to final location. + */ + public void step() + { + this.begin = this.end; + } + + /** + * A representation of the location. + */ + public string toString() const + { auto end_col = 0 < end.column ? end.column - 1 : 0; auto res = begin.toString (); if (end.filename && begin.filename != end.filename) @@ -174,32 +238,34 @@ } } -private immutable bool yy_location_is_class = true; +private immutable bool yy_location_is_class = false; -]])])m4_ifdef([b4_user_union_members], [private union YYSemanticType +]])])[]b4_value_type_setup[]m4_ifdef([b4_user_union_members], [private union YYSemanticType { b4_user_union_members };], [m4_if(b4_tag_seen_flag, 0, [[private alias int YYSemanticType;]])])[ -]b4_token_enums(b4_tokens)[ +]b4_token_enums[ ]b4_parser_class_declaration[ { ]b4_identification[ +]b4_declare_symbol_enum[ + ]b4_locations_if([[ - private final ]b4_location_type[ yylloc_from_stack (ref YYStack rhs, int n) + private final Location yylloc_from_stack (ref YYStack rhs, int n) { static if (yy_location_is_class) { if (n > 0) - return new ]b4_location_type[ (rhs.locationAt (n-1).begin, rhs.locationAt (0).end); + return new Location (rhs.locationAt (n-1).begin, rhs.locationAt (0).end); else - return new ]b4_location_type[ (rhs.locationAt (0).end); + return new Location (rhs.locationAt (0).end); } else { if (n > 0) - return ]b4_location_type[ (rhs.locationAt (n-1).begin, rhs.locationAt (0).end); + return Location (rhs.locationAt (n-1).begin, rhs.locationAt (0).end); else - return ]b4_location_type[ (rhs.locationAt (0).end); + return Location (rhs.locationAt (0).end); } }]])[ @@ -217,6 +283,9 @@ * Instantiate the Bison-generated parser. */ public this] (b4_parse_param_decl([b4_lex_param_decl])[) { +]b4_percent_code_get([[init]])[]b4_lac_if([[ + this.yylacStack = new int[]; + this.yylacEstablished = false;]])[ this (new YYLexer(]b4_lex_param_call[)); } ]])[ @@ -231,6 +300,7 @@ ]b4_parse_param_cons[ } ]b4_parse_trace_if([[ + import std.stdio; private File yyDebugStream; /** @@ -262,18 +332,29 @@ protected final void yycdebug (string s) { if (0 < yydebug) + yyDebugStream.write (s); + } + + protected final void yycdebugln (string s) { + if (0 < yydebug) yyDebugStream.writeln (s); } ]])[ - private final int yylex () { + private final ]b4_parser_class[.Symbol yylex () { return yylexer.yylex (); } - protected final void yyerror (]b4_locations_if(ref [b4_location_type[ loc, ]])[string s) { + protected final void yyerror (]b4_locations_if([[const Location loc, ]])[string s) { yylexer.yyerror (]b4_locations_if([loc, ])[s); } /** + * The number of syntax errors so far. + */ + public int numberOfErrors() const { return yynerrs_; } + private int yynerrs_ = 0; + + /** * Returned by a Bison action in order to stop the parsing process and * return success (true). */ public static immutable int YYACCEPT = 0; @@ -282,6 +363,11 @@ * Returned by a Bison action in order to stop the parsing process and * return failure (false). */ public static immutable int YYABORT = 1; +]b4_push_if([ + /** + * Returned by a Bison action in order to request a new token. + */ + public static immutable int YYPUSH_MORE = 4;])[ /** * Returned by a Bison action in order to start error recovery without @@ -296,10 +382,43 @@ private static immutable int YYREDUCE = 6; private static immutable int YYERRLAB1 = 7; private static immutable int YYRETURN = 8; +]b4_push_if([[ private static immutable int YYGETTOKEN = 9; /* Signify that a new token is expected when doing push-parsing. */]])[ + ]b4_locations_if([ private static immutable YYSemanticType yy_semantic_null;])[ private int yyerrstatus_ = 0; + private void yyerrok() + { + yyerrstatus_ = 0; + } + + // Lookahead symbol kind. + SymbolKind yytoken = ]b4_symbol(empty, kind)[; + + /* State. */ + int yyn = 0; + int yylen = 0; + int yystate = 0; + + YYStack yystack; + + int label = YYNEWSTATE; + + /* Error handling. */ +]b4_locations_if([[ + /// The location where the error started. + Location yyerrloc; + + /// Location of the lookahead. + Location yylloc; + + /// @@$. + Location yyloc;]])[ + + /// Semantic value of the lookahead. + Value yylval; + /** * Whether error recovery is being done. In this state, the parser * reads token until it reaches a known state, and then restarts normal @@ -309,10 +428,22 @@ return yyerrstatus_ == 0; } + /** Compute post-reduction state. + * @@param yystate the current state + * @@param yysym the nonterminal to push on the stack + */ + private int yyLRGotoState(int yystate, int yysym) { + int yyr = yypgoto_[yysym - yyntokens_] + yystate; + if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate) + return yytable_[yyr]; + else + return yydefgoto_[yysym - yyntokens_]; + } + private int yyaction (int yyn, ref YYStack yystack, int yylen) { - ]b4_yystype[ yyval;]b4_locations_if([[ - ]b4_location_type[ yyloc = yylloc_from_stack (yystack, yylen);]])[ + Value yyval;]b4_locations_if([[ + Location yyloc = yylloc_from_stack (yystack, yylen);]])[ /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, use the top of the stack. @@ -335,82 +466,47 @@ } ]b4_parse_trace_if([[ - yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);]])[ + yy_symbol_print ("-> $$ =", to!SymbolKind (yyr1_[yyn]), yyval]b4_locations_if([, yyloc])[);]])[ yystack.pop (yylen); yylen = 0; /* Shift the result of the reduction. */ - yyn = yyr1_[yyn]; - int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0); - if (0 <= yystate && yystate <= yylast_ - && yycheck_[yystate] == yystack.stateAt (0)) - yystate = yytable_[yystate]; - else - yystate = yydefgoto_[yyn - yyntokens_]; - + int yystate = yyLRGotoState(yystack.stateAt(0), yyr1_[yyn]); yystack.push (yystate, yyval]b4_locations_if([, yyloc])[); return YYNEWSTATE; } - /* Return YYSTR after stripping away unnecessary quotes and - backslashes, so that it's suitable for yyerror. The heuristic is - that double-quoting is unnecessary unless the string contains an - apostrophe, a comma, or backslash (other than backslash-backslash). - YYSTR is taken from yytname. */ - private final string yytnamerr_ (string yystr) - { - if (yystr[0] == '"') - { - string yyr; - strip_quotes: - for (int i = 1; i < yystr.length; i++) - switch (yystr[i]) - { - case '\'': - case ',': - break strip_quotes; - - case '\\': - if (yystr[++i] != '\\') - break strip_quotes; - goto default; - default: - yyr ~= yystr[i]; - break; - - case '"': - return yyr; - } - } - else if (yystr == "$end") - return "end of input"; - - return yystr; - } ]b4_parse_trace_if([[ /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ - private final void yy_symbol_print (string s, int yytype, - ref ]b4_yystype[ yyvaluep]dnl -b4_locations_if([, ref ]b4_location_type[ yylocationp])[) + private final void yy_symbol_print (string s, SymbolKind yykind, + ref Value yyval]b4_locations_if([, ref Location yyloc])[) { if (0 < yydebug) { - string message = s ~ (yytype < yyntokens_ ? " token " : " nterm ") - ~ yytname_[yytype] ~ " ("]b4_locations_if([ - ~ yylocationp.toString() ~ ": "])[; - static if (__traits(compiles, message ~= yyvaluep.toString ())) - message ~= yyvaluep.toString (); - else - message ~= format ("%s", &yyvaluep); - message ~= ")"; - yycdebug (message); + File yyo = yyDebugStream; + yyo.write(s); + yyo.write(yykind < yyntokens_ ? " token " : " nterm "); + yyo.write(format("%s", yykind)); + yyo.write(" ("]b4_locations_if([ ~ yyloc.toString() ~ ": "])[); + ]b4_symbol_actions([printer])[ + yyo.write(")\n"); } } ]])[ +]b4_symbol_type_define[ +]b4_push_if([[ + /** + * Push Parse input from external lexer + * + * @@param yyla current Symbol + * + * @@return YYACCEPT, YYABORT, YYPUSH_MORE + */ + public int pushParse(Symbol yyla)]], [[ /** * Parse input from the scanner that was specified at object construction * time. Return whether the end of the input was reached successfully. @@ -418,36 +514,23 @@ * @@return true if the parsing succeeds. Note that this does not * imply that there were no syntax errors. */ - public bool parse () - { - /// Lookahead and lookahead in internal form. - int yychar = yyempty_; - int yytoken = 0; - - /* State. */ - int yyn = 0; - int yylen = 0; - int yystate = 0; - - YYStack yystack; - - /* Error handling. */ - int yynerrs_ = 0;]b4_locations_if([[ - /// The location where the error started. - ]b4_location_type[ yyerrloc = null; - - /// ]b4_location_type[ of the lookahead. - ]b4_location_type[ yylloc; - - /// @@$. - ]b4_location_type[ yyloc;]])[ - - /// Semantic value of the lookahead. - ]b4_yystype[ yylval; + public bool parse()]])[ + {]b4_push_if([[ + if (!this.pushParseInitialized) + { + pushParseInitialize(); + yyerrstatus_ = 0; + } + else + label = YYGETTOKEN; - int yyresult;]b4_parse_trace_if([[ + bool push_token_consumed = true; +]], [[ bool yyresult;]b4_lac_if([[ + // Discard the LAC context in case there still is one left from a + // previous invocation. + yylacDiscard("init");]])[]b4_parse_trace_if([[ - yycdebug ("Starting parse\n");]])[ + yycdebugln ("Starting parse");]])[ yyerrstatus_ = 0; ]m4_ifdef([b4_initial_action], [ @@ -461,81 +544,107 @@ [ /* Initialize the stack. */ yystack.push (yystate, yylval]b4_locations_if([, yylloc])[); - int label = YYNEWSTATE; + label = YYNEWSTATE;]])[ for (;;) final switch (label) { /* New state. Unlike in the C/C++ skeletons, the state is already pushed when we come here. */ case YYNEWSTATE:]b4_parse_trace_if([[ - yycdebug (format("Entering state %d\n", yystate)); + yycdebugln (format("Entering state %d", yystate)); if (0 < yydebug) yystack.print (yyDebugStream);]])[ /* Accept? */ - if (yystate == yyfinal_) - return true; + if (yystate == yyfinal_)]b4_push_if([[ + { + label = YYACCEPT; + break; + }]], [[ + return true;]])[ /* Take a decision. First try without lookahead. */ yyn = yypact_[yystate]; - if (yy_pact_value_is_default_ (yyn)) + if (yyPactValueIsDefault(yyn)) { label = YYDEFAULT; break; - } + }]b4_push_if([[ + goto case; + + case YYGETTOKEN:]])[ /* Read a lookahead token. */ - if (yychar == yyempty_) - {]b4_parse_trace_if([[ - yycdebug ("Reading a token: ");]])[ - yychar = yylex ();]b4_locations_if([[ - static if (yy_location_is_class) { - yylloc = new ]b4_location_type[(yylexer.startPos, yylexer.endPos); - } else { - yylloc = ]b4_location_type[(yylexer.startPos, yylexer.endPos); - }]]) - yylval = yylexer.semanticVal;[ + if (yytoken == ]b4_symbol(empty, kind)[) + {]b4_push_if([[ + if (!push_token_consumed) + return YYPUSH_MORE;]])[]b4_parse_trace_if([[ + yycdebugln ("Reading a token");]])[]b4_push_if([[ + yytoken = yyla.token; + yylval = yyla.value;]b4_locations_if([[ + yylloc = yyla.location;]])[ + push_token_consumed = false;]], [[ + Symbol yysymbol = yylex(); + yytoken = yysymbol.token(); + yylval = yysymbol.value();]b4_locations_if([[ + yylloc = yysymbol.location();]])[]])[ } - /* Convert token to internal form. */ - yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[ - yy_symbol_print ("Next token is", - yytoken, yylval]b4_locations_if([, yylloc])[);]])[ - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken) - label = YYDEFAULT; + /* Token already converted to internal form. */]b4_parse_trace_if([[ + yy_symbol_print ("Next token is", yytoken, yylval]b4_locations_if([, yylloc])[);]])[ - /* <= 0 means reduce or error. */ - else if ((yyn = yytable_[yyn]) <= 0) + if (yytoken == ]b4_symbol(error, kind)[) { - if (yy_table_value_is_error_ (yyn)) - label = YYERRLAB; - else - { - yyn = -yyn; - label = YYREDUCE; - } + // The scanner already issued an error message, process directly + // to error recovery. But do not keep the error token as + // lookahead, it is too special and may lead us to an endless + // loop in error recovery. */ + yytoken = ]b4_symbol(undef, kind)[;]b4_locations_if([[ + yyerrloc = yylloc;]])[ + label = YYERRLAB1; } else { - /* Shift the lookahead token. */]b4_parse_trace_if([[ - yy_symbol_print ("Shifting", yytoken, - yylval]b4_locations_if([, yylloc])[);]])[ - - /* Discard the token being shifted. */ - yychar = yyempty_; - - /* Count tokens shifted since error; after three, turn off error - * status. */ - if (yyerrstatus_ > 0) - --yyerrstatus_; - - yystate = yyn; - yystack.push (yystate, yylval]b4_locations_if([, yylloc])[); - label = YYNEWSTATE; + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken) {]b4_lac_if([[ + if (!yylacEstablish(yystack, yytoken)) + label = YYERRLAB; + else]])[ + label = YYDEFAULT; + } + /* <= 0 means reduce or error. */ + else if ((yyn = yytable_[yyn]) <= 0) + { + if (yyTableValueIsError(yyn)) + label = YYERRLAB;]b4_lac_if([[ + else if (!yylacEstablish(yystack, yytoken)) + label = YYERRLAB;]])[ + else + { + yyn = -yyn; + label = YYREDUCE; + } + } + else + { + /* Shift the lookahead token. */]b4_parse_trace_if([[ + yy_symbol_print ("Shifting", yytoken, yylval]b4_locations_if([, yylloc])[);]])[ + + /* Discard the token being shifted. */ + yytoken = ]b4_symbol(empty, kind)[; + + /* Count tokens shifted since error; after three, turn off error + * status. */ + if (yyerrstatus_ > 0) + --yyerrstatus_; + + yystate = yyn; + yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);]b4_lac_if([[ + yylacDiscard("shift");]])[ + label = YYNEWSTATE; + } } break; @@ -559,33 +668,32 @@ yystate = yystack.stateAt (0); break; - /*------------------------------------. - | yyerrlab -- here on detecting error | - `------------------------------------*/ + /*--------------------------------------. + | yyerrlab -- here on detecting error. | + `--------------------------------------*/ case YYERRLAB: /* If not already recovering from an error, report this error. */ if (yyerrstatus_ == 0) { ++yynerrs_; - if (yychar == yyempty_) - yytoken = yyempty_; - yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken)); + yyreportSyntaxError(new Context(]b4_lac_if([[this, ]])[yystack, yytoken]b4_locations_if([[, yylloc]])[)); } - -]b4_locations_if([ yyerrloc = yylloc;])[ +]b4_locations_if([ + yyerrloc = yylloc;])[ if (yyerrstatus_ == 3) { /* If just tried and failed to reuse lookahead token after an * error, discard it. */ - if (yychar <= YYTokenType.EOF) + /* Return failure if at end of input. */ + if (yytoken == ]b4_symbol(eof, [kind])[)]b4_push_if([[ { - /* Return failure if at end of input. */ - if (yychar == YYTokenType.EOF) - return false; - } + label = YYABORT; + break; + }]], [[ + return false;]])[ else - yychar = yyempty_; + yytoken = ]b4_symbol(empty, kind)[; } /* Else will try to reuse lookahead token after shifting the error @@ -612,13 +720,14 @@ case YYERRLAB1: yyerrstatus_ = 3; /* Each real token shifted decrements this. */ + // Pop stack until we find a state that shifts the error token. for (;;) { yyn = yypact_[yystate]; - if (!yy_pact_value_is_default_ (yyn)) + if (!yyPactValueIsDefault(yyn)) { - yyn += yy_error_token_; - if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yy_error_token_) + yyn += ]b4_symbol(error, kind)[; + if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == ]b4_symbol(error, kind)[) { yyn = yytable_[yyn]; if (0 < yyn) @@ -627,16 +736,23 @@ } /* Pop the current state because it cannot handle the error token. */ - if (yystack.height == 1) - return false; + if (yystack.height == 1)]b4_push_if([[ + { + label = YYABORT; + break; + }]],[[ + return false;]])[ ]b4_locations_if([ yyerrloc = yystack.locationAt (0);])[ yystack.pop (); yystate = yystack.stateAt (0);]b4_parse_trace_if([[ if (0 < yydebug) yystack.print (yyDebugStream);]])[ - } - + }]b4_push_if([[ + if (label == YYABORT) + /* Leave the switch. */ + break; +]])[ ]b4_locations_if([ /* Muck with the stack to setup for yylloc. */ yystack.push (0, yy_semantic_null, yylloc); @@ -644,34 +760,145 @@ yyloc = yylloc_from_stack (yystack, 2); yystack.pop (2);])[ - /* Shift the error token. */]b4_parse_trace_if([[ - yy_symbol_print ("Shifting", yystos_[yyn], - yylval]b4_locations_if([, yyloc])[);]])[ - + /* Shift the error token. */]b4_lac_if([[ + yylacDiscard("error recovery");]])[]b4_parse_trace_if([[ + yy_symbol_print ("Shifting", to!SymbolKind (yystos_[yyn]), yylval]b4_locations_if([, yyloc])[);]])[ yystate = yyn; yystack.push (yyn, yylval]b4_locations_if([, yyloc])[); label = YYNEWSTATE; break; /* Accept. */ - case YYACCEPT: - return true; + case YYACCEPT:]b4_push_if([[ + this.pushParseInitialized = false;]b4_parse_trace_if([[ + if (0 < yydebug) + yystack.print (yyDebugStream);]])[ + return YYACCEPT;]], [[ + yyresult = true; + label = YYRETURN; + break;]])[ /* Abort. */ - case YYABORT: - return false; + case YYABORT:]b4_push_if([[ + this.pushParseInitialized = false;]b4_parse_trace_if([[ + if (0 < yydebug) + yystack.print (yyDebugStream);]])[ + return YYABORT;]], [[ + yyresult = false; + label = YYRETURN; + break;]])[ +]b4_push_if([[]], [[ ][case YYRETURN:]b4_parse_trace_if([[ + if (0 < yydebug) + yystack.print (yyDebugStream);]])[ + return yyresult;]])[ } + assert(0); } +]b4_push_if([[ + bool pushParseInitialized = false; + + /** + * (Re-)Initialize the state of the push parser. + */ + public void pushParseInitialize() + { + + /* Lookahead and lookahead in internal form. */ + this.yytoken = ]b4_symbol(empty, kind)[; + + /* State. */ + this.yyn = 0; + this.yylen = 0; + this.yystate = 0; + destroy(this.yystack); + this.label = YYNEWSTATE; +]b4_lac_if([[ + destroy(this.yylacStack); + this.yylacEstablished = false;]])[ + + /* Error handling. */ + this.yynerrs_ = 0; +]b4_locations_if([ + /* The location where the error started. */ + this.yyerrloc = Location(Position(), Position()); + this.yylloc = Location(Position(), Position());])[ + + /* Semantic value of the lookahead. */ + //destroy(this.yylval); + + /* Initialize the stack. */ + yystack.push(this.yystate, this.yylval]b4_locations_if([, this.yylloc])[); + + this.pushParseInitialized = true; + }]])[]b4_both_if([[ + /** + * Parse input from the scanner that was specified at object construction + * time. Return whether the end of the input was reached successfully. + * This version of parse() is defined only when api.push-push=both. + * + * @@return true if the parsing succeeds. Note that this does not + * imply that there were no syntax errors. + */ + bool parse() + { + int status = 0; + do { + status = this.pushParse(yylex()); + } while (status == YYPUSH_MORE); + return status == YYACCEPT; + }]])[ + // Generate an error message. - private final string yysyntax_error (int yystate, int tok) - {]b4_error_verbose_if([[ + private final void yyreportSyntaxError(Context yyctx) + {]b4_parse_error_bmatch( +[custom], [[ + yylexer.reportSyntaxError(yyctx);]], +[detailed], [[ + if (yyctx.getToken() != ]b4_symbol(empty, kind)[) + { + // FIXME: This method of building the message is not compatible + // with internationalization. + immutable int argmax = 5; + SymbolKind[] yyarg = new SymbolKind[argmax]; + int yycount = yysyntaxErrorArguments(yyctx, yyarg, argmax); + string res, yyformat; + switch (yycount) + { + case 1: + yyformat = YY_("syntax error, unexpected %s"); + res = format(yyformat, yyarg[0]); + break; + case 2: + yyformat = YY_("syntax error, unexpected %s, expecting %s"); + res = format(yyformat, yyarg[0], yyarg[1]); + break; + case 3: + yyformat = YY_("syntax error, unexpected %s, expecting %s or %s"); + res = format(yyformat, yyarg[0], yyarg[1], yyarg[2]); + break; + case 4: + yyformat = YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + res = format(yyformat, yyarg[0], yyarg[1], yyarg[2], yyarg[3]); + break; + case 5: + yyformat = YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); + res = format(yyformat, yyarg[0], yyarg[1], yyarg[2], yyarg[3], yyarg[4]); + break; + default: + res = YY_("syntax error"); + break; + } + yyerror(]b4_locations_if([yyctx.getLocation(), ])[res); + }]], +[[simple]], [[ + yyerror(]b4_locations_if([yyctx.getLocation(), ])[YY_("syntax error"));]])[ + } + +]b4_parse_error_bmatch( +[detailed], [[ + private int yysyntaxErrorArguments(Context yyctx, SymbolKind[] yyarg, int yyargn) { /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. - See - - for details. YYERROR is fine as it does not invoke this - function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't @@ -696,15 +923,85 @@ list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. - */ - if (tok != yyempty_) + */ + int yycount = 0; + if (yyctx.getToken() != ]b4_symbol(empty, kind)[) + { + if (yyarg !is null) + yyarg[yycount] = yyctx.getToken(); + yycount += 1; + yycount += yyctx.getExpectedTokens(yyarg, 1, yyargn); + } + return yycount; + } +]])[ + + + /** + * Information needed to get the list of expected tokens and to forge + * a syntax error diagnostic. + */ + public static final class Context + {]b4_lac_if([[ + private ]b4_parser_class[ yyparser;]])[ + private const(YYStack) yystack; + private SymbolKind yytoken;]b4_locations_if([[ + private const(Location) yylocation;]])[ + + this(]b4_lac_if([[]b4_parser_class[ parser, ]])[YYStack stack, SymbolKind kind]b4_locations_if([[, Location loc]])[) + {]b4_lac_if([[ + yyparser = parser;]])[ + yystack = stack; + yytoken = kind;]b4_locations_if([[ + yylocation = loc;]])[ + } + + final SymbolKind getToken() const { - // FIXME: This method of building the message is not compatible - // with internationalization. - string res = "syntax error, unexpected "; - res ~= yytnamerr_ (yytname_[tok]); - int yyn = yypact_[yystate]; - if (!yy_pact_value_is_default_ (yyn)) + return yytoken; + }]b4_locations_if([[ + + final const(Location) getLocation() const + { + return yylocation; + }]])[ + /** + * Put in YYARG at most YYARGN of the expected tokens given the + * current YYCTX, and return the number of tokens stored in YYARG. If + * YYARG is null, return the number of expected tokens (guaranteed to + * be less than YYNTOKENS). + */ + int getExpectedTokens(SymbolKind[] yyarg, int yyargn)]b4_lac_if([[]], [[ const]])[ + { + return getExpectedTokens(yyarg, 0, yyargn); + } + + int getExpectedTokens(SymbolKind[] yyarg, int yyoffset, int yyargn)]b4_lac_if([[]], [[ const]])[ + { + int yycount = yyoffset;]b4_lac_if([b4_parse_trace_if([[ + // Execute LAC once. We don't care if it is successful, we + // only do it for the sake of debugging output. + + if (!yyparser.yylacEstablished) + yyparser.yylacCheck(yystack, yytoken); +]])[ + for (int yyx = 0; yyx < yyntokens_; ++yyx) + { + SymbolKind yysym = SymbolKind(yyx); + if (yysym != ]b4_symbol(error, kind)[ + && yysym != ]b4_symbol(undef, kind)[ + && yyparser.yylacCheck(yystack, yysym)) + { + if (yyarg == null) + yycount += 1; + else if (yycount == yyargn) + return 0; + else + yyarg[yycount++] = yysym; + } + }]], [[ + int yyn = yypact_[this.yystack.stateAt(0)]; + if (!yyPactValueIsDefault(yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first @@ -714,33 +1011,181 @@ /* Stay within bounds of both yycheck and yytname. */ int yychecklim = yylast_ - yyn + 1; int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; - int count = 0; - for (int x = yyxbegin; x < yyxend; ++x) - if (yycheck_[x + yyn] == x && x != yy_error_token_ - && !yy_table_value_is_error_ (yytable_[x + yyn])) - ++count; - if (count < 5) + for (int yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck_[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[ + && !yyTableValueIsError(yytable_[yyx + yyn])) { - count = 0; - for (int x = yyxbegin; x < yyxend; ++x) - if (yycheck_[x + yyn] == x && x != yy_error_token_ - && !yy_table_value_is_error_ (yytable_[x + yyn])) - { - res ~= count++ == 0 ? ", expecting " : " or "; - res ~= yytnamerr_ (yytname_[x]); - } + if (yyarg is null) + ++yycount; + else if (yycount == yyargn) + return 0; + else + yyarg[yycount++] = SymbolKind(yyx); } + }]])[ + if (yyarg !is null && yycount == yyoffset && yyoffset < yyargn) + yyarg[yyoffset] = ]b4_symbol(empty, kind)[; + return yycount - yyoffset; + } + } + +]b4_lac_if([[ + /** Check the lookahead yytoken. + * \returns true iff the token will be eventually shifted. + */ + bool yylacCheck(const YYStack yystack, SymbolKind yytoken) + { + // Logically, the yylacStack's lifetime is confined to this function. + // Clear it, to get rid of potential left-overs from previous call. + destroy(yylacStack); + // Reduce until we encounter a shift and thereby accept the token. +]b4_parse_trace_if([[ + yycdebug("LAC: checking lookahead " ~ format("%s", yytoken) ~ ":");]])[ + int lacTop = 0; + while (true) + { + int topState = (yylacStack.length == 0 + ? yystack.stateAt(lacTop) + : yylacStack[$ - 1]); + int yyrule = yypact_[topState]; + if (yyPactValueIsDefault(yyrule) + || (yyrule += yytoken) < 0 || yylast_ < yyrule + || yycheck_[yyrule] != yytoken) + { + // Use the default action. + yyrule = yydefact_[+topState]; + if (yyrule == 0) + {]b4_parse_trace_if([[ + yycdebugln(" Err");]])[ + return false; + } } - return res; - }]])[ - return "syntax error"; + else + { + // Use the action from yytable. + yyrule = yytable_[yyrule]; + if (yyTableValueIsError(yyrule)) + {]b4_parse_trace_if([[ + yycdebugln(" Err");]])[ + return false; + } + if (0 < yyrule) + {]b4_parse_trace_if([[ + yycdebugln(" S" ~ to!string(yyrule));]])[ + return true; + } + yyrule = -yyrule; + } + // By now we know we have to simulate a reduce. +]b4_parse_trace_if([[ + yycdebug(" R" ~ to!string(yyrule - 1));]])[ + // Pop the corresponding number of values from the stack. + { + int yylen = yyr2_[yyrule]; + // First pop from the LAC stack as many tokens as possible. + int lacSize = cast (int) yylacStack.length; + if (yylen < lacSize) + { + yylacStack.length -= yylen; + yylen = 0; + } + else if (lacSize != 0) + { + destroy(yylacStack); + yylen -= lacSize; + } + // Only afterwards look at the main stack. + // We simulate popping elements by incrementing lacTop. + lacTop += yylen; + } + // Keep topState in sync with the updated stack. + topState = (yylacStack.length == 0 + ? yystack.stateAt(lacTop) + : yylacStack[$ - 1]); + // Push the resulting state of the reduction. + int state = yyLRGotoState(topState, yyr1_[yyrule]);]b4_parse_trace_if([[ + yycdebug(" G" ~ to!string(state));]])[ + yylacStack.length++; + yylacStack[$ - 1] = state; + } + } + + /** Establish the initial context if no initial context currently exists. + * \returns true iff the token will be eventually shifted. + */ + bool yylacEstablish(YYStack yystack, SymbolKind yytoken) + { + /* Establish the initial context for the current lookahead if no initial + context is currently established. + + We define a context as a snapshot of the parser stacks. We define + the initial context for a lookahead as the context in which the + parser initially examines that lookahead in order to select a + syntactic action. Thus, if the lookahead eventually proves + syntactically unacceptable (possibly in a later context reached via a + series of reductions), the initial context can be used to determine + the exact set of tokens that would be syntactically acceptable in the + lookahead's place. Moreover, it is the context after which any + further semantic actions would be erroneous because they would be + determined by a syntactically unacceptable token. + + yylacEstablish should be invoked when a reduction is about to be + performed in an inconsistent state (which, for the purposes of LAC, + includes consistent states that don't know they're consistent because + their default reductions have been disabled). + + For parse.lac=full, the implementation of yylacEstablish is as + follows. If no initial context is currently established for the + current lookahead, then check if that lookahead can eventually be + shifted if syntactic actions continue from the current context. */ + if (yylacEstablished) + return true; + else + {]b4_parse_trace_if([[ + yycdebugln("LAC: initial context established for " ~ format("%s", yytoken));]])[ + yylacEstablished = true; + return yylacCheck(yystack, yytoken); + } } + /** Discard any previous initial lookahead context because of event. + * \param event the event which caused the lookahead to be discarded. + * Only used for debbuging output. */ + void yylacDiscard(string event) + { + /* Discard any previous initial lookahead context because of Event, + which may be a lookahead change or an invalidation of the currently + established initial context for the current lookahead. + + The most common example of a lookahead change is a shift. An example + of both cases is syntax error recovery. That is, a syntax error + occurs when the lookahead is syntactically erroneous for the + currently established initial context, so error recovery manipulates + the parser stacks to try to find a new initial context in which the + current lookahead is syntactically acceptable. If it fails to find + such a context, it discards the lookahead. */ + if (yylacEstablished) + {]b4_parse_trace_if([[ + yycdebugln("LAC: initial context discarded due to " ~ event);]])[ + yylacEstablished = false; + } + } + + /** The stack for LAC. + * Logically, the yylacStack's lifetime is confined to the function + * yylacCheck. We just store it as a member of this class to hold + * on to the memory and to avoid frequent reallocations. + */ + int[] yylacStack; + /** Whether an initial LAC context was established. */ + bool yylacEstablished; +]])[ + /** * Whether the given yypact_ value indicates a defaulted state. * @@param yyvalue the value to check */ - private static bool yy_pact_value_is_default_ (int yyvalue) + private static bool yyPactValueIsDefault(int yyvalue) { return yyvalue == yypact_ninf_; } @@ -749,7 +1194,7 @@ * Whether the given yytable_ value indicates a syntax error. * @@param yyvalue the value to check */ - private static bool yy_table_value_is_error_ (int yyvalue) + private static bool yyTableValueIsError(int yyvalue) { return yyvalue == yytable_ninf_; } @@ -765,13 +1210,6 @@ ]b4_parser_tables_define[ - /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at \a yyntokens_, nonterminals. */ - private static immutable string[] yytname_ = - @{ - ]b4_tname[ - @}; - ]b4_parse_trace_if([[ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ private static immutable ]b4_int_type_for([b4_rline])[[] yyrline_ = @@ -788,66 +1226,60 @@ int yylno = yyrline_[yyrule]; int yynrhs = yyr2_[yyrule]; /* Print the symbols being reduced, and their result. */ - yycdebug (format("Reducing stack by rule %d (line %d), ", - yyrule - 1, yylno)); + yycdebugln (format("Reducing stack by rule %d (line %d):", + yyrule - 1, yylno)); /* The symbols being reduced. */ for (int yyi = 0; yyi < yynrhs; yyi++) yy_symbol_print (format(" $%d =", yyi + 1), - yystos_[yystack.stateAt(yynrhs - (yyi + 1))], + to!SymbolKind (yystos_[yystack.stateAt(yynrhs - (yyi + 1))]), ]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([, b4_rhs_location(yynrhs, yyi + 1)])[); } ]])[ - private static token_number_type yytranslate_ (int t) + private static auto yytranslate_ (int t) { ]b4_api_token_raw_if( -[[ import std.conv : to; - return to!byte (t);]], +[[ return SymbolKind(t);]], [[ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ - immutable token_number_type[] translate_table = + immutable ]b4_int_type_for([b4_translate])[[] translate_table = @{ ]b4_translate[ @}; - immutable int user_token_number_max_ = ]b4_user_token_number_max[; - immutable token_number_type undef_token_ = ]b4_undef_token_number[; + // Last valid token kind. + immutable int code_max = ]b4_code_max[; if (t <= 0) - return YYTokenType.EOF; - else if (t <= user_token_number_max_) - return translate_table[t]; + return ]b4_symbol(eof, kind)[; + else if (t <= code_max) + return SymbolKind(translate_table[t]); else - return undef_token_;]])[ + return ]b4_symbol(undef, kind)[;]])[ } - alias ]b4_int_type_for([b4_translate])[ token_number_type; - - private static immutable token_number_type yy_error_token_ = 1; - private static immutable int yylast_ = ]b4_last[; private static immutable int yynnts_ = ]b4_nterms_number[; - private static immutable int yyempty_ = -2; private static immutable int yyfinal_ = ]b4_final_state_number[; private static immutable int yyntokens_ = ]b4_tokens_number[; private final struct YYStackElement { int state; - ]b4_yystype[ value;]b4_locations_if( + Value value;]b4_locations_if( b4_location_type[[] location;])[ } private final struct YYStack { private YYStackElement[] stack = []; - public final @@property ulong height() + public final ulong height() { return stack.length; } - public final void push (int state, ]b4_yystype[ value]dnl - b4_locations_if([, ref ]b4_location_type[ loc])[) + public final void push (int state, Value value]dnl + b4_locations_if([, ref Location loc])[) { stack ~= YYStackElement(state, value]b4_locations_if([, loc])[); } @@ -862,18 +1294,18 @@ stack.length -= num; } - public final int stateAt (int i) + public final int stateAt (int i) const { return stack[$-i-1].state; } ]b4_locations_if([[ - public final ref ]b4_location_type[ locationAt (int i) + public final ref Location locationAt (int i) { return stack[$-i-1].location; }]])[ - public final ref ]b4_yystype[ valueAt (int i) + public final ref Value valueAt (int i) { return stack[$-i-1].value; } @@ -887,9 +1319,8 @@ stream.writeln (); }]])[ } - - /* User implementation code. */ ]b4_percent_code_get[ } -]b4_epilogue[]dnl +]b4_percent_code_get([[epilogue]])[]dnl +b4_epilogue[]dnl b4_output_end diff -Nru bison-3.5.1+dfsg/data/skeletons/lalr1.java bison-3.8.2+dfsg/data/skeletons/lalr1.java --- bison-3.5.1+dfsg/data/skeletons/lalr1.java 2020-01-19 13:07:51.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/lalr1.java 2021-08-08 06:59:01.000000000 +0000 @@ -1,6 +1,6 @@ -# Java skeleton for Bison -*- autoconf -*- +# Java skeleton for Bison -*- java -*- -# Copyright (C) 2007-2015, 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,11 +13,11 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . m4_include(b4_skeletonsdir/[java.m4]) -b4_defines_if([b4_complain([%defines does not make sense in Java])]) +b4_header_if([b4_complain([%header/%defines does not make sense in Java])]) m4_define([b4_symbol_no_destructor_assert], [b4_symbol_if([$1], [has_destructor], @@ -25,7 +25,10 @@ [%destructor does not make sense in Java])])]) b4_symbol_foreach([b4_symbol_no_destructor_assert]) -# Setup some macros for api.push-pull. +## --------------- ## +## api.push-pull. ## +## --------------- ## + b4_percent_define_default([[api.push-pull]], [[pull]]) b4_percent_define_check_values([[[[api.push-pull]], [[pull]], [[push]], [[both]]]]) @@ -49,13 +52,15 @@ b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])], [m4_define([b4_push_flag], [[1]])])]) -# Define a macro to encapsulate the parse state variables. -# This allows them to be defined either in parse() when doing -# pull parsing, or as class instance variable when doing push parsing. -m4_define([b4_define_state],[[ - /* Lookahead and lookahead in internal form. */ - int yychar = yyempty_; - int yytoken = 0; +# Define a macro to encapsulate the parse state variables. This +# allows them to be defined either in parse() when doing pull parsing, +# or as class instance variable when doing push parsing. +m4_define([b4_define_state], +[[ + /* Lookahead token kind. */ + int yychar = YYEMPTY_; + /* Lookahead symbol kind. */ + SymbolKind yytoken = null; /* State. */ int yyn = 0; @@ -64,9 +69,8 @@ YYStack yystack = new YYStack (); int label = YYNEWSTATE; - /* Error handling. */ - int yynerrs_ = 0; - ]b4_locations_if([[/* The location where the error started. */ +]b4_locations_if([[ + /* The location where the error started. */ ]b4_location_type[ yyerrloc = null; /* Location. */ @@ -74,15 +78,31 @@ /* Semantic value of the lookahead. */ ]b4_yystype[ yylval = null; -]])[ +]]) + +# parse.lac +b4_percent_define_default([[parse.lac]], [[none]]) +b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]]) +b4_define_flag_if([lac]) +m4_define([b4_lac_flag], + [m4_if(b4_percent_define_get([[parse.lac]]), + [none], [[0]], [[1]])]) + -]b4_output_begin([b4_parser_file_name])[ +## ------------- ## +## Parser File. ## +## ------------- ## + +b4_output_begin([b4_parser_file_name])[ ]b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java], - [2007-2015, 2018-2020])[ -]b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);[ + [2007-2015, 2018-2021])[ +]b4_disclaimer[ +]b4_percent_define_ifdef([api.package], [package b4_percent_define_get([api.package]);[ ]])[ ]b4_user_pre_prologue[ ]b4_user_post_prologue[ +import java.text.MessageFormat; +import java.util.ArrayList; ]b4_percent_code_get([[imports]])[ /** * A Bison parser, automatically generated from ]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[. @@ -91,8 +111,10 @@ */ ]b4_parser_class_declaration[ { - ]b4_identification[ -]b4_error_verbose_if([[ +]b4_identification[ +][ +]b4_parse_error_bmatch( + [detailed\|verbose], [[ /** * True if verbose error messages are enabled. */ @@ -109,16 +131,16 @@ */ public final void setErrorVerbose(boolean verbose) { yyErrorVerbose = verbose; } -]]) +]])[ -b4_locations_if([[ +]b4_locations_if([[ /** * A class defining a pair of positions. Positions, defined by the * ]b4_position_type[ class, denote a point in the input. * Locations represent a part of the input through the beginning * and ending positions. */ - public class ]b4_location_type[ { + public static class ]b4_location_type[ { /** * The first, inclusive, position in the range. */ @@ -153,52 +175,50 @@ * ]b4_position_type[ should override the equals * method. */ - public String toString () { + public String toString() { if (begin.equals (end)) - return begin.toString (); + return begin.toString(); else - return begin.toString () + "-" + end.toString (); + return begin.toString() + "-" + end.toString(); } } -]])[ - -]b4_locations_if([[ - private ]b4_location_type[ yylloc (YYStack rhs, int n) + private ]b4_location_type[ yylloc(YYStack rhs, int n) { if (0 < n) - return new ]b4_location_type[ (rhs.locationAt (n-1).begin, rhs.locationAt (0).end); + return new ]b4_location_type[(rhs.locationAt(n-1).begin, rhs.locationAt(0).end); else - return new ]b4_location_type[ (rhs.locationAt (0).end); + return new ]b4_location_type[(rhs.locationAt(0).end); }]])[ +]b4_declare_symbol_enum[ + /** * Communication interface between the scanner and the Bison-generated * parser ]b4_parser_class[. */ public interface Lexer { - /** Token returned by the scanner to signal the end of its input. */ - public static final int EOF = 0; - ]b4_token_enums[ - - ]b4_locations_if([[/** + /** Deprecated, use ]b4_symbol(eof, id)[ instead. */ + public static final int EOF = ]b4_symbol(eof, id)[; +]b4_pull_if([b4_locations_if([[ + /** * Method to retrieve the beginning position of the last scanned token. * @@return the position at which the last scanned token starts. */ - ]b4_position_type[ getStartPos (); + ]b4_position_type[ getStartPos(); /** * Method to retrieve the ending position of the last scanned token. * @@return the first position beyond the last scanned token. */ - ]b4_position_type[ getEndPos ();]])[ + ]b4_position_type[ getEndPos();]])[ /** * Method to retrieve the semantic value of the last scanned token. * @@return the semantic value of the last scanned token. */ - ]b4_yystype[ getLVal (); + ]b4_yystype[ getLVal(); /** * Entry point for the scanner. Returns the token identifier corresponding @@ -206,17 +226,26 @@ * ]b4_locations_if([and beginning/ending positions ])[of the token. * @@return the token identifier corresponding to the next token. */ - int yylex () ]b4_maybe_throws([b4_lex_throws])[; - + int yylex()]b4_maybe_throws([b4_lex_throws])[; +]])[ /** - * Entry point for error reporting. Emits an error - * ]b4_locations_if([referring to the given location ])[in a user-defined way. + * Emit an error]b4_locations_if([ referring to the given location])[in a user-defined way. * - * ]b4_locations_if([[@@param loc The location of the element to which the - * error message is related]])[ + *]b4_locations_if([[ @@param loc The location of the element to which the + * error message is related.]])[ * @@param msg The string for the error message. */ - void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String msg); + void yyerror(]b4_locations_if([b4_location_type[ loc, ]])[String msg); + +]b4_parse_error_bmatch( + [custom], [[ + /** + * Build and emit a "syntax error" message in a user-defined way. + * + * @@param ctx The context of the error. + */ + void reportSyntaxError(Context ctx); +]])[ } ]b4_lexer_if([[ @@ -224,22 +253,25 @@ ]b4_percent_code_get([[lexer]])[ } - ]])[/** +]])[ + /** * The object doing lexical analysis for us. */ private Lexer yylexer; - ]b4_parse_param_vars[ +]b4_parse_param_vars[ ]b4_lexer_if([[ /** * Instantiates the Bison-generated parser. */ - public ]b4_parser_class (b4_parse_param_decl([b4_lex_param_decl])[) ]b4_maybe_throws([b4_init_throws])[ + public ]b4_parser_class[(]b4_parse_param_decl([b4_lex_param_decl])[)]b4_maybe_throws([b4_init_throws])[ { - ]b4_percent_code_get([[init]])[ +]b4_percent_code_get([[init]])[]b4_lac_if([[ + this.yylacStack = new ArrayList(); + this.yylacEstablished = false;]])[ this.yylexer = new YYLexer(]b4_lex_param_call[); - ]b4_parse_param_cons[ +]b4_parse_param_cons[ } ]])[ @@ -247,11 +279,13 @@ * Instantiates the Bison-generated parser. * @@param yylexer The scanner that will supply tokens to the parser. */ - ]b4_lexer_if([[protected]], [[public]]) b4_parser_class[ (]b4_parse_param_decl([[Lexer yylexer]])[) ]b4_maybe_throws([b4_init_throws])[ + ]b4_lexer_if([[protected]], [[public]]) b4_parser_class[(]b4_parse_param_decl([[Lexer yylexer]])[)]b4_maybe_throws([b4_init_throws])[ { - ]b4_percent_code_get([[init]])[ +]b4_percent_code_get([[init]])[]b4_lac_if([[ + this.yylacStack = new ArrayList(); + this.yylacEstablished = false;]])[ this.yylexer = yylexer; - ]b4_parse_param_cons[ +]b4_parse_param_cons[ } ]b4_parse_trace_if([[ @@ -260,7 +294,7 @@ /** * The PrintStream on which the debugging output is printed. */ - public final java.io.PrintStream getDebugStream () { return yyDebugStream; } + public final java.io.PrintStream getDebugStream() { return yyDebugStream; } /** * Set the PrintStream on which the debug output is printed. @@ -284,14 +318,20 @@ public final void setDebugLevel(int level) { yydebug = level; } ]])[ + private int yynerrs = 0; + + /** + * The number of syntax errors so far. + */ + public final int getNumberOfErrors() { return yynerrs; } + /** * Print an error message via the lexer. *]b4_locations_if([[ Use a null location.]])[ * @@param msg The error message. */ - public final void yyerror (String msg) - { - yylexer.yyerror (]b4_locations_if([[(]b4_location_type[)null, ]])[msg); + public final void yyerror(String msg) { + yylexer.yyerror(]b4_locations_if([[(]b4_location_type[)null, ]])[msg); } ]b4_locations_if([[ /** @@ -299,9 +339,8 @@ * @@param loc The location associated with the message. * @@param msg The error message. */ - public final void yyerror (]b4_location_type[ loc, String msg) - { - yylexer.yyerror (loc, msg); + public final void yyerror(]b4_location_type[ loc, String msg) { + yylexer.yyerror(loc, msg); } /** @@ -309,84 +348,85 @@ * @@param pos The position associated with the message. * @@param msg The error message. */ - public final void yyerror (]b4_position_type[ pos, String msg) - { - yylexer.yyerror (new ]b4_location_type[ (pos), msg); + public final void yyerror(]b4_position_type[ pos, String msg) { + yylexer.yyerror(new ]b4_location_type[ (pos), msg); }]])[ ]b4_parse_trace_if([[ - protected final void yycdebug (String s) { + protected final void yycdebugNnl(String s) { if (0 < yydebug) - yyDebugStream.println (s); + yyDebugStream.print(s); + } + + protected final void yycdebug(String s) { + if (0 < yydebug) + yyDebugStream.println(s); }]])[ private final class YYStack { - private int[] stateStack = new int[16]; - ]b4_locations_if([[private ]b4_location_type[[] locStack = new ]b4_location_type[[16];]])[ + private int[] stateStack = new int[16];]b4_locations_if([[ + private ]b4_location_type[[] locStack = new ]b4_location_type[[16];]])[ private ]b4_yystype[[] valueStack = new ]b4_yystype[[16]; public int size = 16; public int height = -1; - public final void push (int state, ]b4_yystype[ value]dnl - b4_locations_if([, ]b4_location_type[ loc])[) { + public final void push(int state, ]b4_yystype[ value]b4_locations_if([, ]b4_location_type[ loc])[) { height++; - if (size == height) - { - int[] newStateStack = new int[size * 2]; - System.arraycopy (stateStack, 0, newStateStack, 0, height); - stateStack = newStateStack; - ]b4_locations_if([[ - ]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2]; - System.arraycopy (locStack, 0, newLocStack, 0, height); - locStack = newLocStack;]]) - - b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2]; - System.arraycopy (valueStack, 0, newValueStack, 0, height); - valueStack = newValueStack; + if (size == height) { + int[] newStateStack = new int[size * 2]; + System.arraycopy(stateStack, 0, newStateStack, 0, height); + stateStack = newStateStack;]b4_locations_if([[ + ]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2]; + System.arraycopy(locStack, 0, newLocStack, 0, height); + locStack = newLocStack;]]) + + b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2]; + System.arraycopy(valueStack, 0, newValueStack, 0, height); + valueStack = newValueStack; - size *= 2; - } + size *= 2; + } - stateStack[height] = state; - ]b4_locations_if([[locStack[height] = loc;]])[ + stateStack[height] = state;]b4_locations_if([[ + locStack[height] = loc;]])[ valueStack[height] = value; } - public final void pop () { - pop (1); + public final void pop() { + pop(1); } - public final void pop (int num) { + public final void pop(int num) { // Avoid memory leaks... garbage collection is a white lie! if (0 < num) { - java.util.Arrays.fill (valueStack, height - num + 1, height + 1, null); - ]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height + 1, null);]])[ + java.util.Arrays.fill(valueStack, height - num + 1, height + 1, null);]b4_locations_if([[ + java.util.Arrays.fill(locStack, height - num + 1, height + 1, null);]])[ } height -= num; } - public final int stateAt (int i) { + public final int stateAt(int i) { return stateStack[height - i]; } +]b4_locations_if([[ - ]b4_locations_if([[public final ]b4_location_type[ locationAt (int i) { + public final ]b4_location_type[ locationAt(int i) { return locStack[height - i]; } - - ]])[public final ]b4_yystype[ valueAt (int i) { +]])[ + public final ]b4_yystype[ valueAt(int i) { return valueStack[height - i]; } // Print the state stack on the debug stream. - public void print (java.io.PrintStream out) { + public void print(java.io.PrintStream out) { out.print ("Stack now"); - for (int i = 0; i <= height; i++) - { - out.print (' '); - out.print (stateStack[i]); - } - out.println (); + for (int i = 0; i <= height; i++) { + out.print(' '); + out.print(stateStack[i]); + } + out.println(); } } @@ -443,16 +483,15 @@ * @@param yystate the current state * @@param yysym the nonterminal to push on the stack */ - private int yyLRGotoState (int yystate, int yysym) - { - int yyr = yypgoto_[yysym - yyntokens_] + yystate; - if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate) + private int yyLRGotoState(int yystate, int yysym) { + int yyr = yypgoto_[yysym - YYNTOKENS_] + yystate; + if (0 <= yyr && yyr <= YYLAST_ && yycheck_[yyr] == yystate) return yytable_[yyr]; else - return yydefgoto_[yysym - yyntokens_]; + return yydefgoto_[yysym - YYNTOKENS_]; } - private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[ + private int yyaction(int yyn, YYStack yystack, int yylen)]b4_maybe_throws([b4_throws])[ { /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, use the top of the stack. @@ -460,10 +499,10 @@ Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. */ - ]b4_yystype[ yyval = (0 < yylen) ? yystack.valueAt (yylen - 1) : yystack.valueAt (0); - ]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[]b4_parse_trace_if([[ + ]b4_yystype[ yyval = (0 < yylen) ? yystack.valueAt(yylen - 1) : yystack.valueAt(0);]b4_locations_if([[ + ]b4_location_type[ yyloc = yylloc(yystack, yylen);]])[]b4_parse_trace_if([[ - yyReducePrint (yyn, yystack);]])[ + yyReducePrint(yyn, yystack);]])[ switch (yyn) { @@ -471,66 +510,30 @@ default: break; }]b4_parse_trace_if([[ - yySymbolPrint ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);]])[ + yySymbolPrint("-> $$ =", SymbolKind.get(yyr1_[yyn]), yyval]b4_locations_if([, yyloc])[);]])[ - yystack.pop (yylen); + yystack.pop(yylen); yylen = 0; - /* Shift the result of the reduction. */ - int yystate = yyLRGotoState (yystack.stateAt (0), yyr1_[yyn]); - yystack.push (yystate, yyval]b4_locations_if([, yyloc])[); + int yystate = yyLRGotoState(yystack.stateAt(0), yyr1_[yyn]); + yystack.push(yystate, yyval]b4_locations_if([, yyloc])[); return YYNEWSTATE; } -]b4_error_verbose_if([[ - /* Return YYSTR after stripping away unnecessary quotes and - backslashes, so that it's suitable for yyerror. The heuristic is - that double-quoting is unnecessary unless the string contains an - apostrophe, a comma, or backslash (other than backslash-backslash). - YYSTR is taken from yytname. */ - private final String yytnamerr_ (String yystr) - { - if (yystr.charAt (0) == '"') - { - StringBuffer yyr = new StringBuffer (); - strip_quotes: for (int i = 1; i < yystr.length (); i++) - switch (yystr.charAt (i)) - { - case '\'': - case ',': - break strip_quotes; - - case '\\': - if (yystr.charAt(++i) != '\\') - break strip_quotes; - /* Fall through. */ - default: - yyr.append (yystr.charAt (i)); - break; - - case '"': - return yyr.toString (); - } - } - else if (yystr.equals ("$end")) - return "end of input"; - - return yystr; - } -]])[ ]b4_parse_trace_if([[ /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ - private void yySymbolPrint (String s, int yytype, - ]b4_yystype[ yyvaluep]dnl - b4_locations_if([, Object yylocationp])[) - { - yycdebug (s + (yytype < yyntokens_ ? " token " : " nterm ") - + yytname_[yytype] + " ("]b4_locations_if([ - + yylocationp + ": "])[ - + (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")"); + private void yySymbolPrint(String s, SymbolKind yykind, + ]b4_yystype[ yyvalue]b4_locations_if([, ]b4_location_type[ yylocation])[) { + if (0 < yydebug) { + yycdebug(s + + (yykind.getCode() < YYNTOKENS_ ? " token " : " nterm ") + + yykind.getName() + " ("]b4_locations_if([ + + yylocation + ": "])[ + + (yyvalue == null ? "(null)" : yyvalue.toString()) + ")"); + } }]])[ ]b4_push_if([],[[ @@ -541,29 +544,34 @@ * @@return true if the parsing succeeds. Note that this does not * imply that there were no syntax errors. */ - public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[]])[ + public boolean parse()]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[]])[ ]b4_push_if([ /** * Push Parse input from external lexer * * @@param yylextoken current token - * @@param yylexval current lval -]b4_locations_if([ * @@param yylexloc current position])[ + * @@param yylexval current lval]b4_locations_if([[ + * @@param yylexloc current position]])[ * * @@return YYACCEPT, YYABORT, YYPUSH_MORE */ - public int push_parse (int yylextoken, b4_yystype yylexval[]b4_locations_if([, b4_location_type yylexloc])) - b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])])[ - { - ]b4_locations_if([/* @@$. */ - b4_location_type yyloc;])[ + public int push_parse(int yylextoken, b4_yystype yylexval[]b4_locations_if([, b4_location_type yylexloc]))b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])])[ + {]b4_locations_if([[ + /* @@$. */ + ]b4_location_type[ yyloc;]])[ ]b4_push_if([],[[ -]b4_define_state[]b4_parse_trace_if([[ - yycdebug ("Starting parse\n");]])[ +]b4_define_state[ +]b4_lac_if([[ + // Discard the LAC context in case there still is one left from a + // previous invocation. + yylacDiscard("init");]])[ +]b4_parse_trace_if([[ + yycdebug ("Starting parse");]])[ yyerrstatus_ = 0; + yynerrs = 0; /* Initialize the stack. */ - yystack.push (yystate, yylval ]b4_locations_if([, yylloc])[); + yystack.push (yystate, yylval]b4_locations_if([, yylloc])[); ]m4_ifdef([b4_initial_action], [ b4_dollar_pushdef([yylval], [], [], [yylloc])dnl b4_user_initial_action @@ -579,7 +587,7 @@ b4_user_initial_action b4_dollar_popdef[]dnl ])[]b4_parse_trace_if([[ - yycdebug ("Starting parse\n");]])[ + yycdebug ("Starting parse");]])[ yyerrstatus_ = 0; } else label = YYGETTOKEN; @@ -592,12 +600,12 @@ /* New state. Unlike in the C/C++ skeletons, the state is already pushed when we come here. */ case YYNEWSTATE:]b4_parse_trace_if([[ - yycdebug ("Entering state " + yystate + "\n"); + yycdebug ("Entering state " + yystate); if (0 < yydebug) yystack.print (yyDebugStream);]])[ /* Accept? */ - if (yystate == yyfinal_) + if (yystate == YYFINAL_) ]b4_push_if([{label = YYACCEPT; break;}], [return true;])[ @@ -612,64 +620,84 @@ case YYGETTOKEN:])[ /* Read a lookahead token. */ - if (yychar == yyempty_) + if (yychar == YYEMPTY_) { ]b4_push_if([[ if (!push_token_consumed) return YYPUSH_MORE;]b4_parse_trace_if([[ - yycdebug ("Reading a token: ");]])[ + yycdebug ("Reading a token");]])[ yychar = yylextoken; yylval = yylexval;]b4_locations_if([ yylloc = yylexloc;])[ push_token_consumed = false;]], [b4_parse_trace_if([[ - yycdebug ("Reading a token: ");]])[ + yycdebug ("Reading a token");]])[ yychar = yylexer.yylex (); - yylval = yylexer.getLVal ();]b4_locations_if([ - yylloc = new b4_location_type (yylexer.getStartPos (), - yylexer.getEndPos ());])[ + yylval = yylexer.getLVal();]b4_locations_if([[ + yylloc = new ]b4_location_type[(yylexer.getStartPos(), + yylexer.getEndPos());]])[ ]])[ } /* Convert token to internal form. */ yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[ - yySymbolPrint ("Next token is", yytoken, - yylval]b4_locations_if([, yylloc])[);]])[ + yySymbolPrint("Next token is", yytoken, + yylval]b4_locations_if([, yylloc])[);]])[ - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken) - label = YYDEFAULT; - - /* <= 0 means reduce or error. */ - else if ((yyn = yytable_[yyn]) <= 0) + if (yytoken == ]b4_symbol(error, kind)[) { - if (yyTableValueIsError (yyn)) - label = YYERRLAB; - else - { - yyn = -yyn; - label = YYREDUCE; - } + // The scanner already issued an error message, process directly + // to error recovery. But do not keep the error token as + // lookahead, it is too special and may lead us to an endless + // loop in error recovery. */ + yychar = Lexer.]b4_symbol(undef, id)[; + yytoken = ]b4_symbol(undef, kind)[;]b4_locations_if([[ + yyerrloc = yylloc;]])[ + label = YYERRLAB1; } - else { - /* Shift the lookahead token. */]b4_parse_trace_if([[ - yySymbolPrint ("Shifting", yytoken, - yylval]b4_locations_if([, yylloc])[); + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken.getCode(); + if (yyn < 0 || YYLAST_ < yyn || yycheck_[yyn] != yytoken.getCode()) {]b4_lac_if([[ + if (!yylacEstablish(yystack, yytoken)) { + label = YYERRLAB; + } else]])[ + label = YYDEFAULT; + } + + /* <= 0 means reduce or error. */ + else if ((yyn = yytable_[yyn]) <= 0) + { + if (yyTableValueIsError(yyn)) { + label = YYERRLAB; + }]b4_lac_if([[ else if (!yylacEstablish(yystack, yytoken)) { + label = YYERRLAB; + }]])[ else { + yyn = -yyn; + label = YYREDUCE; + } + } + + else + { + /* Shift the lookahead token. */]b4_parse_trace_if([[ + yySymbolPrint("Shifting", yytoken, + yylval]b4_locations_if([, yylloc])[); ]])[ - /* Discard the token being shifted. */ - yychar = yyempty_; + /* Discard the token being shifted. */ + yychar = YYEMPTY_; - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus_ > 0) - --yyerrstatus_; - - yystate = yyn; - yystack.push (yystate, yylval]b4_locations_if([, yylloc])[); - label = YYNEWSTATE; + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus_ > 0) + --yyerrstatus_; + + yystate = yyn; + yystack.push(yystate, yylval]b4_locations_if([, yylloc])[);]b4_lac_if([[ + yylacDiscard("shift");]])[ + label = YYNEWSTATE; + } } break; @@ -689,8 +717,8 @@ `-----------------------------*/ case YYREDUCE: yylen = yyr2_[yyn]; - label = yyaction (yyn, yystack, yylen); - yystate = yystack.stateAt (0); + label = yyaction(yyn, yystack, yylen); + yystate = yystack.stateAt(0); break; /*------------------------------------. @@ -700,26 +728,26 @@ /* If not already recovering from an error, report this error. */ if (yyerrstatus_ == 0) { - ++yynerrs_; - if (yychar == yyempty_) - yytoken = yyempty_; - yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken)); + ++yynerrs; + if (yychar == YYEMPTY_) + yytoken = null; + yyreportSyntaxError(new Context(this, yystack, yytoken]b4_locations_if([[, yylloc]])[)); } - - ]b4_locations_if([yyerrloc = yylloc;])[ +]b4_locations_if([[ + yyerrloc = yylloc;]])[ if (yyerrstatus_ == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ - if (yychar <= Lexer.EOF) + if (yychar <= Lexer.]b4_symbol(eof, id)[) { /* Return failure if at end of input. */ - if (yychar == Lexer.EOF) + if (yychar == Lexer.]b4_symbol(eof, id)[) ]b4_push_if([{label = YYABORT; break;}], [return false;])[ } else - yychar = yyempty_; + yychar = YYEMPTY_; } /* Else will try to reuse lookahead token after shifting the error @@ -730,13 +758,13 @@ /*-------------------------------------------------. | errorlab -- error raised explicitly by YYERROR. | `-------------------------------------------------*/ - case YYERROR: - ]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[ + case YYERROR:]b4_locations_if([[ + yyerrloc = yystack.locationAt (yylen - 1);]])[ /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ yystack.pop (yylen); yylen = 0; - yystate = yystack.stateAt (0); + yystate = yystack.stateAt(0); label = YYERRLAB1; break; @@ -746,13 +774,15 @@ case YYERRLAB1: yyerrstatus_ = 3; /* Each real token shifted decrements this. */ + // Pop stack until we find a state that shifts the error token. for (;;) { yyn = yypact_[yystate]; if (!yyPactValueIsDefault (yyn)) { - yyn += yy_error_token_; - if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yy_error_token_) + yyn += ]b4_symbol(error, kind)[.getCode(); + if (0 <= yyn && yyn <= YYLAST_ + && yycheck_[yyn] == ]b4_symbol(error, kind)[.getCode()) { yyn = yytable_[yyn]; if (0 < yyn) @@ -765,27 +795,29 @@ if (yystack.height == 0) ]b4_push_if([{label = YYABORT; break;}],[return false;])[ - ]b4_locations_if([yyerrloc = yystack.locationAt (0);])[ +]b4_locations_if([[ + yyerrloc = yystack.locationAt (0);]])[ yystack.pop (); - yystate = yystack.stateAt (0);]b4_parse_trace_if([[ + yystate = yystack.stateAt(0);]b4_parse_trace_if([[ if (0 < yydebug) yystack.print (yyDebugStream);]])[ } if (label == YYABORT) - /* Leave the switch. */ - break; + /* Leave the switch. */ + break; -]b4_locations_if([ +]b4_locations_if([[ /* Muck with the stack to setup for yylloc. */ yystack.push (0, null, yylloc); yystack.push (0, null, yyerrloc); yyloc = yylloc (yystack, 2); - yystack.pop (2);])[ + yystack.pop (2);]])[ - /* Shift the error token. */]b4_parse_trace_if([[ - yySymbolPrint ("Shifting", yystos_[yyn], - yylval]b4_locations_if([, yyloc])[);]])[ + /* Shift the error token. */]b4_lac_if([[ + yylacDiscard("error recovery");]])[]b4_parse_trace_if([[ + yySymbolPrint("Shifting", SymbolKind.get(yystos_[yyn]), + yylval]b4_locations_if([, yyloc])[);]])[ yystate = yyn; yystack.push (yyn, yylval]b4_locations_if([, yyloc])[); @@ -809,24 +841,26 @@ /** * (Re-)Initialize the state of the push parser. */ - public void push_parse_initialize() + public void push_parse_initialize () { /* Lookahead and lookahead in internal form. */ - this.yychar = yyempty_; - this.yytoken = 0; + this.yychar = YYEMPTY_; + this.yytoken = null; /* State. */ this.yyn = 0; this.yylen = 0; this.yystate = 0; - this.yystack = new YYStack (); + this.yystack = new YYStack();]b4_lac_if([[ + this.yylacStack = new ArrayList(); + this.yylacEstablished = false;]])[ this.label = YYNEWSTATE; /* Error handling. */ - this.yynerrs_ = 0; - ]b4_locations_if([/* The location where the error started. */ + this.yynerrs = 0;]b4_locations_if([[ + /* The location where the error started. */ this.yyerrloc = null; - this.yylloc = new b4_location_type (null, null);])[ + this.yylloc = new ]b4_location_type[ (null, null);]])[ /* Semantic value of the lookahead. */ this.yylval = null; @@ -836,7 +870,7 @@ this.push_parse_initialized = true; } -]b4_locations_if([ +]b4_locations_if([[ /** * Push parse given input from an external lexer. * @@ -846,119 +880,354 @@ * * @@return YYACCEPT, YYABORT, YYPUSH_MORE */ - public int push_parse (int yylextoken, b4_yystype yylexval, b4_position_type yylexpos) - b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])]) - { - return push_parse (yylextoken, yylexval, new b4_location_type (yylexpos)); + public int push_parse(int yylextoken, ]b4_yystype[ yylexval, ]b4_position_type[ yylexpos)]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[ { + return push_parse(yylextoken, yylexval, new ]b4_location_type[(yylexpos)); } -])[]])[ +]])])[ ]b4_both_if([[ /** * Parse input from the scanner that was specified at object construction * time. Return whether the end of the input was reached successfully. - * This version of parse () is defined only when api.push-push=both. + * This version of parse() is defined only when api.push-push=both. * * @@return true if the parsing succeeds. Note that this does not * imply that there were no syntax errors. */ - public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[ - { - if (yylexer == null) - throw new NullPointerException("Null Lexer"); - int status; - do { - int token = yylexer.yylex(); - ]b4_yystype[ lval = yylexer.getLVal(); -]b4_locations_if([dnl - b4_location_type yyloc = new b4_location_type (yylexer.getStartPos (), - yylexer.getEndPos ());])[ - ]b4_locations_if([status = push_parse(token,lval,yyloc);],[ - status = push_parse(token,lval);])[ - } while (status == YYPUSH_MORE); - return (status == YYACCEPT); + public boolean parse()]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[ { + if (yylexer == null) + throw new NullPointerException("Null Lexer"); + int status; + do { + int token = yylexer.yylex(); + ]b4_yystype[ lval = yylexer.getLVal();]b4_locations_if([[ + ]b4_location_type[ yyloc = new ]b4_location_type[(yylexer.getStartPos(), yylexer.getEndPos()); + status = push_parse(token, lval, yyloc);]], [[ + status = push_parse(token, lval);]])[ + } while (status == YYPUSH_MORE); + return status == YYACCEPT; } ]])[ - // Generate an error message. - private String yysyntax_error (int yystate, int tok) - {]b4_error_verbose_if([[ - if (yyErrorVerbose) - { - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, - then the only way this function was invoked is if the - default action is an error action. In that case, don't - check for expected tokens because there are none. - - The only way there can be no lookahead present (in tok) is - if this state is a consistent state with a default action. - Thus, detecting the absence of a lookahead is sufficient to - determine that there is no unexpected or expected token to - report. In that case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this - state is a consistent state with a default action. There - might have been a previous inconsistent state, consistent - state with a non-default action, or user semantic action - that manipulated yychar. (However, yychar is currently out - of scope during semantic actions.) - - Of course, the expected token list depends on states to - have correct lookahead information, and it depends on the - parser not to perform extra reductions after fetching a - lookahead from the scanner and before detecting a syntax - error. Thus, state merging (from LALR or IELR) and default - reductions corrupt the expected token list. However, the - list is correct for canonical LR with one exception: it - will still contain any token that will not be accepted due - to an error action in a later state. - */ - if (tok != yyempty_) - { - /* FIXME: This method of building the message is not compatible - with internationalization. */ - StringBuffer res = - new StringBuffer ("syntax error, unexpected "); - res.append (yytnamerr_ (yytname_[tok])); - int yyn = yypact_[yystate]; - if (!yyPactValueIsDefault (yyn)) + /** + * Information needed to get the list of expected tokens and to forge + * a syntax error diagnostic. + */ + public static final class Context { + Context(]b4_parser_class[ parser, YYStack stack, SymbolKind token]b4_locations_if([[, ]b4_location_type[ loc]])[) { + yyparser = parser; + yystack = stack; + yytoken = token;]b4_locations_if([[ + yylocation = loc;]])[ + } + + private ]b4_parser_class[ yyparser; + private YYStack yystack; + + + /** + * The symbol kind of the lookahead token. + */ + public final SymbolKind getToken() { + return yytoken; + } + + private SymbolKind yytoken;]b4_locations_if([[ + + /** + * The location of the lookahead. + */ + public final ]b4_location_type[ getLocation() { + return yylocation; + } + + private ]b4_location_type[ yylocation;]])[ + static final int NTOKENS = ]b4_parser_class[.YYNTOKENS_; + + /** + * Put in YYARG at most YYARGN of the expected tokens given the + * current YYCTX, and return the number of tokens stored in YYARG. If + * YYARG is null, return the number of expected tokens (guaranteed to + * be less than YYNTOKENS). + */ + int getExpectedTokens(SymbolKind yyarg[], int yyargn) { + return getExpectedTokens (yyarg, 0, yyargn); + } + + int getExpectedTokens(SymbolKind yyarg[], int yyoffset, int yyargn) { + int yycount = yyoffset;]b4_lac_if([b4_parse_trace_if([[ + // Execute LAC once. We don't care if it is successful, we + // only do it for the sake of debugging output. + if (!yyparser.yylacEstablished) + yyparser.yylacCheck(yystack, yytoken); +]])[ + for (int yyx = 0; yyx < YYNTOKENS_; ++yyx) + { + SymbolKind yysym = SymbolKind.get(yyx); + if (yysym != ]b4_symbol(error, kind)[ + && yysym != ]b4_symbol(undef, kind)[ + && yyparser.yylacCheck(yystack, yysym)) + { + if (yyarg == null) + yycount += 1; + else if (yycount == yyargn) + return 0; + else + yyarg[yycount++] = yysym; + } + }]], [[ + int yyn = yypact_[this.yystack.stateAt(0)]; + if (!yyPactValueIsDefault(yyn)) + { + /* Start YYX at -YYN if negative to avoid negative + indexes in YYCHECK. In other words, skip the first + -YYN actions for this state because they are default + actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST_ - yyn + 1; + int yyxend = yychecklim < NTOKENS ? yychecklim : NTOKENS; + for (int yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck_[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[.getCode() + && !yyTableValueIsError(yytable_[yyx + yyn])) { - /* Start YYX at -YYN if negative to avoid negative - indexes in YYCHECK. In other words, skip the first - -YYN actions for this state because they are default - actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = yylast_ - yyn + 1; - int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; - int count = 0; - for (int x = yyxbegin; x < yyxend; ++x) - if (yycheck_[x + yyn] == x && x != yy_error_token_ - && !yyTableValueIsError (yytable_[x + yyn])) - ++count; - if (count < 5) - { - count = 0; - for (int x = yyxbegin; x < yyxend; ++x) - if (yycheck_[x + yyn] == x && x != yy_error_token_ - && !yyTableValueIsError (yytable_[x + yyn])) - { - res.append (count++ == 0 ? ", expecting " : " or "); - res.append (yytnamerr_ (yytname_[x])); - } - } + if (yyarg == null) + yycount += 1; + else if (yycount == yyargn) + return 0; // FIXME: this is incorrect. + else + yyarg[yycount++] = SymbolKind.get(yyx); + } + }]])[ + if (yyarg != null && yycount == yyoffset && yyoffset < yyargn) + yyarg[yycount] = null; + return yycount - yyoffset; + } + } + +]b4_lac_if([[ + /** Check the lookahead yytoken. + * \returns true iff the token will be eventually shifted. + */ + boolean yylacCheck(YYStack yystack, SymbolKind yytoken) + { + // Logically, the yylacStack's lifetime is confined to this function. + // Clear it, to get rid of potential left-overs from previous call. + yylacStack.clear(); + // Reduce until we encounter a shift and thereby accept the token. + yycdebugNnl("LAC: checking lookahead " + yytoken.getName() + ":"); + int lacTop = 0; + while (true) + { + int topState = (yylacStack.isEmpty() + ? yystack.stateAt(lacTop) + : yylacStack.get(yylacStack.size() - 1)); + int yyrule = yypact_[topState]; + if (yyPactValueIsDefault(yyrule) + || (yyrule += yytoken.getCode()) < 0 || YYLAST_ < yyrule + || yycheck_[yyrule] != yytoken.getCode()) + { + // Use the default action. + yyrule = yydefact_[+topState]; + if (yyrule == 0) { + yycdebug(" Err"); + return false; + } + } + else + { + // Use the action from yytable. + yyrule = yytable_[yyrule]; + if (yyTableValueIsError(yyrule)) { + yycdebug(" Err"); + return false; + } + if (0 < yyrule) { + yycdebug(" S" + yyrule); + return true; + } + yyrule = -yyrule; + } + // By now we know we have to simulate a reduce. + yycdebugNnl(" R" + (yyrule - 1)); + // Pop the corresponding number of values from the stack. + { + int yylen = yyr2_[yyrule]; + // First pop from the LAC stack as many tokens as possible. + int lacSize = yylacStack.size(); + if (yylen < lacSize) { + // yylacStack.setSize(lacSize - yylen); + for (/* Nothing */; 0 < yylen; yylen -= 1) { + yylacStack.remove(yylacStack.size() - 1); } - return res.toString (); + yylen = 0; + } else if (lacSize != 0) { + yylacStack.clear(); + yylen -= lacSize; + } + // Only afterwards look at the main stack. + // We simulate popping elements by incrementing lacTop. + lacTop += yylen; } + // Keep topState in sync with the updated stack. + topState = (yylacStack.isEmpty() + ? yystack.stateAt(lacTop) + : yylacStack.get(yylacStack.size() - 1)); + // Push the resulting state of the reduction. + int state = yyLRGotoState(topState, yyr1_[yyrule]); + yycdebugNnl(" G" + state); + yylacStack.add(state); + } + } + + /** Establish the initial context if no initial context currently exists. + * \returns true iff the token will be eventually shifted. + */ + boolean yylacEstablish(YYStack yystack, SymbolKind yytoken) { + /* Establish the initial context for the current lookahead if no initial + context is currently established. + + We define a context as a snapshot of the parser stacks. We define + the initial context for a lookahead as the context in which the + parser initially examines that lookahead in order to select a + syntactic action. Thus, if the lookahead eventually proves + syntactically unacceptable (possibly in a later context reached via a + series of reductions), the initial context can be used to determine + the exact set of tokens that would be syntactically acceptable in the + lookahead's place. Moreover, it is the context after which any + further semantic actions would be erroneous because they would be + determined by a syntactically unacceptable token. + + yylacEstablish should be invoked when a reduction is about to be + performed in an inconsistent state (which, for the purposes of LAC, + includes consistent states that don't know they're consistent because + their default reductions have been disabled). + + For parse.lac=full, the implementation of yylacEstablish is as + follows. If no initial context is currently established for the + current lookahead, then check if that lookahead can eventually be + shifted if syntactic actions continue from the current context. */ + if (yylacEstablished) { + return true; + } else { + yycdebug("LAC: initial context established for " + yytoken.getName()); + yylacEstablished = true; + return yylacCheck(yystack, yytoken); } + } + + /** Discard any previous initial lookahead context because of event. + * \param event the event which caused the lookahead to be discarded. + * Only used for debbuging output. */ + void yylacDiscard(String event) { + /* Discard any previous initial lookahead context because of Event, + which may be a lookahead change or an invalidation of the currently + established initial context for the current lookahead. + + The most common example of a lookahead change is a shift. An example + of both cases is syntax error recovery. That is, a syntax error + occurs when the lookahead is syntactically erroneous for the + currently established initial context, so error recovery manipulates + the parser stacks to try to find a new initial context in which the + current lookahead is syntactically acceptable. If it fails to find + such a context, it discards the lookahead. */ + if (yylacEstablished) { + yycdebug("LAC: initial context discarded due to " + event); + yylacEstablished = false; + } + } + + /** The stack for LAC. + * Logically, the yylacStack's lifetime is confined to the function + * yylacCheck. We just store it as a member of this class to hold + * on to the memory and to avoid frequent reallocations. + */ + ArrayList yylacStack; + /** Whether an initial LAC context was established. */ + boolean yylacEstablished; ]])[ - return "syntax error"; + +]b4_parse_error_bmatch( +[detailed\|verbose], [[ + private int yysyntaxErrorArguments(Context yyctx, SymbolKind[] yyarg, int yyargn) { + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, + then the only way this function was invoked is if the + default action is an error action. In that case, don't + check for expected tokens because there are none. + - The only way there can be no lookahead present (in tok) is + if this state is a consistent state with a default action. + Thus, detecting the absence of a lookahead is sufficient to + determine that there is no unexpected or expected token to + report. In that case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this + state is a consistent state with a default action. There + might have been a previous inconsistent state, consistent + state with a non-default action, or user semantic action + that manipulated yychar. (However, yychar is currently out + of scope during semantic actions.) + - Of course, the expected token list depends on states to + have correct lookahead information, and it depends on the + parser not to perform extra reductions after fetching a + lookahead from the scanner and before detecting a syntax + error. Thus, state merging (from LALR or IELR) and default + reductions corrupt the expected token list. However, the + list is correct for canonical LR with one exception: it + will still contain any token that will not be accepted due + to an error action in a later state. + */ + int yycount = 0; + if (yyctx.getToken() != null) + { + if (yyarg != null) + yyarg[yycount] = yyctx.getToken(); + yycount += 1; + yycount += yyctx.getExpectedTokens(yyarg, 1, yyargn); + } + return yycount; + } +]])[ + + /** + * Build and emit a "syntax error" message in a user-defined way. + * + * @@param ctx The context of the error. + */ + private void yyreportSyntaxError(Context yyctx) {]b4_parse_error_bmatch( +[custom], [[ + yylexer.reportSyntaxError(yyctx);]], +[detailed\|verbose], [[ + if (yyErrorVerbose) { + final int argmax = 5; + SymbolKind[] yyarg = new SymbolKind[argmax]; + int yycount = yysyntaxErrorArguments(yyctx, yyarg, argmax); + String[] yystr = new String[yycount]; + for (int yyi = 0; yyi < yycount; ++yyi) { + yystr[yyi] = yyarg[yyi].getName(); + } + String yyformat; + switch (yycount) { + default: + case 0: yyformat = ]b4_trans(["syntax error"])[; break; + case 1: yyformat = ]b4_trans(["syntax error, unexpected {0}"])[; break; + case 2: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1}"])[; break; + case 3: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2}"])[; break; + case 4: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2} or {3}"])[; break; + case 5: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2} or {3} or {4}"])[; break; + } + yyerror(]b4_locations_if([[yyctx.yylocation, ]])[new MessageFormat(yyformat).format(yystr)); + } else { + yyerror(]b4_locations_if([[yyctx.yylocation, ]])[]b4_trans(["syntax error"])[); + }]], +[simple], [[ + yyerror(]b4_locations_if([[yyctx.yylocation, ]])[]b4_trans(["syntax error"])[);]])[ } /** * Whether the given yypact_ value indicates a defaulted state. * @@param yyvalue the value to check */ - private static boolean yyPactValueIsDefault (int yyvalue) - { + private static boolean yyPactValueIsDefault(int yyvalue) { return yyvalue == yypact_ninf_; } @@ -967,19 +1236,14 @@ * value indicates a syntax error. * @@param yyvalue the value to check */ - private static boolean yyTableValueIsError (int yyvalue) - { + private static boolean yyTableValueIsError(int yyvalue) { return yyvalue == yytable_ninf_; } private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[; private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[; - ]b4_parser_tables_define[ - - /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at \a yyntokens_, nonterminals. */ - ]b4_typed_parser_table_define([String], [tname], [b4_tname])[ +]b4_parser_tables_define[ ]b4_parse_trace_if([[ ]b4_integral_parser_table_define([rline], [b4_rline], @@ -996,50 +1260,44 @@ int yynrhs = yyr2_[yyrule]; /* Print the symbols being reduced, and their result. */ yycdebug ("Reducing stack by rule " + (yyrule - 1) - + " (line " + yylno + "), "); + + " (line " + yylno + "):"); /* The symbols being reduced. */ for (int yyi = 0; yyi < yynrhs; yyi++) - yySymbolPrint (" $" + (yyi + 1) + " =", - yystos_[yystack.stateAt(yynrhs - (yyi + 1))], - ]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([, - b4_rhs_location(yynrhs, yyi + 1)])[); + yySymbolPrint(" $" + (yyi + 1) + " =", + SymbolKind.get(yystos_[yystack.stateAt(yynrhs - (yyi + 1))]), + ]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([, + b4_rhs_location(yynrhs, yyi + 1)])[); }]])[ /* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. */ - private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t) + private static final SymbolKind yytranslate_(int t) ]b4_api_token_raw_if(dnl [[ { - return t; + return SymbolKind.get(t); } ]], [[ { - int user_token_number_max_ = ]b4_user_token_number_max[; - ]b4_int_type_for([b4_translate])[ undef_token_ = ]b4_undef_token_number[; - + // Last valid token kind. + int code_max = ]b4_code_max[; if (t <= 0) - return Lexer.EOF; - else if (t <= user_token_number_max_) - return yytranslate_table_[t]; + return ]b4_symbol(eof, kind)[; + else if (t <= code_max) + return SymbolKind.get(yytranslate_table_[t]); else - return undef_token_; + return ]b4_symbol(undef, kind)[; } ]b4_integral_parser_table_define([translate_table], [b4_translate])[ ]])[ - private static final ]b4_int_type_for([b4_translate])[ yy_error_token_ = 1; - - private static final int yylast_ = ]b4_last[; - private static final int yynnts_ = ]b4_nterms_number[; - private static final int yyempty_ = -2; - private static final int yyfinal_ = ]b4_final_state_number[; - private static final int yyntokens_ = ]b4_tokens_number[; - -/* User implementation code. */ -]b4_percent_code_get[]dnl + private static final int YYLAST_ = ]b4_last[; + private static final int YYEMPTY_ = -2; + private static final int YYFINAL_ = ]b4_final_state_number[; + private static final int YYNTOKENS_ = ]b4_tokens_number[; +]b4_percent_code_get[ } - +]b4_percent_code_get([[epilogue]])[]dnl b4_epilogue[]dnl b4_output_end diff -Nru bison-3.5.1+dfsg/data/skeletons/location.cc bison-3.8.2+dfsg/data/skeletons/location.cc --- bison-3.5.1+dfsg/data/skeletons/location.cc 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/location.cc 2021-08-07 10:53:19.000000000 +0000 @@ -1,6 +1,6 @@ # C++ skeleton for Bison -# Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,17 +13,10 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . m4_pushdef([b4_copyright_years], - [2002-2015, 2018-2020]) - - -# b4_position_file -# ---------------- -# Name of the file containing the position class, if we want this file. -b4_defines_if([b4_required_version_if([302], [], - [m4_define([b4_position_file], [position.hh])])])]) + [2002-2015, 2018-2021]) # b4_location_file @@ -32,7 +25,7 @@ # if we want this file. b4_percent_define_check_file([b4_location_file], [[api.location.file]], - b4_defines_if([[location.hh]])) + b4_header_if([[location.hh]])) # b4_location_include # ------------------- @@ -48,12 +41,22 @@ ["b4_location_file"])]) m4_define([b4_location_path], b4_percent_define_get([[api.location.include]], - ["b4_dir_prefix[]b4_location_file"])) + ["b4_mapped_dir_prefix[]b4_location_file"])) m4_define([b4_location_path], m4_substr(m4_defn([b4_location_path]), 1, m4_eval(m4_len(m4_defn([b4_location_path])) - 2))) ]) +# b4_position_file +# ---------------- +# Name of the file containing the position class, if we want this file. +b4_header_if( + [b4_required_version_if( + [30200], [], + [m4_ifdef([b4_location_file], + [m4_define([b4_position_file], [position.hh])])])]) + + # b4_location_define # ------------------ @@ -63,11 +66,13 @@ class position { public: + /// Type for file name. + typedef ]b4_percent_define_get([[api.filename.type]])[ filename_type; /// Type for line and column numbers. typedef int counter_type; ]m4_ifdef([b4_location_constructors], [[ /// Construct a position. - explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR, + explicit position (filename_type* f = YY_NULLPTR, counter_type l = ]b4_location_initial_line[, counter_type c = ]b4_location_initial_column[) : filename (f) @@ -77,7 +82,7 @@ ]])[ /// Initialization. - void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR, + void initialize (filename_type* fn = YY_NULLPTR, counter_type l = ]b4_location_initial_line[, counter_type c = ]b4_location_initial_column[) { @@ -106,7 +111,7 @@ /** \} */ /// File name to which this position refers. - ]b4_percent_define_get([[filename_type]])[* filename; + filename_type* filename; /// Current line number. counter_type line; /// Current column number. @@ -184,6 +189,8 @@ class location { public: + /// Type for file name. + typedef position::filename_type filename_type; /// Type for line and column numbers. typedef position::counter_type counter_type; ]m4_ifdef([b4_location_constructors], [ @@ -200,7 +207,7 @@ {} /// Construct a 0-width location in \a f, \a l, \a c. - explicit location (]b4_percent_define_get([[filename_type]])[* f, + explicit location (filename_type* f, counter_type l = ]b4_location_initial_line[, counter_type c = ]b4_location_initial_column[) : begin (f, l, c) @@ -209,7 +216,7 @@ ])[ /// Initialization. - void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR, + void initialize (filename_type* f = YY_NULLPTR, counter_type l = ]b4_location_initial_line[, counter_type c = ]b4_location_initial_column[) { diff -Nru bison-3.5.1+dfsg/data/skeletons/README-D.txt bison-3.8.2+dfsg/data/skeletons/README-D.txt --- bison-3.5.1+dfsg/data/skeletons/README-D.txt 2020-01-05 08:41:35.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/README-D.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -Some usage notes for the D Parser: - -- it is a port of the Java parser, so interface is very similar. - -- the lexer class needs to implement the interface 'Lexer' (similar to - java). It typically (depending on options) looks like this: - -public interface Lexer -{ - /** - * Method to retrieve the beginning position of the last scanned token. - * @return the position at which the last scanned token starts. */ - @property YYPosition startPos (); - - /** - * Method to retrieve the ending position of the last scanned token. - * @return the first position beyond the last scanned token. */ - @property YYPosition endPos (); - - /** - * Method to retrieve the semantic value of the last scanned token. - * @return the semantic value of the last scanned token. */ - @property YYSemanticType semanticVal (); - - /** - * Entry point for the scanner. Returns the token identifier corresponding - * to the next token and prepares to return the semantic value - * and beginning/ending positions of the token. - * @return the token identifier corresponding to the next token. */ - YYTokenType yylex (); - - /** - * Entry point for error reporting. Emits an error - * referring to the given location in a user-defined way. - * - * @param loc The location of the element to which the - * error message is related - * @param s The string for the error message. */ - void yyerror (YYLocation loc, string s); -} - -- semantic types are handled by D usions (same as for C/C++ parsers) - -- the following (non-standard) %defines are supported: - - %define package "" - %define api.parser.class "my_class_name>" - %define position_type "my_position_type" - %define location_type "my_location_type" - -- the following declarations basically work like in C/C++: - - %locations - %error-verbose - %parse-param - %initial-action - %code - %union - -- %destructor is not yet supported diff -Nru bison-3.5.1+dfsg/data/skeletons/stack.hh bison-3.8.2+dfsg/data/skeletons/stack.hh --- bison-3.5.1+dfsg/data/skeletons/stack.hh 2020-01-19 13:07:51.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/stack.hh 2021-09-18 06:06:22.000000000 +0000 @@ -1,6 +1,6 @@ # C++ skeleton for Bison -# Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,14 +13,14 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # b4_stack_file # ------------- # Name of the file containing the stack class, if we want this file. -b4_defines_if([b4_required_version_if([302], [], - [m4_define([b4_stack_file], [stack.hh])])]) +b4_header_if([b4_required_version_if([30200], [], + [m4_define([b4_stack_file], [stack.hh])])]) # b4_stack_define @@ -32,15 +32,22 @@ { public: // Hide our reversed order. - typedef typename S::reverse_iterator iterator; - typedef typename S::const_reverse_iterator const_iterator; + typedef typename S::iterator iterator; + typedef typename S::const_iterator const_iterator; typedef typename S::size_type size_type; typedef typename std::ptrdiff_t index_type; - stack (size_type n = 200) + stack (size_type n = 200) YY_NOEXCEPT : seq_ (n) {} +#if 201103L <= YY_CPLUSPLUS + /// Non copyable. + stack (const stack&) = delete; + /// Non copyable. + stack& operator= (const stack&) = delete; +#endif + /// Random access. /// /// Index 0 returns the topmost element. @@ -91,31 +98,25 @@ return index_type (seq_.size ()); } - std::ptrdiff_t - ssize () const YY_NOEXCEPT - { - return std::ptrdiff_t (size ()); - } - /// Iterator on top of the stack (going downwards). const_iterator begin () const YY_NOEXCEPT { - return seq_.rbegin (); + return seq_.begin (); } /// Bottom of the stack. const_iterator end () const YY_NOEXCEPT { - return seq_.rend (); + return seq_.end (); } /// Present a slice of the top of a stack. class slice { public: - slice (const stack& stack, index_type range) + slice (const stack& stack, index_type range) YY_NOEXCEPT : stack_ (stack) , range_ (range) {} @@ -132,8 +133,12 @@ }; private: +#if YY_CPLUSPLUS < 201103L + /// Non copyable. stack (const stack&); + /// Non copyable. stack& operator= (const stack&); +#endif /// The wrapped container. S seq_; }; diff -Nru bison-3.5.1+dfsg/data/skeletons/traceon.m4 bison-3.8.2+dfsg/data/skeletons/traceon.m4 --- bison-3.5.1+dfsg/data/skeletons/traceon.m4 1970-01-01 00:00:00.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/traceon.m4 2021-01-16 14:58:00.000000000 +0000 @@ -0,0 +1,2 @@ +dnl GNU M4 treats -dV in a position-independent manner. +m4_debugmode(V)m4_traceon()dnl diff -Nru bison-3.5.1+dfsg/data/skeletons/variant.hh bison-3.8.2+dfsg/data/skeletons/variant.hh --- bison-3.5.1+dfsg/data/skeletons/variant.hh 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/variant.hh 2021-09-14 04:57:28.000000000 +0000 @@ -1,6 +1,6 @@ # C++ skeleton for Bison -# Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,13 +13,20 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . ## --------- ## ## variant. ## ## --------- ## +# b4_assert +# --------- +# The name of YY_ASSERT. +m4_define([b4_assert], + [b4_api_PREFIX[]_ASSERT]) + + # b4_symbol_variant(YYTYPE, YYVAL, ACTION, [ARGS]) # ------------------------------------------------ # Run some ACTION ("build", or "destroy") on YYVAL of symbol type @@ -71,12 +78,12 @@ # ------------------- # The needed includes for variants support. m4_define([b4_variant_includes], -[b4_parse_assert_if([[#include ]])[ -#ifndef YY_ASSERT +[b4_parse_assert_if([[#include +#ifndef ]b4_assert[ # include -# define YY_ASSERT assert +# define ]b4_assert[ assert #endif -]]) +]])]) @@ -87,38 +94,45 @@ # b4_value_type_declare # --------------------- -# Define semantic_type. +# Define value_type. m4_define([b4_value_type_declare], [[ /// A buffer to store and retrieve objects. /// /// Sort of a variant, but does not keep track of the nature /// of the stored data, since that knowledge is available /// via the current parser state. - class semantic_type + class value_type { public: /// Type of *this. - typedef semantic_type self_type; + typedef value_type self_type; /// Empty construction. - semantic_type () YY_NOEXCEPT - : yybuffer_ ()]b4_parse_assert_if([ + value_type () YY_NOEXCEPT + : yyraw_ ()]b4_parse_assert_if([ , yytypeid_ (YY_NULLPTR)])[ {} /// Construct and fill. template - semantic_type (YY_RVREF (T) t)]b4_parse_assert_if([ + value_type (YY_RVREF (T) t)]b4_parse_assert_if([ : yytypeid_ (&typeid (T))])[ - { - YY_ASSERT (sizeof (T) <= size); + {]b4_parse_assert_if([[ + ]b4_assert[ (sizeof (T) <= size);]])[ new (yyas_ ()) T (YY_MOVE (t)); } +#if 201103L <= YY_CPLUSPLUS + /// Non copyable. + value_type (const self_type&) = delete; + /// Non copyable. + self_type& operator= (const self_type&) = delete; +#endif + /// Destruction, allowed only if empty. - ~semantic_type () YY_NOEXCEPT + ~value_type () YY_NOEXCEPT {]b4_parse_assert_if([ - YY_ASSERT (!yytypeid_); + ]b4_assert[ (!yytypeid_); ])[} # if 201103L <= YY_CPLUSPLUS @@ -126,10 +140,10 @@ template T& emplace (U&&... u) - {]b4_parse_assert_if([ - YY_ASSERT (!yytypeid_); - YY_ASSERT (sizeof (T) <= size); - yytypeid_ = & typeid (T);])[ + {]b4_parse_assert_if([[ + ]b4_assert[ (!yytypeid_); + ]b4_assert[ (sizeof (T) <= size); + yytypeid_ = & typeid (T);]])[ return *new (yyas_ ()) T (std::forward (u)...); } # else @@ -137,10 +151,10 @@ template T& emplace () - {]b4_parse_assert_if([ - YY_ASSERT (!yytypeid_); - YY_ASSERT (sizeof (T) <= size); - yytypeid_ = & typeid (T);])[ + {]b4_parse_assert_if([[ + ]b4_assert[ (!yytypeid_); + ]b4_assert[ (sizeof (T) <= size); + yytypeid_ = & typeid (T);]])[ return *new (yyas_ ()) T (); } @@ -148,10 +162,10 @@ template T& emplace (const T& t) - {]b4_parse_assert_if([ - YY_ASSERT (!yytypeid_); - YY_ASSERT (sizeof (T) <= size); - yytypeid_ = & typeid (T);])[ + {]b4_parse_assert_if([[ + ]b4_assert[ (!yytypeid_); + ]b4_assert[ (sizeof (T) <= size); + yytypeid_ = & typeid (T);]])[ return *new (yyas_ ()) T (t); } # endif @@ -178,10 +192,10 @@ template T& as () YY_NOEXCEPT - {]b4_parse_assert_if([ - YY_ASSERT (yytypeid_); - YY_ASSERT (*yytypeid_ == typeid (T)); - YY_ASSERT (sizeof (T) <= size);])[ + {]b4_parse_assert_if([[ + ]b4_assert[ (yytypeid_); + ]b4_assert[ (*yytypeid_ == typeid (T)); + ]b4_assert[ (sizeof (T) <= size);]])[ return *yyas_ (); } @@ -189,10 +203,10 @@ template const T& as () const YY_NOEXCEPT - {]b4_parse_assert_if([ - YY_ASSERT (yytypeid_); - YY_ASSERT (*yytypeid_ == typeid (T)); - YY_ASSERT (sizeof (T) <= size);])[ + {]b4_parse_assert_if([[ + ]b4_assert[ (yytypeid_); + ]b4_assert[ (*yytypeid_ == typeid (T)); + ]b4_assert[ (sizeof (T) <= size);]])[ return *yyas_ (); } @@ -207,9 +221,9 @@ template void swap (self_type& that) YY_NOEXCEPT - {]b4_parse_assert_if([ - YY_ASSERT (yytypeid_); - YY_ASSERT (*yytypeid_ == *that.yytypeid_);])[ + {]b4_parse_assert_if([[ + ]b4_assert[ (yytypeid_); + ]b4_assert[ (*yytypeid_ == *that.yytypeid_);]])[ std::swap (as (), that.as ()); } @@ -258,16 +272,19 @@ } private: - /// Prohibit blind copies. +#if YY_CPLUSPLUS < 201103L + /// Non copyable. + value_type (const self_type&); + /// Non copyable. self_type& operator= (const self_type&); - semantic_type (const self_type&); +#endif /// Accessor to raw memory as \a T. template T* yyas_ () YY_NOEXCEPT { - void *yyp = yybuffer_.yyraw; + void *yyp = yyraw_; return static_cast (yyp); } @@ -276,7 +293,7 @@ const T* yyas_ () const YY_NOEXCEPT { - const void *yyp = yybuffer_.yyraw; + const void *yyp = yyraw_; return static_cast (yyp); } @@ -291,10 +308,10 @@ union { /// Strongest alignment constraints. - long double yyalign_me; + long double yyalign_me_; /// A buffer large enough to store any of the semantic values. - char yyraw[size]; - } yybuffer_;]b4_parse_assert_if([ + char yyraw_[size]; + };]b4_parse_assert_if([ /// Whether the content is built: if defined, the name of the stored type. const std::type_info *yytypeid_;])[ @@ -378,18 +395,74 @@ ])]) -m4_define([_b4_type_clause], -[b4_symbol_if([$1], [is_token], - [b4_symbol_if([$1], [has_id], - [tok == token::b4_symbol([$1], [id])], - [tok == b4_symbol([$1], [user_number])])])]) +# b4_token_kind(SYMBOL-NUM) +# ------------------------- +# Some tokens don't have an ID. +m4_define([b4_token_kind], +[b4_symbol_if([$1], [has_id], + [token::b4_symbol([$1], [id])], + [b4_symbol([$1], [code])])]) -# _b4_token_constructor_define(SYMBOL-NUM...) -# ------------------------------------------- -# Define a unique make_symbol for all the SYMBOL-NUM (they +# _b4_tok_in(SYMBOL-NUM, ...) +# --------------------------- +# See b4_tok_in below. The SYMBOL-NUMs... are tokens only. +# +# We iterate over the tokens to group them by "range" of token numbers (not +# symbols numbers!). +# +# b4_fst is the start of that range. +# b4_prev is the previous value. +# b4_val is the current value. +# If b4_val is the successor of b4_prev in token numbers, update the latter, +# otherwise emit the code for range b4_fst .. b4_prev. +# $1 is also used as a terminator in the foreach, but it will not be printed. +# +m4_define([_b4_tok_in], +[m4_pushdef([b4_prev], [$1])dnl +m4_pushdef([b4_fst], [$1])dnl +m4_pushdef([b4_sep], [])dnl +m4_foreach([b4_val], m4_dquote(m4_shift($@, $1)), + [m4_if(b4_symbol(b4_val, [code]), m4_eval(b4_symbol(b4_prev, [code]) + 1), [], + [b4_sep[]m4_if(b4_fst, b4_prev, + [tok == b4_token_kind(b4_fst)], + [(b4_token_kind(b4_fst) <= tok && tok <= b4_token_kind(b4_prev))])[]dnl +m4_define([b4_fst], b4_val)dnl +m4_define([b4_sep], [ + || ])])dnl +m4_define([b4_prev], b4_val)])dnl +m4_popdef([b4_sep])dnl +m4_popdef([b4_fst])dnl +m4_popdef([b4_prev])dnl +]) + + +# _b4_filter_tokens(SYMBOL-NUM, ...) +# ---------------------------------- +# Expand as the list of tokens amongst SYMBOL-NUM. +m4_define([_b4_filter_tokens], +[m4_pushdef([b4_sep])dnl +m4_foreach([b4_val], [$@], + [b4_symbol_if(b4_val, [is_token], [b4_sep[]b4_val[]m4_define([b4_sep], [,])])])dnl +m4_popdef([b4_sep])dnl +]) + + +# b4_tok_in(SYMBOL-NUM, ...) +# --------------------------- +# A C++ conditional that checks that `tok` is a member of this list of symbol +# numbers. +m4_define([b4_tok_in], + [_$0(_b4_filter_tokens($@))]) + + + + +# _b4_symbol_constructor_define(SYMBOL-NUM...) +# -------------------------------------------- +# Define a symbol_type constructor common to all the SYMBOL-NUM (they # have the same type). Use at class-level. -m4_define([_b4_token_constructor_define], +m4_define([_b4_symbol_constructor_define], [m4_ifval(_b4_includes_tokens($@), [[#if 201103L <= YY_CPLUSPLUS symbol_type (]b4_join( @@ -397,25 +470,24 @@ b4_symbol_if([$1], [has_type], [b4_symbol([$1], [type]) v]), b4_locations_if([location_type l]))[) - : super_type(]b4_join([token_type (tok)], - b4_symbol_if([$1], [has_type], [std::move (v)]), - b4_locations_if([std::move (l)]))[) - { - YY_ASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[); - } + : super_type (]b4_join([token_kind_type (tok)], + b4_symbol_if([$1], [has_type], [std::move (v)]), + b4_locations_if([std::move (l)]))[) #else symbol_type (]b4_join( [int tok], b4_symbol_if([$1], [has_type], [const b4_symbol([$1], [type])& v]), b4_locations_if([const location_type& l]))[) - : super_type(]b4_join([token_type (tok)], - b4_symbol_if([$1], [has_type], [v]), - b4_locations_if([l]))[) - { - YY_ASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[); - } + : super_type (]b4_join([token_kind_type (tok)], + b4_symbol_if([$1], [has_type], [v]), + b4_locations_if([l]))[) +#endif + {]b4_parse_assert_if([[ +#if !defined _MSC_VER || defined __clang__ + ]b4_assert[ (]b4_tok_in($@)[); #endif + ]])[} ]])]) @@ -447,7 +519,7 @@ # b4_token_constructor_define # --------------------------- -# Define the overloaded versions of make_symbol for all the value types. +# Define the overloaded versions of make_FOO for all the token kinds. m4_define([b4_token_constructor_define], -[ // Implementation of make_symbol for each symbol type. +[ // Implementation of make_symbol for each token kind. b4_symbol_foreach([_b4_token_maker_define])]) diff -Nru bison-3.5.1+dfsg/data/skeletons/yacc.c bison-3.8.2+dfsg/data/skeletons/yacc.c --- bison-3.5.1+dfsg/data/skeletons/yacc.c 2020-01-19 13:07:51.000000000 +0000 +++ bison-3.8.2+dfsg/data/skeletons/yacc.c 2021-09-12 09:42:54.000000000 +0000 @@ -1,11 +1,11 @@ # -*- C -*- # Yacc compatible skeleton for Bison -# Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software +# Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software # Foundation, Inc. m4_pushdef([b4_copyright_years], - [1984, 1989-1990, 2000-2015, 2018-2020]) + [1984, 1989-1990, 2000-2015, 2018-2021]) # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,10 +18,11 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . m4_include(b4_skeletonsdir/[c.m4]) + ## ---------- ## ## api.pure. ## ## ---------- ## @@ -48,6 +49,10 @@ ## api.push-pull. ## ## --------------- ## +# b4_pull_if, b4_push_if +# ---------------------- +# Whether the pull/push APIs are needed. Both can be enabled. + b4_percent_define_default([[api.push-pull]], [[pull]]) b4_percent_define_check_values([[[[api.push-pull]], [[pull]], [[push]], [[both]]]]) @@ -97,6 +102,16 @@ [1], [m4_ifset([b4_parse_param], [$1])], [2], [$1])])]) +# b4_yyerror_formals +# ------------------ +m4_define([b4_yyerror_formals], +[b4_pure_if([b4_locations_if([, [[const ]b4_api_PREFIX[LTYPE *yyllocp], [&yylloc]]])[]dnl +m4_ifdef([b4_parse_param], [, b4_parse_param])[]dnl +,])dnl +[[const char *msg], [msg]]]) + + + # b4_yyerror_args # --------------- # Arguments passed to yyerror: user args plus yylloc. @@ -111,6 +126,16 @@ ## ----------------- ## +# b4_accept([SYMBOL-NUM]) +# ----------------------- +# Used in actions of the rules of accept, the initial symbol, to call +# YYACCEPT. If SYMBOL-NUM is specified, run "yyvalue->SLOT = $2;" +# before, using the slot of SYMBOL-NUM. +m4_define([b4_accept], +[m4_ifval([$1], + [b4_symbol_value(yyimpl->yyvalue, [$1]) = b4_rhs_value(2, 1, [$1]); ]) YYACCEPT]) + + # b4_lhs_value(SYMBOL-NUM, [TYPE]) # -------------------------------- # See README. @@ -132,6 +157,7 @@ # b4_lhs_location() # ----------------- # Expansion of @$. +# Overparenthetized to avoid obscure problems with "foo$$bar = foo$1bar". m4_define([b4_lhs_location], [(yyloc)]) @@ -140,6 +166,7 @@ # --------------------------------- # Expansion of @POS, where the current rule has RULE-LENGTH symbols # on RHS. +# Overparenthetized to avoid obscure problems with "foo$$bar = foo$1bar". m4_define([b4_rhs_location], [(yylsp@{b4_subtract([$2], [$1])@})]) @@ -148,14 +175,61 @@ ## Declarations. ## ## -------------- ## +# _b4_declare_sub_yyparse(START-SYMBOL-NUM, SWITCHING-TOKEN-SYMBOL-NUM) +# --------------------------------------------------------------------- +# Define the return type of the parsing function for SYMBOL-NUM, and +# declare its parsing function. +m4_define([_b4_declare_sub_yyparse], +[[ +// Return type when parsing one ]_b4_symbol($1, tag)[. +typedef struct +{]b4_symbol_if([$1], [has_type], [[ + ]_b4_symbol($1, type)[ yyvalue;]])[ + int yystatus; + int yynerrs; +} ]b4_prefix[parse_]_b4_symbol($1, id)[_t; + +// Parse one ]_b4_symbol($1, tag)[. +]b4_prefix[parse_]_b4_symbol($1, id)[_t ]b4_prefix[parse_]_b4_symbol($1, id)[ (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[); +]]) + + +# _b4_first_switching_token +# ------------------------- +m4_define([b4_first], [$1]) +m4_define([b4_second], [$2]) +m4_define([_b4_first_switching_token], +[b4_second(b4_first(b4_start_symbols))]) + + +# _b4_define_sub_yyparse(START-SYMBOL-NUM, SWITCHING-TOKEN-SYMBOL-NUM) +# -------------------------------------------------------------------- +# Define the parsing function for START-SYMBOL-NUM. +m4_define([_b4_define_sub_yyparse], +[[ +]b4_prefix[parse_]_b4_symbol($1, id)[_t +]b4_prefix[parse_]_b4_symbol($1, id)[ (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[) +{ + ]b4_prefix[parse_]_b4_symbol($1, id)[_t yyres; + yy_parse_impl_t yyimpl; + yyres.yystatus = yy_parse_impl (]b4_symbol($2, id)[, &yyimpl]m4_ifset([b4_parse_param], + [[, ]b4_args(b4_parse_param)])[);]b4_symbol_if([$1], [has_type], [[ + yyres.yyvalue = yyimpl.yyvalue.]b4_symbol($1, slot)[;]])[ + yyres.yynerrs = yyimpl.yynerrs; + return yyres; +} +]]) + + # b4_declare_scanner_communication_variables # ------------------------------------------ # Declare the variables that are global, or local to YYPARSE if # pure-parser. m4_define([b4_declare_scanner_communication_variables], [[ -/* The lookahead symbol. */ +]m4_ifdef([b4_start_symbols], [], +[[/* Lookahead token kind. */ int yychar; - +]])[ ]b4_pure_if([[ /* The semantic value of the lookahead symbol. */ /* Default value used for initialization, for pacifying older GCCs @@ -174,49 +248,79 @@ int yynerrs;]])]) -# b4_declare_parser_state_variables -# --------------------------------- +# b4_declare_parser_state_variables([INIT]) +# ----------------------------------------- # Declare all the variables that are needed to maintain the parser state # between calls to yypush_parse. -m4_define([b4_declare_parser_state_variables], [b4_pure_if([[ +# If INIT is non-null, initialize these variables. +m4_define([b4_declare_parser_state_variables], +[b4_pure_if([[ /* Number of syntax errors so far. */ - int yynerrs; + int yynerrs]m4_ifval([$1], [ = 0])[; ]])[ - yy_state_fast_t yystate; + yy_state_fast_t yystate]m4_ifval([$1], [ = 0])[; /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; + int yyerrstatus]m4_ifval([$1], [ = 0])[; - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values.]b4_locations_if([[ - 'yyls': related to locations.]])[ - - Refer to the stacks through separate pointers, to allow yyoverflow + /* Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ - /* The state stack. */ + /* Their size. */ + YYPTRDIFF_T yystacksize]m4_ifval([$1], [ = YYINITDEPTH])[; + + /* The state stack: array, bottom, top. */ yy_state_t yyssa[YYINITDEPTH]; - yy_state_t *yyss; - yy_state_t *yyssp; + yy_state_t *yyss]m4_ifval([$1], [ = yyssa])[; + yy_state_t *yyssp]m4_ifval([$1], [ = yyss])[; - /* The semantic value stack. */ + /* The semantic value stack: array, bottom, top. */ YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp;]b4_locations_if([[ + YYSTYPE *yyvs]m4_ifval([$1], [ = yyvsa])[; + YYSTYPE *yyvsp]m4_ifval([$1], [ = yyvs])[;]b4_locations_if([[ - /* The location stack. */ + /* The location stack: array, bottom, top. */ YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls; - YYLTYPE *yylsp; + YYLTYPE *yyls]m4_ifval([$1], [ = yylsa])[; + YYLTYPE *yylsp]m4_ifval([$1], [ = yyls])[;]])[]b4_lac_if([[ - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[3];]])[ + yy_state_t yyesa@{]b4_percent_define_get([[parse.lac.es-capacity-initial]])[@}; + yy_state_t *yyes]m4_ifval([$1], [ = yyesa])[; + YYPTRDIFF_T yyes_capacity][]m4_ifval([$1], + [m4_do([ = b4_percent_define_get([[parse.lac.es-capacity-initial]]) < YYMAXDEPTH], + [ ? b4_percent_define_get([[parse.lac.es-capacity-initial]])], + [ : YYMAXDEPTH])])[;]])]) + + +m4_define([b4_macro_define], +[[#]define $1 $2]) + +m4_define([b4_macro_undef], +[[#]undef $1]) + +m4_define([b4_pstate_macro_define], +[b4_macro_define([$1], [yyps->$1])]) + +# b4_parse_state_variable_macros(b4_macro_define|b4_macro_undef) +# -------------------------------------------------------------- +m4_define([b4_parse_state_variable_macros], +[b4_pure_if([$1([b4_prefix[]nerrs])]) +$1([yystate]) +$1([yyerrstatus]) +$1([yyssa]) +$1([yyss]) +$1([yyssp]) +$1([yyvsa]) +$1([yyvs]) +$1([yyvsp])[]b4_locations_if([ +$1([yylsa]) +$1([yyls]) +$1([yylsp])]) +$1([yystacksize])[]b4_lac_if([ +$1([yyesa]) +$1([yyes]) +$1([yyes_capacity])])]) - YYPTRDIFF_T yystacksize;]b4_lac_if([[ - yy_state_t yyesa@{]b4_percent_define_get([[parse.lac.es-capacity-initial]])[@}; - yy_state_t *yyes; - YYPTRDIFF_T yyes_capacity;]])]) # _b4_declare_yyparse_push @@ -231,27 +335,23 @@ typedef struct ]b4_prefix[pstate ]b4_prefix[pstate; -]b4_pull_if([b4_function_declare([b4_prefix[parse]], [[int]], b4_parse_param) -])b4_function_declare([b4_prefix[push_parse]], [[int]], - [[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([, - [[[int pushed_char]], [[pushed_char]]], - [[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([, - [[b4_api_PREFIX[LTYPE *pushed_loc]], [[pushed_loc]]]])])m4_ifset([b4_parse_param], [, - b4_parse_param])) -b4_pull_if([b4_function_declare([b4_prefix[pull_parse]], [[int]], - [[b4_prefix[pstate *ps]], [[ps]]]m4_ifset([b4_parse_param], [, - b4_parse_param]))]) -b4_function_declare([b4_prefix[pstate_new]], [b4_prefix[pstate *]], - [[[void]], []]) -b4_function_declare([b4_prefix[pstate_delete]], [[void]], - [[b4_prefix[pstate *ps]], [[ps]]])dnl -]) +]b4_pull_if([[ +int ]b4_prefix[parse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[);]])[ +int ]b4_prefix[push_parse (]b4_prefix[pstate *ps]b4_pure_if([[, + int pushed_char, ]b4_api_PREFIX[STYPE const *pushed_val]b4_locations_if([[, ]b4_api_PREFIX[LTYPE *pushed_loc]])])b4_user_formals[); +]b4_pull_if([[int ]b4_prefix[pull_parse (]b4_prefix[pstate *ps]b4_user_formals[);]])[ +]b4_prefix[pstate *]b4_prefix[pstate_new (void); +void ]b4_prefix[pstate_delete (]b4_prefix[pstate *ps); +]]) + # _b4_declare_yyparse # ------------------- # When not the push parser. m4_define([_b4_declare_yyparse], -[b4_function_declare(b4_prefix[parse], [int], b4_parse_param)]) +[[int ]b4_prefix[parse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[); +]m4_ifdef([b4_start_symbols], + [m4_map([_b4_declare_sub_yyparse], m4_defn([b4_start_symbols]))])]) # b4_declare_yyparse @@ -262,19 +362,35 @@ ]) +# b4_declare_yyerror_and_yylex +# ---------------------------- +# Comply with POSIX Yacc. +# +m4_define([b4_declare_yyerror_and_yylex], +[b4_posix_if([[#if !defined ]b4_prefix[error && !defined ]b4_api_PREFIX[ERROR_IS_DECLARED +]b4_function_declare([b4_prefix[error]], void, b4_yyerror_formals)[ +#endif +#if !defined ]b4_prefix[lex && !defined ]b4_api_PREFIX[LEX_IS_DECLARED +]b4_function_declare([b4_prefix[lex]], int, b4_yylex_formals)[ +#endif +]])dnl +]) + + # b4_shared_declarations # ---------------------- -# Declaration that might either go into the header (if --defines) -# or open coded in the parser body. +# Declarations that might either go into the header (if --header) +# or into the implementation file. m4_define([b4_shared_declarations], -[b4_cpp_guard_open([b4_spec_header_file])[ +[b4_cpp_guard_open([b4_spec_mapped_header_file])[ ]b4_declare_yydebug[ ]b4_percent_code_get([[requires]])[ ]b4_token_enums_defines[ ]b4_declare_yylstype[ +]b4_declare_yyerror_and_yylex[ ]b4_declare_yyparse[ ]b4_percent_code_get([[provides]])[ -]b4_cpp_guard_close([b4_spec_header_file])[]dnl +]b4_cpp_guard_close([b4_spec_mapped_header_file])[]dnl ]) @@ -289,7 +405,7 @@ [$2])], [$2])]) -m4_if(b4_spec_header_file, [[y.tab.h]], +m4_if(b4_spec_header_file, [y.tab.h], [], [b4_percent_define_default([[api.header.include]], [["@basename(]b4_spec_header_file[@)"]])]) @@ -301,19 +417,20 @@ ## -------------- ## -b4_defines_if([[ +b4_header_if([[ ]b4_output_begin([b4_spec_header_file])[ ]b4_copyright([Bison interface for Yacc-like parsers in C])[ ]b4_disclaimer[ ]b4_shared_declarations[ ]b4_output_end[ -]])# b4_defines_if +]])# b4_header_if b4_output_begin([b4_parser_file_name])[ ]b4_copyright([Bison implementation for Yacc-like parsers in C])[ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ +]b4_disclaimer[ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. @@ -321,7 +438,6 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -]b4_disclaimer[ ]b4_identification[ ]b4_percent_code_get([[top]])[]dnl m4_if(b4_api_prefix, [yy], [], @@ -334,6 +450,7 @@ #define yypush_parse ]b4_prefix[push_parse]b4_pull_if([[ #define yypull_parse ]b4_prefix[pull_parse]])[ #define yypstate_new ]b4_prefix[pstate_new +#define yypstate_clear ]b4_prefix[pstate_clear #define yypstate_delete ]b4_prefix[pstate_delete #define yypstate ]b4_prefix[pstate]])[ #define yylex ]b4_prefix[lex @@ -348,65 +465,18 @@ ]b4_cast_define[ ]b4_null_define[ -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[ -#endif - ]b4_header_include_if([[#include ]b4_percent_define_get([[api.header.include]])], [m4_ifval(m4_quote(b4_spec_header_file), [/* Use api.header.include to #include this header instead of duplicating it here. */ ])b4_shared_declarations])[ +]b4_declare_symbol_enum[ ]b4_user_post_prologue[ -]b4_percent_code_get[]dnl - -[#ifdef short -# undef short -#endif - +]b4_percent_code_get[ ]b4_c99_int_type_define[ -#ifndef YYPTRDIFF_T -# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ -# define YYPTRDIFF_T __PTRDIFF_TYPE__ -# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ -# elif defined PTRDIFF_MAX -# ifndef ptrdiff_t -# include /* INFRINGES ON USER NAME SPACE */ -# endif -# define YYPTRDIFF_T ptrdiff_t -# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX -# else -# define YYPTRDIFF_T long -# define YYPTRDIFF_MAXIMUM LONG_MAX -# endif -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned -# endif -#endif - -#define YYSIZE_MAXIMUM \ - YY_CAST (YYPTRDIFF_T, \ - (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ - ? YYPTRDIFF_MAXIMUM \ - : YY_CAST (YYSIZE_T, -1))) - -#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) +]b4_sizes_types_define[ /* Stored state numbers (used for stacks). */ typedef ]b4_int_type(0, m4_eval(b4_states_number - 1))[ yy_state_t; @@ -425,6 +495,11 @@ # define YY_(Msgid) Msgid # endif #endif +]b4_has_translations_if([ +#ifndef N_ +# define N_(Msgid) Msgid +#endif +])[ ]b4_attribute_define[ @@ -437,7 +512,7 @@ ]], [[#define YY_ASSERT(E) ((void) (0 && (E)))]])[ -#if ]b4_lac_if([[1]], [[! defined yyoverflow || YYERROR_VERBOSE]])[ +#if ]b4_lac_if([[1]], [b4_parse_error_case([simple], [[!defined yyoverflow]], [[1]])])[ /* The parser invokes alloca or malloc; define the necessary symbols. */]dnl b4_push_if([], [b4_lac_if([], [[ @@ -504,8 +579,7 @@ # endif # endif]b4_lac_if([[ # define YYCOPY_NEEDED 1]])[ -#endif]b4_lac_if([], [[ /* ! defined yyoverflow || YYERROR_VERBOSE */]])[ - +#endif /* ]b4_lac_if([[1]], [b4_parse_error_case([simple], [[!defined yyoverflow]], [[1]])])[ */ #if (! defined yyoverflow \ && (! defined __cplusplus \ @@ -588,16 +662,18 @@ /* YYNSTATES -- Number of states. */ #define YYNSTATES ]b4_states_number[ -#define YYUNDEFTOK ]b4_undef_token_number[ -#define YYMAXUTOK ]b4_user_token_number_max[ +/* YYMAXUTOK -- Last valid token kind. */ +#define YYMAXUTOK ]b4_code_max[ /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. */ ]b4_api_token_raw_if(dnl -[[#define YYTRANSLATE(YYX) (YYX)]], -[[#define YYTRANSLATE(YYX) \ - (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) +[[#define YYTRANSLATE(YYX) YY_CAST (yysymbol_kind_t, YYX)]], +[[#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK \ + ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ + : ]b4_symbol_prefix[YYUNDEF) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex. */ @@ -611,23 +687,46 @@ [[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[ #endif -#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[ -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. +/** Accessing symbol of state STATE. */ +#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) + +#if ]b4_parse_error_case([simple], [b4_api_PREFIX[DEBUG || ]b4_token_table_flag], [[1]])[ +/* The user-facing name of the symbol whose (internal) number is + YYSYMBOL. No bounds checking. */ +static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; + +]b4_parse_error_bmatch([simple\|verbose], +[[/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { ]b4_tname[ }; -#endif -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const ]b4_int_type_for([b4_toknum])[ yytoknum[] = +static const char * +yysymbol_name (yysymbol_kind_t yysymbol) { - ]b4_toknum[ -}; -# endif + return yytname[yysymbol]; +}]], +[[static const char * +yysymbol_name (yysymbol_kind_t yysymbol) +{ + static const char *const yy_sname[] = + { + ]b4_symbol_names[ + };]b4_has_translations_if([[ + /* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is + internationalizable. */ + static ]b4_int_type_for([b4_translatable])[ yytranslatable[] = + { + ]b4_translatable[ + }; + return (yysymbol < YYNTOKENS && yytranslatable[yysymbol] + ? _(yy_sname[yysymbol]) + : yy_sname[yysymbol]);]], [[ + return yy_sname[yysymbol];]])[ +}]])[ +#endif #define YYPACT_NINF (]b4_pact_ninf[) @@ -641,21 +740,22 @@ ]b4_parser_tables_define[ +enum { YYENOMEM = -2 }; + #define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 +#define yyclearin (yychar = ]b4_symbol(empty, id)[) #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab +#define YYNOMEM goto yyexhaustedlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ - if (yychar == YYEMPTY) \ + if (yychar == ]b4_symbol(empty, id)[) \ { \ yychar = (Token); \ yylval = (Value); \ @@ -671,10 +771,9 @@ } \ while (0) -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - +/* Backward compatibility with an undocumented macro. + Use ]b4_symbol(error, id)[ or ]b4_symbol(undef, id)[. */ +#define YYERRCODE ]b4_symbol(undef, id)[ ]b4_locations_if([[ ]b4_yylloc_default_define[ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) @@ -694,15 +793,15 @@ YYFPRINTF Args; \ } while (0) -]b4_yy_location_print_define[ +]b4_yylocation_print_define[ -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ - Type, Value]b4_locations_if([, Location])[]b4_user_args[); \ + Kind, Value]b4_locations_if([, Location])[]b4_user_args[); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) @@ -714,9 +813,8 @@ | TOP (included). | `------------------------------------------------------------------*/ -]b4_function_define([yy_stack_print], [static void], - [[yy_state_t *yybottom], [yybottom]], - [[yy_state_t *yytop], [yytop]])[ +static void +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -738,12 +836,9 @@ | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -]b4_function_define([yy_reduce_print], [static void], - [[yy_state_t *yyssp], [yyssp]], - [[YYSTYPE *yyvsp], [yyvsp]], - b4_locations_if([[[YYLTYPE *yylsp], [yylsp]], - ])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [, - b4_parse_param]))[ +static void +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,]b4_locations_if([[ YYLTYPE *yylsp,]])[ + int yyrule]b4_user_formals[) { int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; @@ -755,10 +850,9 @@ { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - yystos[+yyssp[yyi + 1 - yynrhs]], - &]b4_rhs_value(yynrhs, yyi + 1)[ - ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl - b4_user_args[); + YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), + &]b4_rhs_value(yynrhs, yyi + 1)[]b4_locations_if([, + &]b4_rhs_location(yynrhs, yyi + 1))[]b4_user_args[); YYFPRINTF (stderr, "\n"); } } @@ -773,8 +867,8 @@ multiple parsers can coexist. */ int yydebug; #else /* !]b4_api_PREFIX[DEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YYDPRINTF(Args) ((void) 0) +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !]b4_api_PREFIX[DEBUG */ @@ -794,7 +888,18 @@ #ifndef YYMAXDEPTH # define YYMAXDEPTH ]b4_stack_depth_max[ -#endif]b4_lac_if([[ +#endif]b4_push_if([[ +/* Parser data structure. */ +struct yypstate + {]b4_declare_parser_state_variables[ + /* Whether this instance has not started parsing yet. + * If 2, it corresponds to a finished parsing. */ + int yynew; + };]b4_pure_if([], [[ + +/* Whether the only allowed instance of yypstate is allocated. */ +static char yypstate_allocated = 0;]])])[ +]b4_lac_if([[ /* Given a state stack such that *YYBOTTOM is its bottom, such that *YYTOP is either its top or is YYTOP_EMPTY to indicate an empty @@ -805,7 +910,7 @@ *YYTOP, and *YYCAPACITY to reflect the new capacity and memory location. If *YYBOTTOM != YYBOTTOM_NO_FREE, then free the old stack using YYSTACK_FREE. Return 0 if successful or if no reallocation is - required. Return 1 if memory is exhausted. */ + required. Return YYENOMEM if memory is exhausted. */ static int yy_lac_stack_realloc (YYPTRDIFF_T *yycapacity, YYPTRDIFF_T yyadd, #if ]b4_api_PREFIX[DEBUG @@ -830,7 +935,7 @@ { YYDPRINTF ((stderr, "%smax size exceeded%s", yydebug_prefix, yydebug_suffix)); - return 1; + return YYENOMEM; } if (YYMAXDEPTH < yyalloc) yyalloc = YYMAXDEPTH; @@ -842,7 +947,7 @@ { YYDPRINTF ((stderr, "%srealloc failed%s", yydebug_prefix, yydebug_suffix)); - return 1; + return YYENOMEM; } if (*yytop != yytop_empty) { @@ -888,23 +993,22 @@ current lookahead, then check if that lookahead can eventually be shifted if syntactic actions continue from the current context. Report a syntax error if it cannot. */ -#define YY_LAC_ESTABLISH \ -do { \ - if (!yy_lac_established) \ - { \ - YYDPRINTF ((stderr, \ - "LAC: initial context established for %s\n", \ - yytname[yytoken])); \ - yy_lac_established = 1; \ - { \ - int yy_lac_status = \ - yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken); \ - if (yy_lac_status == 2) \ - goto yyexhaustedlab; \ - if (yy_lac_status == 1) \ - goto yyerrlab; \ - } \ - } \ +#define YY_LAC_ESTABLISH \ +do { \ + if (!yy_lac_established) \ + { \ + YYDPRINTF ((stderr, \ + "LAC: initial context established for %s\n", \ + yysymbol_name (yytoken))); \ + yy_lac_established = 1; \ + switch (yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken)) \ + { \ + case YYENOMEM: \ + YYNOMEM; \ + case 1: \ + goto yyerrlab; \ + } \ + } \ } while (0) /* Discard any previous initial lookahead context because of Event, @@ -923,9 +1027,8 @@ do { \ if (yy_lac_established) \ { \ - if (yydebug) \ - YYFPRINTF (stderr, "LAC: initial context discarded due to " \ - Event "\n"); \ + YYDPRINTF ((stderr, "LAC: initial context discarded due to " \ + Event "\n")); \ yy_lac_established = 0; \ } \ } while (0) @@ -935,7 +1038,7 @@ /* Given the stack whose top is *YYSSP, return 0 iff YYTOKEN can eventually (after perhaps some reductions) be shifted, return 1 if - not, or return 2 if memory is exhausted. As preconditions and + not, or return YYENOMEM if memory is exhausted. As preconditions and postconditions: *YYES_CAPACITY is the allocated size of the array to which *YYES points, and either *YYES = YYESA or *YYES points to an array allocated with YYSTACK_ALLOC. yy_lac may overwrite the @@ -943,12 +1046,13 @@ any old *YYES other than YYESA. */ static int yy_lac (yy_state_t *yyesa, yy_state_t **yyes, - YYPTRDIFF_T *yyes_capacity, yy_state_t *yyssp, int yytoken) + YYPTRDIFF_T *yyes_capacity, yy_state_t *yyssp, yysymbol_kind_t yytoken) { yy_state_t *yyes_prev = yyssp; yy_state_t *yyesp = yyes_prev; - YYDPRINTF ((stderr, "LAC: checking lookahead %s:", yytname[yytoken])); - if (yytoken == YYUNDEFTOK) + /* Reduce until we encounter a shift and thereby accept the token. */ + YYDPRINTF ((stderr, "LAC: checking lookahead %s:", yysymbol_name (yytoken))); + if (yytoken == ]b4_symbol_prefix[YYUNDEF) { YYDPRINTF ((stderr, " Always Err\n")); return 1; @@ -960,6 +1064,7 @@ || (yyrule += yytoken) < 0 || YYLAST < yyrule || yycheck[yyrule] != yytoken) { + /* Use the default action. */ yyrule = yydefact[+*yyesp]; if (yyrule == 0) { @@ -969,6 +1074,7 @@ } else { + /* Use the action from yytable. */ yyrule = yytable[yyrule]; if (yytable_value_is_error (yyrule)) { @@ -982,9 +1088,12 @@ } yyrule = -yyrule; } + /* By now we know we have to simulate a reduce. */ + YYDPRINTF ((stderr, " R%d", yyrule - 1)); { + /* Pop the corresponding number of values from the stack. */ YYPTRDIFF_T yylen = yyr2[yyrule]; - YYDPRINTF ((stderr, " R%d", yyrule - 1)); + /* First pop from the LAC stack as many tokens as possible. */ if (yyesp != yyes_prev) { YYPTRDIFF_T yysize = yyesp - *yyes + 1; @@ -995,13 +1104,15 @@ } else { - yylen -= yysize; yyesp = yyes_prev; + yylen -= yysize; } } + /* Only afterwards look at the main stack. */ if (yylen) yyesp = yyes_prev -= yylen; } + /* Push the resulting state of the reduction. */ { yy_state_fast_t yystate; { @@ -1027,7 +1138,7 @@ yyes, yyesa, &yyesp, yyes_prev)) { YYDPRINTF ((stderr, "\n")); - return 2; + return YYENOMEM; } YY_IGNORE_USELESS_CAST_BEGIN *++yyesp = YY_CAST (yy_state_t, yystate); @@ -1038,33 +1149,144 @@ } }]])[ +]b4_parse_error_case([simple], [], +[[/* Context of a parse error. */ +typedef struct +{]b4_push_if([[ + yypstate* yyps;]], [[ + yy_state_t *yyssp;]b4_lac_if([[ + yy_state_t *yyesa; + yy_state_t **yyes; + YYPTRDIFF_T *yyes_capacity;]])])[ + yysymbol_kind_t yytoken;]b4_locations_if([[ + YYLTYPE *yylloc;]])[ +} yypcontext_t; + +/* Put in YYARG at most YYARGN of the expected tokens given the + current YYCTX, and return the number of tokens stored in YYARG. If + YYARG is null, return the number of expected tokens (guaranteed to + be less than YYNTOKENS). Return YYENOMEM on memory exhaustion. + Return 0 if there are more than YYARGN expected tokens, yet fill + YYARG up to YYARGN. */]b4_push_if([[ +static int +yypstate_expected_tokens (yypstate *yyps, + yysymbol_kind_t yyarg[], int yyargn)]], [[ +static int +yypcontext_expected_tokens (const yypcontext_t *yyctx, + yysymbol_kind_t yyarg[], int yyargn)]])[ +{ + /* Actual size of YYARG. */ + int yycount = 0; +]b4_lac_if([[ + int yyx; + for (yyx = 0; yyx < YYNTOKENS; ++yyx) + { + yysymbol_kind_t yysym = YY_CAST (yysymbol_kind_t, yyx); + if (yysym != ]b4_symbol(error, kind)[ && yysym != ]b4_symbol_prefix[YYUNDEF) + switch (yy_lac (]b4_push_if([[yyps->yyesa, &yyps->yyes, &yyps->yyes_capacity, yyps->yyssp, yysym]], + [[yyctx->yyesa, yyctx->yyes, yyctx->yyes_capacity, yyctx->yyssp, yysym]])[)) + { + case YYENOMEM: + return YYENOMEM; + case 1: + continue; + default: + if (!yyarg) + ++yycount; + else if (yycount == yyargn) + return 0; + else + yyarg[yycount++] = yysym; + } + }]], +[[ int yyn = yypact@{+*]b4_push_if([yyps], [yyctx])[->yyssp@}; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[ + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (!yyarg) + ++yycount; + else if (yycount == yyargn) + return 0; + else + yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx); + } + }]])[ + if (yyarg && yycount == 0 && 0 < yyargn) + yyarg[0] = ]b4_symbol(empty, kind)[; + return yycount; +} -#if YYERROR_VERBOSE +]b4_push_if([[ +/* Similar to the previous function. */ +static int +yypcontext_expected_tokens (const yypcontext_t *yyctx, + yysymbol_kind_t yyarg[], int yyargn) +{ + return yypstate_expected_tokens (yyctx->yyps, yyarg, yyargn); +}]])[ +]])[ -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) -# else +]b4_parse_error_bmatch( + [custom], +[[/* The kind of the lookahead of this context. */ +static yysymbol_kind_t +yypcontext_token (const yypcontext_t *yyctx) YY_ATTRIBUTE_UNUSED; + +static yysymbol_kind_t +yypcontext_token (const yypcontext_t *yyctx) +{ + return yyctx->yytoken; +} + +]b4_locations_if([[/* The location of the lookahead of this context. */ +static YYLTYPE * +yypcontext_location (const yypcontext_t *yyctx) YY_ATTRIBUTE_UNUSED; + +static YYLTYPE * +yypcontext_location (const yypcontext_t *yyctx) +{ + return yyctx->yylloc; +}]])[ + +/* User defined function to report a syntax error. */ +static int +yyreport_syntax_error (const yypcontext_t *yyctx]b4_user_formals[);]], + [detailed\|verbose], +[[#ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) +# else /* Return the length of YYSTR. */ -]b4_function_define([yystrlen], [static YYPTRDIFF_T], - [[const char *yystr], [yystr]])[ +static YYPTRDIFF_T +yystrlen (const char *yystr) { YYPTRDIFF_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } -# endif # endif +#endif -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else +#ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -]b4_function_define([yystpcpy], [static char *], - [[char *yydest], [yydest]], [[const char *yysrc], [yysrc]])[ +static char * +yystpcpy (char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; @@ -1074,10 +1296,12 @@ return yyd - 1; } -# endif # endif +#endif -# ifndef yytnamerr +]b4_parse_error_case( + [verbose], +[[#ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string @@ -1092,7 +1316,6 @@ { YYPTRDIFF_T yyn = 0; char const *yyp = yystr; - for (;;) switch (*++yyp) { @@ -1126,34 +1349,15 @@ else return yystrlen (yystr); } -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP.]b4_lac_if([[ In order to see if a particular token T is a - valid looakhead, invoke yy_lac (YYESA, YYES, YYES_CAPACITY, YYSSP, T).]])[ +#endif +]])[ - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store]b4_lac_if([[ or if - yy_lac returned 2]])[. */ static int -yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, - ]b4_lac_if([[yy_state_t *yyesa, yy_state_t **yyes, - YYPTRDIFF_T *yyes_capacity, ]])[yy_state_t *yyssp, int yytoken) +yy_syntax_error_arguments (const yypcontext_t *yyctx, + yysymbol_kind_t yyarg[], int yyargn) { - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat: reported tokens (one for the "unexpected", - one per "expected"). */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Actual size of YYARG. */ int yycount = 0; - /* Cumulated lengths of YYARG. */ - YYPTRDIFF_T yysize = 0; - /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action @@ -1182,70 +1386,59 @@ one exception: it will still contain any token that will not be accepted due to an error action in a later state.]])[ */ - if (yytoken != YYEMPTY) + if (yyctx->yytoken != ]b4_symbol(empty, kind)[) { - int yyn = yypact[+*yyssp]; - YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - yysize = yysize0;]b4_lac_if([[ + int yyn;]b4_lac_if([[ YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[ - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - {]b4_lac_if([[ - int yyx; - - for (yyx = 0; yyx < YYNTOKENS; ++yyx) - if (yyx != YYTERROR && yyx != YYUNDEFTOK) - { - { - int yy_lac_status = yy_lac (yyesa, yyes, yyes_capacity, - yyssp, yyx); - if (yy_lac_status == 2) - return 2; - if (yy_lac_status == 1) - continue; - }]], [[ - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - {]])[ - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYPTRDIFF_T yysize1 - = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else - return 2; - } - } - }]b4_lac_if([[ -# if ]b4_api_PREFIX[DEBUG - else if (yydebug) - YYFPRINTF (stderr, "No expected tokens.\n"); -# endif]])[ + if (yyarg) + yyarg[yycount] = yyctx->yytoken; + ++yycount; + yyn = yypcontext_expected_tokens (yyctx, + yyarg ? yyarg + 1 : yyarg, yyargn - 1); + if (yyn == YYENOMEM) + return YYENOMEM;]b4_lac_if([[ + else if (yyn == 0) + YYDPRINTF ((stderr, "No expected tokens.\n"));]])[ + else + yycount += yyn; } + return yycount; +} + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP.]b4_lac_if([[ In order to see if a particular token T is a + valid looakhead, invoke yy_lac (YYESA, YYES, YYES_CAPACITY, YYSSP, T).]])[ + + Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the + required number of bytes is too large to store]b4_lac_if([[ or if + yy_lac returned YYENOMEM]])[. */ +static int +yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, + const yypcontext_t *yyctx) +{ + enum { YYARGS_MAX = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat: reported tokens (one for the "unexpected", + one per "expected"). */ + yysymbol_kind_t yyarg[YYARGS_MAX]; + /* Cumulated lengths of YYARG. */ + YYPTRDIFF_T yysize = 0; + + /* Actual size of YYARG. */ + int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX); + if (yycount == YYENOMEM) + return YYENOMEM; switch (yycount) { -# define YYCASE_(N, S) \ +#define YYCASE_(N, S) \ case N: \ yyformat = S; \ - break + break default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); @@ -1253,17 +1446,25 @@ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ +#undef YYCASE_ } + /* Compute error message size. Don't count the "%s"s, but reserve + room for the terminator. */ + yysize = yystrlen (yyformat) - 2 * yycount + 1; { - /* Don't count the "%s"s in the final size, but reserve room for - the terminator. */ - YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else - return 2; + int yyi; + for (yyi = 0; yyi < yycount; ++yyi) + { + YYPTRDIFF_T yysize1 + = yysize + ]b4_parse_error_case( + [verbose], [[yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]])]], + [[yystrlen (yysymbol_name (yyarg[yyi]))]]);[ + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else + return YYENOMEM; + } } if (*yymsg_alloc < yysize) @@ -1272,7 +1473,7 @@ if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; + return -1; } /* Avoid sprintf, as that infringes on the user's name space. @@ -1283,8 +1484,9 @@ int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); + {]b4_parse_error_case([verbose], [[ + yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);]], [[ + yyp = yystpcpy (yyp, yysymbol_name (yyarg[yyi++]));]])[ yyformat += 2; } else @@ -1295,153 +1497,175 @@ } return 0; } -#endif /* YYERROR_VERBOSE */ +]])[ ]b4_yydestruct_define[ -]b4_pure_if([], [ +]b4_pure_if([], [b4_declare_scanner_communication_variables])[ -b4_declare_scanner_communication_variables])[]b4_push_if([[ +]b4_push_if([b4_pull_if([[ -struct yypstate - {]b4_declare_parser_state_variables[ - /* Used to determine if this is the first time this instance has - been used. */ - int yynew; - };]b4_pure_if([], [[ - -static char yypstate_allocated = 0;]])b4_pull_if([ - -b4_function_define([[yyparse]], [[int]], b4_parse_param)[ +int +yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[) { - return yypull_parse (YY_NULLPTR]m4_ifset([b4_parse_param], - [[, ]b4_args(b4_parse_param)])[); + yypstate *yyps = yypstate_new (); + if (!yyps) + {]b4_pure_if([b4_locations_if([[ + static YYLTYPE yyloc_default][]b4_yyloc_default[; + YYLTYPE yylloc = yyloc_default;]])[ + yyerror (]b4_yyerror_args[YY_("memory exhausted"));]], [[ + if (!yypstate_allocated) + yyerror (]b4_yyerror_args[YY_("memory exhausted"));]])[ + return 2; + } + int yystatus = yypull_parse (yyps]b4_user_args[); + yypstate_delete (yyps); + return yystatus; } -]b4_function_define([[yypull_parse]], [[int]], - [[[yypstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [, - b4_parse_param]))[ -{]b4_pure_if([b4_locations_if([[ +int +yypull_parse (yypstate *yyps]b4_user_formals[) +{ + YY_ASSERT (yyps);]b4_pure_if([b4_locations_if([[ static YYLTYPE yyloc_default][]b4_yyloc_default[; YYLTYPE yylloc = yyloc_default;]])])[ - yypstate *yyps_local; - if (yyps) - yyps_local = yyps; - else - { - yyps_local = yypstate_new (); - if (!yyps_local) - {]b4_pure_if([[ - yyerror (]b4_yyerror_args[YY_("memory exhausted"));]], [[ - if (!yypstate_allocated) - yyerror (]b4_yyerror_args[YY_("memory exhausted"));]])[ - return 2; - } - } int yystatus; - do {]b4_pure_if([[ - YYSTYPE yylval; - int ]])[yychar = ]b4_lex[; - yystatus = - yypush_parse (yyps_local]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[); + do { +]b4_pure_if([[ YYSTYPE yylval; + int ]])[yychar = ]b4_yylex[; + yystatus = yypush_parse (yyps]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[); } while (yystatus == YYPUSH_MORE); - if (!yyps) - yypstate_delete (yyps_local); return yystatus; }]])[ +]b4_parse_state_variable_macros([b4_pstate_macro_define])[ + +/* Initialize the parser data structure. */ +static void +yypstate_clear (yypstate *yyps) +{ + yynerrs = 0; + yystate = 0; + yyerrstatus = 0; + + yyssp = yyss; + yyvsp = yyvs;]b4_locations_if([[ + yylsp = yyls;]])[ + + /* Initialize the state stack, in case yypcontext_expected_tokens is + called before the first call to yyparse. */ + *yyssp = 0; + yyps->yynew = 1; +} + /* Initialize the parser data structure. */ -]b4_function_define([[yypstate_new]], [[yypstate *]])[ +yypstate * +yypstate_new (void) { yypstate *yyps;]b4_pure_if([], [[ if (yypstate_allocated) return YY_NULLPTR;]])[ - yyps = YY_CAST (yypstate *, malloc (sizeof *yyps)); + yyps = YY_CAST (yypstate *, YYMALLOC (sizeof *yyps)); if (!yyps) - return YY_NULLPTR; - yyps->yynew = 1;]b4_pure_if([], [[ + return YY_NULLPTR;]b4_pure_if([], [[ yypstate_allocated = 1;]])[ + yystacksize = YYINITDEPTH; + yyss = yyssa; + yyvs = yyvsa;]b4_locations_if([[ + yyls = yylsa;]])[]b4_lac_if([[ + yyes = yyesa; + yyes_capacity = ]b4_percent_define_get([[parse.lac.es-capacity-initial]])[; + if (YYMAXDEPTH < yyes_capacity) + yyes_capacity = YYMAXDEPTH;]])[ + yypstate_clear (yyps); return yyps; } -]b4_function_define([[yypstate_delete]], [[void]], - [[[yypstate *yyps]], [[yyps]]])[ +void +yypstate_delete (yypstate *yyps) { if (yyps) { #ifndef yyoverflow /* If the stack was reallocated but the parse did not complete, then the stack still needs to be freed. */ - if (!yyps->yynew && yyps->yyss != yyps->yyssa) - YYSTACK_FREE (yyps->yyss); + if (yyss != yyssa) + YYSTACK_FREE (yyss); #endif]b4_lac_if([[ - if (!yyps->yynew && yyps->yyes != yyps->yyesa) - YYSTACK_FREE (yyps->yyes);]])[ - free (yyps);]b4_pure_if([], [[ + if (yyes != yyesa) + YYSTACK_FREE (yyes);]])[ + YYFREE (yyps);]b4_pure_if([], [[ yypstate_allocated = 0;]])[ } } -]b4_pure_if([[ -#define ]b4_prefix[nerrs yyps->]b4_prefix[nerrs]])[ -#define yystate yyps->yystate -#define yyerrstatus yyps->yyerrstatus -#define yyssa yyps->yyssa -#define yyss yyps->yyss -#define yyssp yyps->yyssp -#define yyvsa yyps->yyvsa -#define yyvs yyps->yyvs -#define yyvsp yyps->yyvsp]b4_locations_if([[ -#define yylsa yyps->yylsa -#define yyls yyps->yyls -#define yylsp yyps->yylsp -#define yyerror_range yyps->yyerror_range]])[ -#define yystacksize yyps->yystacksize]b4_lac_if([[ -#define yyesa yyps->yyesa -#define yyes yyps->yyes -#define yyes_capacity yyps->yyes_capacity]])[ - +]])[ +]b4_push_if([[ /*---------------. | yypush_parse. | `---------------*/ -]b4_function_define([[yypush_parse]], [[int]], - [[[yypstate *yyps]], [[yyps]]]b4_pure_if([, - [[[int yypushed_char]], [[yypushed_char]]], - [[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([, - [[[YYLTYPE *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [, - b4_parse_param]))], [[ - - +int +yypush_parse (yypstate *yyps]b4_pure_if([[, + int yypushed_char, YYSTYPE const *yypushed_val]b4_locations_if([[, YYLTYPE *yypushed_loc]])])b4_user_formals[)]], +[[ /*----------. | yyparse. | `----------*/ -]b4_function_define([yyparse], [int], b4_parse_param)])[ +]m4_ifdef([b4_start_symbols], +[[// Extract data from the parser. +typedef struct +{ + YYSTYPE yyvalue; + int yynerrs; +} yy_parse_impl_t; + +// Run a full parse, using YYCHAR as switching token. +static int +yy_parse_impl (int yychar, yy_parse_impl_t *yyimpl]m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])[); + +]m4_map([_b4_define_sub_yyparse], m4_defn([b4_start_symbols]))[ + +int +yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[) +{ + return yy_parse_impl (]b4_symbol(_b4_first_switching_token, id)[, YY_NULLPTR]m4_ifset([b4_parse_param], + [[, ]b4_args(b4_parse_param)])[); +} + +static int +yy_parse_impl (int yychar, yy_parse_impl_t *yyimpl]m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])[)]], +[[int +yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)]])])[ {]b4_pure_if([b4_declare_scanner_communication_variables ])b4_push_if([b4_pure_if([], [[ int yypushed_char = yychar; YYSTYPE yypushed_val = yylval;]b4_locations_if([[ YYLTYPE yypushed_loc = yylloc;]]) ])], - [b4_declare_parser_state_variables + [b4_declare_parser_state_variables([init]) ])b4_lac_if([[ + /* Whether LAC context is established. A Boolean. */ int yy_lac_established = 0;]])[ int yyn; + /* The return value of yyparse. */ int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; + /* Lookahead symbol kind. */ + yysymbol_kind_t yytoken = ]b4_symbol(empty, kind)[; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval;]b4_locations_if([[ - YYLTYPE yyloc;]])[ + YYLTYPE yyloc; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[3];]])[ + +]b4_parse_error_bmatch([detailed\|verbose], +[[ /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; - YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; -#endif + YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;]])[ #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)]b4_locations_if([, yylsp -= (N)])[) @@ -1449,28 +1673,25 @@ Keep to zero when no symbol should be popped. */ int yylen = 0;]b4_push_if([[ - if (!yyps->yynew) + switch (yyps->yynew) { + case 0: yyn = yypact[yystate]; goto yyread_pushed_token; - }]])[ - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa;]b4_locations_if([[ - yylsp = yyls = yylsa;]])[ - yystacksize = YYINITDEPTH;]b4_lac_if([[ + case 2: + yypstate_clear (yyps); + break; - yyes = yyesa; - yyes_capacity = ]b4_percent_define_get([[parse.lac.es-capacity-initial]])[; - if (YYMAXDEPTH < yyes_capacity) - yyes_capacity = YYMAXDEPTH;]])[ + default: + break; + }]])[ YYDPRINTF ((stderr, "Starting parse\n")); - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ +]m4_ifdef([b4_start_symbols], [], +[[ yychar = ]b4_symbol(empty, id)[; /* Cause a token to be read. */ +]])[ ]m4_ifdef([b4_initial_action], [ b4_dollar_pushdef([m4_define([b4_dollar_dollar_used])yylval], [], [], [b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])])dnl @@ -1501,10 +1722,11 @@ YY_IGNORE_USELESS_CAST_BEGIN *yyssp = YY_CAST (yy_state_t, yystate); YY_IGNORE_USELESS_CAST_END + YY_STACK_PRINT (yyss, yyssp); if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE - goto yyexhaustedlab; + YYNOMEM; #else { /* Get the current used size of the three stacks, in elements. */ @@ -1535,7 +1757,7 @@ # else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + YYNOMEM; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; @@ -1546,11 +1768,11 @@ YY_CAST (union yyalloc *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) - goto yyexhaustedlab; + YYNOMEM; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs);]b4_locations_if([ YYSTACK_RELOCATE (yyls_alloc, yyls);])[ -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } @@ -1570,8 +1792,9 @@ } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ +]m4_ifdef([b4_start_symbols], [], [[ if (yystate == YYFINAL) - YYACCEPT; + YYACCEPT;]])[ goto yybackup; @@ -1590,8 +1813,8 @@ /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) + /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ + if (yychar == ]b4_symbol(empty, id)[) {]b4_push_if([[ if (!yyps->yynew) {]b4_use_push_for_pull_if([], [[ @@ -1607,20 +1830,32 @@ yylval = yypushed_val;]b4_locations_if([[ yylloc = yypushed_loc;]])])[ yyread_pushed_token:]])[ - YYDPRINTF ((stderr, "Reading a token: "));]b4_push_if([b4_pure_if([[ + YYDPRINTF ((stderr, "Reading a token\n"));]b4_push_if([b4_pure_if([[ yychar = yypushed_char; if (yypushed_val) yylval = *yypushed_val;]b4_locations_if([[ if (yypushed_loc) yylloc = *yypushed_loc;]])])], [[ - yychar = ]b4_lex[;]])[ + yychar = ]b4_yylex[;]])[ } - if (yychar <= YYEOF) + if (yychar <= ]b4_symbol(eof, [id])[) { - yychar = yytoken = YYEOF; + yychar = ]b4_symbol(eof, [id])[; + yytoken = ]b4_symbol(eof, [kind])[; YYDPRINTF ((stderr, "Now at end of input.\n")); } + else if (yychar == ]b4_symbol(error, [id])[) + { + /* The scanner already issued an error message, process directly + to error recovery. But do not keep the error token as + lookahead, it is too special and may lead us to an endless + loop in error recovery. */ + yychar = ]b4_symbol(undef, [id])[; + yytoken = ]b4_symbol(error, [kind])[;]b4_locations_if([[ + yyerror_range[1] = yylloc;]])[ + goto yyerrlab1; + } else { yytoken = YYTRANSLATE (yychar); @@ -1640,9 +1875,9 @@ if (yyn <= 0) { if (yytable_value_is_error (yyn)) - goto yyerrlab;]b4_lac_if([[ + goto yyerrlab; + yyn = -yyn;]b4_lac_if([[ YY_LAC_ESTABLISH;]])[ - yyn = -yyn; goto yyreduce; } @@ -1660,7 +1895,7 @@ *++yylsp = yylloc;])[ /* Discard the shifted token. */ - yychar = YYEMPTY;]b4_lac_if([[ + yychar = ]b4_symbol(empty, id)[;]b4_lac_if([[ YY_LAC_DISCARD ("shift");]])[ goto yynewstate; @@ -1723,11 +1958,10 @@ case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; - YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval;]b4_locations_if([ *++yylsp = yyloc;])[ @@ -1752,69 +1986,76 @@ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - + yytoken = yychar == ]b4_symbol(empty, id)[ ? ]b4_symbol(empty, kind)[ : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (]b4_yyerror_args[YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \]b4_lac_if([[ - yyesa, &yyes, &yyes_capacity, \]])[ - yyssp, yytoken) - { +]b4_parse_error_case( + [custom], +[[ { + yypcontext_t yyctx + = {]b4_push_if([[yyps]], [[yyssp]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])])[, yytoken]b4_locations_if([[, &yylloc]])[};]b4_lac_if([[ + if (yychar != ]b4_symbol(empty, id)[) + YY_LAC_ESTABLISH;]])[ + if (yyreport_syntax_error (&yyctx]m4_ifset([b4_parse_param], + [[, ]b4_args(b4_parse_param)])[) == 2) + YYNOMEM; + }]], + [simple], +[[ yyerror (]b4_yyerror_args[YY_("syntax error"));]], +[[ { + yypcontext_t yyctx + = {]b4_push_if([[yyps]], [[yyssp]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])])[, yytoken]b4_locations_if([[, &yylloc]])[}; char const *yymsgp = YY_("syntax error"); int yysyntax_error_status;]b4_lac_if([[ - if (yychar != YYEMPTY) + if (yychar != ]b4_symbol(empty, id)[) YY_LAC_ESTABLISH;]])[ - yysyntax_error_status = YYSYNTAX_ERROR; + yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); if (yysyntax_error_status == 0) yymsgp = yymsg; - else if (yysyntax_error_status == 1) + else if (yysyntax_error_status == -1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); - if (!yymsg) + yymsg = YY_CAST (char *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); + if (yymsg) { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; + yysyntax_error_status + = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); + yymsgp = yymsg; } else { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = YYENOMEM; } } yyerror (]b4_yyerror_args[yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif + if (yysyntax_error_status == YYENOMEM) + YYNOMEM; + }]])[ } - -]b4_locations_if([[ yyerror_range[1] = yylloc;]])[ - +]b4_locations_if([[ + yyerror_range[1] = yylloc;]])[ if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ - if (yychar <= YYEOF) + if (yychar <= ]b4_symbol(eof, [id])[) { /* Return failure if at end of input. */ - if (yychar == YYEOF) + if (yychar == ]b4_symbol(eof, [id])[) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[); - yychar = YYEMPTY; + yychar = ]b4_symbol(empty, id)[; } } @@ -1831,6 +2072,7 @@ label yyerrorlab therefore never appears in user code. */ if (0) YYERROR; + ++yynerrs; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -1847,13 +2089,14 @@ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ + /* Pop stack until we find a state that shifts the error token. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + yyn += ]b4_symbol(error, kind)[; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == ]b4_symbol(error, kind)[) { yyn = yytable[yyn]; if (0 < yyn) @@ -1867,7 +2110,7 @@ ]b4_locations_if([[ yyerror_range[1] = *yylsp;]])[ yydestruct ("Error: popping", - yystos[yystate], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[); + YY_ACCESSING_SYMBOL (yystate), yyvsp]b4_locations_if([, yylsp])[]b4_user_args[); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -1882,13 +2125,11 @@ YY_IGNORE_MAYBE_UNINITIALIZED_END ]b4_locations_if([[ yyerror_range[2] = yylloc; - /* Using YYLLOC is tempting, but would change the location of - the lookahead. YYLOC is available though. */ - YYLLOC_DEFAULT (yyloc, yyerror_range, 2); - *++yylsp = yyloc;]])[ + ++yylsp; + YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);]])[ /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -1899,7 +2140,7 @@ `-------------------------------------*/ yyacceptlab: yyresult = 0; - goto yyreturn; + goto yyreturnlab; /*-----------------------------------. @@ -1907,25 +2148,23 @@ `-----------------------------------*/ yyabortlab: yyresult = 1; - goto yyreturn; + goto yyreturnlab; -#if ]b4_lac_if([[1]], [[!defined yyoverflow || YYERROR_VERBOSE]])[ -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ +/*-----------------------------------------------------------. +| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | +`-----------------------------------------------------------*/ yyexhaustedlab: yyerror (]b4_yyerror_args[YY_("memory exhausted")); yyresult = 2; - /* Fall through. */ -#endif + goto yyreturnlab; -/*-----------------------------------------------------. -| yyreturn -- parsing is finished, return the result. | -`-----------------------------------------------------*/ -yyreturn: - if (yychar != YYEMPTY) +/*----------------------------------------------------------. +| yyreturnlab -- parsing is finished, clean up and return. | +`----------------------------------------------------------*/ +yyreturnlab: + if (yychar != ]b4_symbol(empty, id)[) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -1940,27 +2179,31 @@ while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[+*yyssp], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[); + YY_ACCESSING_SYMBOL (+*yyssp), yyvsp]b4_locations_if([, yylsp])[]b4_user_args[); YYPOPSTACK (1); - } + }]b4_push_if([[ + yyps->yynew = 2; + goto yypushreturn; + + +/*-------------------------. +| yypushreturn -- return. | +`-------------------------*/ +yypushreturn:]], [[ #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif]b4_lac_if([[ if (yyes != yyesa) - YYSTACK_FREE (yyes);]])b4_push_if([[ - yyps->yynew = 1; - - -/*-----------------------------------------. -| yypushreturn -- ask for the next token. | -`-----------------------------------------*/ -yypushreturn:]])[ -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif + YYSTACK_FREE (yyes);]])])[ +]b4_parse_error_bmatch([detailed\|verbose], +[[ if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg);]])[]m4_ifdef([b4_start_symbols], [[ + if (yyimpl) + yyimpl->yynerrs = yynerrs;]])[ return yyresult; } -]b4_epilogue[]dnl +]b4_push_if([b4_parse_state_variable_macros([b4_macro_undef])])[ +]b4_percent_code_get([[epilogue]])[]dnl +b4_epilogue[]dnl b4_output_end diff -Nru bison-3.5.1+dfsg/data/xslt/bison.xsl bison-3.8.2+dfsg/data/xslt/bison.xsl --- bison-3.5.1+dfsg/data/xslt/bison.xsl 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/xslt/bison.xsl 2021-06-23 04:48:48.000000000 +0000 @@ -3,7 +3,7 @@ + xmlns:bison="https://www.gnu.org/software/bison/"> . + along with this program. If not, see . Written by Wojciech Polak . --> + xmlns:bison="https://www.gnu.org/software/bison/"> @@ -159,7 +159,7 @@ - + - + @@ -198,14 +198,14 @@ : - + . - + . diff -Nru bison-3.5.1+dfsg/data/xslt/xml2text.xsl bison-3.8.2+dfsg/data/xslt/xml2text.xsl --- bison-3.5.1+dfsg/data/xslt/xml2text.xsl 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/xslt/xml2text.xsl 2021-06-23 04:48:48.000000000 +0000 @@ -3,7 +3,7 @@ + xmlns:bison="https://www.gnu.org/software/bison/"> @@ -52,7 +52,7 @@ Nonterminals useless in grammar - + @@ -65,7 +65,7 @@ Terminals unused in grammar - + @@ -136,6 +136,7 @@ + @@ -148,6 +149,9 @@ + + + @@ -157,14 +161,18 @@ + + + + - + on@left: @@ -173,7 +181,7 @@ - , + on@right: @@ -300,7 +308,7 @@ name="prev-lhs" select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]" /> - + @@ -311,7 +319,7 @@ - + @@ -347,12 +355,12 @@ - - . + + - - . + + diff -Nru bison-3.5.1+dfsg/data/xslt/xml2xhtml.xsl bison-3.8.2+dfsg/data/xslt/xml2xhtml.xsl --- bison-3.5.1+dfsg/data/xslt/xml2xhtml.xsl 2020-01-10 18:16:23.000000000 +0000 +++ bison-3.8.2+dfsg/data/xslt/xml2xhtml.xsl 2021-06-23 04:48:48.000000000 +0000 @@ -3,7 +3,7 @@ @@ -26,7 +26,7 @@ + xmlns:bison="https://www.gnu.org/software/bison/"> @@ -75,7 +75,7 @@ ol.lower-alpha { list-style-type: lower-alpha; } - .point { + .dot { color: #cc0000; } #footer { @@ -88,7 +88,7 @@