build: Check how many arguments pthread_setname_np() takes.

Based on a patch by Chip Davis.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia
2018-08-15 18:13:32 +02:00
committed by Alexandre Julliard
parent aa12c0a751
commit d9858b63b9
4 changed files with 50 additions and 4 deletions

View File

@@ -14,3 +14,42 @@ AC_DEFUN([VKD3D_CHECK_LIB_FUNCS],
LIBS="$LIBS $2"
AC_CHECK_FUNCS([$1], [$3], [$4])
LIBS="$vkd3d_libs_saved"])
dnl VKD3D_CHECK_WHICH_PTHREAD_SETNAME_NP
AC_DEFUN([VKD3D_CHECK_WHICH_PTHREAD_SETNAME_NP],
[AC_MSG_CHECKING([how many arguments pthread_set_np() takes])
AC_CACHE_VAL([vkd3d_cv_which_pthread_set_np], [
vkd3d_cv_which_pthread_set_np=unknown
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[pthread_setname_np(pthread_self(), "conftest")])],
[vkd3d_cv_which_pthread_set_np=two])
AS_IF([test "$vkd3d_cv_which_pthread_set_np" = "unknown"],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[pthread_setname_np("conftest")])],
[vkd3d_cv_which_pthread_set_np=one])])
]) dnl AC_CACHE_VAL
AS_CASE(["$vkd3d_cv_which_pthread_set_np"],
[one],
[AC_DEFINE([HAVE_PTHREAD_SETNAME_NP_1], [1],
[Define to 1 if you have the one-argument variant of pthread_setname_np().])
AC_MSG_RESULT([one])],
[two],
[AC_DEFINE([HAVE_PTHREAD_SETNAME_NP_2], [1],
[Define to 1 if you have the two-argument variant of pthread_setname_np().])
AC_MSG_RESULT([two])],
[AC_MSG_RESULT([unknown])])
]) dnl AC_DEFUN
dnl VKD3D_CHECK_PTHREAD_SETNAME_NP
AC_DEFUN([VKD3D_CHECK_PTHREAD_SETNAME_NP],
[VKD3D_CHECK_LIB_FUNCS([pthread_setname_np], [$PTHREAD_LIBS])
AS_IF([test "x$ac_cv_func_pthread_setname_np" = "xyes"],
[VKD3D_CHECK_WHICH_PTHREAD_SETNAME_NP])])