update from texinfo
autoupdate
savedir: add sorting arg to savedir, streamsavedir; remove fdsavedir

Patch based on an idea by Dick Streefland in
<https://savannah.gnu.org/patch/?7892>.

* NEWS: Document this.
* lib/savedir.c (NAME_SIZE_DEFAULT): Remove.
(direntry_t, comparison_function): New types.
(direntry_cmp_name): New function.
(direntry_cmp_inode) [D_INO_IN_DIRENT]: New function.
(streamsavedir, savedir): New arg OPTION.
(streamsavedir): Simplify memory allocation.
(fdsavedir): Remove.
* lib/savedir.h (enum savedir_option): New type.
(streamsavedir, savedir): New arg OPTION.
(fdsavedir): Remove.
update from texinfo
maintainer-makefiles: use $(SED) for syntax check

Roman Bogorodskiy reported that attempts to use 'make syntax-check'
for libvirt on a BSD host was failing, due to libvirt's use of
GNU sed constructs in cfg.mk.  While libvirt could be patched to
use only portable sed constructs, it is also worth making sed
replaceable so that any maintainer can use a consistent sed program
rather than being hardcoded to the first 'sed' on $PATH.

* modules/maintainer-makefile (configure.ac): Check for sane sed.
* top/maint.mk: Change sed to $(SED).

Signed-off-by: Eric Blake <eblake@redhat.com>
exclude: add support for posix regexps

This commit adds support for POSIX extended regular expressions
and fixes a long-standing memory leak (pattern buffer was never
freed).  It also implements a new interface function to read
exclude patterns from a FILE, which passes an additional parameter
to its callback function, thereby allowing to preserve its state
between invocations.

* lib/exclude.c (struct patopts): Pack regex and pattern into union.
(pattern_buffer): New struct.
(exclude): New member patbuf.
(exclude_add_pattern_buffer): New function.
(free_exclude_segment): Free regexps.
(free_exclude): Free allocated pattern buffers.
(exclude_patopts): New function.
(file_pattern_matches): Use exclude_patopts.
(add_exclude): support regexps.
(add_exclude_fp): New function.
(add_exclude_file): Rewrite using add_exclude_fp.
(fnmatch_pattern_has_wildcards): Support posix extended regexps.
* lib/exclude.h (EXCLUDE_REGEX, EXCLUDE_ALLOC): New flags.
(add_exclude_fp)
(exclude_add_pattern_buffer): New prototypes.
* modules/exclude: Depends on regex and filename.
maintainer-makefiles: provide AC_PROG_SED for older autoconf

Pavel Hrdina reported build failures on RHEL 5, where autoconf 2.59
is still the default, and predates the introduction of AC_PROG_SED.

This version is copied from autoconf 2.69, but with lots of constructs
open-coded because of macros not being available in 2.59; I tested
that the result selects the correct sed under RHEL 5.

* m4/gnulib-common.m4 (AC_PROG_SED): Copy from newer autoconf.

Signed-off-by: Eric Blake <eblake@redhat.com>
m4: fix gl_TIMER_TIME() detection of threads on uClibc

The timer_time.m4 gl_TIMER_TIME function determines which libraries
need to be linked to get access to the timer function, generally -lrt
for Linux systems. On platforms where threads are used, librt
typically uses thread functions from libpthread.

However, the test to determine whether the platform has thread or not
is incorrect: it assumes that if the C library is uClibc, then threads
are not available. This is actually not true: uClibc has configurable
thread support, and when thread support is available, librt calls
libpthread functions.

This is important when static linking is used, because otherwise only
-lrt is used at link time, which fails because librt calls undefined
thread functions. Both -lrt and -lpthread must be passed.

This problem is fixed by making the uClibc thread detection a bit
smarter, thanks to the usage of the __HAS_NO_THREADS__ macro defined
in <bits/uClibc_config.h>, which itself is included by <features.h>.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
spawn: fix link error on uclibc

* m4/spawn_h.m4 (gl_HAVE_POSIX_SPAWN): use AC_SEARCH_LIBS,
to incorporate -lrt if needed (on uclibc for example).
* modules/posix_spawn: Reference the substituted LIB.
savedir: simplify by using stpcpy

* lib/savedir.c (direntry_t): Remove size member.  All uses removed.
(streamsavedir): Use stpcpy instead.
* modules/savedir (Depends-on): Add stpcpy.
diffseq: remove TOO_EXPENSIVE heuristic

Problem with diffutils reported by Vincent Lefevre in
<http://bugs.gnu.org/16848>.  The simplest solution is to remove
the TOO_EXPENSIVE heuristic that I added to GNU diff in 1993.
Although appropriate for circa-1993 hardware, these days the heuristic
seems to be more trouble than it's worth.
* lib/diffseq.h: Modernize citations.
(struct context): Remove member too_expensive.
All uses changed.
(struct partition): Remove members lo_minimal, hi_minimal.
All uses changed.
(diag, compareseq): Remove arg find_minimal.  All uses changed.
(diag): Remove the TOO_EXPENSIVE heuristic that I added back in
1993 to make 'diff' run faster (but not as well) on large inputs.
These days, computers are fast enough that it's typically better
to run slower but more accurately.
* lib/fstrcmp.c: Remove duplicate comment.
* lib/fstrcmp.c (strcmp_bounded):
* lib/git-merge-changelog.c (compute_differences):
Adjust to diffseq.h changes.
* NEWS: Document recent change to diffseq.
unistd: port readlink to Mac OS X 10.3.9

* lib/unistd.in.h (_GL_INCLUDING_UNISTD_H): New macro, to work
around self-include problem in Mac OS X 10.3.9 when combined with
readlink module.  Problem reported by Klaus Zietler in
<http://bugs.gnu.org/16825>.