Simon Josefsson <simon <at> josefsson.org> writes:
>
> > (remember, however, that the system memmem may be broken, as on
> > cygwin).
>
> Did the old check find that brokenness? Has this brokenness been
> discussed before, and was a m4 test to detect it produced? I can't see
> anything in memmem.m4 about it now.
On cygwin 1.5.25-7 and earlier, memmem(ptr1,len,ptr2,0) returned NULL, not
ptr1. This has since been fixed in cygwin CVS (but unreleased); with that fix,
cygwin is now in the same boat as glibc 2.6.1 (working, but quadratic). This
bug is detected by the following line in the run-time test, added when I first
started touching memmem last month:
return !result || !memmem ("a", 1, 0, 0);]])],
It's also documented in doc/functions/memmem.texi.
For cross-compiling, I would just blindly replace memmem, even when targeting
glibc or other platform where the system memmem works, since that is easier
than dragging in a dependency on AC_CANONICAL_TARGET and adding a case
statement to distinguish known good systems.
--
Eric Blake