Use __pthread_get_minstack() when available.

Some but not all versions of glibc have a __pthread_get_minstack()
function that returns PTHREAD_STACK_MIN plus however many bytes are
needed for thread-local storage.  Use it when it's available because
just PTHREAD_STACK_MIN is not enough.

Assumes that we've been dynamically linked to libpthread, which
currently is always the case.

Fixes #6233.