bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* critique of gnulib
@ 2019-08-31 21:46 Bruno Haible
  2019-08-31 23:20 ` Paul Eggert
  0 siblings, 1 reply; 13+ messages in thread
From: Bruno Haible @ 2019-08-31 21:46 UTC (permalink / raw)
  To: Jonas Termansen; +Cc: bug-gnulib

Dear Jonas,

Just discovered this critique of gnulib, that you wrote in 2016:
https://gitlab.com/sortix/sortix/wikis/Gnulib

It deserves a discussion.

> Gnulib is a portability layer but ironically fails to be portable,
> as it requires knowledge of implementation details of every supported
> operating system.

Yes, the word "portable" can mean two things:
  (a) a software can be compiled in a different environment without
      modifications,
  (b) a software can easily be modified for the different environment,
      so that it compiles there.

I share the disappointment with you: when I wanted to run "Portable
Common LOOPS" [1] in GNU clisp in 1992, I had to port it myself; it
wasn't portable in the sense (a) but in the sense (b).

For gnulib, sure, when you look into the files lib/mountlist.c or
lib/get_progname_of.c, you will find that often a new OS requires new
code there.

> The gnulib files included [i]n software releases tends to be rarely
> updated and bug fixes in gnulib can take several years to appear
> in most packages.

In which packages have you observed this? We would have to talk with
the maintainers of these packages, in order to understand the cause
of the problem.

> Some parts of gnulib are unnecessary and cause trouble in the modern
> world as it attempts to fix bugs in irrelevant ancient Unix systems.

This may happen, yes, unfortunately, and should be reported to bug-gnulib
when you encounter such trouble.

> Occasionally gnulib wraps standard library interfaces so code can be
> written with glibc assumptions. For instance, whether malloc(0)
> returns NULL or a unique pointer, which can't be detected at compile
> time, and the code should be rewritten to not make such assumptions
> (wrapping malloc might even make it more difficult for code analysis
> tools to detect bugs).

We are assuming that the people who run the code analysis tools do so
on glibc system, where gnulib does not wrap malloc. Developers that
use other OSes as their main OS where they run analysis tools are not
so much in the focus of the GNU project. We do care about them, but not
as much as about developers on glibc systems.

> Gnulib can occasionally cause more trouble than it solves.

These should be rare. When it occurs, feel free to report it.

> Gnulib may even indirectly have exploit mitigation counter-measures,
> as it prevents the standard library with exploit mitigations from
> being used, potentially making vulnerabilities even worse.

I don't understand this argument. Can you back it with some example,
please?

> Gnulib can be especially bad when cross-compiling, as it assumes the
> very worst about the operating system when it can't perform runtime
> tests, which leads to the maximum amount of gnulib being enabled.
> Depending on how much of gnulib is included, in the worst case, gnulib
> might attempt to replace large parts of the standard library.

All autoconf macros in gnulib have cross-compilation support for
glibc / musl systems and for native Windows, because these are the
systems for which cross-compilation is most frequently attempted.
For other platforms, we don't have made this effort, because on these
platforms programs are usually compiled natively, not cross.
And the effect of "replace large parts of the standard library" is not
that bad. Yes, it bloats the libraries and executables a bit. But that
can be afforded.

> The build system tends to assume that if it can't perform a runtime
> test, then you might have a very specific bug that got fixed in
> OpenBSD 1.4, even though you are not OpenBSD, and that OpenBSD 1.4
> is horribly ancient.

Yes, what you describe here is the Autoconf philosophy - test for a
particular bug, not for a particular operating system -, and Gnulib
follows this philosophy for the vast majority of its Autoconf tests.

It's a lesson that people learned in the 1990ies, but that is still
valid today: As e.g. the i18n code from NetBSD ("citrus") gets pulled
into other operating systems, it's no suitable to just test for NetBSD.
Or when you find many BeOS bugs to be also present in Haiku.

> The correct behavior should be assume the very best about unknown
> operating systems, and only assume a bug if the operating system
> is known to have the bug, and require the user to set the applicable
> environment variables with the true answers if gnulib guesses wrong.

No, the practice that you suggest produces more buggy programs,
because
  1. an unknown operating system often pulls in code or design from
     other operating systems,
  2. even in an OS written from scratch, the same mistakes can happen
     as have happened in existing OSes.

> Overall, you will likely find yourself wishing for gnulib to just go away.

From your perspective as an OS author, yes, the world would be nicer if
all OSes would implement POSIX to the letter and without bugs, and when
your OS equally implements POSIX to the letter and without bugs, all
applications run fine. But that's not how life is.

Also, the perspective of a package developer is not the same as the
perspective of an OS author.

> Build the port (and don't clean its directory). Look at what object
> files got built. Look for any object files that replace standard library
> functionality. Due to the utility functions and mostly innocuous wrappers
> (malloc(0) for instance), it requires a close look to determine whether
> the object file is undesirable.  If you found something that shouldn't
> be used, look at the corresponding m4 file that does the check (for
> lib/foo.c that's often m4/foo.m4) and understand why it was included.
> The configure output and config.log might be of use.

Yes, that's the recipe to follow when attempting to remove useless workarounds
for a given OS. Should I add text like this to the Gnulib manual?

> freadptr.c, freadseek.c, freadahead.c and SLOW_BUT_NO_HACKS and sometimes
> aborting.

Now that you added stdio-ext functions to your OS [2], the issue is fixed for
good and in the proper way (namely, the source code of these functions reside
in the libc of your OS).

> utimens.c not correctly realizing Sortix does the awesome option.

Feel free to report a bug about the corresponding .m4 macro.

> sprintf calls.

What do you mean? sprintf is a standardized libc function.

> If getgroups isn't available, GETGROUPS_T is assumed to int, not gid_t.

Systems which don't have getgroups() most often don't have 'gid_t',
therefore gnulib will make 'git_t' default to 'int'.

Bruno

[1] https://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/oop/clos/pcl/0.html
[2] https://gitlab.com/sortix/sortix/tree/master/libc/stdio_ext



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: critique of gnulib
  2019-08-31 21:46 critique of gnulib Bruno Haible
@ 2019-08-31 23:20 ` Paul Eggert
  2019-09-01 21:53   ` Jonas 'Sortie' Termansen
  0 siblings, 1 reply; 13+ messages in thread
From: Paul Eggert @ 2019-08-31 23:20 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Gnulib bugs, Jonas Termansen

Bruno Haible wrote:
> https://gitlab.com/sortix/sortix/wikis/Gnulib
>> sprintf calls.
> What do you mean? sprintf is a standardized libc function.

I imagine Jonas is referring to the practice of avoiding sprintf and using 
snprintf instead, under the theory that sprintf can be dangerous. Gnulib does 
not follow that practice; instead, it avoids dangerous uses of sprintf. 
Similarly for strcpy and for several other C functions that can be dangerous if 
misused.

The Gnulib style for sprintf helps avoid the common problem of inadvertently 
truncating strings.[1] Admittedly (and as Bruno knows) this has long been a 
controversial area.[2][3]

[1] 
https://wiki.sei.cmu.edu/confluence/display/c/STR03-C.+Do+not+inadvertently+truncate+a+string
[2] https://lists.gnu.org/archive/html/bug-gnulib/2004-09/msg00181.html
[3] https://sourceware.org/ml/libc-alpha/2002-01/msg00133.html


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: critique of gnulib
  2019-08-31 23:20 ` Paul Eggert
@ 2019-09-01 21:53   ` Jonas 'Sortie' Termansen
  2019-09-01 22:46     ` Paul Eggert
                       ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Jonas 'Sortie' Termansen @ 2019-09-01 21:53 UTC (permalink / raw)
  To: Paul Eggert, Bruno Haible; +Cc: Gnulib bugs

Hi Bruno & Paul,

Thanks for your interest in my notes on gnulib. I appreciate your desire
to discuss them. Please excuse some of the resources that I'll link
below for overreacting in jest ("screaming in horror", "usual gnulib
infection"), they weren’t really meant for upstream consumption, but
they do refer to true struggles that I've had to go through. I
understand and appreciate that you and I have different goals, but I
think we do have some common ground. I'll give you the context of my
notes below.

My goal is to make a good and clean  POSIX-like operating system, and to
enable other people to do so as well because healthy competition is good.

I have contributed to gnulib in the past. Although my main interest is
my operating systems project and I only work on ports as needed. This
year I am dedicating my time to my game development project, so I don't
have the resources to do OS work these days. Please excuse me if my
information is out of date.

I rather enjoy my operating systems work on Sortix, though, because I've
accomplished something extraordinary: A self-hosting POSIX-like system
made from scratch with key ports of third party software (about 75% of
ports compiles natively, so I rely on cross-compilation). What really
surprised me pleasantly was that I did not have the same backwards
compatibility concerns of a GNU/Linux system. By doing things in a
simple way without historical mistakes, my project got a good baseline
quality.

This really accomplishes the best qualities of a free software platform,
because all the code and ports are integrated and are easy to modify
(you can 'cd /src && make sysmerge' out of the box and the system is
updated to the new sources of everything). I'm free to compete with
other POSIX-like systems by making better implementations of the
standard interfaces and in turn encouraging other systems to improve.
Meanwhile I have encountered technical debt in other projects that I
port, and I sometimes fix those issues and contribute fixes upstream,
improving the health of the free software ecosystem.

My method for porting software is to cross-compile the software to my OS
(see <https://wiki.osdev.org/Cross-Porting_Software>). Sometimes I have
to fix some build system bugs. Then I fix the compile errors and
warnings, if any. That may require implementing some new features in my
OS. Finally it compiles and I run it. It might not work or crash, and I
fix those bugs too. Finally I package up the thing and I might send a
patch to the upstream if I like the software and it's easy and the
upstream seems receptive.

I find BSD software can be easier to port than GNU software, even though
it often does not even attempt to be portable. I can easily deal with it
because it simply fails to compile and I can easily figure out what I
need to provide, or just change the software to use a different feature.
Porting GNU software can be much harder to port because of complexities
in layers like autoconf or gnulib that cause problems that didn't need
to be there.

A big problem with gnulib is that good new operating systems are
unreasonably burdened because of the mistakes of buggy operating systems
(which may have been fixed long ago). A good example is e.g.
cross-compilation. For instance, an old Unix might not have had a broken
fork() system call or something. When cross-compiling, gnulib might be
pessimistic and default to assuming the system call is broken, which may
be handled with a poor or inefficient fallback, disabling functionality
at runtime, or a compile time error. There is usually a whitelist of
systems without the problem and an environment variable to inject the
true answer. That means that it's harder to compete with a new unknown
operating system because I must set the environment variable, while
other operating systems just work, including the buggy one. That means
my good operating system is paying for the complexity caused by a bad
operating system. I'd rather the extra work of cross-compiling is moved
to the buggy operating systems.

Cross-compilation is inherently a bit more difficult when the host
system is buggy, so a more reasonable design would could be to assume
the best about unknown operating systems, and to only invoke the
workarounds for known buggy systems (and forcing them to set the
environment variable instead of me). That means the buggy operating
systems pay the cost instead of the good ones (making it harder for new
systems). Making cross-compilation nice helps the development of new
operating systems, and not just for established things like glibc/musl.

As you saw in my gnulib wiki page, I literally inject 120 environment
variables to make gnulib assume the very best about my operating system.
I'd rather be confronted with bugs up front than have then be secretly
hidden by a portability layer, or be told that it assumed the worst
about my unknown operating system so I have to teach it internals about
my OS. I'd love if it was able to disable the gnulib bug replacements
and just get the bugs (if any). It doesn't help that gnulib contains 1)
implementations of missing functionality 2) workarounds for bugs,
including fallback implementations 3) and utility code shared between
projects. gnulib should really be restructured so these three are
separated. It's hard to find out if 1) or 2) got included, and I'd
rather know those things up front (so I can implement the features / fix
bugs).

It's fine that gnulib requires OS specific knowledge whenever POSIX
doesn't cover a feature (such as mountpoints) and the OS doesn't
implement that any interface that gnulib knows about.

Sorry, I don't have a list of packages with stale gnulib files, and such
a list would probably be stale by now. I assume you scan all the GNU
packages and other packages known to embed gnulib and ping them whenever
they forget to update. This was certainly a bad problem some years ago
when gnulib was worse at cross-compilation and I found myself having to
workaround the same bug over and again (trying to check for locale by
running cross-compiled programs), but it got better. But if config.sub
and config.guess is any indication, the delay for updating these things
can take years. For what it's worth, you can see the list of my patches
at <https://pub.sortix.org/sortix/release/nightly/patches/> although
many of my third party ports are a few years old by now. You can also
see my notes with personal opinions about each of my ports (including
gnulib) at <https://gitlab.com/sortix/sortix/wikis/Ports>.

I don't think I have a list of parts of gnulib that are troublesome on
modern systems. It is good to know that you're receptive to such
reports, I might report such cases when I come across them. Although I
suggest you audit the bugs that gnulib work around and simply get rid of
anything that doesn't affect any relevant system release from the past 5
years (or even 10, or this millennium).

I object to the attitude that code analysis tools should only really be
supported on glibc systems. A lot of security features are being
pioneered on other systems and making it easier for everyone to use
these tools benefits everyone

"Exploit mitigation counter-measures" is whenever a system has an
exploit mitigation and software goes out of its way to not take benefit.
A good example is the 2014 Heartbleed vulnerability where there was a
good old buffer overflow. OpenSSL was wrapping malloc with its own
allocation layer, which made use-after-free bugs worse and did not
support zeroing freed allocations. That meant that systems with a
hardened malloc (an exploit mitigation) such as OpenBSD, which would
have reduced the data leakage a lot, did not benefit from the exploit
mitigation. When gnulib wraps malloc, it's hardly as bad, but it does
replace the libc definition (which may contain attributes and other
features that help the compiler / code analysis tools detect bugs).
That's why I consider it really bad whenever software wraps malloc. I do
understand that assuming malloc(0) never returns NULL on success is a
deep assumption and it can be extremely difficult to audit GNU code for
such assumptions. Though I'd almost argue that systems whose malloc(0)
returns NULL on success might really bring that pain upon themselves.
Does any modern relevant system even do that? It might be fun to check
in my os-test project where I test every POSIX I could get my hands on.
I'd default to no for unknown systems when cross-compiling.

I do think it's very reasonable to test for particular bugs and that
it's the right thing to do, when possible. When cross-compiling, that's
not possible and the best bet should be listing known buggy operating
systems, not assuming the worst about unrelated systems. The big problem
is that the gnulib replacements that got used because gnulib was
pessimistic might be worse ((or less secure) than the operating system
provided features, or might even require being ported (once and over
again, unless I upstream support and wait years for it to get
downstream). As someone making a new OS, I'd much rather know about bugs
rather than sweeping them under the rug. In any case, gnulib can check
for these bugs when compiled natively, my point is about the
cross-compilation assumption which only really matters to developers
bootstrapping the new OS.

I recognize that different people (OS developers, packagers, users) have
slightly different needs here. In my case, packaging is done as part of
the OS development to get a fully consistent and integrated system. I'd
love if the users could download the upstream source code and build it,
although that's not so likely, as most software needs a patch (if just
to add my OS to config.sub, at least I got that upstream a couple years
ago, should be in many downstreams by now). My users will probably want
to get my modified sources if they want to build the software. Getting
to a point where upstream support me out of the box is many years away,
if ever.

Re adding that to the gnulib manual: I'd rather have you restructure the
project, and make it possible to disable the bug workarounds with a
--disable-gnulib-workarounds. That will make things easy for me and
other people too.

It's been a while since I looked at the stdio-ext functions, although
I'm not really sure why they need to exist. At least there is a way to
satisfy gnulib.

My libc warns about every sprintf use because I consider it an
inherently dangerous interface. Buffer allocation and string production
should not be decoupled as it leads to bugs. (Modern languages, such as
the one I develop at work, does simply not have these problems.) In C,
strdup should be used instead of strlen+malloc+strcpy/memcpy because
it's much less error prone. Generally asprintf should be used instead of
sprintf/snprintf because it does the buffer allocation for you and
significantly reduces the risk. At the very least snprintf should be
used, because the destination size must be known whenever sprintf is
used, or the code is a risk (I've seen plenty of such bugs or code
reeking of such bugs). You can see
<https://maxsi.org/coding/c-string-creation.html> about how I believe C
strings should be created.

I object to the notion that truncation is a worse outcome than a buffer
overflow. A buffer overflow is at worst a remote code execution
vulnerability, while a truncation is at worst a program bug (although
that may be exploitable in turn, it is not inherently exploitable). The
correct resolution is to not even have this class of problems in the
first place by not decoupling buffer allocation from the string
creation. That's why the resolution to the strcpy debate is not to have
a secure strcpy, but to instead use strdup. We need to be better than
expose ourselves to the risk of 1990's (and way earlier) security
vulnerabilities.

getgroups() is an interesting case. Often when making an OS, I have to
choose between having a feature, having a stub of a feature that doesn't
work, or not having the feature at all. It really depends on the
ecosystem. In this case, my OS doesn't properly implement users and
groups yet, and I simply don't have getgroups (although I do have
getgid). New systems will often be in this kind of inconsistent state.
Generally I prefer not to have features unless I really do implement
them, but sometimes a stub is required to get ports working that don't
truly need the feature. In any case, GETGROUPS_T should just check
whether gid_t is a type and then just use it instead of int.

To recap, my primary requests are:

1) Categorizing gnulib into three parts (replacement functions for when
they don't exist, workarounds for bugs, and utility functions).

2) Making it possible to disable the gnulib bug replacements with a
configure command line option.

3) Defaulting to assume the best when cross-compiling to unknown systems.

Thanks for listening. I believe that making gnulib better for
new/unknown operating systems will benefit everyone in the long run and
improves the health of the free software ecosystem. I'm close with the
hobbyist OS community and there really are a bunch of people like me
starting new projects and porting GNU software to try out new ideas.

Jonas



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: critique of gnulib
  2019-09-01 21:53   ` Jonas 'Sortie' Termansen
@ 2019-09-01 22:46     ` Paul Eggert
  2019-09-08 17:08       ` critique of gnulib - string allocation Bruno Haible
  2019-09-09  1:04       ` critique of gnulib - cross-compilation guesses Bruno Haible
  2019-09-08 17:20     ` critique of gnulib - stdioext Bruno Haible
                       ` (2 subsequent siblings)
  3 siblings, 2 replies; 13+ messages in thread
From: Paul Eggert @ 2019-09-01 22:46 UTC (permalink / raw)
  To: Jonas 'Sortie' Termansen, Bruno Haible; +Cc: Gnulib bugs

Thanks for your thoughtful reply. A few points:

Jonas 'Sortie' Termansen wrote:

> I object to the notion that truncation is a worse outcome than a buffer
> overflow. A buffer overflow is at worst a remote code execution
> vulnerability, while a truncation is at worst a program bug (although
> that may be exploitable in turn, it is not inherently exploitable).

We look at things a different way. Buffer overflows are easily caught by 
widely-available tools, and if remote code execution is a problem then one ought 
to be using such tools. In contrast, silent truncation bugs cannot be caught 
easily and automatically, so these bugs are much harder to find and fix. If one 
looks at the overall bug burden, silent truncations are probably a worse problem 
for Gnulib-like code than buffer overflows are.  (Integer overflows are probably 
worse than either.)

Of course this is a judgment call and your judgment might differ. Still, there's 
a lot to say for the GNU tradition of refusing to impose arbitrary limits (as 
snprintf-using code usually does), and it's reasonable to follow that tradition.

> Generally asprintf should be used instead of
> sprintf/snprintf because it does the buffer allocation for you and
> significantly reduces the risk.

asprintf is often a good way to go, and Gnulib uses it. However, like sprintf 
and snprintf, asprintf mishandles large buffers and so careful code cannot use 
it to both allocate and format large results - which means that careful code 
must do the "risky" stuff anyway since asprintf is not up to the task.

> To recap, my primary requests are:
> 
> 1) Categorizing gnulib into three parts (replacement functions for when
> they don't exist, workarounds for bugs, and utility functions).
> 
> 2) Making it possible to disable the gnulib bug replacements with a
> configure command line option.
> 
> 3) Defaulting to assume the best when cross-compiling to unknown systems.

(3) shouldn't be that hard to do, though it would be tedious. (2) sounds 
trickier, since not everybody agrees about what's a "bug" (are we talking about 
a bug relative to C11? to C99? to POSIX-2017? to current GNU? that sort of 
thing). I don't see the categories in (1) as being that sharp or useful, but 
perhaps I'm missing something.

To my mind, the most important feature needed is to make it easy to do reliable 
cross-compiling, by letting the builder supply a method for 'configure' to run a 
program on the target platform. This would be an Autoconf feature, not a Gnulib 
feature. It would have addressed many of your problems. It's been on the 
Autoconf to-do list nearly forever, alas.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: critique of gnulib - string allocation
  2019-09-01 22:46     ` Paul Eggert
@ 2019-09-08 17:08       ` Bruno Haible
  2019-09-08 17:47         ` Ben Pfaff
  2019-09-08 20:17         ` Paul Eggert
  2019-09-09  1:04       ` critique of gnulib - cross-compilation guesses Bruno Haible
  1 sibling, 2 replies; 13+ messages in thread
From: Bruno Haible @ 2019-09-08 17:08 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Gnulib bugs, Jonas 'Sortie' Termansen

Jonas Termansen wrote:
> > Buffer allocation and string production
> > should not be decoupled as it leads to bugs. (Modern languages, such as
> > the one I develop at work, does simply not have these problems.) In C,
> > strdup should be used instead of strlen+malloc+strcpy/memcpy because
> > it's much less error prone. Generally asprintf should be used instead of
> > sprintf/snprintf because it does the buffer allocation for you and
> > significantly reduces the risk.
> > ...
> > The
> > correct resolution is to not even have this class of problems in the
> > first place by not decoupling buffer allocation from the string
> > creation.

This is something I can support. The problem is that asprintf is often
considered overkill, because it has to parse a format string first.
Application programmers don't care about this, by system programmers do.

What can we do about it? If gnulib offers some convenience functions

   char * concatenated_string2 (const char *string1, const char *string2);
   char * concatenated_string3 (const char *string1, const char *string2,
                                const char *string3);
   char * concatenated_string4 (const char *string1, const char *string2,
                                const char *string3, const char *string4);

it only solves half of the problem, because often a concatenation involves
a substring, and system programmers don't want to do an intermediate
memory allocation for the substring.

So, what we would need is are functions

   char * substring (const char *string, size_t length);
   char * concatenated_string2 (const char *string1, size_t length1,
                                const char *string2, size_t length2);
   char * concatenated_string3 (const char *string1, size_t length1,
                                const char *string2, size_t length2,
                                const char *string3, size_t length3);
   ...

where the length arguments are set to SIZE_MAX to designate the entire
string.

How does that sound? Should we add something like that to gnulib?

Paul Eggert wrote:
> asprintf is often a good way to go, and Gnulib uses it. However, like sprintf 
> and snprintf, asprintf mishandles large buffers and so careful code cannot use 
> it to both allocate and format large results - which means that careful code 
> must do the "risky" stuff anyway since asprintf is not up to the task.

What do you mean by "asprintf mishandles large buffers"? The fact that an error
occurs if the result is longer than INT_MAX characters? Really, we have data
larger than 2 GB in many places, but *strings* larger than 2 GB? You can't send
a mail of that size, nor open a file with a line that is that long in any text
editor except Emacs.

In GNU gettext, I make plenty of use of xasprintf. What are the risks?

Bruno



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: critique of gnulib - stdioext
  2019-09-01 21:53   ` Jonas 'Sortie' Termansen
  2019-09-01 22:46     ` Paul Eggert
@ 2019-09-08 17:20     ` Bruno Haible
  2019-09-08 17:28     ` critique of gnulib - malloc wrapper Bruno Haible
  2019-09-09  1:24     ` critique of gnulib - disabling workarounds Bruno Haible
  3 siblings, 0 replies; 13+ messages in thread
From: Bruno Haible @ 2019-09-08 17:20 UTC (permalink / raw)
  To: Jonas 'Sortie' Termansen; +Cc: Paul Eggert, Gnulib bugs

Jonas Termansen wrote:
> It's been a while since I looked at the stdio-ext functions, although
> I'm not really sure why they need to exist. At least there is a way to
> satisfy gnulib.

These functions exist
  a) to enable important functionality that has been forgotten by the ISO C
     standards authors, e.g.
       - fseterr (why should a custom/extended printf implementation not be
         able to set the error indicator of a stream?)
       - fpending (needed when, at the end of a program, we want to flush
         stdout in a safe way, but without introducing unneeded system calls).
  b) as an optimization, so that e.g. GNU m4 does not need to copy the contents
     of the FILE buffers into its own buffers, but can already do searches
     for newlines and parentheses directly in the FILE buffers.

Bruno



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: critique of gnulib - malloc wrapper
  2019-09-01 21:53   ` Jonas 'Sortie' Termansen
  2019-09-01 22:46     ` Paul Eggert
  2019-09-08 17:20     ` critique of gnulib - stdioext Bruno Haible
@ 2019-09-08 17:28     ` Bruno Haible
  2019-09-09  1:24     ` critique of gnulib - disabling workarounds Bruno Haible
  3 siblings, 0 replies; 13+ messages in thread
From: Bruno Haible @ 2019-09-08 17:28 UTC (permalink / raw)
  To: Jonas 'Sortie' Termansen; +Cc: Paul Eggert, Gnulib bugs

Jonas Termansen wrote:
> I object to the attitude that code analysis tools should only really be
> supported on glibc systems. A lot of security features are being
> pioneered on other systems and making it easier for everyone to use
> these tools benefits everyone
> 
> "Exploit mitigation counter-measures" is whenever a system has an
> exploit mitigation and software goes out of its way to not take benefit.
> A good example is the 2014 Heartbleed vulnerability where there was a
> good old buffer overflow. OpenSSL was wrapping malloc with its own
> allocation layer, which made use-after-free bugs worse and did not
> support zeroing freed allocations. That meant that systems with a
> hardened malloc (an exploit mitigation) such as OpenBSD, which would
> have reduced the data leakage a lot, did not benefit from the exploit
> mitigation. ...

The gnulib malloc wrapper is not an as severe problem as you might think.
It is only enabled
  - on AIX, because malloc(0) -> NULL on this platform,
  - on native Windows, because malloc does not errno upon failure,
  - in cross-compiles - a problem for which we are searching a solution.

When you say "A lot of security features are being pioneered on other systems",
these are mostly BSD and research OSes, not AIX nor native Windows.

Bruno



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: critique of gnulib - string allocation
  2019-09-08 17:08       ` critique of gnulib - string allocation Bruno Haible
@ 2019-09-08 17:47         ` Ben Pfaff
  2019-09-08 20:17         ` Paul Eggert
  1 sibling, 0 replies; 13+ messages in thread
From: Ben Pfaff @ 2019-09-08 17:47 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Jonas 'Sortie' Termansen, Paul Eggert, Gnulib bugs

On Sun, Sep 8, 2019 at 10:08 AM Bruno Haible <bruno@clisp.org> wrote:
> So, what we would need is are functions
>
>    char * substring (const char *string, size_t length);
>    char * concatenated_string2 (const char *string1, size_t length1,
>                                 const char *string2, size_t length2);
>    char * concatenated_string3 (const char *string1, size_t length1,
>                                 const char *string2, size_t length2,
>                                 const char *string3, size_t length3);
>    ...
>
> where the length arguments are set to SIZE_MAX to designate the entire
> string.

I think that substring() is the same as xstrndup().


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: critique of gnulib - string allocation
  2019-09-08 17:08       ` critique of gnulib - string allocation Bruno Haible
  2019-09-08 17:47         ` Ben Pfaff
@ 2019-09-08 20:17         ` Paul Eggert
  2019-09-08 20:58           ` Bruno Haible
  1 sibling, 1 reply; 13+ messages in thread
From: Paul Eggert @ 2019-09-08 20:17 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Gnulib bugs, Jonas 'Sortie' Termansen

On 9/8/19 10:08 AM, Bruno Haible wrote:
> What do you mean by "asprintf mishandles large buffers"? The fact that an error
> occurs if the result is longer than INT_MAX characters? Really, we have data
> larger than 2 GB in many places, but *strings* larger than 2 GB?

Sure, in Emacs:

(length (make-string (ash 1 31) ?x))
2147483648

or in regular-expression matchers:

$ truncate -s 2GiB big
$ printf '\nx\n' >>big
$ ls -l big
-rw-r--r-- 1 eggert eggert 2147483651 Sep  8 13:15 big
$ grep -a x big
x

or in other places where GNU tools use strings to represent arbitrary 
user-specified data. The GNU coding standards say to avoid arbitrary limits, and 
on 64-bit platforms we should avoid arbitrary 32-bit limits on the lengths of 
strings.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: critique of gnulib - string allocation
  2019-09-08 20:17         ` Paul Eggert
@ 2019-09-08 20:58           ` Bruno Haible
  2019-09-08 23:29             ` Paul Eggert
  0 siblings, 1 reply; 13+ messages in thread
From: Bruno Haible @ 2019-09-08 20:58 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Gnulib bugs, Jonas 'Sortie' Termansen

Paul Eggert wrote:
> The GNU coding standards say to avoid arbitrary limits, and 
> on 64-bit platforms we should avoid arbitrary 32-bit limits on the lengths of 
> strings.

Well, then we need variants of the *printf functions that return an 'ssize_t'
instead of an 'int'.

Do you happen to know the opinion of the glibc people on this topic?

Bruno




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: critique of gnulib - string allocation
  2019-09-08 20:58           ` Bruno Haible
@ 2019-09-08 23:29             ` Paul Eggert
  0 siblings, 0 replies; 13+ messages in thread
From: Paul Eggert @ 2019-09-08 23:29 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Gnulib bugs, Jonas 'Sortie' Termansen

On 9/8/19 1:58 PM, Bruno Haible wrote:
> Well, then we need variants of the *printf functions that return an 'ssize_t'
> instead of an 'int'.
> 
> Do you happen to know the opinion of the glibc people on this topic?

Sorry, no. I imagine it's come up.

I would suggest ptrdiff_t rather than ssize_t, as the latter was 'int' on some 
old 64-bit platforms whereas ptrdiff_t never had that problem, and Glibc malloc 
now prohibits objects larger than PTRDIFF_MAX bytes.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: critique of gnulib - cross-compilation guesses
  2019-09-01 22:46     ` Paul Eggert
  2019-09-08 17:08       ` critique of gnulib - string allocation Bruno Haible
@ 2019-09-09  1:04       ` Bruno Haible
  1 sibling, 0 replies; 13+ messages in thread
From: Bruno Haible @ 2019-09-09  1:04 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Gnulib bugs, Jonas 'Sortie' Termansen

Jonas Termansen wrote:
> > A good example is e.g.
> > cross-compilation. For instance, an old Unix might not have had a broken
> > fork() system call or something. When cross-compiling, gnulib might be
> > pessimistic and default to assuming the system call is broken, which may
> > be handled with a poor or inefficient fallback, disabling functionality
> > at runtime, or a compile time error. There is usually a whitelist of
> > systems without the problem and an environment variable to inject the
> > true answer. That means that it's harder to compete with a new unknown
> > operating system because I must set the environment variable, while
> > other operating systems just work, including the buggy one. That means
> > my good operating system is paying for the complexity caused by a bad
> > operating system. I'd rather the extra work of cross-compiling is moved
> > to the buggy operating systems.
> > 
> > Cross-compilation is inherently a bit more difficult when the host
> > system is buggy, so a more reasonable design would could be to assume
> > the best about unknown operating systems, and to only invoke the
> > workarounds for known buggy systems (and forcing them to set the
> > environment variable instead of me). That means the buggy operating
> > systems pay the cost instead of the good ones (making it harder for new
> > systems). Making cross-compilation nice helps the development of new
> > operating systems, and not just for established things like glibc/musl.
> > 
> > As you saw in my gnulib wiki page, I literally inject 120 environment
> > variables to make gnulib assume the very best about my operating system.
> > I'd rather be confronted with bugs up front than have then be secretly
> > hidden by a portability layer ...

> > 3) Defaulting to assume the best when cross-compiling to unknown systems.

Paul Eggert wrote:
> (3) shouldn't be that hard to do, though it would be tedious.

Here's the patch that implements a configure option to "assume the best"
instead of "assume the worst". I've called it 'risky', so people know that
it's risky to enable it.

I've put it into gnulib-common.m4, although a couple of macros in Autoconf's
functions.m4 could also profit from it. The reason is that an Autoconf
release is likely not going to happen soon.

It handles all your 120 variables, and more.


2019-09-08  Bruno Haible  <bruno@clisp.org>

	Add option to assume the best, not the worst, when cross-compiling.
	Suggested by Jonas Termansen <sortie@maxsi.org>.
	* m4/gnulib-common.m4 (gl_COMMON_BODY): Add --enable-cross-guesses=...
	option. Set gl_cross_guess_normal and gl_cross_guess_inverted.
	* m4/argz.m4 (gl_FUNC_ARGZ): Obey --enable-cross-guesses for
	lt_cv_sys_argz_works.
	* m4/calloc.m4 (_AC_FUNC_CALLOC_IF): Obey --enable-cross-guesses for
	ac_cv_func_calloc_0_nonnull.
	* m4/canonicalize.m4 (gl_FUNC_REALPATH_WORKS): Obey
	--enable-cross-guesses for gl_cv_func_realpath_works.
	* m4/cbrtl.m4 (gl_FUNC_CBRTL): Obey --enable-cross-guesses for
	gl_cv_func_cbrtl_ieee.
	* m4/ceil.m4 (gl_FUNC_CEIL): Obey --enable-cross-guesses for
	gl_cv_func_ceil_ieee.
	* m4/ceilf.m4 (gl_FUNC_CEILF): Obey --enable-cross-guesses for
	gl_cv_func_ceilf_ieee.
	* m4/ceill.m4 (gl_FUNC_CEILL): Obey --enable-cross-guesses for
	gl_cv_func_ceill_ieee.
	* m4/chown.m4 (AC_FUNC_CHOWN): Obey --enable-cross-guesses for
	ac_cv_func_chown_works.
	(gl_FUNC_CHOWN): Obey --enable-cross-guesses for
	gl_cv_func_chown_slash_works, gl_cv_func_chown_ctime_works.
	* m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Obey
	--enable-cross-guesses for gl_cv_struct_dirent_d_ino.
	* m4/exp2l.m4 (gl_FUNC_EXP2L): Obey --enable-cross-guesses for
	gl_cv_func_exp2l_works, gl_cv_func_exp2l_ieee.
	* m4/expl.m4 (gl_FUNC_EXPL): Obey --enable-cross-guesses for
	gl_cv_func_expl_works.
	* m4/expm1.m4 (gl_FUNC_EXPM1): Obey --enable-cross-guesses for
	gl_cv_func_expm1_ieee.
	* m4/expm1l.m4 (gl_FUNC_EXPM1L): Obey --enable-cross-guesses for
	gl_cv_func_expm1l_works.
	* m4/fchdir.m4 (gl_FUNC_FCHDIR): Obey --enable-cross-guesses for
	gl_cv_func_open_directory_works.
	* m4/fchownat.m4 (gl_FUNC_FCHOWNAT_DEREF_BUG): Obey
	--enable-cross-guesses for gl_cv_func_fchownat_nofollow_works.
	(gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG): Obey --enable-cross-guesses for
	gl_cv_func_fchownat_empty_filename_works.
	* m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Obey --enable-cross-guesses for
	gl_cv_func_fdopendir_works.
	* m4/floor.m4 (gl_FUNC_FLOOR): Obey --enable-cross-guesses for
	gl_cv_func_floor_ieee.
	* m4/floorf.m4 (gl_FUNC_FLOORF): Obey --enable-cross-guesses for
	gl_cv_func_floorf_ieee.
	* m4/fma.m4 (gl_FUNC_FMA_WORKS): Obey --enable-cross-guesses for
	gl_cv_func_fma_works.
	* m4/fmaf.m4 (gl_FUNC_FMAF_WORKS): Obey --enable-cross-guesses for
	gl_cv_func_fmaf_works.
	* m4/fmal.m4 (gl_FUNC_FMAL_WORKS): Obey --enable-cross-guesses for
	gl_cv_func_fmal_works.
	* m4/fmod.m4 (gl_FUNC_FMOD): Obey --enable-cross-guesses for
	gl_cv_func_fmod_ieee.
	* m4/fmodf.m4 (gl_FUNC_FMODF): Obey --enable-cross-guesses for
	gl_cv_func_fmodf_ieee.
	* m4/fmodl.m4 (gl_FUNC_FMODL): Obey --enable-cross-guesses for
	gl_cv_func_fmodl_ieee.
	* m4/fpurge.m4 (gl_FUNC_FPURGE): Obey --enable-cross-guesses for
	gl_cv_func_fpurge_works.
	* m4/getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX): Obey
	--enable-cross-guesses for gl_cv_func_getcwd_path_max.
	* m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Obey --enable-cross-guesses for
	gl_cv_func_getcwd_null.
	(gl_FUNC_GETCWD): Update for getcwd-path-max.m4 change.
	* m4/getdelim.m4 (gl_FUNC_GETDELIM): Obey --enable-cross-guesses for
	gl_cv_func_working_getdelim.
	* m4/getgroups.m4 (AC_FUNC_GETGROUPS): Obey --enable-cross-guesses for
	ac_cv_func_getgroups_works. Keep this macro also in Autoconf >= 2.70.
	(gl_FUNC_GETGROUPS): Obey --enable-cross-guesses for
	gl_cv_func_getgroups_works.
	* m4/getline.m4 (gl_FUNC_GETLINE): Obey --enable-cross-guesses for
	am_cv_func_working_getline.
	* m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Obey --enable-cross-guesses
	for gl_cv_func_getopt_gnu.
	* m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY_CLOBBER): Obey
	--enable-cross-guesses for gl_cv_func_gettimeofday_clobber.
	* m4/hypot.m4 (gl_FUNC_HYPOT): Obey --enable-cross-guesses for
	gl_cv_func_hypot_ieee.
	* m4/hypotf.m4 (gl_FUNC_HYPOTF): Obey --enable-cross-guesses for
	gl_cv_func_hypotf_ieee.
	* m4/hypotl.m4 (gl_FUNC_HYPOTL): Obey --enable-cross-guesses for
	gl_cv_func_hypotl_ieee.
	* m4/iconv_open-utf.m4 (gl_FUNC_ICONV_OPEN_UTF_SUPPORT): Obey
	--enable-cross-guesses for gl_cv_func_iconv_supports_utf.
	* m4/link.m4 (gl_FUNC_LINK): Obey --enable-cross-guesses for
	gl_cv_func_link_works.
	* m4/linkat.m4 (gl_FUNC_LINKAT): Obey --enable-cross-guesses for
	gl_cv_func_linkat_slash.
	* m4/log.m4 (gl_FUNC_LOG): Obey --enable-cross-guesses for
	gl_cv_func_log_ieee.
	* m4/logf.m4 (gl_FUNC_LOGF): Obey --enable-cross-guesses for
	gl_cv_func_logf_ieee.
	* m4/logl.m4 (gl_FUNC_LOGL_WORKS): Obey --enable-cross-guesses for
	gl_cv_func_logl_works.
	* m4/log10.m4 (gl_FUNC_LOG10): Obey --enable-cross-guesses for
	gl_cv_func_log10_ieee.
	* m4/log10f.m4 (gl_FUNC_LOG10F): Obey --enable-cross-guesses for
	gl_cv_func_log10f_ieee.
	* m4/log10l.m4 (gl_FUNC_LOG10L_WORKS): Obey --enable-cross-guesses for
	gl_cv_func_log10l_works.
	* m4/log1p.m4 (gl_FUNC_LOG1P): Obey --enable-cross-guesses for
	gl_cv_func_log1p_ieee.
	* m4/log1pf.m4 (gl_FUNC_LOG1PF): Obey --enable-cross-guesses for
	gl_cv_func_log1pf_ieee.
	* m4/log1pl.m4 (gl_FUNC_LOG1PL): Obey --enable-cross-guesses for
	gl_cv_func_log1pl_ieee.
	* m4/log2.m4 (gl_FUNC_LOG2): Obey --enable-cross-guesses for
	gl_cv_func_log2_ieee.
	* m4/log2f.m4 (gl_FUNC_LOG2F): Obey --enable-cross-guesses for
	gl_cv_func_log2f_ieee.
	* m4/lstat.m4 (gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK): Obey
	--enable-cross-guesses for
	gl_cv_func_lstat_dereferences_slashed_symlink.
	* m4/malloc.m4 (_AC_FUNC_MALLOC_IF): Obey --enable-cross-guesses for
	ac_cv_func_malloc_0_nonnull. Keep this macro also in Autoconf >= 2.70.
	* m4/mbrtowc.m4 (gl_MBRTOWC_C_LOCALE): Obey --enable-cross-guesses for
	gl_cv_C_locale_sans_EILSEQ.
	* m4/memchr.m4 (gl_FUNC_MEMCHR): Obey --enable-cross-guesses for
	gl_cv_func_memchr_works.
	* m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE): Obey --enable-cross-guesses for
	gl_cv_func_memmem_works_always.
	(gl_FUNC_MEMMEM): Obey --enable-cross-guesses for
	gl_cv_func_memmem_works_fast.
	* m4/mkdir.m4 (gl_FUNC_MKDIR): Obey --enable-cross-guesses for
	gl_cv_func_mkdir_trailing_slash_works,
	gl_cv_func_mkdir_trailing_dot_works.
	* m4/mkfifo.m4 (gl_FUNC_MKFIFO): Obey --enable-cross-guesses for
	gl_cv_func_mkfifo_works.
	* m4/mknod.m4 (gl_FUNC_MKNOD): Obey --enable-cross-guesses for
	gl_cv_func_mknod_works.
	* m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Obey --enable-cross-guesses for
	gl_cv_func_working_mkstemp.
	* m4/mktime.m4 (gl_FUNC_MKTIME_WORKS): Obey --enable-cross-guesses for
	gl_cv_func_working_mktime.
	* m4/modf.m4 (gl_FUNC_MODF): Obey --enable-cross-guesses for
	gl_cv_func_modf_ieee.
	* m4/modff.m4 (gl_FUNC_MODFF): Obey --enable-cross-guesses for
	gl_cv_func_modff_ieee.
	* m4/modfl.m4 (gl_FUNC_MODFL): Obey --enable-cross-guesses for
	gl_cv_func_modfl_ieee.
	* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Obey --enable-cross-guesses for
	gl_cv_func_nanosleep.
	* m4/perror.m4 (gl_FUNC_PERROR): Obey --enable-cross-guesses for
	gl_cv_func_perror_works.
	* m4/printf.m4 (gl_PRINTF_SIZES_C99): Obey --enable-cross-guesses for
	gl_cv_func_printf_sizes_c99.
	(gl_PRINTF_INFINITE): Obey --enable-cross-guesses for
	gl_cv_func_printf_infinite.
	(gl_PRINTF_INFINITE_LONG_DOUBLE): Obey --enable-cross-guesses for
	gl_cv_func_printf_infinite_long_double.
	(gl_PRINTF_DIRECTIVE_A): Obey --enable-cross-guesses for
	gl_cv_func_printf_directive_a.
	(gl_PRINTF_DIRECTIVE_F): Obey --enable-cross-guesses for
	gl_cv_func_printf_directive_f.
	(gl_PRINTF_FLAG_ZERO): Obey --enable-cross-guesses for
	gl_cv_func_printf_flag_zero.
	(gl_PRINTF_ENOMEM): Obey --enable-cross-guesses for
	gl_cv_func_printf_enomem.
	(gl_SNPRINTF_TRUNCATION_C99): Obey --enable-cross-guesses for
	gl_cv_func_snprintf_truncation_c99.
	(gl_SNPRINTF_RETVAL_C99): Obey --enable-cross-guesses for
	gl_cv_func_snprintf_retval_c99.
	(gl_SNPRINTF_DIRECTIVE_N): Obey --enable-cross-guesses for
	gl_cv_func_snprintf_directive_n.
	(gl_VSNPRINTF_ZEROSIZE_C99): Obey --enable-cross-guesses for
	gl_cv_func_vsnprintf_zerosize_c99.
	* m4/pselect.m4 (gl_FUNC_PSELECT): Obey --enable-cross-guesses for
	gl_cv_func_pselect_detects_ebadf.
	* m4/pthread_rwlock_rdlock.m4 (gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER):
	Obey --enable-cross-guesses for
	gl_cv_pthread_rwlock_rdlock_prefer_writer.
	* m4/ptsname.m4 (gl_FUNC_PTSNAME): Obey --enable-cross-guesses for
	gl_cv_func_ptsname_sets_errno.
	* m4/putenv.m4 (gl_FUNC_PUTENV): Obey --enable-cross-guesses for
	gl_cv_func_svid_putenv.
	* m4/readlink.m4 (gl_FUNC_READLINK): Obey --enable-cross-guesses for
	gl_cv_func_readlink_works.
	* m4/realloc.m4 (_AC_FUNC_REALLOC_IF): Obey --enable-cross-guesses for
	ac_cv_func_realloc_0_nonnull. Keep this macro also in Autoconf >= 2.70.
	* m4/regex.m4 (gl_REGEX): Obey --enable-cross-guesses for
	gl_cv_func_re_compile_pattern_working.
	* m4/remainder.m4 (gl_FUNC_REMAINDER): Obey --enable-cross-guesses for
	gl_cv_func_remainder_ieee.
	* m4/remainderf.m4 (gl_FUNC_REMAINDERF): Obey --enable-cross-guesses for
	gl_cv_func_remainderf_ieee.
	* m4/remainderl.m4 (gl_FUNC_REMAINDERL): Obey --enable-cross-guesses for
	gl_cv_func_remainderl_ieee.
	* m4/rintl.m4 (gl_FUNC_RINTL): Obey --enable-cross-guesses for
	gl_cv_func_rintl_works.
	* m4/rmdir.m4 (gl_FUNC_RMDIR): Obey --enable-cross-guesses for
	gl_cv_func_rmdir_works.
	* m4/round.m4 (gl_FUNC_ROUND): Obey --enable-cross-guesses for
	gl_cv_func_round_ieee.
	* m4/roundf.m4 (gl_FUNC_ROUNDF): Obey --enable-cross-guesses for
	gl_cv_func_roundf_ieee.
	* m4/roundl.m4 (gl_FUNC_ROUNDL): Obey --enable-cross-guesses for
	gl_cv_func_roundl_ieee.
	* m4/select.m4 (gl_FUNC_SELECT): Obey --enable-cross-guesses for
	gl_cv_func_select_detects_ebadf.
	* m4/setenv.m4 (gl_FUNC_SETENV): Obey --enable-cross-guesses for
	gl_cv_func_setenv_works.
	(gl_FUNC_UNSETENV): Obey --enable-cross-guesses for
	gl_cv_func_unsetenv_works.
	* m4/signbit.m4 (gl_SIGNBIT): Obey --enable-cross-guesses for
	gl_cv_func_signbit, gl_cv_func_signbit_gcc.
	* m4/sleep.m4 (gl_FUNC_SLEEP): Obey --enable-cross-guesses for
	gl_cv_func_sleep_works.
	* m4/stat.m4 (gl_FUNC_STAT): Obey --enable-cross-guesses for
	gl_cv_func_stat_file_slash.
	* m4/stpncpy.m4 (gl_FUNC_STPNCPY): Obey --enable-cross-guesses for
	gl_cv_func_stpncpy.
	* m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE): Obey
	--enable-cross-guesses for gl_cv_func_strcasestr_works_always.
	(gl_FUNC_STRCASESTR): Obey --enable-cross-guesses for
	gl_cv_func_strcasestr_linear.
	* m4/strerror.m4 (gl_FUNC_STRERROR): Obey --enable-cross-guesses for
	gl_cv_func_working_strerror.
	(gl_FUNC_STRERROR_0): Obey --enable-cross-guesses for
	gl_cv_func_strerror_0_works.
	* m4/strerror_r.m4 (gl_FUNC_STRERROR_R_WORKS): Obey
	--enable-cross-guesses for gl_cv_func_strerror_r_works.
	* m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE): Obey --enable-cross-guesses for
	gl_cv_func_strstr_works_always.
	(gl_FUNC_STRSTR): Obey --enable-cross-guesses for
	gl_cv_func_strstr_linear.
	* m4/strtod.m4 (gl_FUNC_STRTOD): Obey --enable-cross-guesses for
	gl_cv_func_strtod_works.
	* m4/strtold.m4 (gl_FUNC_STRTOLD): Obey --enable-cross-guesses for
	gl_cv_func_strtold_works.
	* m4/symlink.m4 (gl_FUNC_SYMLINK): Obey --enable-cross-guesses for
	gl_cv_func_symlink_works.
	* m4/symlinkat.m4 (gl_FUNC_SYMLINKAT): Obey --enable-cross-guesses for
	gl_cv_func_symlinkat_works.
	* m4/trunc.m4 (gl_FUNC_TRUNC): Obey --enable-cross-guesses for
	gl_cv_func_trunc_ieee.
	* m4/truncf.m4 (gl_FUNC_TRUNCF): Obey --enable-cross-guesses for
	gl_cv_func_truncf_ieee.
	* m4/truncl.m4 (gl_FUNC_TRUNCL): Obey --enable-cross-guesses for
	gl_cv_func_truncl_ieee.
	* m4/tzset.m4 (gl_FUNC_TZSET_CLOBBER): Obey --enable-cross-guesses for
	gl_cv_func_tzset_clobber.
	* m4/ungetc.m4 (gl_FUNC_UNGETC_WORKS): Obey --enable-cross-guesses for
	gl_cv_func_ungetc_works.
	* m4/unlink.m4 (gl_FUNC_UNLINK): Obey --enable-cross-guesses for
	gl_cv_func_unlink_honors_slashes, gl_cv_func_unlink_parent_fails.
	* m4/usleep.m4 (gl_FUNC_USLEEP): Obey --enable-cross-guesses for
	gl_cv_func_usleep_works.
	* m4/utimens.m4 (gl_UTIMENS): Obey --enable-cross-guesses for
	gl_cv_func_futimesat_works.
	* m4/utimes.m4 (gl_FUNC_UTIMES): Obey --enable-cross-guesses for
	gl_cv_func_working_utimes.
	* m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Obey --enable-cross-guesses for
	gl_cv_func_wcwidth_works.
	* m4/glob.m4 (gl_GLOB): When cross-compiling, don't create symlinks for
	testing. Obey --enable-cross-guesses for gl_cv_glob_lists_symlinks.
	* m4/rename.m4 (gl_FUNC_RENAME): When cross-compiling, don't create
	links for testing. Obey --enable-cross-guesses for
	gl_cv_func_rename_slash_dst_works, gl_cv_func_rename_slash_src_works,
	gl_cv_func_rename_link_works, gl_cv_func_rename_dest_works.

diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 57b94ed..ee85250 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 44
+# gnulib-common.m4 serial 45
 dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -115,6 +115,33 @@ AC_DEFUN([gl_COMMON_BODY], [
        errno.  */
 #define _GL_ASYNC_SAFE
 ])
+  dnl Hint which direction to take regarding cross-compilation guesses:
+  dnl When a user installs a program on a platform they are not intimately
+  dnl familiar with, --enable-cross-guesses=conservative is the appropriate
+  dnl choice.  It implements the "If we don't know, assume the worst" principle.
+  dnl However, when an operating system developer (on a platform which is not
+  dnl yet known to gnulib) builds packages for their platform, they want to
+  dnl expose, not hide, possible platform bugs; in this case,
+  dnl --enable-cross-guesses=risky is the appropriate choice.
+  dnl Sets the variables
+  dnl gl_cross_guess_normal    (to be used when 'yes' is good and 'no' is bad),
+  dnl gl_cross_guess_inverted  (to be used when 'no' is good and 'yes' is bad).
+  AC_ARG_ENABLE([cross-guesses],
+    [AS_HELP_STRING([--enable-cross-guesses={conservative|risky}],
+       [specify policy for cross-compilation guesses])],
+    [if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then
+       AC_MSG_WARN([invalid argument supplied to --enable-cross-guesses])
+       enableval=conservative
+     fi
+     gl_cross_guesses="$enableval"],
+    [gl_cross_guesses=conservative])
+  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
   dnl Preparation for running test programs:
   dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not
   dnl to /dev/tty, so they can be redirected to log files.  Such diagnostics
diff --git a/m4/argz.m4 b/m4/argz.m4
index b22edf2..c0a0a63 100644
--- a/m4/argz.m4
+++ b/m4/argz.m4
@@ -7,7 +7,7 @@
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 12 argz.m4
+# serial 13 argz.m4
 
 AC_DEFUN([gl_FUNC_ARGZ],
 [gl_PREREQ_ARGZ
@@ -47,7 +47,7 @@ AS_IF([test -z "$ARGZ_H"],
          *cygwin*)
            lt_cv_sys_argz_works=no
            if test "$cross_compiling" != no; then
-             lt_cv_sys_argz_works="guessing no"
+             lt_cv_sys_argz_works="$gl_cross_guess_normal"
            else
              lt_sed_extract_leading_digits='s/^\([0-9\.]*\).*/\1/'
              save_IFS=$IFS
diff --git a/m4/calloc.m4 b/m4/calloc.m4
index d76535d..15fb07c 100644
--- a/m4/calloc.m4
+++ b/m4/calloc.m4
@@ -1,4 +1,4 @@
-# calloc.m4 serial 19
+# calloc.m4 serial 20
 
 # Copyright (C) 2004-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -44,8 +44,8 @@ AC_DEFUN([_AC_FUNC_CALLOC_IF],
           *-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, assume the worst.
-          *)             ac_cv_func_calloc_0_nonnull="guessing no" ;;
+                         # If we don't know, obey --enable-cross-guesses.
+          *)             ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;;
         esac
        ])])
   case "$ac_cv_func_calloc_0_nonnull" in
diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4
index b61747b..cb0896f 100644
--- a/m4/canonicalize.m4
+++ b/m4/canonicalize.m4
@@ -1,4 +1,4 @@
-# canonicalize.m4 serial 30
+# canonicalize.m4 serial 31
 
 dnl Copyright (C) 2003-2007, 2009-2019 Free Software Foundation, Inc.
 
@@ -117,8 +117,8 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS],
         *-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, assume the worst.
-        *)             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
      ])
     rm -rf conftest.a conftest.d
diff --git a/m4/cbrtl.m4 b/m4/cbrtl.m4
index 091c799..48f27da 100644
--- a/m4/cbrtl.m4
+++ b/m4/cbrtl.m4
@@ -1,4 +1,4 @@
-# cbrtl.m4 serial 9
+# cbrtl.m4 serial 10
 dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -78,8 +78,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_cbrtl_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_cbrtl_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_cbrtl_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_cbrtl_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/ceil.m4 b/m4/ceil.m4
index 396b3cf..f8b70a3 100644
--- a/m4/ceil.m4
+++ b/m4/ceil.m4
@@ -1,4 +1,4 @@
-# ceil.m4 serial 14
+# ceil.m4 serial 15
 dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -52,8 +52,8 @@ int main (int argc, char *argv[])
                *-musl*)       gl_cv_func_ceil_ieee="guessing yes" ;;
                               # Guess yes on native Windows.
                mingw*)        gl_cv_func_ceil_ieee="guessing yes" ;;
-                              # If we don't know, assume the worst.
-               *)             gl_cv_func_ceil_ieee="guessing no" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+               *)             gl_cv_func_ceil_ieee="$gl_cross_guess_normal" ;;
              esac
             ])
           LIBS="$save_LIBS"
diff --git a/m4/ceilf.m4 b/m4/ceilf.m4
index 9c898b4..4bf2839 100644
--- a/m4/ceilf.m4
+++ b/m4/ceilf.m4
@@ -1,4 +1,4 @@
-# ceilf.m4 serial 18
+# ceilf.m4 serial 19
 dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -59,8 +59,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_ceilf_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_ceilf_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_ceilf_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_ceilf_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/ceill.m4 b/m4/ceill.m4
index a65defc..ff43619 100644
--- a/m4/ceill.m4
+++ b/m4/ceill.m4
@@ -1,4 +1,4 @@
-# ceill.m4 serial 19
+# ceill.m4 serial 20
 dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -58,8 +58,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_ceill_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_ceill_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_ceill_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_ceill_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/chown.m4 b/m4/chown.m4
index b693686..554c492 100644
--- a/m4/chown.m4
+++ b/m4/chown.m4
@@ -1,4 +1,4 @@
-# serial 33
+# serial 34
 # Determine whether we need the chown wrapper.
 
 dnl Copyright (C) 1997-2001, 2003-2005, 2007, 2009-2019 Free Software
@@ -52,8 +52,8 @@ AC_DEFUN([AC_FUNC_CHOWN],
           *-gnu* | gnu*)   ac_cv_func_chown_works="guessing yes" ;;
                            # Guess no on native Windows.
           mingw*)          ac_cv_func_chown_works="guessing no" ;;
-                           # If we don't know, assume the worst.
-          *)               ac_cv_func_chown_works="guessing no" ;;
+                           # If we don't know, obey --enable-cross-guesses.
+          *)               ac_cv_func_chown_works="$gl_cross_guess_normal" ;;
         esac
        ])
      rm -f conftest.chown
@@ -114,8 +114,8 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN],
            *-gnu*)  gl_cv_func_chown_slash_works="guessing yes" ;;
                     # Guess yes on musl systems.
            *-musl*) gl_cv_func_chown_slash_works="guessing yes" ;;
-                    # If we don't know, assume the worst.
-           *)       gl_cv_func_chown_slash_works="guessing no" ;;
+                    # If we don't know, obey --enable-cross-guesses.
+           *)       gl_cv_func_chown_slash_works="$gl_cross_guess_normal" ;;
          esac
         ])
       rm -f conftest.link conftest.file])
@@ -152,8 +152,8 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN],
            *-gnu*)  gl_cv_func_chown_ctime_works="guessing yes" ;;
                     # Guess yes on musl systems.
            *-musl*) gl_cv_func_chown_ctime_works="guessing yes" ;;
-                    # If we don't know, assume the worst.
-           *)       gl_cv_func_chown_ctime_works="guessing no" ;;
+                    # If we don't know, obey --enable-cross-guesses.
+           *)       gl_cv_func_chown_ctime_works="$gl_cross_guess_normal" ;;
          esac
         ])
       rm -f conftest.file])
diff --git a/m4/d-ino.m4 b/m4/d-ino.m4
index 87dcacc..882fc4c 100644
--- a/m4/d-ino.m4
+++ b/m4/d-ino.m4
@@ -1,4 +1,4 @@
-# serial 19
+# serial 20
 
 dnl From Jim Meyering.
 dnl
@@ -46,8 +46,8 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO],
               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, assume the worst.
-              *)            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
            ])])
    case "$gl_cv_struct_dirent_d_ino" in
diff --git a/m4/exp2l.m4 b/m4/exp2l.m4
index 8bfb2d9..40e36be 100644
--- a/m4/exp2l.m4
+++ b/m4/exp2l.m4
@@ -1,4 +1,4 @@
-# exp2l.m4 serial 8
+# exp2l.m4 serial 9
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -105,8 +105,8 @@ int main (int argc, char *argv[])
                *-musl*)       gl_cv_func_exp2l_works="guessing yes" ;;
                               # Guess yes on native Windows.
                mingw*)        gl_cv_func_exp2l_works="guessing yes" ;;
-                              # If we don't know, assume the worst.
-               *)             gl_cv_func_exp2l_works="guessing no" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+               *)             gl_cv_func_exp2l_works="$gl_cross_guess_normal" ;;
              esac
             ])
           LIBS="$save_LIBS"
@@ -160,8 +160,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_exp2l_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_exp2l_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_exp2l_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_exp2l_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/expl.m4 b/m4/expl.m4
index 0619a2d..959dfdc 100644
--- a/m4/expl.m4
+++ b/m4/expl.m4
@@ -1,4 +1,4 @@
-# expl.m4 serial 14
+# expl.m4 serial 15
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -175,8 +175,8 @@ int main (int argc, char *argv[])
                *-musl*)       gl_cv_func_expl_works="guessing yes" ;;
                               # Guess yes on native Windows.
                mingw*)        gl_cv_func_expl_works="guessing yes" ;;
-                              # If we don't know, assume the worst.
-               *)             gl_cv_func_expl_works="guessing no" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+               *)             gl_cv_func_expl_works="$gl_cross_guess_normal" ;;
              esac
             ])
           LIBS="$save_LIBS"
diff --git a/m4/expm1.m4 b/m4/expm1.m4
index 389c7dc..ac9b1ec 100644
--- a/m4/expm1.m4
+++ b/m4/expm1.m4
@@ -1,4 +1,4 @@
-# expm1.m4 serial 8
+# expm1.m4 serial 9
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -91,8 +91,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_expm1_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_expm1_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_expm1_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_expm1_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/expm1l.m4 b/m4/expm1l.m4
index 5d3a991..19da3f5 100644
--- a/m4/expm1l.m4
+++ b/m4/expm1l.m4
@@ -1,4 +1,4 @@
-# expm1l.m4 serial 5
+# expm1l.m4 serial 6
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -150,8 +150,8 @@ int main (int argc, char *argv[])
                *-musl*)       gl_cv_func_expm1l_works="guessing yes" ;;
                               # Guess yes on native Windows.
                mingw*)        gl_cv_func_expm1l_works="guessing yes" ;;
-                              # If we don't know, assume the worst.
-               *)             gl_cv_func_expm1l_works="guessing no" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+               *)             gl_cv_func_expm1l_works="$gl_cross_guess_normal" ;;
              esac
             ])
           LIBS="$save_LIBS"
diff --git a/m4/fchdir.m4 b/m4/fchdir.m4
index ea5a4f9..ed29562 100644
--- a/m4/fchdir.m4
+++ b/m4/fchdir.m4
@@ -1,4 +1,4 @@
-# fchdir.m4 serial 24
+# fchdir.m4 serial 25
 dnl Copyright (C) 2006-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -37,8 +37,8 @@ AC_DEFUN([gl_FUNC_FCHDIR],
            *-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, assume the worst.
-           *)               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
         ])])
     case "$gl_cv_func_open_directory_works" in
diff --git a/m4/fchownat.m4 b/m4/fchownat.m4
index 042ef17..f6cb409 100644
--- a/m4/fchownat.m4
+++ b/m4/fchownat.m4
@@ -1,4 +1,4 @@
-# fchownat.m4 serial 4
+# fchownat.m4 serial 5
 dnl Copyright (C) 2004-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -71,7 +71,7 @@ main ()
           ]])],
        [gl_cv_func_fchownat_nofollow_works=yes],
        [gl_cv_func_fchownat_nofollow_works=no],
-       [gl_cv_func_fchownat_nofollow_works="guessing no"])
+       [gl_cv_func_fchownat_nofollow_works="$gl_cross_guess_normal"])
   ])
   AS_IF([test "$gl_cv_func_fchownat_nofollow_works" != yes], [$1], [$2])
 ])
@@ -105,7 +105,7 @@ AC_DEFUN([gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG],
           ]])],
        [gl_cv_func_fchownat_empty_filename_works=yes],
        [gl_cv_func_fchownat_empty_filename_works=no],
-       [gl_cv_func_fchownat_empty_filename_works="guessing no"])
+       [gl_cv_func_fchownat_empty_filename_works="$gl_cross_guess_normal"])
     ])
   AS_IF([test "$gl_cv_func_fchownat_empty_filename_works" != yes], [$1], [$2])
 ])
diff --git a/m4/fdopendir.m4 b/m4/fdopendir.m4
index b2b3b03..ad48e4e 100644
--- a/m4/fdopendir.m4
+++ b/m4/fdopendir.m4
@@ -1,4 +1,4 @@
-# serial 11
+# serial 12
 # See if we need to provide fdopendir.
 
 dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
@@ -49,8 +49,8 @@ DIR *fdopendir (int);
             *-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, assume the worst.
-            *)       gl_cv_func_fdopendir_works="guessing no" ;;
+                     # If we don't know, obey --enable-cross-guesses.
+            *)       gl_cv_func_fdopendir_works="$gl_cross_guess_normal" ;;
           esac
          ])])
     case "$gl_cv_func_fdopendir_works" in
diff --git a/m4/floor.m4 b/m4/floor.m4
index 4bfd699..e7de296 100644
--- a/m4/floor.m4
+++ b/m4/floor.m4
@@ -1,4 +1,4 @@
-# floor.m4 serial 13
+# floor.m4 serial 14
 dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -48,8 +48,8 @@ int main (int argc, char *argv[])
                *-musl*)       gl_cv_func_floor_ieee="guessing yes" ;;
                               # Guess yes on native Windows.
                mingw*)        gl_cv_func_floor_ieee="guessing yes" ;;
-                              # If we don't know, assume the worst.
-               *)             gl_cv_func_floor_ieee="guessing no" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+               *)             gl_cv_func_floor_ieee="$gl_cross_guess_normal" ;;
              esac
             ])
           LIBS="$save_LIBS"
diff --git a/m4/floorf.m4 b/m4/floorf.m4
index d1bd987..1a2b93e 100644
--- a/m4/floorf.m4
+++ b/m4/floorf.m4
@@ -1,4 +1,4 @@
-# floorf.m4 serial 17
+# floorf.m4 serial 18
 dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -55,8 +55,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_floorf_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_floorf_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_floorf_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_floorf_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/fma.m4 b/m4/fma.m4
index ac99f3c..2ff3c8e 100644
--- a/m4/fma.m4
+++ b/m4/fma.m4
@@ -1,4 +1,4 @@
-# fma.m4 serial 3
+# fma.m4 serial 4
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -169,7 +169,7 @@ int main()
         [gl_cv_func_fma_works=no],
         [dnl Guess yes on native Windows with MSVC.
          dnl Otherwise guess no, even on glibc systems.
-         gl_cv_func_fma_works="guessing no"
+         gl_cv_func_fma_works="$gl_cross_guess_normal"
          case "$host_os" in
            mingw*)
              AC_EGREP_CPP([Known], [
diff --git a/m4/fmaf.m4 b/m4/fmaf.m4
index 55edbbe..36e0a73 100644
--- a/m4/fmaf.m4
+++ b/m4/fmaf.m4
@@ -1,4 +1,4 @@
-# fmaf.m4 serial 4
+# fmaf.m4 serial 5
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -173,7 +173,7 @@ int main()
         [gl_cv_func_fmaf_works=no],
         [dnl Guess yes on native Windows with MSVC.
          dnl Otherwise guess no, even on glibc systems.
-         gl_cv_func_fmaf_works="guessing no"
+         gl_cv_func_fmaf_works="$gl_cross_guess_normal"
          case "$host_os" in
            mingw*)
              AC_EGREP_CPP([Known], [
diff --git a/m4/fmal.m4 b/m4/fmal.m4
index 9ece1df..76a4713 100644
--- a/m4/fmal.m4
+++ b/m4/fmal.m4
@@ -1,4 +1,4 @@
-# fmal.m4 serial 6
+# fmal.m4 serial 7
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -371,7 +371,7 @@ int main()
         [gl_cv_func_fmal_works=no],
         [dnl Guess yes on native Windows with MSVC.
          dnl Otherwise guess no, even on glibc systems.
-         gl_cv_func_fmal_works="guessing no"
+         gl_cv_func_fmal_works="$gl_cross_guess_normal"
          case "$host_os" in
            mingw*)
              AC_EGREP_CPP([Known], [
diff --git a/m4/fmod.m4 b/m4/fmod.m4
index cb9e568..ae72482 100644
--- a/m4/fmod.m4
+++ b/m4/fmod.m4
@@ -1,4 +1,4 @@
-# fmod.m4 serial 8
+# fmod.m4 serial 9
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -64,8 +64,8 @@ int main (int argc, char *argv[])
                *-musl*)       gl_cv_func_fmod_ieee="guessing yes" ;;
                               # Guess yes on native Windows.
                mingw*)        gl_cv_func_fmod_ieee="guessing yes" ;;
-                              # If we don't know, assume the worst.
-               *)             gl_cv_func_fmod_ieee="guessing no" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+               *)             gl_cv_func_fmod_ieee="$gl_cross_guess_normal" ;;
              esac
             ])
           LIBS="$save_LIBS"
diff --git a/m4/fmodf.m4 b/m4/fmodf.m4
index 7cc82f9..bb6450a 100644
--- a/m4/fmodf.m4
+++ b/m4/fmodf.m4
@@ -1,4 +1,4 @@
-# fmodf.m4 serial 10
+# fmodf.m4 serial 11
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -65,8 +65,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_fmodf_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_fmodf_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_fmodf_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_fmodf_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/fmodl.m4 b/m4/fmodl.m4
index 74c01ce..f451886 100644
--- a/m4/fmodl.m4
+++ b/m4/fmodl.m4
@@ -1,4 +1,4 @@
-# fmodl.m4 serial 10
+# fmodl.m4 serial 11
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -76,8 +76,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_fmodl_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_fmodl_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_fmodl_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_fmodl_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/fpurge.m4 b/m4/fpurge.m4
index 6c5b3e9..d98c469 100644
--- a/m4/fpurge.m4
+++ b/m4/fpurge.m4
@@ -1,4 +1,4 @@
-# fpurge.m4 serial 9
+# fpurge.m4 serial 10
 dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -54,8 +54,8 @@ AC_DEFUN([gl_FUNC_FPURGE],
          [case "$host_os" in
                      # Guess yes on musl systems.
             *-musl*) gl_cv_func_fpurge_works="guessing yes" ;;
-                     # Guess no otherwise.
-            *)       gl_cv_func_fpurge_works="guessing no" ;;
+                     # Otherwise obey --enable-cross-guesses.
+            *)       gl_cv_func_fpurge_works="$gl_cross_guess_normal" ;;
           esac
          ])
       ])
diff --git a/m4/getcwd-path-max.m4 b/m4/getcwd-path-max.m4
index 0ae3e1e..95a55be 100644
--- a/m4/getcwd-path-max.m4
+++ b/m4/getcwd-path-max.m4
@@ -1,4 +1,4 @@
-# serial 22
+# serial 23
 # Check for several getcwd bugs with long file names.
 # If so, arrange to compile the wrapper function.
 
@@ -220,17 +220,17 @@ main ()
        [# Cross-compilation guesses:
         case "$host_os" in
           aix*) # On AIX, it has the AIX bug.
-            gl_cv_func_getcwd_path_max='no, 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=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='no, but it is partly working' ;;
-          *) # If we don't know, assume the worst.
-            gl_cv_func_getcwd_path_max=no ;;
+            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
        ])
     ])
diff --git a/m4/getcwd.m4 b/m4/getcwd.m4
index 625171a..3b3f755 100644
--- a/m4/getcwd.m4
+++ b/m4/getcwd.m4
@@ -6,7 +6,7 @@
 # with or without modifications, as long as this notice is preserved.
 
 # Written by Paul Eggert.
-# serial 17
+# serial 18
 
 AC_DEFUN([gl_FUNC_GETCWD_NULL],
   [
@@ -54,8 +54,8 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL],
             *-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, assume the worst.
-            *)             gl_cv_func_getcwd_null="guessing no";;
+                           # If we don't know, obey --enable-cross-guesses.
+            *)             gl_cv_func_getcwd_null="$gl_cross_guess_normal";;
           esac
         ]])])
 ])
@@ -127,7 +127,7 @@ AC_DEFUN([gl_FUNC_GETCWD],
   dnl Define HAVE_MINIMALLY_WORKING_GETCWD and HAVE_PARTLY_WORKING_GETCWD
   dnl if appropriate.
   case "$gl_cv_func_getcwd_path_max" in
-    "no"|"no, it has the AIX bug") ;;
+    *"no" | *"no, it has the AIX bug") ;;
     *)
       AC_DEFINE([HAVE_MINIMALLY_WORKING_GETCWD], [1],
         [Define to 1 if getcwd minimally works, that is, its result can be
@@ -135,12 +135,12 @@ AC_DEFUN([gl_FUNC_GETCWD],
       ;;
   esac
   case "$gl_cv_func_getcwd_path_max" in
-    "no, but it is partly working")
+    *"no, but it is partly working")
       AC_DEFINE([HAVE_PARTLY_WORKING_GETCWD], [1],
         [Define to 1 if getcwd works, except it sometimes fails when it
          shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.])
       ;;
-    "yes, but with shorter paths")
+    *"yes, but with shorter paths")
       AC_DEFINE([HAVE_GETCWD_SHORTER], [1],
         [Define to 1 if getcwd works, but with shorter paths
          than is generally tested with the replacement.])
diff --git a/m4/getdelim.m4 b/m4/getdelim.m4
index e77c379..5cd85da 100644
--- a/m4/getdelim.m4
+++ b/m4/getdelim.m4
@@ -1,4 +1,4 @@
-# getdelim.m4 serial 13
+# getdelim.m4 serial 14
 
 dnl Copyright (C) 2005-2007, 2009-2019 Free Software Foundation, Inc.
 dnl
@@ -72,7 +72,7 @@ AC_DEFUN([gl_FUNC_GETDELIM],
             [gl_cv_func_working_getdelim="guessing yes"],
             [case "$host_os" in
                *-musl*) gl_cv_func_working_getdelim="guessing yes" ;;
-               *)       gl_cv_func_working_getdelim="guessing no" ;;
+               *)       gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;;
              esac
             ])
          ])
diff --git a/m4/getgroups.m4 b/m4/getgroups.m4
index c93447b..556c177 100644
--- a/m4/getgroups.m4
+++ b/m4/getgroups.m4
@@ -1,4 +1,4 @@
-# serial 22
+# serial 23
 
 dnl From Jim Meyering.
 dnl A wrapper around AC_FUNC_GETGROUPS.
@@ -9,8 +9,6 @@ dnl A wrapper around AC_FUNC_GETGROUPS.
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-m4_version_prereq([2.70], [] ,[
-
 # This is taken from the following Autoconf patch:
 # https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9
 AC_DEFUN([AC_FUNC_GETGROUPS],
@@ -44,8 +42,8 @@ AC_DEFUN([AC_FUNC_GETGROUPS],
             *-gnu* | gnu*) ac_cv_func_getgroups_works="guessing yes" ;;
                            # Guess yes on musl systems.
             *-musl*)       ac_cv_func_getgroups_works="guessing yes" ;;
-                           # If we don't know, assume the worst.
-            *)             ac_cv_func_getgroups_works="guessing no" ;;
+                           # If we don't know, obey --enable-cross-guesses.
+            *)             ac_cv_func_getgroups_works="$gl_cross_guess_normal" ;;
           esac
          ])
       ])
@@ -61,8 +59,6 @@ AC_DEFUN([AC_FUNC_GETGROUPS],
   LIBS=$ac_save_LIBS
 ])# AC_FUNC_GETGROUPS
 
-])
-
 AC_DEFUN([gl_FUNC_GETGROUPS],
 [
   AC_REQUIRE([AC_TYPE_GETGROUPS])
@@ -99,8 +95,8 @@ AC_DEFUN([gl_FUNC_GETGROUPS],
              *-gnu* | gnu*) gl_cv_func_getgroups_works="guessing yes" ;;
                             # Guess yes on musl systems.
              *-musl*)       gl_cv_func_getgroups_works="guessing yes" ;;
-                            # If we don't know, assume the worst.
-             *)             gl_cv_func_getgroups_works="guessing no" ;;
+                            # If we don't know, obey --enable-cross-guesses.
+             *)             gl_cv_func_getgroups_works="$gl_cross_guess_normal" ;;
            esac
           ])])
       case "$gl_cv_func_getgroups_works" in
diff --git a/m4/getline.m4 b/m4/getline.m4
index 32f771c..457c160 100644
--- a/m4/getline.m4
+++ b/m4/getline.m4
@@ -1,4 +1,4 @@
-# getline.m4 serial 29
+# getline.m4 serial 30
 
 dnl Copyright (C) 1998-2003, 2005-2007, 2009-2019 Free Software Foundation,
 dnl Inc.
@@ -80,7 +80,7 @@ AC_DEFUN([gl_FUNC_GETLINE],
             [am_cv_func_working_getline="guessing yes"],
             [case "$host_os" in
                *-musl*) am_cv_func_working_getline="guessing yes" ;;
-               *)       am_cv_func_working_getline="guessing no" ;;
+               *)       am_cv_func_working_getline="$gl_cross_guess_normal" ;;
              esac
             ])
          ])
diff --git a/m4/getopt.m4 b/m4/getopt.m4
index 5991bf8..8cc7827 100644
--- a/m4/getopt.m4
+++ b/m4/getopt.m4
@@ -1,4 +1,4 @@
-# getopt.m4 serial 46
+# getopt.m4 serial 47
 dnl Copyright (C) 2002-2006, 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -302,8 +302,10 @@ dnl is ambiguous with environment values that contain newlines.
            ]])],
         [gl_cv_func_getopt_gnu=yes],
         [gl_cv_func_getopt_gnu=no],
-        [dnl Cross compiling. Assume the worst, even on glibc platforms.
-         gl_cv_func_getopt_gnu="guessing no"
+        [dnl Cross compiling.
+         dnl Assume the worst, even on glibc platforms.
+         dnl But obey --enable-cross-guesses.
+         gl_cv_func_getopt_gnu="$gl_cross_guess_normal"
         ])
        case $gl_had_POSIXLY_CORRECT in
          exported) ;;
diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4
index 5e2ef6f..7eebabd 100644
--- a/m4/gettimeofday.m4
+++ b/m4/gettimeofday.m4
@@ -1,4 +1,4 @@
-# serial 26
+# serial 27
 
 # Copyright (C) 2001-2003, 2005, 2007, 2009-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -109,8 +109,8 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
         *-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, assume the worst.
-        *)             gl_cv_func_gettimeofday_clobber="guessing yes" ;;
+                       # If we don't know, obey --enable-cross-guesses.
+        *)             gl_cv_func_gettimeofday_clobber="$gl_cross_guess_inverted" ;;
       esac
      ])])
 
diff --git a/m4/glob.m4 b/m4/glob.m4
index 00b4297..543722c 100644
--- a/m4/glob.m4
+++ b/m4/glob.m4
@@ -1,4 +1,4 @@
-# glob.m4 serial 22
+# glob.m4 serial 23
 dnl Copyright (C) 2005-2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -31,27 +31,33 @@ char a[_GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2 ? 1
     if test $REPLACE_GLOB = 0; then
       AC_CACHE_CHECK([whether glob lists broken symlinks],
                      [gl_cv_glob_lists_symlinks],
-        [if ln -s conf-doesntexist conf$$-globtest 2>/dev/null; then
-           gl_cv_glob_lists_symlinks=maybe
+        [if test $cross_compiling != yes; then
+           if ln -s conf-doesntexist conf$$-globtest 2>/dev/null; then
+             gl_cv_glob_lists_symlinks=maybe
+           else
+             # If we can't make a symlink, then we cannot test this issue.  Be
+             # pessimistic about this.
+             gl_cv_glob_lists_symlinks=no
+           fi
+           if test $gl_cv_glob_lists_symlinks = maybe; then
+             AC_RUN_IFELSE(
+               [AC_LANG_PROGRAM(
+                  [[#include <stddef.h>
+                    #include <glob.h>]],
+                  [[glob_t found;
+                    if (glob ("conf*-globtest", 0, NULL, &found) == GLOB_NOMATCH)
+                      return 1;
+                  ]])],
+               [gl_cv_glob_lists_symlinks=yes],
+               [gl_cv_glob_lists_symlinks=no],
+               [dnl We don't get here.
+                :
+               ])
+           fi
+           rm -f conf$$-globtest
          else
-           # If we can't make a symlink, then we cannot test this issue.  Be
-           # pessimistic about this.
-           gl_cv_glob_lists_symlinks=no
+           gl_cv_glob_lists_symlinks="$gl_cross_guess_normal"
          fi
-         if test $gl_cv_glob_lists_symlinks = maybe; then
-           AC_RUN_IFELSE(
-             [AC_LANG_PROGRAM(
-                [[#include <stddef.h>
-                  #include <glob.h>]],
-                [[glob_t found;
-                  if (glob ("conf*-globtest", 0, NULL, &found) == GLOB_NOMATCH)
-                    return 1;
-                ]])],
-             [gl_cv_glob_lists_symlinks=yes],
-             [gl_cv_glob_lists_symlinks=no],
-             [gl_cv_glob_lists_symlinks="guessing no"])
-         fi
-         rm -f conf$$-globtest
         ])
       case "$gl_cv_glob_lists_symlinks" in
         *yes) ;;
diff --git a/m4/hypot.m4 b/m4/hypot.m4
index 74448c5..a7fb0cf 100644
--- a/m4/hypot.m4
+++ b/m4/hypot.m4
@@ -1,4 +1,4 @@
-# hypot.m4 serial 8
+# hypot.m4 serial 9
 dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -61,8 +61,8 @@ int main (int argc, char *argv[])
                *-musl*)       gl_cv_func_hypot_ieee="guessing yes" ;;
                               # Guess yes on native Windows.
                mingw*)        gl_cv_func_hypot_ieee="guessing yes" ;;
-                              # If we don't know, assume the worst.
-               *)             gl_cv_func_hypot_ieee="guessing no" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+               *)             gl_cv_func_hypot_ieee="$gl_cross_guess_normal" ;;
              esac
             ])
           LIBS="$save_LIBS"
diff --git a/m4/hypotf.m4 b/m4/hypotf.m4
index dcdb07a..550f877 100644
--- a/m4/hypotf.m4
+++ b/m4/hypotf.m4
@@ -1,4 +1,4 @@
-# hypotf.m4 serial 9
+# hypotf.m4 serial 10
 dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -77,8 +77,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_hypotf_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_hypotf_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_hypotf_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_hypotf_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/hypotl.m4 b/m4/hypotl.m4
index 3d7f47d..9ae1da5 100644
--- a/m4/hypotl.m4
+++ b/m4/hypotl.m4
@@ -1,4 +1,4 @@
-# hypotl.m4 serial 10
+# hypotl.m4 serial 11
 dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -77,8 +77,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_hypotl_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_hypotl_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_hypotl_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_hypotl_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/iconv_open-utf.m4 b/m4/iconv_open-utf.m4
index fa60a2d..2479f70 100644
--- a/m4/iconv_open-utf.m4
+++ b/m4/iconv_open-utf.m4
@@ -1,4 +1,4 @@
-# iconv_open-utf.m4 serial 3
+# iconv_open-utf.m4 serial 4
 dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -214,7 +214,7 @@ int main ()
            dnl We know that GNU libiconv, GNU libc, musl libc, and Solaris >= 9 do.
            dnl OSF/1 5.1 has these encodings, but inserts a BOM in the "to"
            dnl direction.
-           gl_cv_func_iconv_supports_utf="guessing no"
+           gl_cv_func_iconv_supports_utf="$gl_cross_guess_normal"
            if test $gl_func_iconv_gnu = yes; then
              gl_cv_func_iconv_supports_utf="guessing yes"
            else
diff --git a/m4/link.m4 b/m4/link.m4
index a6d77b8..d4ab056 100644
--- a/m4/link.m4
+++ b/m4/link.m4
@@ -1,4 +1,4 @@
-# link.m4 serial 10
+# link.m4 serial 11
 dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -43,8 +43,8 @@ AC_DEFUN([gl_FUNC_LINK],
             linux-* | linux) gl_cv_func_link_works="guessing yes" ;;
                              # Guess yes on glibc systems.
             *-gnu* | gnu*)   gl_cv_func_link_works="guessing yes" ;;
-                             # If we don't know, assume the worst.
-            *)               gl_cv_func_link_works="guessing no" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_link_works="$gl_cross_guess_normal" ;;
           esac
          ])
        rm -f conftest.a conftest.b conftest.lnk])
diff --git a/m4/linkat.m4 b/m4/linkat.m4
index 860abf3..0b4ead3 100644
--- a/m4/linkat.m4
+++ b/m4/linkat.m4
@@ -1,4 +1,4 @@
-# serial 9
+# serial 10
 # See if we need to provide linkat replacement.
 
 dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
@@ -102,8 +102,8 @@ AC_DEFUN([gl_FUNC_LINKAT],
             linux-* | linux) gl_cv_func_linkat_slash="guessing yes";;
                              # Guess yes on glibc systems.
             *-gnu* | gnu*)   gl_cv_func_linkat_slash="guessing yes";;
-                             # If we don't know, assume the worst.
-            *)               gl_cv_func_linkat_slash="guessing no";;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_linkat_slash="$gl_cross_guess_normal";;
           esac
          ])
        rm -rf conftest.a conftest.b conftest.c conftest.d conftest.e conftest.s])
diff --git a/m4/log.m4 b/m4/log.m4
index 233ebe3..102c0b3 100644
--- a/m4/log.m4
+++ b/m4/log.m4
@@ -1,4 +1,4 @@
-# log.m4 serial 10
+# log.m4 serial 11
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -64,8 +64,8 @@ int main (int argc, char *argv[])
                *-musl*)       gl_cv_func_log_ieee="guessing yes" ;;
                               # Guess yes on native Windows.
                mingw*)        gl_cv_func_log_ieee="guessing yes" ;;
-                              # If we don't know, assume the worst.
-               *)             gl_cv_func_log_ieee="guessing no" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+               *)             gl_cv_func_log_ieee="$gl_cross_guess_normal" ;;
              esac
             ])
           LIBS="$save_LIBS"
diff --git a/m4/log10.m4 b/m4/log10.m4
index e8cf74f..e5bbfd8 100644
--- a/m4/log10.m4
+++ b/m4/log10.m4
@@ -1,4 +1,4 @@
-# log10.m4 serial 10
+# log10.m4 serial 11
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -64,8 +64,8 @@ int main (int argc, char *argv[])
                *-musl*)       gl_cv_func_log10_ieee="guessing yes" ;;
                               # Guess yes on native Windows.
                mingw*)        gl_cv_func_log10_ieee="guessing yes" ;;
-                              # If we don't know, assume the worst.
-               *)             gl_cv_func_log10_ieee="guessing no" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+               *)             gl_cv_func_log10_ieee="$gl_cross_guess_normal" ;;
              esac
             ])
           LIBS="$save_LIBS"
diff --git a/m4/log10f.m4 b/m4/log10f.m4
index d2beeff..4390f53 100644
--- a/m4/log10f.m4
+++ b/m4/log10f.m4
@@ -1,4 +1,4 @@
-# log10f.m4 serial 11
+# log10f.m4 serial 12
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -74,8 +74,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_log10f_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_log10f_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_log10f_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_log10f_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/log10l.m4 b/m4/log10l.m4
index ac17e76..90f1642 100644
--- a/m4/log10l.m4
+++ b/m4/log10l.m4
@@ -1,4 +1,4 @@
-# log10l.m4 serial 7
+# log10l.m4 serial 8
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -151,8 +151,8 @@ int main (int argc, char *argv[])
            *-musl*)       gl_cv_func_log10l_works="guessing yes" ;;
                           # Guess yes on native Windows.
            mingw*)        gl_cv_func_log10l_works="guessing yes" ;;
-                          # If we don't know, assume the worst.
-           *)             gl_cv_func_log10l_works="guessing no" ;;
+                          # If we don't know, obey --enable-cross-guesses.
+           *)             gl_cv_func_log10l_works="$gl_cross_guess_normal" ;;
          esac
         ])
     ])
diff --git a/m4/log1p.m4 b/m4/log1p.m4
index 834f5c3..9a2f628 100644
--- a/m4/log1p.m4
+++ b/m4/log1p.m4
@@ -1,4 +1,4 @@
-# log1p.m4 serial 7
+# log1p.m4 serial 8
 dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -58,8 +58,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_log1p_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_log1p_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_log1p_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_log1p_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/log1pf.m4 b/m4/log1pf.m4
index 6cbf3fb..724ede3 100644
--- a/m4/log1pf.m4
+++ b/m4/log1pf.m4
@@ -1,4 +1,4 @@
-# log1pf.m4 serial 7
+# log1pf.m4 serial 8
 dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -67,8 +67,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_log1pf_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_log1pf_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_log1pf_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_log1pf_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/log1pl.m4 b/m4/log1pl.m4
index baee5fc..62bc60a 100644
--- a/m4/log1pl.m4
+++ b/m4/log1pl.m4
@@ -1,4 +1,4 @@
-# log1pl.m4 serial 7
+# log1pl.m4 serial 8
 dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -58,8 +58,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_log1pl_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_log1pl_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_log1pl_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_log1pl_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/log2.m4 b/m4/log2.m4
index 12abad2..0b64c8b 100644
--- a/m4/log2.m4
+++ b/m4/log2.m4
@@ -1,4 +1,4 @@
-# log2.m4 serial 9
+# log2.m4 serial 10
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -85,8 +85,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_log2_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_log2_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_log2_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_log2_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/log2f.m4 b/m4/log2f.m4
index 22a7a67..5df3baf 100644
--- a/m4/log2f.m4
+++ b/m4/log2f.m4
@@ -1,4 +1,4 @@
-# log2f.m4 serial 9
+# log2f.m4 serial 10
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -86,8 +86,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_log2f_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_log2f_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_log2f_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_log2f_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/logf.m4 b/m4/logf.m4
index 178a2a7..05d3721 100644
--- a/m4/logf.m4
+++ b/m4/logf.m4
@@ -1,4 +1,4 @@
-# logf.m4 serial 11
+# logf.m4 serial 12
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -74,8 +74,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_logf_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_logf_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_logf_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_logf_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/logl.m4 b/m4/logl.m4
index 4110694..8984ec4 100644
--- a/m4/logl.m4
+++ b/m4/logl.m4
@@ -1,4 +1,4 @@
-# logl.m4 serial 12
+# logl.m4 serial 13
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -192,8 +192,8 @@ int main (int argc, char *argv[])
            *-musl*)       gl_cv_func_logl_works="guessing yes" ;;
                           # Guess yes on native Windows.
            mingw*)        gl_cv_func_logl_works="guessing yes" ;;
-                          # If we don't know, assume the worst.
-           *)             gl_cv_func_logl_works="guessing no" ;;
+                          # If we don't know, obey --enable-cross-guesses.
+           *)             gl_cv_func_logl_works="$gl_cross_guess_normal" ;;
          esac
         ])
     ])
diff --git a/m4/lstat.m4 b/m4/lstat.m4
index ace1638..be6d3f2 100644
--- a/m4/lstat.m4
+++ b/m4/lstat.m4
@@ -1,4 +1,4 @@
-# serial 32
+# serial 33
 
 # Copyright (C) 1997-2001, 2003-2019 Free Software Foundation, Inc.
 #
@@ -63,8 +63,8 @@ AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
             # Guess no on native Windows.
             gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;;
           *)
-            # If we don't know, assume the worst.
-            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
        ])
      rm -f conftest.sym conftest.file
diff --git a/m4/malloc.m4 b/m4/malloc.m4
index c469c45..6555dee 100644
--- a/m4/malloc.m4
+++ b/m4/malloc.m4
@@ -1,11 +1,9 @@
-# malloc.m4 serial 19
+# malloc.m4 serial 20
 dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-m4_version_prereq([2.70], [] ,[
-
 # This is adapted with modifications from upstream Autoconf here:
 # https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c
 AC_DEFUN([_AC_FUNC_MALLOC_IF],
@@ -35,8 +33,8 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF],
           *-gnu* | gnu* | *-musl* | freebsd* | netbsd* | openbsd* \
           | hpux* | solaris* | cygwin* | mingw*)
             ac_cv_func_malloc_0_nonnull="guessing yes" ;;
-          # If we don't know, assume the worst.
-          *) ac_cv_func_malloc_0_nonnull="guessing no" ;;
+          # If we don't know, obey --enable-cross-guesses.
+          *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;;
         esac
        ])
     ])
@@ -50,8 +48,6 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF],
   esac
 ])# _AC_FUNC_MALLOC_IF
 
-])
-
 # gl_FUNC_MALLOC_GNU
 # ------------------
 # Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if
diff --git a/m4/mbrtowc.m4 b/m4/mbrtowc.m4
index 4811af5..255e5b0 100644
--- a/m4/mbrtowc.m4
+++ b/m4/mbrtowc.m4
@@ -1,4 +1,4 @@
-# mbrtowc.m4 serial 31  -*- coding: utf-8 -*-
+# mbrtowc.m4 serial 32  -*- coding: utf-8 -*-
 dnl Copyright (C) 2001-2002, 2004-2005, 2008-2019 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -599,7 +599,7 @@ AC_DEFUN([gl_MBRTOWC_C_LOCALE],
     [
      dnl Initial guess, used when cross-compiling or when no suitable locale
      dnl is present.
-     gl_cv_C_locale_sans_EILSEQ="guessing no"
+     gl_cv_C_locale_sans_EILSEQ="$gl_cross_guess_normal"
 
      AC_RUN_IFELSE(
        [AC_LANG_PROGRAM(
diff --git a/m4/memchr.m4 b/m4/memchr.m4
index 0be394d..c12d20a 100644
--- a/m4/memchr.m4
+++ b/m4/memchr.m4
@@ -1,4 +1,4 @@
-# memchr.m4 serial 14
+# memchr.m4 serial 15
 dnl Copyright (C) 2002-2004, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -94,8 +94,8 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
             linux*-android*) gl_cv_func_memchr_works="guessing no" ;;
                              # Guess yes on native Windows.
             mingw*)          gl_cv_func_memchr_works="guessing yes" ;;
-                             # Be pessimistic for now.
-            *)               gl_cv_func_memchr_works="guessing no" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_memchr_works="$gl_cross_guess_normal" ;;
           esac
          ])
       ])
diff --git a/m4/memmem.m4 b/m4/memmem.m4
index af2d5bb..dcccefa 100644
--- a/m4/memmem.m4
+++ b/m4/memmem.m4
@@ -1,4 +1,4 @@
-# memmem.m4 serial 25
+# memmem.m4 serial 26
 dnl Copyright (C) 2002-2004, 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -68,7 +68,7 @@ AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE],
 #endif
            ],
            [gl_cv_func_memmem_works_always="guessing yes"],
-           [gl_cv_func_memmem_works_always="guessing no"])
+           [gl_cv_func_memmem_works_always="$gl_cross_guess_normal"])
         ])
       ])
     case "$gl_cv_func_memmem_works_always" in
@@ -138,7 +138,7 @@ static void quit (int sig) { _exit (sig + 128); }
 #endif
            ],
            [gl_cv_func_memmem_works_fast="guessing yes"],
-           [gl_cv_func_memmem_works_fast="guessing no"])
+           [gl_cv_func_memmem_works_fast="$gl_cross_guess_normal"])
         ])
       ])
     case "$gl_cv_func_memmem_works_fast" in
diff --git a/m4/mkdir.m4 b/m4/mkdir.m4
index 366a3cd..6451fb7 100644
--- a/m4/mkdir.m4
+++ b/m4/mkdir.m4
@@ -1,4 +1,4 @@
-# serial 15
+# serial 16
 
 # Copyright (C) 2001, 2003-2004, 2006, 2008-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -36,8 +36,8 @@ AC_DEFUN([gl_FUNC_MKDIR],
                             [gl_cv_func_mkdir_trailing_slash_works="guessing yes"],
                             [gl_cv_func_mkdir_trailing_slash_works="guessing no"])
                           ;;
-                          # If we don't know, assume the worst.
-         *)               gl_cv_func_mkdir_trailing_slash_works="guessing no" ;;
+                          # If we don't know, obey --enable-cross-guesses.
+         *)               gl_cv_func_mkdir_trailing_slash_works="$gl_cross_guess_normal" ;;
        esac
       ])
     rm -rf conftest.dir
@@ -66,8 +66,8 @@ AC_DEFUN([gl_FUNC_MKDIR],
          *-musl*)       gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;;
                         # Guess no on native Windows.
          mingw*)        gl_cv_func_mkdir_trailing_dot_works="guessing no" ;;
-                        # If we don't know, assume the worst.
-         *)             gl_cv_func_mkdir_trailing_dot_works="guessing no" ;;
+                        # If we don't know, obey --enable-cross-guesses.
+         *)             gl_cv_func_mkdir_trailing_dot_works="$gl_cross_guess_normal" ;;
        esac
       ])
     rm -rf conftest.dir
diff --git a/m4/mkfifo.m4 b/m4/mkfifo.m4
index 37a6fc7..f0c14d2 100644
--- a/m4/mkfifo.m4
+++ b/m4/mkfifo.m4
@@ -1,4 +1,4 @@
-# serial 8
+# serial 9
 # See if we need to provide mkfifo replacement.
 
 dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
@@ -56,8 +56,8 @@ AC_DEFUN([gl_FUNC_MKFIFO],
             linux-* | linux) gl_cv_func_mkfifo_works="guessing yes" ;;
                              # Guess yes on glibc systems.
             *-gnu* | gnu*)   gl_cv_func_mkfifo_works="guessing yes" ;;
-                             # If we don't know, assume the worst.
-            *)               gl_cv_func_mkfifo_works="guessing no" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_mkfifo_works="$gl_cross_guess_normal" ;;
           esac
          ])
        rm -f conftest.tmp conftest.lnk])
diff --git a/m4/mknod.m4 b/m4/mknod.m4
index 710784d..691cf6a 100644
--- a/m4/mknod.m4
+++ b/m4/mknod.m4
@@ -1,4 +1,4 @@
-# serial 7
+# serial 8
 # See if we need to provide mknod replacement.
 
 dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
@@ -47,8 +47,8 @@ AC_DEFUN([gl_FUNC_MKNOD],
             linux-* | linux) gl_cv_func_mknod_works="guessing yes" ;;
                              # Guess yes on glibc systems.
             *-gnu* | gnu*)   gl_cv_func_mknod_works="guessing yes" ;;
-                             # If we don't know, assume the worst.
-            *)               gl_cv_func_mknod_works="guessing no" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_mknod_works="$gl_cross_guess_normal" ;;
           esac
          ])
        rm -f conftest.fifo])
diff --git a/m4/mkstemp.m4 b/m4/mkstemp.m4
index 1b15c2e..45f79fa 100644
--- a/m4/mkstemp.m4
+++ b/m4/mkstemp.m4
@@ -1,4 +1,4 @@
-#serial 26
+#serial 27
 
 # Copyright (C) 2001, 2003-2007, 2009-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -63,8 +63,8 @@ AC_DEFUN([gl_FUNC_MKSTEMP],
              *-musl*)       gl_cv_func_working_mkstemp="guessing yes" ;;
                             # Guess no on native Windows.
              mingw*)        gl_cv_func_working_mkstemp="guessing no" ;;
-                            # If we don't know, assume the worst.
-             *)             gl_cv_func_working_mkstemp="guessing no" ;;
+                            # If we don't know, obey --enable-cross-guesses.
+             *)             gl_cv_func_working_mkstemp="$gl_cross_guess_normal" ;;
            esac
           ])
         rm -rf conftest.mkstemp
diff --git a/m4/mktime.m4 b/m4/mktime.m4
index a86e1ee..4054761 100644
--- a/m4/mktime.m4
+++ b/m4/mktime.m4
@@ -1,4 +1,4 @@
-# serial 30
+# serial 31
 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2019 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -247,7 +247,7 @@ main ()
        [case "$host_os" in
                   # Guess no on native Windows.
           mingw*) gl_cv_func_working_mktime="guessing no" ;;
-          *)      gl_cv_func_working_mktime="guessing no" ;;
+          *)      gl_cv_func_working_mktime="$gl_cross_guess_normal" ;;
         esac
        ])
     ])
diff --git a/m4/modf.m4 b/m4/modf.m4
index 3b4b7f1..7bd295d 100644
--- a/m4/modf.m4
+++ b/m4/modf.m4
@@ -1,4 +1,4 @@
-# modf.m4 serial 7
+# modf.m4 serial 8
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -74,8 +74,8 @@ int main (int argc, char *argv[])
                                 [gl_cv_func_modf_ieee="guessing yes"],
                                 [gl_cv_func_modf_ieee="guessing no"])
                               ;;
-                              # If we don't know, assume the worst.
-               *)             gl_cv_func_modf_ieee="guessing no" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+               *)             gl_cv_func_modf_ieee="$gl_cross_guess_normal" ;;
              esac
             ])
           LIBS="$save_LIBS"
diff --git a/m4/modff.m4 b/m4/modff.m4
index 44ce838..815ae69 100644
--- a/m4/modff.m4
+++ b/m4/modff.m4
@@ -1,4 +1,4 @@
-# modff.m4 serial 9
+# modff.m4 serial 10
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -82,8 +82,8 @@ int main (int argc, char *argv[])
                                   [gl_cv_func_modff_ieee="guessing yes"],
                                   [gl_cv_func_modff_ieee="guessing no"])
                                 ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_modff_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_modff_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/modfl.m4 b/m4/modfl.m4
index 2859c4d..ee9d6af 100644
--- a/m4/modfl.m4
+++ b/m4/modfl.m4
@@ -1,4 +1,4 @@
-# modfl.m4 serial 7
+# modfl.m4 serial 8
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -76,8 +76,8 @@ int main (int argc, char *argv[])
                                   [gl_cv_func_modfl_ieee="guessing yes"],
                                   [gl_cv_func_modfl_ieee="guessing no"])
                                 ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_modfl_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_modfl_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/nanosleep.m4 b/m4/nanosleep.m4
index 971aae3..012279f 100644
--- a/m4/nanosleep.m4
+++ b/m4/nanosleep.m4
@@ -1,4 +1,4 @@
-# serial 38
+# serial 39
 
 dnl From Jim Meyering.
 dnl Check for the nanosleep function.
@@ -119,8 +119,8 @@ AC_DEFUN([gl_FUNC_NANOSLEEP],
             gl_cv_func_nanosleep='guessing no (mishandles large arguments)' ;;
           mingw*) # Guess no on native Windows.
             gl_cv_func_nanosleep='guessing no' ;;
-          *)      # If we don't know, assume the worst.
-            gl_cv_func_nanosleep='guessing no' ;;
+          *)      # If we don't know, obey --enable-cross-guesses.
+            gl_cv_func_nanosleep="$gl_cross_guess_normal" ;;
         esac
        ])
     ])
diff --git a/m4/perror.m4 b/m4/perror.m4
index 08e2db1..8e9a3a8 100644
--- a/m4/perror.m4
+++ b/m4/perror.m4
@@ -1,4 +1,4 @@
-# perror.m4 serial 8
+# perror.m4 serial 9
 dnl Copyright (C) 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -52,8 +52,8 @@ AC_DEFUN([gl_FUNC_PERROR],
               *-musl*) gl_cv_func_perror_works="guessing yes" ;;
                        # Guess yes on native Windows.
               mingw*)  gl_cv_func_perror_works="guessing yes" ;;
-                       # Otherwise guess no.
-              *)       gl_cv_func_perror_works="guessing no" ;;
+                       # Otherwise obey --enable-cross-guesses.
+              *)       gl_cv_func_perror_works="$gl_cross_guess_normal" ;;
             esac
            ])
         ])
diff --git a/m4/printf.m4 b/m4/printf.m4
index 6d2280e..d59db20 100644
--- a/m4/printf.m4
+++ b/m4/printf.m4
@@ -1,4 +1,4 @@
-# printf.m4 serial 61
+# printf.m4 serial 62
 dnl Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -93,8 +93,8 @@ changequote([,])dnl
                                    [gl_cv_func_printf_sizes_c99="guessing yes"],
                                    [gl_cv_func_printf_sizes_c99="guessing no"])
                                  ;;
-                                 # If we don't know, assume the worst.
-           *)                    gl_cv_func_printf_sizes_c99="guessing no";;
+                                 # If we don't know, obey --enable-cross-guesses.
+           *)                    gl_cv_func_printf_sizes_c99="$gl_cross_guess_normal";;
          esac
         ])
     ])
@@ -271,8 +271,8 @@ changequote([,])dnl
                                    [gl_cv_func_printf_infinite="guessing yes"],
                                    [gl_cv_func_printf_infinite="guessing no"])
                                  ;;
-                                 # If we don't know, assume the worst.
-           *)                    gl_cv_func_printf_infinite="guessing no";;
+                                 # If we don't know, obey --enable-cross-guesses.
+           *)                    gl_cv_func_printf_infinite="$gl_cross_guess_normal";;
          esac
         ])
     ])
@@ -481,8 +481,8 @@ changequote([,])dnl
                                            [gl_cv_func_printf_infinite_long_double="guessing yes"],
                                            [gl_cv_func_printf_infinite_long_double="guessing no"])
                                          ;;
-                                         # If we don't know, assume the worst.
-                   *)                    gl_cv_func_printf_infinite_long_double="guessing no";;
+                                         # If we don't know, obey --enable-cross-guesses.
+                   *)                    gl_cv_func_printf_infinite_long_double="$gl_cross_guess_normal";;
                  esac
                  ;;
              esac
@@ -587,8 +587,8 @@ int main ()
            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, assume the worst.
-           *)                    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
         ])
     ])
@@ -656,8 +656,8 @@ changequote([,])dnl
                                    [gl_cv_func_printf_directive_f="guessing yes"],
                                    [gl_cv_func_printf_directive_f="guessing no"])
                                  ;;
-                                 # If we don't know, assume the worst.
-           *)                    gl_cv_func_printf_directive_f="guessing no";;
+                                 # If we don't know, obey --enable-cross-guesses.
+           *)                    gl_cv_func_printf_directive_f="$gl_cross_guess_normal";;
          esac
         ])
     ])
@@ -978,8 +978,8 @@ changequote(,)dnl
            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, assume the worst.
-           *)               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
 changequote([,])dnl
         ])
@@ -1156,8 +1156,8 @@ changequote(,)dnl
           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, assume the worst.
-          *)               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
 changequote([,])dnl
       fi
@@ -1255,8 +1255,8 @@ changequote(,)dnl
            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, assume the worst.
-           *)                    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
 changequote([,])dnl
         ])
@@ -1358,8 +1358,8 @@ changequote([,])dnl
                                    [gl_cv_func_snprintf_retval_c99="guessing yes"],
                                    [gl_cv_func_snprintf_retval_c99="guessing no"])
                                  ;;
-                                 # If we don't know, assume the worst.
-           *)                    gl_cv_func_snprintf_retval_c99="guessing no";;
+                                 # If we don't know, obey --enable-cross-guesses.
+           *)                    gl_cv_func_snprintf_retval_c99="$gl_cross_guess_normal";;
          esac
         ])
     ])
@@ -1446,8 +1446,8 @@ changequote(,)dnl
            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, assume the worst.
-           *)                    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
 changequote([,])dnl
         ])
@@ -1601,8 +1601,8 @@ changequote(,)dnl
            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, assume the worst.
-           *)                    gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+                                 # If we don't know, obey --enable-cross-guesses.
+           *)                    gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";;
          esac
 changequote([,])dnl
         ])
diff --git a/m4/pselect.m4 b/m4/pselect.m4
index 5c72b69..250463d 100644
--- a/m4/pselect.m4
+++ b/m4/pselect.m4
@@ -1,4 +1,4 @@
-# pselect.m4 serial 7
+# pselect.m4 serial 8
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -55,8 +55,8 @@ AC_DEFUN([gl_FUNC_PSELECT],
             linux-* | linux) gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
                              # Guess yes on glibc systems.
             *-gnu* | gnu*)   gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
-                             # If we don't know, assume the worst.
-            *)               gl_cv_func_pselect_detects_ebadf="guessing no" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_pselect_detects_ebadf="$gl_cross_guess_normal" ;;
            esac
           ])
       ])
diff --git a/m4/pthread_rwlock_rdlock.m4 b/m4/pthread_rwlock_rdlock.m4
index 85e8dba..cbc2df8 100644
--- a/m4/pthread_rwlock_rdlock.m4
+++ b/m4/pthread_rwlock_rdlock.m4
@@ -1,4 +1,4 @@
-# pthread_rwlock_rdlock.m4 serial 3
+# pthread_rwlock_rdlock.m4 serial 4
 dnl Copyright (C) 2017-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -170,8 +170,8 @@ main ()
                            gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no"
                          fi
                          ;;
-                         # If we don't know, assume the worst.
-          *)             gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;;
+                         # If we don't know, obey --enable-cross-guesses.
+          *)             gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;;
          esac
        ])
      LIBS="$save_LIBS"
diff --git a/m4/ptsname.m4 b/m4/ptsname.m4
index be027b8..5033d90 100644
--- a/m4/ptsname.m4
+++ b/m4/ptsname.m4
@@ -1,4 +1,4 @@
-# ptsname.m4 serial 6
+# ptsname.m4 serial 7
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -30,8 +30,8 @@ AC_DEFUN([gl_FUNC_PTSNAME],
             *-gnu* | gnu*) gl_cv_func_ptsname_sets_errno="guessing yes" ;;
                            # Guess yes on musl systems.
             *-musl*)       gl_cv_func_ptsname_sets_errno="guessing yes" ;;
-                           # If we don't know, assume the worst.
-            *)             gl_cv_func_ptsname_sets_errno="guessing no" ;;
+                           # If we don't know, obey --enable-cross-guesses.
+            *)             gl_cv_func_ptsname_sets_errno="$gl_cross_guess_normal" ;;
           esac
          ])])
     case $gl_cv_func_ptsname_sets_errno in
diff --git a/m4/putenv.m4 b/m4/putenv.m4
index 342ba26..1267b90 100644
--- a/m4/putenv.m4
+++ b/m4/putenv.m4
@@ -1,4 +1,4 @@
-# putenv.m4 serial 23
+# putenv.m4 serial 24
 dnl Copyright (C) 2002-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -40,8 +40,8 @@ AC_DEFUN([gl_FUNC_PUTENV],
                 *-musl*)       gl_cv_func_svid_putenv="guessing yes" ;;
                                # Guess no on native Windows.
                 mingw*)        gl_cv_func_svid_putenv="guessing no" ;;
-                               # If we don't know, assume the worst.
-                *)             gl_cv_func_svid_putenv="guessing no" ;;
+                               # If we don't know, obey --enable-cross-guesses.
+                *)             gl_cv_func_svid_putenv="$gl_cross_guess_normal" ;;
               esac
              ])
    ])
diff --git a/m4/readlink.m4 b/m4/readlink.m4
index 2d76815..7aa6ce0 100644
--- a/m4/readlink.m4
+++ b/m4/readlink.m4
@@ -1,4 +1,4 @@
-# readlink.m4 serial 14
+# readlink.m4 serial 15
 dnl Copyright (C) 2003, 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -38,8 +38,8 @@ AC_DEFUN([gl_FUNC_READLINK],
             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, assume the worst.
-            *)               gl_cv_func_readlink_works="guessing no" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_readlink_works="$gl_cross_guess_normal" ;;
           esac
          ])
       rm -f conftest.link conftest.lnk2])
diff --git a/m4/realloc.m4 b/m4/realloc.m4
index 93066e8..05e7243 100644
--- a/m4/realloc.m4
+++ b/m4/realloc.m4
@@ -1,11 +1,9 @@
-# realloc.m4 serial 17
+# realloc.m4 serial 18
 dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-m4_version_prereq([2.70], [] ,[
-
 # This is adapted with modifications from upstream Autoconf here:
 # https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c
 AC_DEFUN([_AC_FUNC_REALLOC_IF],
@@ -35,8 +33,8 @@ AC_DEFUN([_AC_FUNC_REALLOC_IF],
           *-gnu* | gnu* | *-musl* | freebsd* | netbsd* | openbsd* \
           | hpux* | solaris* | cygwin* | mingw*)
             ac_cv_func_realloc_0_nonnull="guessing yes" ;;
-          # If we don't know, assume the worst.
-          *) ac_cv_func_realloc_0_nonnull="guessing no" ;;
+          # If we don't know, obey --enable-cross-guesses.
+          *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;;
         esac
        ])
     ])
@@ -50,8 +48,6 @@ AC_DEFUN([_AC_FUNC_REALLOC_IF],
   esac
 ])# AC_FUNC_REALLOC
 
-])
-
 # gl_FUNC_REALLOC_GNU
 # -------------------
 # Test whether 'realloc (0, 0)' is handled like in GNU libc, and replace
diff --git a/m4/regex.m4 b/m4/regex.m4
index 35119c5..ad36dc2 100644
--- a/m4/regex.m4
+++ b/m4/regex.m4
@@ -1,4 +1,4 @@
-# serial 68
+# serial 69
 
 # Copyright (C) 1996-2001, 2003-2019 Free Software Foundation, Inc.
 #
@@ -243,8 +243,8 @@ AC_DEFUN([gl_REGEX],
         [case "$host_os" in
                    # Guess no on native Windows.
            mingw*) gl_cv_func_re_compile_pattern_working="guessing no" ;;
-                   # Otherwise, assume it is not working.
-           *)      gl_cv_func_re_compile_pattern_working="guessing no" ;;
+                   # Otherwise obey --enable-cross-guesses.
+           *)      gl_cv_func_re_compile_pattern_working="$gl_cross_guess_normal" ;;
          esac
         ])
       ])
diff --git a/m4/remainder.m4 b/m4/remainder.m4
index e9253a1..eed78eb 100644
--- a/m4/remainder.m4
+++ b/m4/remainder.m4
@@ -1,4 +1,4 @@
-# remainder.m4 serial 8
+# remainder.m4 serial 9
 dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -98,8 +98,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_remainder_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_remainder_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_remainder_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_remainder_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/remainderf.m4 b/m4/remainderf.m4
index 4c7319a..73287c2 100644
--- a/m4/remainderf.m4
+++ b/m4/remainderf.m4
@@ -1,4 +1,4 @@
-# remainderf.m4 serial 12
+# remainderf.m4 serial 13
 dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -101,8 +101,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_remainderf_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_remainderf_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_remainderf_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_remainderf_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/remainderl.m4 b/m4/remainderl.m4
index dde2f4f..b54b5e3 100644
--- a/m4/remainderl.m4
+++ b/m4/remainderl.m4
@@ -1,4 +1,4 @@
-# remainderl.m4 serial 11
+# remainderl.m4 serial 12
 dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -106,8 +106,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_remainderl_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_remainderl_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_remainderl_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_remainderl_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/rename.m4 b/m4/rename.m4
index 7318e75..b453666 100644
--- a/m4/rename.m4
+++ b/m4/rename.m4
@@ -1,4 +1,4 @@
-# serial 31
+# serial 32
 
 # Copyright (C) 2001, 2003, 2005-2006, 2009-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -61,8 +61,8 @@ AC_DEFUN([gl_FUNC_RENAME],
          *-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, assume the worst.
-         *)               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
       ])
     rm -rf conftest.f conftest.f1 conftest.f2 conftest.d1 conftest.d2 conftest.lnk
@@ -117,8 +117,8 @@ AC_DEFUN([gl_FUNC_RENAME],
          *-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, assume the worst.
-         *)               gl_cv_func_rename_slash_src_works="guessing no" ;;
+                          # If we don't know, obey --enable-cross-guesses.
+         *)               gl_cv_func_rename_slash_src_works="$gl_cross_guess_normal" ;;
        esac
       ])
     rm -rf conftest.f conftest.f1 conftest.d1 conftest.d2 conftest.d3 conftest.lnk
@@ -140,53 +140,58 @@ AC_DEFUN([gl_FUNC_RENAME],
   AC_CACHE_CHECK([whether rename manages hard links correctly],
     [gl_cv_func_rename_link_works],
     [if test $ac_cv_func_link = 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 "$2" = "$4"; then
-         AC_RUN_IFELSE(
-           [AC_LANG_PROGRAM([[
-#             include <errno.h>
-#             include <stdio.h>
-#             include <stdlib.h>
-#             include <unistd.h>
-              ]],
-              [[int result = 0;
-                if (rename ("conftest.f", "conftest.f1"))
-                  result |= 1;
-                if (unlink ("conftest.f1"))
-                  result |= 2;
+       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 "$2" = "$4"; then
+           AC_RUN_IFELSE(
+             [AC_LANG_PROGRAM([[
+#               include <errno.h>
+#               include <stdio.h>
+#               include <stdlib.h>
+#               include <unistd.h>
+                ]],
+                [[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;
+                  /* 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;
-              ]])],
-           [gl_cv_func_rename_link_works=yes],
-           [gl_cv_func_rename_link_works=no],
-           dnl When crosscompiling, assume rename is broken.
-           [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, assume the worst.
-              *)               gl_cv_func_rename_link_works="guessing no" ;;
-            esac
-           ])
+                  if (rename ("conftest.f1", "conftest.f1") == 0)
+                    result |= 8;
+                  if (rename ("conftest.f2", "conftest.f2") != 0)
+                    result |= 16;
+                  return result;
+                ]])],
+             [gl_cv_func_rename_link_works=yes],
+             [gl_cv_func_rename_link_works=no],
+             [dnl We don't get here.
+              :
+             ])
+         else
+           gl_cv_func_rename_link_works="guessing no"
+         fi
+         rm -rf conftest.f conftest.f1 conftest.f2
        else
-         gl_cv_func_rename_link_works="guessing no"
+         dnl When crosscompiling, assume rename is broken.
+         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
-       rm -rf conftest.f conftest.f1 conftest.f2
      else
        gl_cv_func_rename_link_works=yes
      fi
@@ -232,8 +237,8 @@ AC_DEFUN([gl_FUNC_RENAME],
          *-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, assume the worst.
-         *)               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
       ])
     rm -rf conftest.f conftest.d1 conftest.d2
diff --git a/m4/rintl.m4 b/m4/rintl.m4
index d7e2e90..4e9383f 100644
--- a/m4/rintl.m4
+++ b/m4/rintl.m4
@@ -1,4 +1,4 @@
-# rintl.m4 serial 6
+# rintl.m4 serial 7
 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -56,8 +56,8 @@ int main (int argc, char *argv[])
                *-musl*)       gl_cv_func_rintl_works="guessing yes" ;;
                               # Guess yes on native Windows.
                mingw*)        gl_cv_func_rintl_works="guessing yes" ;;
-                              # If we don't know, assume the worst.
-               *)             gl_cv_func_rintl_works="guessing no" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+               *)             gl_cv_func_rintl_works="$gl_cross_guess_normal" ;;
              esac
             ])
           LIBS="$save_LIBS"
diff --git a/m4/rmdir.m4 b/m4/rmdir.m4
index 5d32caa..bc01778 100644
--- a/m4/rmdir.m4
+++ b/m4/rmdir.m4
@@ -1,4 +1,4 @@
-# rmdir.m4 serial 16
+# rmdir.m4 serial 17
 dnl Copyright (C) 2002, 2005, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -39,8 +39,8 @@ AC_DEFUN([gl_FUNC_RMDIR],
           *-gnu* | gnu*)   gl_cv_func_rmdir_works="guessing yes" ;;
                            # Guess no on native Windows.
           mingw*)          gl_cv_func_rmdir_works="guessing no" ;;
-                           # If we don't know, assume the worst.
-          *)               gl_cv_func_rmdir_works="guessing no" ;;
+                           # If we don't know, obey --enable-cross-guesses.
+          *)               gl_cv_func_rmdir_works="$gl_cross_guess_normal" ;;
         esac
        ])
      rm -rf conftest.dir conftest.file])
diff --git a/m4/round.m4 b/m4/round.m4
index e4df615..983fb68 100644
--- a/m4/round.m4
+++ b/m4/round.m4
@@ -1,4 +1,4 @@
-# round.m4 serial 21
+# round.m4 serial 22
 dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -126,8 +126,8 @@ int main (int argc, char *argv[])
                                   [gl_cv_func_round_ieee="guessing yes"],
                                   [gl_cv_func_round_ieee="guessing no"])
                                 ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_round_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_round_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/roundf.m4 b/m4/roundf.m4
index 17cc9da..7ec988c 100644
--- a/m4/roundf.m4
+++ b/m4/roundf.m4
@@ -1,4 +1,4 @@
-# roundf.m4 serial 22
+# roundf.m4 serial 23
 dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -126,8 +126,8 @@ int main (int argc, char *argv[])
                                   [gl_cv_func_roundf_ieee="guessing yes"],
                                   [gl_cv_func_roundf_ieee="guessing no"])
                                 ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_roundf_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_roundf_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/roundl.m4 b/m4/roundl.m4
index 934e809..98a081f 100644
--- a/m4/roundl.m4
+++ b/m4/roundl.m4
@@ -1,4 +1,4 @@
-# roundl.m4 serial 19
+# roundl.m4 serial 20
 dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -70,8 +70,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_roundl_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_roundl_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_roundl_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_roundl_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/select.m4 b/m4/select.m4
index 531c817..0805b07 100644
--- a/m4/select.m4
+++ b/m4/select.m4
@@ -1,4 +1,4 @@
-# select.m4 serial 10
+# select.m4 serial 11
 dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -78,8 +78,8 @@ changequote([,])dnl
             linux-* | linux) gl_cv_func_select_detects_ebadf="guessing yes" ;;
                              # Guess yes on glibc systems.
             *-gnu* | gnu*)   gl_cv_func_select_detects_ebadf="guessing yes" ;;
-                             # If we don't know, assume the worst.
-            *)               gl_cv_func_select_detects_ebadf="guessing no" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_select_detects_ebadf="$gl_cross_guess_normal" ;;
            esac
           ])
       ])
diff --git a/m4/setenv.m4 b/m4/setenv.m4
index a8f83d6..6755459 100644
--- a/m4/setenv.m4
+++ b/m4/setenv.m4
@@ -1,4 +1,4 @@
-# setenv.m4 serial 28
+# setenv.m4 serial 29
 dnl Copyright (C) 2001-2004, 2006-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -39,8 +39,8 @@ AC_DEFUN([gl_FUNC_SETENV],
          *-gnu* | gnu*) gl_cv_func_setenv_works="guessing yes" ;;
                         # Guess yes on musl systems.
          *-musl*)       gl_cv_func_setenv_works="guessing yes" ;;
-                        # If we don't know, assume the worst.
-         *)             gl_cv_func_setenv_works="guessing no" ;;
+                        # If we don't know, obey --enable-cross-guesses.
+         *)             gl_cv_func_setenv_works="$gl_cross_guess_normal" ;;
        esac
       ])])
     case "$gl_cv_func_setenv_works" in
@@ -131,8 +131,8 @@ int unsetenv (const char *name);
       [case "$host_os" in
                  # Guess yes on glibc systems.
          *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;;
-                 # If we don't know, assume the worst.
-         *)      gl_cv_func_unsetenv_works="guessing no" ;;
+                 # If we don't know, obey --enable-cross-guesses.
+         *)      gl_cv_func_unsetenv_works="$gl_cross_guess_normal" ;;
        esac
       ])])
     case "$gl_cv_func_unsetenv_works" in
diff --git a/m4/signbit.m4 b/m4/signbit.m4
index f7f2f3d..097682b 100644
--- a/m4/signbit.m4
+++ b/m4/signbit.m4
@@ -1,4 +1,4 @@
-# signbit.m4 serial 17
+# signbit.m4 serial 18
 dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -35,8 +35,8 @@ AC_DEFUN([gl_SIGNBIT],
            *-musl*)       gl_cv_func_signbit="guessing yes" ;;
                           # Guess yes on native Windows.
            mingw*)        gl_cv_func_signbit="guessing yes" ;;
-                          # If we don't know, assume the worst.
-           *)             gl_cv_func_signbit="guessing no" ;;
+                          # If we don't know, obey --enable-cross-guesses.
+           *)             gl_cv_func_signbit="$gl_cross_guess_normal" ;;
          esac
         ])
     ])
@@ -73,8 +73,8 @@ AC_DEFUN([gl_SIGNBIT],
                             gl_cv_func_signbit_gcc="guessing no"
                           fi
                           ;;
-                          # If we don't know, assume the worst.
-           *)             gl_cv_func_signbit_gcc="guessing no" ;;
+                          # If we don't know, obey --enable-cross-guesses.
+           *)             gl_cv_func_signbit_gcc="$gl_cross_guess_normal" ;;
          esac
         ])
     ])
diff --git a/m4/sleep.m4 b/m4/sleep.m4
index 7bab467..397fbd8 100644
--- a/m4/sleep.m4
+++ b/m4/sleep.m4
@@ -1,4 +1,4 @@
-# sleep.m4 serial 10
+# sleep.m4 serial 11
 dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -52,8 +52,8 @@ handle_alarm (int sig)
          *-musl*)       gl_cv_func_sleep_works="guessing yes" ;;
                         # Guess no on native Windows.
          mingw*)        gl_cv_func_sleep_works="guessing no" ;;
-                        # If we don't know, assume the worst.
-         *)             gl_cv_func_sleep_works="guessing no" ;;
+                        # If we don't know, obey --enable-cross-guesses.
+         *)             gl_cv_func_sleep_works="$gl_cross_guess_normal" ;;
        esac
       ])])
     case "$gl_cv_func_sleep_works" in
diff --git a/m4/stat.m4 b/m4/stat.m4
index 60040d1..752661f 100644
--- a/m4/stat.m4
+++ b/m4/stat.m4
@@ -1,4 +1,4 @@
-# serial 15
+# serial 16
 
 # Copyright (C) 2009-2019 Free Software Foundation, Inc.
 #
@@ -47,8 +47,8 @@ AC_DEFUN([gl_FUNC_STAT],
               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, assume the worst.
-              *)               gl_cv_func_stat_file_slash="guessing no" ;;
+                               # If we don't know, obey --enable-cross-guesses.
+              *)               gl_cv_func_stat_file_slash="$gl_cross_guess_normal" ;;
             esac
            ])
          rm -f conftest.tmp conftest.lnk])
diff --git a/m4/stpncpy.m4 b/m4/stpncpy.m4
index f8e1a7c..e31898f 100644
--- a/m4/stpncpy.m4
+++ b/m4/stpncpy.m4
@@ -1,4 +1,4 @@
-# stpncpy.m4 serial 17
+# stpncpy.m4 serial 18
 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2019 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -80,7 +80,7 @@ int main ()
 ],         [gl_cv_func_stpncpy="guessing yes"],
            [case "$host_os" in
               *-musl*) gl_cv_func_stpncpy="guessing yes" ;;
-              *)       gl_cv_func_stpncpy="guessing no" ;;
+              *)       gl_cv_func_stpncpy="$gl_cross_guess_normal" ;;
             esac
            ])
         ])
diff --git a/m4/strcasestr.m4 b/m4/strcasestr.m4
index 45abdbd..97fc5a6 100644
--- a/m4/strcasestr.m4
+++ b/m4/strcasestr.m4
@@ -1,4 +1,4 @@
-# strcasestr.m4 serial 24
+# strcasestr.m4 serial 25
 dnl Copyright (C) 2005, 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -64,7 +64,7 @@ AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE],
 #endif
               ],
               [gl_cv_func_strcasestr_works_always="guessing yes"],
-              [gl_cv_func_strcasestr_works_always="guessing no"])
+              [gl_cv_func_strcasestr_works_always="$gl_cross_guess_normal"])
            ])
         ])
       case "$gl_cv_func_strcasestr_works_always" in
@@ -136,7 +136,7 @@ static void quit (int sig) { _exit (sig + 128); }
 #endif
            ],
            [gl_cv_func_strcasestr_linear="guessing yes"],
-           [gl_cv_func_strcasestr_linear="guessing no"])
+           [gl_cv_func_strcasestr_linear="$gl_cross_guess_normal"])
         ])
       ])
     case "$gl_cv_func_strcasestr_linear" in
diff --git a/m4/strerror.m4 b/m4/strerror.m4
index 2c90f31..fbfb4e1 100644
--- a/m4/strerror.m4
+++ b/m4/strerror.m4
@@ -1,4 +1,4 @@
-# strerror.m4 serial 20
+# strerror.m4 serial 21
 dnl Copyright (C) 2002, 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -28,8 +28,8 @@ AC_DEFUN([gl_FUNC_STRERROR],
            *-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, assume the worst.
-           *)             gl_cv_func_working_strerror="guessing no" ;;
+                          # If we don't know, obey --enable-cross-guesses.
+           *)             gl_cv_func_working_strerror="$gl_cross_guess_normal" ;;
          esac
         ])
     ])
@@ -86,8 +86,8 @@ AC_DEFUN([gl_FUNC_STRERROR_0],
          *-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, assume the worst.
-         *)             gl_cv_func_strerror_0_works="guessing no" ;;
+                        # If we don't know, obey --enable-cross-guesses.
+         *)             gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;;
        esac
       ])
   ])
diff --git a/m4/strerror_r.m4 b/m4/strerror_r.m4
index dafc46d..9907113 100644
--- a/m4/strerror_r.m4
+++ b/m4/strerror_r.m4
@@ -1,4 +1,4 @@
-# strerror_r.m4 serial 19
+# strerror_r.m4 serial 20
 dnl Copyright (C) 2002, 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -163,7 +163,7 @@ changequote([,])dnl
                [gl_cv_func_strerror_r_works=no],
                [dnl Guess no on all platforms that have __xpg_strerror_r,
                 dnl at least until fixed glibc and cygwin are more common.
-                gl_cv_func_strerror_r_works="guessing no"
+                gl_cv_func_strerror_r_works="$gl_cross_guess_normal"
                ])
             ])
         fi
diff --git a/m4/strstr.m4 b/m4/strstr.m4
index d6ed6b9..2363514 100644
--- a/m4/strstr.m4
+++ b/m4/strstr.m4
@@ -1,4 +1,4 @@
-# strstr.m4 serial 20
+# strstr.m4 serial 21
 dnl Copyright (C) 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -56,7 +56,7 @@ AC_DEFUN([gl_FUNC_STRSTR_SIMPLE],
 #endif
             ],
             [gl_cv_func_strstr_works_always="guessing yes"],
-            [gl_cv_func_strstr_works_always="guessing no"])
+            [gl_cv_func_strstr_works_always="$gl_cross_guess_normal"])
          ])
       ])
     case "$gl_cv_func_strstr_works_always" in
@@ -135,7 +135,7 @@ static void quit (int sig) { _exit (sig + 128); }
 #endif
            ],
            [gl_cv_func_strstr_linear="guessing yes"],
-           [gl_cv_func_strstr_linear="guessing no"])
+           [gl_cv_func_strstr_linear="$gl_cross_guess_normal"])
         ])
       ])
     case "$gl_cv_func_strstr_linear" in
diff --git a/m4/strtod.m4 b/m4/strtod.m4
index d68ab75..2a0aaea 100644
--- a/m4/strtod.m4
+++ b/m4/strtod.m4
@@ -1,4 +1,4 @@
-# strtod.m4 serial 25
+# strtod.m4 serial 26
 dnl Copyright (C) 2002-2003, 2006-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -119,7 +119,7 @@ numeric_equal (double x, double y)
               *-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="guessing no" ;;
+              *)       gl_cv_func_strtod_works="$gl_cross_guess_normal" ;;
             esac
            ])
         ])
diff --git a/m4/strtold.m4 b/m4/strtold.m4
index 17125fe..389402a 100644
--- a/m4/strtold.m4
+++ b/m4/strtold.m4
@@ -1,4 +1,4 @@
-# strtold.m4 serial 4
+# strtold.m4 serial 5
 dnl Copyright (C) 2002-2003, 2006-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -101,7 +101,7 @@ numeric_equal (long double x, long double y)
            [case "$host_os" in
                        # Guess yes on musl systems.
               *-musl*) gl_cv_func_strtold_works="guessing yes" ;;
-              *)       gl_cv_func_strtold_works="guessing no" ;;
+              *)       gl_cv_func_strtold_works="$gl_cross_guess_normal" ;;
             esac
            ])
         ])
diff --git a/m4/symlink.m4 b/m4/symlink.m4
index 508e94d..2bec317 100644
--- a/m4/symlink.m4
+++ b/m4/symlink.m4
@@ -1,4 +1,4 @@
-# serial 8
+# serial 9
 # See if we need to provide symlink replacement.
 
 dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
@@ -40,8 +40,8 @@ AC_DEFUN([gl_FUNC_SYMLINK],
             linux-* | linux) gl_cv_func_symlink_works="guessing yes" ;;
                              # Guess yes on glibc systems.
             *-gnu* | gnu*)   gl_cv_func_symlink_works="guessing yes" ;;
-                             # If we don't know, assume the worst.
-            *)               gl_cv_func_symlink_works="guessing no" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_symlink_works="$gl_cross_guess_normal" ;;
           esac
          ])
       rm -f conftest.f conftest.link conftest.lnk2])
diff --git a/m4/symlinkat.m4 b/m4/symlinkat.m4
index 99ff258..6b37b51 100644
--- a/m4/symlinkat.m4
+++ b/m4/symlinkat.m4
@@ -1,4 +1,4 @@
-# serial 9
+# serial 10
 # See if we need to provide symlinkat replacement.
 
 dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
@@ -41,8 +41,8 @@ AC_DEFUN([gl_FUNC_SYMLINKAT],
             linux-* | linux) gl_cv_func_symlinkat_works="guessing yes" ;;
                              # Guess yes on glibc systems.
             *-gnu* | gnu*)   gl_cv_func_symlinkat_works="guessing yes" ;;
-                             # If we don't know, assume the worst.
-            *)               gl_cv_func_symlinkat_works="guessing no" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_symlinkat_works="$gl_cross_guess_normal" ;;
           esac
          ])
       rm -f conftest.f conftest.link conftest.lnk2])
diff --git a/m4/trunc.m4 b/m4/trunc.m4
index 9c3694e..5614148 100644
--- a/m4/trunc.m4
+++ b/m4/trunc.m4
@@ -1,4 +1,4 @@
-# trunc.m4 serial 14
+# trunc.m4 serial 15
 dnl Copyright (C) 2007, 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -78,8 +78,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_trunc_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_trunc_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_trunc_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_trunc_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/truncf.m4 b/m4/truncf.m4
index 3ef5b73..02dc73d 100644
--- a/m4/truncf.m4
+++ b/m4/truncf.m4
@@ -1,4 +1,4 @@
-# truncf.m4 serial 14
+# truncf.m4 serial 15
 dnl Copyright (C) 2007, 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -78,8 +78,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_truncf_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_truncf_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_truncf_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_truncf_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/truncl.m4 b/m4/truncl.m4
index 2970f83..b0945f6 100644
--- a/m4/truncl.m4
+++ b/m4/truncl.m4
@@ -1,4 +1,4 @@
-# truncl.m4 serial 16
+# truncl.m4 serial 17
 dnl Copyright (C) 2007-2008, 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -111,8 +111,8 @@ int main (int argc, char *argv[])
                  *-musl*)       gl_cv_func_truncl_ieee="guessing yes" ;;
                                 # Guess yes on native Windows.
                  mingw*)        gl_cv_func_truncl_ieee="guessing yes" ;;
-                                # If we don't know, assume the worst.
-                 *)             gl_cv_func_truncl_ieee="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+                 *)             gl_cv_func_truncl_ieee="$gl_cross_guess_normal" ;;
                esac
               ])
             LIBS="$save_LIBS"
diff --git a/m4/tzset.m4 b/m4/tzset.m4
index afdfa8e..1e852ac 100644
--- a/m4/tzset.m4
+++ b/m4/tzset.m4
@@ -1,4 +1,4 @@
-# serial 12
+# serial 13
 
 # Copyright (C) 2003, 2007, 2009-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -74,8 +74,8 @@ main ()
           *-musl*)       gl_cv_func_tzset_clobber="guessing no" ;;
                          # Guess no on native Windows.
           mingw*)        gl_cv_func_tzset_clobber="guessing no" ;;
-                         # If we don't know, assume the worst.
-          *)             gl_cv_func_tzset_clobber="guessing yes" ;;
+                         # If we don't know, obey --enable-cross-guesses.
+          *)             gl_cv_func_tzset_clobber="$gl_cross_guess_inverted" ;;
         esac
        ])
     ])
diff --git a/m4/ungetc.m4 b/m4/ungetc.m4
index 08baf33..b54c19b 100644
--- a/m4/ungetc.m4
+++ b/m4/ungetc.m4
@@ -1,4 +1,4 @@
-# ungetc.m4 serial 7
+# ungetc.m4 serial 8
 dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -49,8 +49,8 @@ AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS],
            *-android*)    gl_cv_func_ungetc_works="guessing yes" ;;
                           # Guess yes on native Windows.
            mingw*)        gl_cv_func_ungetc_works="guessing yes" ;;
-                          # If we don't know, assume the worst.
-           *)             gl_cv_func_ungetc_works="guessing no" ;;
+                          # If we don't know, obey --enable-cross-guesses.
+           *)             gl_cv_func_ungetc_works="$gl_cross_guess_normal" ;;
          esac
         ])
     ])
diff --git a/m4/unlink.m4 b/m4/unlink.m4
index 69fd1af..fec63c1 100644
--- a/m4/unlink.m4
+++ b/m4/unlink.m4
@@ -1,4 +1,4 @@
-# unlink.m4 serial 13
+# unlink.m4 serial 14
 dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -49,8 +49,8 @@ AC_DEFUN([gl_FUNC_UNLINK],
          *-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, assume the worst.
-         *)               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
       ])
      rm -f conftest.file conftest.lnk])
@@ -110,8 +110,8 @@ AC_DEFUN([gl_FUNC_UNLINK],
               ]])],
              [gl_cv_func_unlink_parent_fails=yes],
              [gl_cv_func_unlink_parent_fails=no],
-             [# If we don't know, assume the worst.
-              gl_cv_func_unlink_parent_fails="guessing no"
+             [# If we don't know, obey --enable-cross-guesses.
+              gl_cv_func_unlink_parent_fails="$gl_cross_guess_normal"
              ])
            unset GL_SUBDIR_FOR_UNLINK
            rm -rf "$tmp"
diff --git a/m4/usleep.m4 b/m4/usleep.m4
index 4a6bff0..4f3abc3 100644
--- a/m4/usleep.m4
+++ b/m4/usleep.m4
@@ -1,4 +1,4 @@
-# usleep.m4 serial 6
+# usleep.m4 serial 7
 dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -35,8 +35,8 @@ AC_DEFUN([gl_FUNC_USLEEP],
            *-musl*)       gl_cv_func_usleep_works="guessing yes" ;;
                           # Guess no on native Windows.
            mingw*)        gl_cv_func_usleep_works="guessing no" ;;
-                          # If we don't know, assume the worst.
-           *)             gl_cv_func_usleep_works="guessing no" ;;
+                          # If we don't know, obey --enable-cross-guesses.
+           *)             gl_cv_func_usleep_works="$gl_cross_guess_normal" ;;
          esac
         ])])
     case "$gl_cv_func_usleep_works" in
diff --git a/m4/utimens.m4 b/m4/utimens.m4
index dda86b0..6ed6593 100644
--- a/m4/utimens.m4
+++ b/m4/utimens.m4
@@ -3,7 +3,7 @@ dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-dnl serial 9
+dnl serial 10
 
 AC_DEFUN([gl_UTIMENS],
 [
@@ -35,8 +35,8 @@ AC_DEFUN([gl_UTIMENS],
            linux-* | linux) gl_cv_func_futimesat_works="guessing yes" ;;
                             # Guess yes on glibc systems.
            *-gnu*)          gl_cv_func_futimesat_works="guessing yes" ;;
-                            # If we don't know, assume the worst.
-           *)               gl_cv_func_futimesat_works="guessing no" ;;
+                            # If we don't know, obey --enable-cross-guesses.
+           *)               gl_cv_func_futimesat_works="$gl_cross_guess_normal" ;;
          esac
         ])
       rm -f conftest.file])
diff --git a/m4/utimes.m4 b/m4/utimes.m4
index 5806d8f..703f823 100644
--- a/m4/utimes.m4
+++ b/m4/utimes.m4
@@ -1,5 +1,5 @@
 # Detect some bugs in glibc's implementation of utimes.
-# serial 6
+# serial 7
 
 dnl Copyright (C) 2003-2005, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
@@ -147,7 +147,7 @@ main ()
           *-musl*) gl_cv_func_working_utimes="guessing yes" ;;
                    # Guess no on native Windows.
           mingw*)  gl_cv_func_working_utimes="guessing no" ;;
-          *)       gl_cv_func_working_utimes="guessing no" ;;
+          *)       gl_cv_func_working_utimes="$gl_cross_guess_normal" ;;
         esac
        ])
     ])
diff --git a/m4/wcwidth.m4 b/m4/wcwidth.m4
index e9b5bf4..cb5935a 100644
--- a/m4/wcwidth.m4
+++ b/m4/wcwidth.m4
@@ -1,4 +1,4 @@
-# wcwidth.m4 serial 29
+# wcwidth.m4 serial 30
 dnl Copyright (C) 2006-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -108,7 +108,7 @@ changequote(,)dnl
              *-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="guessing no";;
+             *)             gl_cv_func_wcwidth_works="$gl_cross_guess_normal";;
            esac
 changequote([,])dnl
           ])



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: critique of gnulib - disabling workarounds
  2019-09-01 21:53   ` Jonas 'Sortie' Termansen
                       ` (2 preceding siblings ...)
  2019-09-08 17:28     ` critique of gnulib - malloc wrapper Bruno Haible
@ 2019-09-09  1:24     ` Bruno Haible
  3 siblings, 0 replies; 13+ messages in thread
From: Bruno Haible @ 2019-09-09  1:24 UTC (permalink / raw)
  To: Jonas 'Sortie' Termansen; +Cc: Paul Eggert, Gnulib bugs

Jonas Termansen wrote:
> To recap, my primary requests are:
> 
> 1) Categorizing gnulib into three parts (replacement functions for when
> they don't exist, workarounds for bugs, and utility functions).
> 
> 2) Making it possible to disable the gnulib bug replacements with a
> configure command line option.
> 
> 3) Defaulting to assume the best when cross-compiling to unknown systems.

Now that 3) is implemented, I don't see the utility of 2). If someone is
NOT cross-compiling, and a configure test has determined that a certain
system function is buggy or missing, what would be the point of disabling
the workaround? Even for your situation as an OS developer, Gnulib doesn't
hide the issues: It mentions the test results in the configure output,
and you even a sample program to reproduce each problem (embedded in the
config.log).

Regarding 1): This categorization exists in the documentation [1][2].
Should we go as far as splitting gnulib into 3 git repositories? I think
it would complicate things too much, because
  - most packages borrow modules from all three kinds,
  - there are dependencies not only from the utility modules to the
    POSIX emulation modules, but also the other way around (e.g. to
    the modules assure, c-ctype, filenamecat, flexmember, gettext-h,
    integer-length, localcharset, localename, minmax, scratch-buffer,
    verify).

Bruno

[1] https://www.gnu.org/software/gnulib/manual/html_node/index.html
[2] https://www.gnu.org/software/gnulib/MODULES.html



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-09-09  1:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-31 21:46 critique of gnulib Bruno Haible
2019-08-31 23:20 ` Paul Eggert
2019-09-01 21:53   ` Jonas 'Sortie' Termansen
2019-09-01 22:46     ` Paul Eggert
2019-09-08 17:08       ` critique of gnulib - string allocation Bruno Haible
2019-09-08 17:47         ` Ben Pfaff
2019-09-08 20:17         ` Paul Eggert
2019-09-08 20:58           ` Bruno Haible
2019-09-08 23:29             ` Paul Eggert
2019-09-09  1:04       ` critique of gnulib - cross-compilation guesses Bruno Haible
2019-09-08 17:20     ` critique of gnulib - stdioext Bruno Haible
2019-09-08 17:28     ` critique of gnulib - malloc wrapper Bruno Haible
2019-09-09  1:24     ` critique of gnulib - disabling workarounds Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).