configure: Detect pthread support using -pthread instead of -lpthread.

The latter links the pthread library, but doesn't set the preprocessor
state that some toolchains require. The former is the supported way
to use pthread.

This allows vkd3d to be compiled with the Android NDK.
This commit is contained in:
Giovanni Mascellani 2024-01-09 10:31:37 +01:00 committed by Alexandre Julliard
parent b0d1fb7d98
commit 0752e545e4
Notes: Alexandre Julliard 2024-01-09 23:37:41 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/547

View File

@ -15,7 +15,15 @@ AS_IF([test "x$vkd3d_pthread_found" = "xno"], [PTHREAD_LIBS=""])
LIBS="$vkd3d_libs_saved"])
AS_IF([test "x$vkd3d_pthread_found" != "xyes"],
AC_CHECK_LIB([pthread], [pthread_create],
[PTHREAD_LIBS="-lpthread"],
[AC_MSG_ERROR([libpthread not found.])]))
[vkd3d_libs_saved="$LIBS"
PTHREAD_LIBS="-pthread"
LIBS="$LIBS $PTHREAD_LIBS"
AC_MSG_CHECKING([checking for pthread_create in $PTHREAD_LIBS])
AC_TRY_LINK_FUNC([pthread_create], [vkd3d_pthread_found=yes])
AC_MSG_RESULT([$vkd3d_pthread_found])
AS_IF([test "x$vkd3d_pthread_found" = "xno"], [PTHREAD_LIBS=""])
LIBS="$vkd3d_libs_saved"])
])