qsort_r: new module, for GNU-style qsort_r

This works even on FreeBSD, which has an incompatible qsort_r API.
* MODULES.html.sh: Add it.
* doc/glibc-functions/qsort_r.texi: It's now supported.
* lib/qsort.c: New file, taken from glibc with minor changes
inside "#ifndef _LIBC" and with an unnecessary "#include <alloca.h>"
removed.
* lib/qsort_r.c: New file, compiled only on FreeBSD.
* lib/stdlib.in.h (qsort_r): Declare in the usual way.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS):
* modules/qsort_r, modules/qsort_r-tests: New files.
* modules/stdlib (Makefile): Set up its defaults.
* tests/test-qsort_r.c: New file.
parse-datetime: Avoid signed/unsigned comparison warning

* lib/parse-datetime.y (yylex): Compare pointer to end of buffer,
instead of calculating difference of pointers.  This removes an
annoying warning, devoid of any use.
vasnprintf: Avoid signed/unsigned comparison warning.

* lib/vasnprintf.c (VASNPRINTF): To calculate padding,
compare end addr of generated string w/ maximum end addr.
vasnprintf: fix bugs in width computation

* lib/vasnprintf.c (VASNPRINTF):
Rework previous change, which introduced a bug,
to avoid the warning in a different way.
Avoid undefined behavior if the width arg is less than -INT_MAX.
Avoid unnecessary use of HAS_WIDTH local.
manywarnings: add GCC 4.9 warnings

Also, make it easier to maintain this in the future.
* build-aux/gcc-warning.spec: Add -Wabi-tag,
-Wconditionally-supported, -Wdelete-incomplete,
-Winherited-variadic-ctor, -Wvirtual-move-assign, -Wzerotrip.
Remove duplicates.  Use tabs uniformly, as that's what 'cut' wants.
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Add -Wdate-time,
-Wopenmp-simd.  Use -fdiagnostics-show-option and -funit-at-a-time
only for older GCC versions that need them.  Handke
-Wnormalized=nfc specially, so that the 'comm' command used
for maintenance doesn't get confused.
gnulib-common.m4: port to GCC 4.2.1 and Sun Studio 12 C++

* m4/gnulib-common.m4 (AC_C_RESTRICT):
Override AC_C_RESTRICT unconditionally.
Update from autoconf, incorporating:
2014-09-02 autoconf: port 'restrict' to GCC 4.2.1
2009-01-28 Fix AC_C_RESTRICT for Sun Studio 12 C++.
error: drop spurious semicolon

* lib/error.c (__error_at_line): Fix ';;'.

Signed-off-by: Eric Blake <eblake@redhat.com>
pthread, pthread_sigmask, threadlib: port to Ubuntu 14.04

Problem reported by Assaf Gordon in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-09/msg00023.html
Apparently Ubuntu is doing some fancy link-time optimization
that doesn't work with -lpthread but does work with -pthread.
Work around the bug by preferring -pthread to -lpthread.
This change affects only LIBS, not CFLAGS, which is a little
weird, but it works.
* m4/pthread.m4 (gl_PTHREAD_CHECK):
* m4/threadlib.m4 (gl_THREADLIB_BODY): Prefer -pthread to -lpthread.
* m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK):
Treat -pthread like -lpthread.
maintainer-makefile: add syntax check for useless ';;'

Most instances of ;; in C code are mistakes, where the second
semicolon is a no-op.  This rule tries to make it easy to flag
the typos occuring at the end of a statement.  It intentionally
does not flag for(;;) loops, and misses grammar problems in
comments if the problem occurs in the middle of the line.

Shell files (including configure.ac and Makefile.am, which can
contain shell snippets) are too likely to use case statements
where ;; is legitimate, so those are not scanned.

* top/maint.mk (sc_prohibit_double_semicolon): New rule.

Signed-off-by: Eric Blake <eblake@redhat.com>
gnulib-tool: Fallback to wget when rsync fails

Current implementation only tries to rsync PO files when rsync is
installed on the host. In case of error, no files are downloaded even
if they are available. This leads to bootstrap problems for hosts
that lie behind a restrictive firewall.

This patch always tries to rsync by default, falling back to wget if
an error occurs.

Signed-off-by: Mathieu Anquetin <mathieu@anquetin.eu>
gnulib-tool: Sync with build-aux/bootstrap options

Options for downloading PO files were not in sync with their
build-aux/bootstrap counterpart. This commit adopt the same behavior for
these tools.

Signed-off-by: Mathieu Anquetin <mathieu@anquetin.eu>
users.txt: add cmogstored

cmogstored has used gnulib since the beginning in 2012 to support
GNU/Linux, FreeBSD, and GNU/kFreeBSD.  cmogstored is currently
included in the FreeBSD ports collection, but developed primarily
on GNU/Linux.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
mountlist: use /proc/self/mountinfo when available

Use libmount to propagate device IDs provided by Linux in
/proc/self/mountinfo.  This will give more accurate output when
using df in chroot'ed environments as the device IDs are not
determined by stat() which may be inaccurate within the chroot.

* lib/mountlist.c (read_file_system_list): Use the libmount routines
from util-linux to parse "/proc/self/mountinfo" or fall back to
standard getmntent() processing.
* m4/ls-mntd-fs.m4: Check for libmount only when 1-argument
getmntent() is used, as is the case on GNU/Linux.
* DEPENDENCIES: Mention the optional util-linux dependency.
autoupdate
fcntl-h: fix compilation with Intel C++ compiler

* lib/fcntl.in.h: ICC has the same issue as GCC <= 4.2.
strerror_r-posix: support compilation with C++

* lib/strerror_r.c: Add necessary C linkage declarations.
qsort_r: new module, for GNU-style qsort_r

* m4/qsort_r.m4: New file.  Forgot to add this earlier.
avltree-list: avoid compiler warnings

* lib/gl_anytree_list2.h: Add _GL_ATTRIBUTE_PURE to avoid
-Werror=suggest-attribute=pure.
* lib/gl_array_list.c: Likewise.
* lib/gl_avltree_list.c (gl_avltree_list_check_invariants): Add extern
declaration to avoid -Werror=missing-prototypes.  This is not added
to a header as only exported for tests.  Add (void) to the
check_invariants() call to indicate we're discarding the result
in this context which avoids -Werror=unused-value.  Note we don't
use ignore_value here to avoid a dependency as we know we'll not
be adding __attribute__((warn_unused_result)) to check_invariants().
Add _GL_ATTRIBUTE_CONST to avoid -Werror=suggest-attribute=const.
qsort_r: include <config.h>

Problem reported by Tom G. Christensen in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-09/msg00071.html
* lib/qsort.c [!_LIBC]: Include <config.h> first.
dirname: support compilation with C++

* lib/dirname.h: Add necessary C linkage declarations.