Add AIThreadID - Cleanup of apr_os_thread* related code.

Apart from just really cleaning things up and moving
everything into one class regarding thread IDs (ie,
is_main_thread(), comparing ID's etc), this also
fixes an obscure bug where LL was casting thread ID's
to U32 and then compared those to find out if it
the same thread. It's theoretically possible that
such fails on a 64bit OS.

By generalizing the interface, I adopted the use
of a thread-local cache for the current thread ID
as used by LLMutex et al, so now all code benefits
from that. The idea was even extended to now also
be used for is_main_thread() tests and even resetting
a thread ID to the ID of the current thread.
Clean up of debug.h: just use LL_COMMON_API.
Fix LL_REF_COUNT_DEBUG debug code.

This code was broken with respect to LLAPRPool.
Fix that, and also fixed it for the new AIThreadID API.
Removed superfluous debug output
Bug fix.

Fixes an exit crash when the user clicks on Login and immediately
on Quit, because termination of the LLAuth curl request statemachine
access the CurlRequestTimeOut debug setting.
Replace CURLOPT_POSTFIELDSIZE_LARGE with CURLOPT_POSTFIELDSIZE

Also adds a more robust interface for setopt that does
type checking based on the options used. This fixes one
bug where a F32 was passed and interpreted as long.
In many cases a U32 or S32 was passed as long, which
would fail (only) on a 64bit non-windows big endian machine.
Compile fixes for windows.
Oops bug fix for last commit.
Merge remote-tracking branch 'shyotl/breakforce' into breakforce
Merge branch 'breakforce' of git://github.com/AlericInglewood/SingularityViewer.git into breakforce
Add eight missing headers...

How did you ever get this to compile if those
headers were removed from the precompiled header?
Compile bug fix for windows.
Pulled llinventorymodel.h/llviewerinventory.h out of llagent.h
Merge branch 'breakforce' of git://github.com/AlericInglewood/SingularityViewer.git into breakforce
Windows compile and linker fixes.

* Do not include aithreadid.h from debug.h, because the latter is
  included everywhere (from linden_common.h) and aithreadid.h is
  heavy (includes among others windows.h).
* On windows, thread local members cannot be exported.
Merge branch 'breakforce' of git://github.com/AlericInglewood/SingularityViewer.git into breakforce
Amend last commit
Curl debug output improvements and minor fixes.
Only accept pointers to valid types for getinfo().
Suppress "Expect:" header for POST and PUT. No longer use CURLOPT_COPYPOSTFIELDS.

For POST and PUT, libcurl adds by default a "Expect: 100-continue"
header and wait for the server to reply with a 100 response.
However, since the server never does that (LL comment in the
code "I'm not sure what it means") it's up to libcurl to continue
anyway after a while and that part is apparently bugged, causing
people not to be able to login sometimes. But suppressing the
header, libcurl doesn't wait for it and we worked around this bug.

The commit introduces a much improved CurlEasyRequest::setPost
method that enforces the above for POST, but that also no longer
uses CURLOPT_COPYPOSTFIELDS (but CURLOPT_POSTFIELDS), no longer
making a copy of the body of what we are going to send to the server.
Instead it uses a new object, derived from AIPostField, to keep track
of this data and to dispose of it once the transaction is complete
(and no sooner).

Copied from llcorehttp, we now also always set a "Connection:
keep-alive" and "Keep-alive: 300" header for POST.
This was already done for texture downloads (HttpOpRequest),
but now we do it always :p. Might need to be changed in the
future, but currently those headers are ignored by the server
anyway.