[libvirt] [PATCH 29/89] configure: move windows common check to its own file

Pavel Hrdina phrdina at redhat.com
Fri Dec 16 09:10:57 UTC 2016


This renames MSCOM_LIBS to WIN32_EXTRA_LIBS to make it consistent with
WIN32_EXTRA_CFLAGS.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 configure.ac          | 30 ++++++++----------------------
 m4/virt-win-common.m4 | 44 ++++++++++++++++++++++++++++++++++++++++++++
 src/Makefile.am       |  4 ++--
 3 files changed, 54 insertions(+), 24 deletions(-)
 create mode 100644 m4/virt-win-common.m4

diff --git a/configure.ac b/configure.ac
index 94812e8edd..7f03f71b6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1638,43 +1638,32 @@ AC_SUBST([GETTEXT_CPPFLAGS])
 
 ALL_LINGUAS=`cd "$srcdir/po" > /dev/null && ls *.po | sed 's+\.po$++'`
 
+dnl Cygwin, MinGW and MSVC checks
+LIBVIRT_WIN_CHECK_COMMON
+
+
 dnl Extra link-time flags for Cygwin.
 dnl Copied from libxml2 configure.in, but I removed mingw changes
 dnl for now since I'm not supporting mingw at present.  - RWMJ
 CYGWIN_EXTRA_LDFLAGS=
 CYGWIN_EXTRA_LIBADD=
 MINGW_EXTRA_LDFLAGS=
-WIN32_EXTRA_CFLAGS=
 dnl libvirt.syms is generated in builddir, but libvirt_qemu.syms is in git;
 dnl hence the asymmetric naming of these two symbol files.
 LIBVIRT_SYMBOL_FILE=libvirt.syms
 LIBVIRT_ADMIN_SYMBOL_FILE=libvirt_admin.syms
 LIBVIRT_LXC_SYMBOL_FILE='$(srcdir)/libvirt_lxc.syms'
 LIBVIRT_QEMU_SYMBOL_FILE='$(srcdir)/libvirt_qemu.syms'
-MSCOM_LIBS=
 case "$host" in
   *-*-cygwin*)
     CYGWIN_EXTRA_LDFLAGS="-no-undefined"
     CYGWIN_EXTRA_LIBADD="${INTLLIBS}"
-    MSCOM_LIBS="-lole32 -loleaut32"
     ;;
   *-*-mingw*)
     MINGW_EXTRA_LDFLAGS="-no-undefined"
-    MSCOM_LIBS="-lole32 -loleaut32"
-    ;;
-  *-*-msvc*)
-    MSCOM_LIBS="-lole32 -loleaut32"
     ;;
 esac
 case "$host" in
-  *-*-mingw* | *-*-cygwin* | *-*-msvc* )
-    # 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
-case "$host" in
   *-*-mingw* | *-*-msvc* )
     # Also set the symbol file to .def, so src/Makefile generates libvirt.def
     # from libvirt.syms and passes libvirt.def instead of libvirt.syms to the linker
@@ -1693,13 +1682,11 @@ esac
 AC_SUBST([CYGWIN_EXTRA_LDFLAGS])
 AC_SUBST([CYGWIN_EXTRA_LIBADD])
 AC_SUBST([MINGW_EXTRA_LDFLAGS])
-AC_SUBST([WIN32_EXTRA_CFLAGS])
 AC_SUBST([LIBVIRT_SYMBOL_FILE])
 AC_SUBST([LIBVIRT_ADMIN_SYMBOL_FILE])
 AC_SUBST([LIBVIRT_LXC_SYMBOL_FILE])
 AC_SUBST([LIBVIRT_QEMU_SYMBOL_FILE])
 AC_SUBST([VERSION_SCRIPT_FLAGS])
-AC_SUBST([MSCOM_LIBS])
 
 
 dnl Look for windres to build a Windows icon resource.
@@ -2050,11 +2037,6 @@ AC_MSG_NOTICE([xenlight: $LIBXL_CFLAGS $LIBXL_LIBS])
 else
 AC_MSG_NOTICE([xenlight: no])
 fi
-if test "$with_vbox" = "yes" && test -n "$MSCOM_LIBS" ; then
-AC_MSG_NOTICE([   mscom: $MSCOM_LIBS])
-else
-AC_MSG_NOTICE([   mscom: no])
-fi
 if test "$with_storage_rbd" = "yes" ; then
 AC_MSG_NOTICE([     rbd: $LIBRBD_LIBS])
 else
@@ -2063,6 +2045,10 @@ fi
 AC_MSG_NOTICE([pm-utils: $with_pm_utils])
 
 AC_MSG_NOTICE([])
+AC_MSG_NOTICE([Windows])
+AC_MSG_NOTICE([])
+LIBVIRT_WIN_RESULT_COMMON
+AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Test suite])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([         Coverage: $enable_coverage])
diff --git a/m4/virt-win-common.m4 b/m4/virt-win-common.m4
new file mode 100644
index 0000000000..b639866e64
--- /dev/null
+++ b/m4/virt-win-common.m4
@@ -0,0 +1,44 @@
+dnl The Cygwin, MinGW and MSVC 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* | *-*-cygwin* | *-*-msvc* )
+      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([Cygwin], [$with_cygwin], [$details])
+  LIBVIRT_RESULT([MinGW], [$with_cygwin], [$details])
+  LIBVIRT_RESULT([MSVC], [$with_cygwin], [$details])
+])
diff --git a/src/Makefile.am b/src/Makefile.am
index 49abcf25d2..262528cb14 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1132,7 +1132,7 @@ libvirt_util_la_CFLAGS = $(CAPNG_CFLAGS) $(YAJL_CFLAGS) $(LIBNL_CFLAGS) \
 		-I$(srcdir)/conf
 libvirt_util_la_LIBADD = $(CAPNG_LIBS) $(YAJL_LIBS) $(LIBNL_LIBS) \
 		$(THREAD_LIBS) $(AUDIT_LIBS) $(DEVMAPPER_LIBS) \
-		$(LIB_CLOCK_GETTIME) $(DBUS_LIBS) $(MSCOM_LIBS) $(LIBXML_LIBS) \
+		$(LIB_CLOCK_GETTIME) $(DBUS_LIBS) $(WIN32_EXTRA_LIBS) $(LIBXML_LIBS) \
 		$(SECDRIVER_LIBS) $(NUMACTL_LIBS) $(ACL_LIBS) \
 		$(POLKIT_LIBS)
 
@@ -1308,7 +1308,7 @@ libvirt_driver_vbox_impl_la_CFLAGS =				\
 		-DVBOX_DRIVER
 libvirt_driver_vbox_impl_la_LDFLAGS = $(AM_LDFLAGS)
 libvirt_driver_vbox_impl_la_LIBADD =  $(DLOPEN_LIBS)		\
-		$(MSCOM_LIBS)					\
+		$(WIN32_EXTRA_LIBS)				\
 		$(LIBXML_LIBS)
 libvirt_driver_vbox_impl_la_SOURCES = $(VBOX_DRIVER_SOURCES)
 endif WITH_VBOX
-- 
2.11.0




More information about the libvir-list mailing list