]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: add thread build dependency
authorPavel Hrdina <phrdina@redhat.com>
Wed, 29 Apr 2020 09:46:41 +0000 (11:46 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:27:00 +0000 (09:27 +0200)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
configure.ac
m4/virt-pthread.m4 [deleted file]
meson.build

index 14a54578d77424eeb9783fdb283a4600ce048e61..06c5a7969dd0be30fb267b0ef2037eafd15fb088 100644 (file)
@@ -116,7 +116,6 @@ LIBVIRT_ARG_YAJL
 
 LIBVIRT_CHECK_NWFILTER
 LIBVIRT_CHECK_PM_UTILS
-LIBVIRT_CHECK_PTHREAD
 LIBVIRT_CHECK_UDEV
 LIBVIRT_CHECK_VIRTUALPORT
 LIBVIRT_CHECK_WIRESHARK
diff --git a/m4/virt-pthread.m4 b/m4/virt-pthread.m4
deleted file mode 100644 (file)
index 0b52b40..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-dnl The libpthread.so library
-dnl
-dnl Copyright (C) 2016 Red Hat, Inc.
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License, or (at your option) any later version.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library.  If not, see
-dnl <http://www.gnu.org/licenses/>.
-dnl
-
-AC_DEFUN([LIBVIRT_CHECK_PTHREAD], [
-  dnl Availability of pthread functions
-
-  AC_SEARCH_LIBS([pthread_mutexattr_init],[pthread ""])
-
-  if test "$ac_cv_func_pthread_mutexattr_init" = "no"
-  then
-    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.
-  dnl Expose this broken implementation, so we can work around it.
-  AC_CACHE_CHECK([whether pthread_sigmask does anything],
-    [lv_cv_pthread_sigmask_works],
-    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-      #include <sys/types.h>
-      #include <signal.h>
-    ]], [[
-      #ifdef pthread_sigmask
-      int (*foo)(int, const sigset_t *, sigset_t *) = &pthread_sigmask;
-      return !foo;
-      #endif
-    ]])], [lv_cv_pthread_sigmask_works=yes], [lv_cv_pthread_sigmask_works=no])])
-  if test "x$lv_cv_pthread_sigmask_works" != xyes; then
-    AC_DEFINE([FUNC_PTHREAD_SIGMASK_BROKEN], [1],
-      [Define to 1 if pthread_sigmask is not a real function])
-  fi
-])
index 836977426d5eb358c0f55e21b3967b3dc1c4261e..0d4f44b6f4ff85c031ecc59e3863adbabfd088ee 100644 (file)
@@ -1364,6 +1364,24 @@ if selinux_dep.found()
   conf.set('WITH_SELINUX', 1)
 endif
 
+thread_dep = dependency('threads', required: true)
+pthread_sigmask_code = '''
+  #include <sys/types.h>
+  #include <signal.h>
+
+  int main() {
+      #ifdef pthread_sigmask
+      int (*foo)(int, const sigset_t *, sigset_t *) = &pthread_sigmask;
+      return !foo;
+      #endif
+
+      return 0;
+  }
+'''
+if not cc.compiles(pthread_sigmask_code)
+  conf.set('FUNC_PTHREAD_SIGMASK_BROKEN', 1)
+endif
+
 
 # generic build dependencies checks