Add thread debugging wrapper thr_debug.c and ldap_thr_debug.h in libldap_r/,
enabled with LDAP_THREAD_DEBUG (cpp macro and environment variable):
Move any ldap_pvt_* definitions from ldap_int_thread.h to ldap_pvt_thread.h.
#define ldap_int_thread_equal/ldap_pvt_thread_equal instead of tpool.c:TID_EQ.
Define some ldap_debug_*_t types, and LDAP_UINTPTR_T, in ldap_int_thread.h.
ldap_int_thread.h/ldap_pvt_thread.h can now be included multiple times, giving
different results depending on whether libldap_r/ldap_thr_debug.h was included.
Add some cleanup and some preprocessor hacks.
#define LDAP_THREAD*_IMPLEMENTATION in libldap_r/*.c, used by ldap_thr_debug.h.
Add PTHREAD_MUTEX_ERRORCHECK/PTHREAD_MUTEX_ERRORCHECK_NP in thr_posix.c.