]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: add win32 build dependency
authorPavel Hrdina <phrdina@redhat.com>
Tue, 16 Jun 2020 20:54:17 +0000 (22:54 +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-win-common.m4 [deleted file]
m4/virt-win-mingw.m4 [deleted file]
meson.build

index ac155106f6b31b831e85a6921ca70cd28e7ff979..e94bbd8542d3c8f4f051c258fa2435958b507cad 100644 (file)
@@ -289,8 +289,6 @@ AC_SUBST(RUNUTF8)
 
 
 dnl MinGW checks
-LIBVIRT_WIN_CHECK_COMMON
-LIBVIRT_WIN_CHECK_MINGW
 LIBVIRT_WIN_CHECK_SYMBOLS
 LIBVIRT_WIN_CHECK_WINDRES
 
@@ -400,7 +398,6 @@ LIBVIRT_RESULT_YAJL
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Windows])
 AC_MSG_NOTICE([])
-LIBVIRT_WIN_RESULT_COMMON
 LIBVIRT_WIN_RESULT_WINDRES
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Miscellaneous])
diff --git a/m4/virt-win-common.m4 b/m4/virt-win-common.m4
deleted file mode 100644 (file)
index ebc9d08..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-dnl The MinGW common checks
-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_WIN_CHECK_COMMON], [
-  WIN32_EXTRA_CFLAGS=
-  WIN32_EXTRA_LIBS=
-
-  case "$host" in
-    *-*-mingw* )
-      WIN32_EXTRA_LIBS="-lole32 -loleaut32"
-      # If the host is Windows, and shared libraries are disabled, we
-      # need to add -DLIBVIRT_STATIC to the CFLAGS for proper linking
-      if test "x$enable_shared" = "xno"; then
-        WIN32_EXTRA_CFLAGS="-DLIBVIRT_STATIC"
-      fi
-      ;;
-  esac
-
-  AC_SUBST([WIN32_EXTRA_CFLAGS])
-  AC_SUBST([WIN32_EXTRA_LIBS])
-])
-
-AC_DEFUN([LIBVIRT_WIN_RESULT_COMMON], [
-  details="CFLAGS='$WIN32_EXTRA_CFLAGS' LIBS='$WIN32_EXTRA_LIBS'"
-  LIBVIRT_RESULT([MinGW], [$with_win], [$details])
-])
diff --git a/m4/virt-win-mingw.m4 b/m4/virt-win-mingw.m4
deleted file mode 100644 (file)
index 3003bcf..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-dnl The MinGW check
-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_WIN_CHECK_MINGW], [
-  MINGW_EXTRA_LDFLAGS=
-  case "$host" in
-    *-*-mingw*)
-      MINGW_EXTRA_LDFLAGS="-no-undefined"
-  esac
-
-  AC_SUBST([MINGW_EXTRA_LDFLAGS])
-])
index 7eddaf554f8b1c543fe9f5a27112ded3cbc7e073..faf5613d690febedd5b974d7298ddfc0bd7e4dd0 100644 (file)
@@ -1401,6 +1401,27 @@ if not get_option('virtualport').disabled()
   endif
 endif
 
+if host_machine.system() == 'windows'
+  ole32_dep = cc.find_library('ole32')
+  oleaut32_dep = cc.find_library('oleaut32')
+  win32_dep = declare_dependency(
+    dependencies: [
+      ole32_dep,
+      oleaut32_dep,
+    ],
+  )
+  if get_option('default_library') == 'static'
+    win32_flags = [ '-DLIBVIRT_STATIC' ]
+  else
+    win32_flags = []
+  endif
+  win32_link_flags = [ '-Wl,-no-undefined' ]
+else
+  win32_dep = dependency('', required: false)
+  win32_flags = []
+  win32_link_flags = []
+endif
+
 
 # generic build dependencies checks
 
@@ -1519,6 +1540,11 @@ libs_summary = {
 }
 summary(libs_summary, section: 'Libraries', bool_yn: true)
 
+win_summary = {
+  'MinGW': host_machine.system() == 'windows',
+}
+summary(win_summary, section: 'Windows', bool_yn: true)
+
 test_summary = {
   'Coverage': coverage_flags.length() > 0,
 }