Added AM_MAINTAINER_MODE to disable Makefile rebuild rules

Some people might want to check-in unpacked result on make dist into
git. But because git doesn't preserve timestamps it would cause those
automatic "auto-retool" rules to trigger. Sometimes even causing build
breakage if system's autotools version don't match autotools version
used for make dist.

Easiest way around this problem is to simply disable those unnecessary
"maintainer" rebuild rules. Especially given that source is always
freely available via git and therefore there should be no reason to
regenerate any of autotools products in 'make dist'-produced sources.
issue-586: detect main executable even if PIE is active

Previous logic of detecting main program addresses is to assume that
main executable is at least addressess. With PIE (active by default on
Ubuntus) it doesn't work.

In order to deal with that, we're attempting to find main executable
mapping in /proc/[pid]/maps. And old logic is preserved too just in
case.
add uclibc support
* some variables defined with "char *" should be modified to "const char*"
* For uclibc, glibc's "void malloc_stats(void)" should be "void malloc_stats(FILE *)", is commented now.
* For uclibc, __sbrk is with attribute "hidden", so we use mmap allocator for uclibc.
add "-finstrument-functions" support for MIPS uclibc.
should configure with CXXFLAGS="-finstrument-functions"
Removed unused AtomicPtr::CompareAndSwap
issue-596: removed unused AtomicIncrement operation

There's no need for us to attempt to maintain Google's atomic ops code
in era of C++11.
issue-592: handle recent mingw with C++11 threads

Somehow it's c++ headers (like string) define pthread symbols without
even us asking for. That breaks old assumption that pthread symbols
are not available on windows.

In order to fix that we detect this condition in configure.ac and
avoid defining windows versions of pthread symbols.
fix compilation under VS 2013

This is essentially a copy of corresponding chromium change from:
https://codereview.chromium.org/27017003
don't re-define strtoq for VS2013

Which is part of previous change that wasn't correctly applied.
fix GCC version detect for platforms other than X86/X64

[alk@tut.by: commented why we're disabling __thread not just for x86]

Signed-off-by: Aliaksey Kandratsenka <alk@tut.by>
eliminated gcc warning on __thread configure snippet

gcc complained about lack of matching ' in code that force-fails
__thread detection on mingw
issue-548: pass -fno-builtin to compiler for unittests

Because clang doesn't understand -fno-builtin-malloc and friends. And
otherwise new/delete pairs get optimized away causing our tests that
expect hooks to be called to fail.
issue-581: avoid destructing DebugMallocImplementation

Because otherwise destructor might be invoked well before other places
that might touch malloc extension instance.

We're using placement new to initialize it and pass pointer to
MallocExtension::Register. Which ensures that destructor for it is
never run.

Based on idea suggested by Andrew C. Morrow.
issue-{66,547}: use signal's ucontext when unwinding backtrace

In issue-66 (and readme) it is pointed out that sometimes there are
some issues grabbing backtrace across signal handler boundary.

This code attempts to fix it by grabbing backtrace from signal's
ucontext which clearly does not include signal handler boundary.

We're using "feature" of libunwind that for some important platforms
libunwind's context is same as libc's ucontext_t which is given to us
as part of calling signal handler.
issue-565: don't pollute global namespace with thread lister API

Instead those functions that are original taken from google's "base"
code now have prefix TCMalloc_. So that they don't conflict with other
google's libraries having same functions.
check debug_malloc_implementation_space via COMPILE_ASSERT

Because we can and because compile-time is always better.
issue-599: fixing FreeBSD issue with sbrk

Applied patch by yurivict.

It was wrong assembly specifically for FreeBSD in sbrk overriding
code.
implement atomics with gcc intrinsics

Gcc after 4.7 provides atomic builtins[1]. Use these instead of adding
yet-another-assembly port for Aarch64 (64-bit ARM). This patch enables
succesfully building and running atomicops unittest on Aarch64.

This patch enables using gcc builtins only when no assembly
implementation is provided. But as a quick check, atomicops_unittest
and rest of testsuite passes with atomicops-internals-gcc also
ARMv7 and X86_64 if the ifdef in atomicops is adjusted to prefer
the generic implementation.

[1] http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
chmod -x configure.ac

Because configure.ac is not really executable. And because it
interferes with tab completion of configure.
allow asking for gcc atomics on all platforms

I.e. by doing ./configure CPPFLAGS=-DTCMALLOC_PREFER_GCC_ATOMICS