Fix thread name setting

Because of a typo, thread names no longer appeared in the overview.

This was broken in 51ed9ec.
build: check for sys/prctl.h in the proper way

Use AC_CHECK_HEADERS to check for the header, and include it only
if detected and the subsequent HAVE_SYS_PRCTL_H is set.