Fill in stack properly for the main thread
Fix up the autotool stuff

Originally this was copied form lithe, so there were some unnecessary
things in there.
Fix spacing and remove printf_safe() (not needed)
Error out on upthread_sigmask or upthread_kill