During startup, motion calls pthread_getspecific() through motion_log()
before pthread_key_create() has been called yet. This works on glibc and
uclibc but segfaults on musl because motion is relying on undefined
Move the pthread initialization before motion_startup() so that
tls_key_threadnr is initialized when motion_log() is called.
Also enforce the use of strerror_r() on musl by defining XSI_STRERROR_R
on all non-glibc systems because the supposed replacement code is broken
and crashes on musl.
http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2015x09x30x203633Signed-off-by: Jo-Philipp Wich <firstname.lastname@example.org>