Provide glthread/lock.h implementation in terms of Guile threads.

Fixes <http://bugs.gnu.org/14404>.
Thanks to Paul Eggert <eggert@cs.ucla.edu> for the suggestion.

* m4/gnulib-cache.m4: Avoid 'lock' module.
* m4/lock.m4, m4/threadlib.m4, lib/glthread/threadlib.c,
  lib/glthread/lock.c: Remove.
* lib/glthread/lock.h: Rewrite in terms of libguile/threads.h.
* m4/gnulib-common.m4, m4/gnulib-comp.m4, lib/Makefile.am,
  lib/unistd.in.h, maint.mk : Update, from Gnulib v0.1-92-g546ff82.

* configure.ac (GNULIB_LOCK): Define 'GNULIB_LOCK'.  Define
  'USE_POSIX_THREADS' when building with pthread support.
* Makefile.am (noinst_HEADERS): New variable.
  (BUILT_SOURCES): Add libguile/scmconfig.h.
  (libguile/scmconfig.h): New target.
Thank Paul.
Avoid side effects in argument to SCM_I_INUM.

* libguile/vm-i-system.c (halt): Avoid side effects in argument to
  SCM_I_INUM.
Avoid signed overflow in random.c.

* libguile/random.c (scm_i_mask32): Avoid signed overflow from shifting
  an unsigned char (promoted to signed int) 24 bits to the left.
Avoid undefined behavior regarding signed integers and left shifts.

* libguile/numbers.c (scm_logbit_p): If the requested bit is the sign
  bit (or above), check the sign portably.  Otherwise, ensure that we're
  testing the bit in a two's complement representation.
  (left_shift_exact_integer): Avoid left-shifting negative integers.

* libguile/vm-i-scheme.c (ash): Avoid left-shifting negative integers.
Use 'offsetof' to avoid undefined behavior.

* libguile/socket.c (SUN_LEN): Use 'offsetof'.
SRFI-60: Reimplement 'rotate-bit-field' on inums to be more portable.

* libguile/srfi-60.c (scm_srfi60_rotate_bit_field): Avoid division by
  zero in the (start == end) case.  Rewrite inum case to work with
  unsigned integers in two's complement format.

* test-suite/tests/srfi-60.test ("rotate-bit-field"): Add more tests.
SCM_SRS: Improve fallback implemention to avoid unspecified behavior.

* libguile/numbers.h (SCM_SRS): Rewrite preprocessor test to avoid
  left-shifting negative integers, and to test more comprehensively for
  the behavior we need.  Rewrite fallback implementation to avoid
  unspecified behavior.
SCM_I_INUM: Rewrite to avoid unspecified behavior when not using GNU C.

* libguile/numbers.h (SCM_I_INUM): Unless using GNU C, use a portable
  implementation that avoids unspecified behavior.
Test for deleted weak pairs in hash-for-each.

* libguile/hashtab.c (scm_internal_hash_for_each_handle): Test for
  deleted weak pairs.
* test-suite/tests/hash.test: Add test case.
build: Fix Gnulib compilation when $builddir != $srcdir.

* configure.ac: Add -I$top_srcdir_absolute to 'CPPFLAGS'.  Fixes
  out-of-source-tree compilation of lib/regex.c.  Reported at
  <https://lists.gnu.org/archive/html/guile-devel/2014-03/msg00022.html>.
build: Don't include <config.h> in native programs when cross-compiling.

* libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): When cross-compiling,
  pass -DCROSS_COMPILING=1.
  (c-tokenize.$(OBJEXT)): Likewise.
* libguile/c-tokenize.lex (%top): Include <config.h> only when
  CROSS_COMPILING is undefined.
* libguile/gen-scmconfig.c: Likewise.
build: Install libguile-2.0-gdb.scm after libguile-2.0.so.

* libguile/Makefile.am (install-data-local): Rename to...
  (install-data-hook): ... this.  This guarantees that the rule runs
  after libguile-2.0.so has been installed.
build: Remove libguile-2.0-gdb.scm and $infodir/dir upon uninstall.

* libguile/Makefile.am (uninstall-data-hook): New target.
Include <config.h> in gen-scmconfig even when cross-compiling.

Partially reverts 8cb0d6d7fa9aaac316c29a64c541336b51b6f93d.

* libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Remove
  -DCROSS_COMPILING=1 from cross-compiling case.
* libguile/gen-scmconfig.c: Include <config.h> regardless of
  whether CROSS_COMPILING is defined.
Check SCM_USE_PTHREAD_THREADS using #if not #ifdef.

* libguile/bdw-gc.h: Check SCM_USE_PTHREAD_THREADS using #if not #ifdef.
SRFI-43 documentation tweaks

* doc/ref/api-compound.texi (Vectors): Add cross-reference to SRFI-43.
* doc/ref/srfi-modules.texi (SRFI-43 Selectors): Simplify description of
  'vector-ref'.
Fix (system base types) on big-endian systems.

* module/system/base/types.scm (cell->object): When reading stringbufs,
  use UTF-32BE on big-endian systems.
build: Link 'test-unwind.c' against libgnu.la.

* test-suite/standalone/Makefile.am (test_unwind_LDADD): Add libgnu.la,
  which provides 'rpl_mkstemp' on systems missing 'mkstemp'.
Documentation tweaks for the 'r7rs-symbols' read/print options.

* doc/ref/api-data.texi (Symbol Read Syntax): Mention the 'r7rs-symbols'
  print option, and provide example code to enable both the read and
  print options.  Add 'r7rs-symbols' to the concept index.