diff --git a/src/xpdev/threadwrap.h b/src/xpdev/threadwrap.h
index 17b2c8227b2e11467d0edf63662bed09cd308e93..7665d0751c6384e42814af3f03f642591808851d 100644
--- a/src/xpdev/threadwrap.h
+++ b/src/xpdev/threadwrap.h
@@ -100,14 +100,19 @@ pthread_mutex_t pthread_mutex_initializer_np(BOOL recursive);
 #if defined(_POSIX_THREADS)
 
 #ifdef _DEBUG
-#if defined (__FreeBSD__) || defined (__OpenBSD__)
-#include <pthread_np.h>
-#define	SetThreadName(c)	pthread_set_name_np(pthread_self(),c)
+ #if defined (__FreeBSD__) || defined (__OpenBSD__)
+  #include <pthread_np.h>
+  #define	SetThreadName(c)	pthread_set_name_np(pthread_self(),c)
+ #elsif defined(__GLIBC__)
+  #include <features.h>
+  #if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12))
+   #define	SetThreadName(c)	pthread_setname_np(pthread_self(),c)
+  #endif
+ #else
+  #define SetThreadName(c)
+ #endif
 #else
-#define SetThreadName(c)
-#endif
-#else
-#define SetThreadName(c)
+ #define SetThreadName(c)
 #endif
 
 #else