diff --git a/m4/virt-pthread.m4 b/m4/virt-pthread.m4 index 5b3750e8e9d34607c3093bf339fcbae1b3fae38e..0b52b40bb82102506ec008fd477a79ad6786f3c3 100644 --- a/m4/virt-pthread.m4 +++ b/m4/virt-pthread.m4 @@ -18,20 +18,24 @@ dnl . dnl AC_DEFUN([LIBVIRT_CHECK_PTHREAD], [ - old_LIBS="$LIBS" + dnl Availability of pthread functions - dnl Availability of pthread functions. Because of $LIB_PTHREAD, we - dnl cannot use AC_CHECK_FUNCS_ONCE. LIB_PTHREAD and LIBMULTITHREAD - dnl were set during gl_INIT by gnulib. - LIBS="$LIBS $LIB_PTHREAD $LIBMULTITHREAD" - pthread_found=yes - AC_CHECK_FUNCS([pthread_mutexattr_init]) - AC_CHECK_HEADER([pthread.h],,[pthread_found=no]) + AC_SEARCH_LIBS([pthread_mutexattr_init],[pthread ""]) - if test "$ac_cv_func_pthread_mutexattr_init:$pthread_found" != "yes:yes" + if test "$ac_cv_func_pthread_mutexattr_init" = "no" then - AC_MSG_ERROR([A pthreads impl is required for building libvirt]) + AC_MSG_ERROR([libpthread is required for building libvirt]) fi + THREAD_LIBS="" + if test "x$ac_cv_func_pthread_mutexattr_init" != "x" + then + THREAD_LIBS="-l$ac_cv_func_pthread_mutexattr_init" + fi + AC_SUBST([THREAD_LIBS]) + + AC_CHECK_HEADER([pthread.h],,[ + AC_MSG_ERROR([pthread.h is required for building libvirt]) + ]) dnl At least mingw64-winpthreads #defines pthread_sigmask to 0, dnl which in turn causes compilation to complain about unused variables. @@ -51,6 +55,4 @@ AC_DEFUN([LIBVIRT_CHECK_PTHREAD], [ AC_DEFINE([FUNC_PTHREAD_SIGMASK_BROKEN], [1], [Define to 1 if pthread_sigmask is not a real function]) fi - - LIBS="$old_LIBS" ]) diff --git a/src/Makefile.am b/src/Makefile.am index 7bb6127ca4b775fc01df0e7b2ecc127e63a3456d..2e1814ccff2551201762b6ffa38561662f89f261 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -130,8 +130,6 @@ include storage/Makefile.inc.am include remote/Makefile.inc.am -THREAD_LIBS = $(LIB_PTHREAD) $(LTLIBMULTITHREAD) - SECDRIVER_CFLAGS = SECDRIVER_LIBS = if WITH_SECDRIVER_SELINUX diff --git a/tests/Makefile.am b/tests/Makefile.am index ef49b122cd22a87bd4413c3f6b582b9ff75de6e3..12f6bf6814c3022e6f32792202608381e4c00180 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1506,7 +1506,7 @@ libshunload_la_LDFLAGS = $(MOCKLIBS_LDFLAGS) shunloadtest_SOURCES = \ shunloadtest.c -shunloadtest_LDADD = $(LIB_PTHREAD) $(DLOPEN_LIBS) +shunloadtest_LDADD = $(THREAD_LIBS) $(DLOPEN_LIBS) shunloadtest_DEPENDENCIES = libshunload.la sysinfotest_SOURCES = \