Workaround Linux NTPL lock elision bug.

glibc 2.19 on Linux x86-64 platforms includes support for lock elision,
by using Intel's TSX support when it is available.  Without modifying an
application this converts suitable critical sections that use mutex into
transactional memory critical sections.  See http://lwn.net/Articles/534758/
If a problem occurs that means that transactional memory can't be used, such
as a system call or buffer overflow, the pthreads implementation will catch
this error and retry the critical section using a normal mutex.

I noticed that since upgrading glibc that programs using Boehm GC crash, one
of these crashes was an assertion that the owner field of a mutex was
invalid.  The assertion was generated by the pthreads implementation.
I believe that there is a bug in glibc that when a mutex cannot be used
safely for transactions that some series of events causes it's owner field
to be set incorrectly (or cleared when it shouldn't be).

I've found that I can work around this problem by having Boehm GC use an
error checking mutex, which I believe doesn't use lock elision and in my
testing doesn't crash.

XXX: This work-around mostly works except for linking the feature detection
in configure.ac to the conditional compilation in pthread_support.c as there
isn't an obvious way to make it work for automake and Makefile.direct.
Could I have some help updating the build system please?

include/private/pthread_support.h:
pthread_support.c:
    Define GC_setup_mark_lock()  This procedure creates the lock specifying a
    pthread_mutexattr_t structure.  This is used to disable lock elision on
    Linux with glibc 2.19 or greater.

configure.ac:
    If we're using Linux then check for the gnu extensions required to
    identify the version of glibc at runtime.

misc.c:
    Call GC_setup_mark_lock() when initialising the collector.
Fix and code refactoring of lock elision workaround (Linux/x64)

* configure.ac (HAVE_LIBC_VERSION_H, HAVE_GNU_GET_LIBC_VERSION): Remove
(revert change in previous commit).
* include/private/gcconfig.h (GLIBC_2_19_TSX_BUG): New macro defined
for Linux/x86_64 (if Glibc used) to workaround a bug in Glibc lock
elision implementation.
* pthread_support.c: Move include of gnu/libc-version.h to gcconfig.h
(used to check whether lock elision workaround needed).
* misc.c (GC_init): Reformat code.
* pthread_support.c (mark_mutex): Initialize (to
PTHREAD_MUTEX_INITIALIZER) even lock elision workaround is needed
(revert change in previous commit).
* pthread_support.c (parse_version): New static function (defined only
if GLIBC_2_19_TSX_BUG).
* pthread_support.c (GC_setup_mark_lock): Use parse_version to check
target Glibc version properly; do not reinitialize mutex unless
workaround needed; call ABORT (with the appropriate message) in case
of a failure in pthread_mutexattr_init/settype, pthread_mutex_init.
Merge branch 'fix_tsx_bug' into release-7_4
Fix setup_mark_lock missing prototype
(and do not call it if no parallel marker)

* include/private/pthread_support.h (GC_setup_mark_lock): Remove
prototype.
* misc.c (GC_init): Remove GC_setup_mark_lock call (move it to
GC_thr_init).
* pthread_support.c (setup_mark_lock): Rename from GC_setup_mark_lock;
add prototype (only if PARALLEL_MARK).
* pthread_support.c (GC_thr_init): Call setup_mark_lock() unless
available_markers_m1 is 0.
Relax mark_mutex attribute needed to disable elision (Linux/x64)

* pthread_support.c (setup_mark_lock): Pass PTHREAD_MUTEX_NORMAL
(instead of PTHREAD_MUTEX_ERRORCHECK) to pthread_mutexattr_settype
(actually, any valid settype call disables lock elision in glibc 2.19).
Also enable the TSX workaround for i386 (Linux)

* include/private/gcconfig.h (GLIBC_2_19_TSX_BUG): Define for
LINUX/I386 (if __GLIBC__).