Fix build when pthread_getname_np is not available

On Android _setname_ is always available but _getname_ is available only
with API level >= 26.

https://bugzilla.gnome.org/show_bug.cgi?id=795406
This commit is contained in:
Xavier Claessens
2018-04-23 10:33:44 -04:00
parent d123717947
commit 01e8396301
4 changed files with 23 additions and 9 deletions

View File

@@ -2245,6 +2245,15 @@ AS_IF([ test x"$have_threads" = xposix], [
AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITH_TID,1,
[Have function pthread_setname_np(pthread_t, const char*)])],
[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for pthread_getname_np(pthread_t, name, len))
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include <pthread.h>],
[[char name[16]; pthread_getname_np(pthread_self(), name, 16);]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PTHREAD_GETNAME_NP,1,
[Have function pthread_getname_np(pthread_t, name, len)])],
[AC_MSG_RESULT(no)])
CPPFLAGS="$glib_save_CPPFLAGS"
])