From: Pavel Hrdina Date: Thu, 15 Dec 2016 10:48:38 +0000 (+0100) Subject: configure: move windows common check to its own file X-Git-Tag: v3.0.0-rc1~223 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9587319333baad6c97a04b76a343ef97ed4db7c1;p=thirdparty%2Flibvirt.git configure: move windows common check to its own file This renames MSCOM_LIBS to WIN32_EXTRA_LIBS to make it consistent with WIN32_EXTRA_CFLAGS. Signed-off-by: Pavel Hrdina --- diff --git a/configure.ac b/configure.ac index 2436b48a36..3c015a4104 100644 --- a/configure.ac +++ b/configure.ac @@ -1638,42 +1638,31 @@ 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 @@ -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 @@ -2062,6 +2044,10 @@ AC_MSG_NOTICE([ rbd: no]) 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([]) 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 . +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 ecaa7cc3d5..73f1d7be02 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