build: Fix pthread tests.

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 2019-03-19 14:41:04 +01:00 committed by Alexandre Julliard
parent 4cdbcbd85f
commit fa5a15c961
2 changed files with 22 additions and 3 deletions

View File

@ -80,9 +80,7 @@ AC_CHECK_LIB([dl], [dlopen],
[AS_IF([test "$ac_cv_header_dlfnc_h" = "xyes"], [AC_MSG_ERROR([libdl not found.])])]) [AS_IF([test "$ac_cv_header_dlfnc_h" = "xyes"], [AC_MSG_ERROR([libdl not found.])])])
AC_ARG_VAR([PTHREAD_LIBS], [linker flags for pthreads]) AC_ARG_VAR([PTHREAD_LIBS], [linker flags for pthreads])
AC_CHECK_LIB([pthread], [pthread_create], VKD3D_CHECK_PTHREAD
[AC_SUBST([PTHREAD_LIBS], ["-lpthread"])],
[AC_MSG_ERROR([libpthread not found.])])
AC_SUBST([VULKAN_LIBS]) AC_SUBST([VULKAN_LIBS])
VKD3D_CHECK_SONAME([vulkan], [vkGetInstanceProcAddr], VKD3D_CHECK_SONAME([vulkan], [vkGetInstanceProcAddr],

21
m4/check-pthread.m4 Normal file
View File

@ -0,0 +1,21 @@
dnl VKD3D_CHECK_PTHREAD
AC_DEFUN([VKD3D_CHECK_PTHREAD],
[vkd3d_pthread_found=no
AS_IF([test "x$PTHREAD_LIBS" != x],
[vkd3d_libs_saved="$LIBS"
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"])
AS_IF([test "x$vkd3d_pthread_found" != "xyes"],
AC_CHECK_LIB([pthread], [pthread_create],
[PTHREAD_LIBS="-lpthread"],
[AC_MSG_ERROR([libpthread not found.])]))
])