Name threads on Linux properly

It helps debug issues if we can easily identify the XBMC thread by name. This patch implements just that.

I upstreamed this at: https://github.com/xbmc/xbmc/pull/2323

This second incarnation now implements a proper configure check to ensure we are using the capabilities of the library on various platforms (esp. when using glibc < 1.12). Should not really affect OpenELEC though.