tests: port to libpcre sans UTF-8 support

Problem reported by Nelson H. F. Beebe.
* tests/pcre-infloop, tests/pcre-invalid-utf8-input, tests/pcre-utf8:
Skip the test unless PCRE works in an en_US.UTF-8 locale.
build: port to GCC 4.6.4 + glibc 2.5

On platforms this old, building with _FORTIFY_SOURCE equal to 2
results in duplicate definitions of standard library functions.
Problem reported by Nelson H. F. Beebe.
* configure.ac (_FORTIFY_SOURCE): Sort after GNULIB_PORTCHECK.
By default, do not enable this unless GNULIB_PORTCHECK is defined.
This better matches the original intent, which as I recall was to
enable these extra checks only with --enable-gcc-warnings.
tests: fix recently-introduced stray output

* tests/init.cfg (require_pcre_): Remove stray debugging output.
tests: port to Darwin

The 'sed' command 's/.//' does not delete all bytes in the C locale.
Problem reported by Nelson H. F. Beebe.
* tests/fmbtest: Don't assume that sed treats bytes with the
top bit set as valid characters in the C locale, as this is not
true for Darwin.  Use the cs_CZ.UTF-8 locale instead, and
simplify the sed script.
grep -F -x -o PAT would print an extra newline for each match

* src/kwsearch.c (Fexecute): Correctly compute the length of a match
by subtracting 2 (not 1) when match_lines is set.  With -x, we augment
the "line" by both prepending and appending an EOLBYTE to the search
pattern.  Here, we must correct for that.  However, to compensate,
when we are using -x (--line-regexp) and start_ptr is NULL, we have
to add 1 to the length so that we still print the trailing EOLBYTE.
Introduced by commit v2.18-85-g2c94326.
* tests/match-lines: Add a new test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
gnulib: update to latest
dfa: avoid undefined behavior

* src/dfa.c (dfassbuild): Don't call memcpy with a second
argument of NULL, even when the size (3rd argument) is 0.
tests: big-match: disable OOM-provoking subtest

* tests/big-match: Our application of this regexp '^.*x\(\)\1'
to a file containing a single matching line of length 2GiB+2
would cause inordinate memory consumption (over 100GB) via
regexec.c, but no leak.  That would cause disruption on most
systems, so remove this subtest.  Reported by Assaf Gordon.
grep -F could erroneously fail to match in non-UTF8 multibyte locales

This fixes a bug that can strike only when using a non-UTF8 multibyte
locale like ja_JP.SHIFT_JIS.

Consider this example: it would mistakenly fail to match before
this patch:

  printf '\203AA\n'|LC_ALL=ja_JP.SHIFT_JIS src/grep -F A

When searching for a single byte that happens to be the latter
byte of a multibyte character, and the target byte also follows
that multibyte character, grep -F would advance an internal pointer
by one byte too many, thus missing the target byte.  A test case
for this bug is already included in tests/sjis-mb.

* src/kwsearch.c (Fexecute): Skip one byte less, after matched middle of a
multi-byte character.  Introduced by commit v2.18-119-gfb7d538.
tests: sjis-mb: remove now-obsolete and failing sub-tests

* tests/sjis-mb: Commit v2.18-123-geb3292b changed how grep
handles patterns with encoding errors.  These SJIS tests are
skipped so often that we didn't notice until now that there were
two tests of that changed behavior, and that on any system with
the ja_JP.SHIFT_JIS locale, they would always fail.  Remove those
two tests, since this functionality is well tested separately,
via tests/prefix-of-multibyte.
version 2.21

* NEWS: Record release date.
maint: post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
maint: correct for four Author: name misspellings

* .mailmap: Correct for misspelling in Norihiro Tanaka's last name
as listed in four commit Author: fields: s/Norihirio/Norihiro/
doc: document grep-2.11 change in behavior of -r, --recursive

* doc/grep.texi (--recursive, -r): Mention the new behavior
of recursively searching "." when there is no FILE argument.
* doc/grep.in.1: Likewise.
That change first appeared in grep-2.11, released on 2012-03-02.
dfa: avoid invalid match or infinite loop in unused matching mode

Neither grep nor gawk uses this DFA code in its matching mode,
since each always calls dfacomp with a nonzero final argument.
However, when used in that mode, it had bug:
After failing to match in matching mode, it should return NULL,
but instead would either report a false match or enter an
infinite loop.

* src/dfa.c (dfaexec_main): After failing to match in matching mode
return NULL, rather than transitioning to the next state.
* tests/dfa-match: Add a new test.
* tests/dfa-match-aux.c: Add a new program to exercise this
otherwise-unused part of dfa.c.
* tests/Makefile.am: Add a rule to build new test.
(check_PROGRAMS): Add dfa-match-aux.
(AM_CPPFLAGS): Add -I$(top_srcdir)/src.
(TESTS): Add dfa-match.
* cfg.mk (exclude_file_name_regexp--sc_bindtextdomain):
(exclude_file_name_regexp--sc_prohibit_atoi_atof):
Exempt the new test file from some syntax-check rules.
dfa: simplify dfaexec

* src/dfa.c (dfaexec): Simplify by rearrangement of IF conditions.
This commit induces no semantic change, and reverts part of commit
v2.5.4-144-gbafa134.
tests: port fmbtest to CentOS 6 and earlier

* tests/fmbtest: Port to platforms where the 'sed' pattern
'[^0-9]' does not match every non-digit character.  Problem
reported by Norihiro Tanaka in: http://bugs.gnu.org/19293
build: avoid build failure with --enable-gcc-warnings and no PCRE

* src/pcresearch.c [HAVE_LIBPCRE] (empty_match): Guard the declaration
of this PCRE-only variable.
maint: fix a new "make syntax-check" failure

* tests/dfa-match-aux.c: s/can not/cannot/
doc: document binary-data heuristic better

Problem reported by Martin Hoch in: http://bugs.gnu.org/19388
* doc/grep.texi (File and Directory Selection):
Document what non-text bytes are.
(Usage): Fix cross reference.