From 0eec69729dd0281afbee06158de628cf567700ef Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 8 Jan 2013 21:47:55 +0000 Subject: [PATCH] Convert ssh2 check to use LIBVIRT_CHECK_PKG This converts the libssh2 configure check to use LIBVIRT_CHECK_PKG. Previously it would check version 1.0 and 1.3, but this simplifies things to just require version 1.3 --- configure.ac | 70 +++++++++---------------------------------------- libvirt.spec.in | 13 +++------ m4/virt-ssh2.m4 | 26 ++++++++++++++++++ src/Makefile.am | 8 +++--- 4 files changed, 46 insertions(+), 71 deletions(-) create mode 100644 m4/virt-ssh2.m4 diff --git a/configure.ac b/configure.ac index f089f257d3..25ad5a9b76 100644 --- a/configure.ac +++ b/configure.ac @@ -105,8 +105,6 @@ DEVMAPPER_REQUIRED=1.0.0 OPENWSMAN_REQUIRED="2.2.3" LIBPCAP_REQUIRED="1.0.0" LIBNL_REQUIRED="1.1" -LIBSSH2_REQUIRED="1.0" -LIBSSH2_TRANSPORT_REQUIRED="1.3" dnl Checks for C compiler. AC_PROG_CC @@ -161,6 +159,7 @@ LIBVIRT_CHECK_PCIACCESS LIBVIRT_CHECK_SANLOCK LIBVIRT_CHECK_SASL LIBVIRT_CHECK_SELINUX +LIBVIRT_CHECK_SSH2 LIBVIRT_CHECK_UDEV LIBVIRT_CHECK_YAJL @@ -415,8 +414,6 @@ AC_ARG_WITH([openvz], AC_HELP_STRING([--with-openvz], [add OpenVZ support @<:@default=check@:>@]),[],[with_openvz=check]) AC_ARG_WITH([vmware], AC_HELP_STRING([--with-vmware], [add VMware support @<:@default=yes@:>@]),[],[with_vmware=yes]) -AC_ARG_WITH([libssh2], - AC_HELP_STRING([--with-libssh2], [libssh2 location @<:@default=check@:>@]),[],[with_libssh2=check]) AC_ARG_WITH([phyp], AC_HELP_STRING([--with-phyp], [add PHYP support @<:@default=check@:>@]),[],[with_phyp=check]) AC_ARG_WITH([xenapi], @@ -447,8 +444,6 @@ AC_ARG_WITH([chrdev-lock-files], (use auto for default paths on some platforms) @<:@default=auto@:>@]), [],[with_chrdev_lock_files=auto]) -AC_ARG_WITH([libssh2_transport], - AC_HELP_STRING([--with-libssh2_transport], [libssh2 location @<:@default=check@:>@]),[],[with_libssh2_transport=check]) dnl dnl in case someone want to build static binaries @@ -1379,61 +1374,26 @@ AM_CONDITIONAL([WITH_UML], [test "$with_uml" = "yes"]) dnl -dnl check for libssh2 (PHYP and libssh2 transport) +dnl check for PHYP dnl -LIBSSH2_CFLAGS="" -LIBSSH2_LIBS="" - -if test "$with_phyp" = "yes" || test "$with_phyp" = "check" || - test "$with_libssh2_transport" = "yes" || test "$with_libssh2_transport" = "check"; then - PKG_CHECK_MODULES([LIBSSH2], [libssh2 >= $LIBSSH2_REQUIRED], [ - if test "$with_phyp" = "check"; then - with_phyp=yes - fi - if $PKG_CONFIG "libssh2 >= $LIBSSH2_TRANSPORT_REQUIRED"; then - if test "$with_libssh2_transport" = "check"; then - with_libssh2_transport=yes - fi - else - if test "$with_libssh2_transport" = "check"; then - with_libssh2_transport=no - AC_MSG_NOTICE([libssh2 >= $LIBSSH2_TRANSPORT_REQUIRED is required for libssh2 transport]) - fi - if test "$with_libssh2_transport" = "yes"; then - AC_MSG_ERROR([libssh2 >= $LIBSSH2_TRANSPORT_REQUIRED is required for libssh2 transport]) - fi - fi - ], [ - if test "$with_phyp" = "check"; then - with_phyp=no - AC_MSG_NOTICE([libssh2 is required for Phyp driver, disabling it]) - fi - if test "$with_phyp" = "yes"; then - AC_MSG_ERROR([libssh2 >= $LIBSSH2_REQUIRED is required for Phyp driver]) - fi - if test "$with_libssh2_transport" = "check"; then - with_libssh2_transport=no - AC_MSG_NOTICE([libssh2 >= $LIBSSH2_TRANSPORT_REQUIRED is required for libssh2 transport]) - fi - if test "$with_libssh2_transport" = "yes"; then - AC_MSG_ERROR([libssh2 >= $LIBSSH2_TRANSPORT_REQUIRED is required for libssh2 transport]) - fi - ]) +if test "$with_phyp" != "no"; then + if test "$with_ssh2" = "no" ; then + if test "$with_phyp" = "check"; then + with_phyp=no + else + AC_MSG_ERROR([libssh2 is required for Phyp driver]) + fi + else + with_phyp=yes + fi fi if test "$with_phyp" = "yes"; then AC_DEFINE_UNQUOTED([WITH_PHYP], 1, [whether IBM HMC / IVM driver is enabled]) fi -if test "$with_libssh2_transport" = "yes"; then - AC_DEFINE_UNQUOTED([WITH_SSH2], 1, [whether libssh2 transport is enabled]) -fi AM_CONDITIONAL([WITH_PHYP],[test "$with_phyp" = "yes"]) -AM_CONDITIONAL([WITH_SSH2], [test "$with_libssh2_transport" = "yes"]) - -AC_SUBST([LIBSSH2_CFLAGS]) -AC_SUBST([LIBSSH2_LIBS]) dnl virsh libraries AC_CHECK_HEADERS([readline/readline.h]) @@ -2528,6 +2488,7 @@ LIBVIRT_RESULT_PCIACCESS LIBVIRT_RESULT_SANLOCK LIBVIRT_RESULT_SASL LIBVIRT_RESULT_SELINUX +LIBVIRT_RESULT_SSH2 LIBVIRT_RESULT_UDEV LIBVIRT_RESULT_YAJL AC_MSG_NOTICE([ libxml: $LIBXML_CFLAGS $LIBXML_LIBS]) @@ -2537,11 +2498,6 @@ AC_MSG_NOTICE([openwsman: $OPENWSMAN_CFLAGS $OPENWSMAN_LIBS]) else AC_MSG_NOTICE([openwsman: no]) fi -if test "$with_libssh2" != "no" ; then -AC_MSG_NOTICE([ libssh2: $LIBSSH2_CFLAGS $LIBSSH2_LIBS]) -else -AC_MSG_NOTICE([ libssh2: no]) -fi if test "$with_gnutls" != "no" ; then AC_MSG_NOTICE([ gnutls: $GNUTLS_CFLAGS $GNUTLS_LIBS]) else diff --git a/libvirt.spec.in b/libvirt.spec.in index 246d889678..35869a8625 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -115,7 +115,7 @@ %define with_systemd 0%{!?_without_systemd:0} %define with_numad 0%{!?_without_numad:0} %define with_firewalld 0%{!?_without_firewalld:0} -%define with_libssh2_transport 0%{!?_without_libssh2_transport:0} +%define with_libssh2 0%{!?_without_libssh2:0} # Non-server/HV driver defaults which are always enabled %define with_python 0%{!?_without_python:1} @@ -244,7 +244,7 @@ # Enable libssh2 transport for new enough distros %if 0%{?fedora} >= 17 || 0%{?rhel} >= 6 -%define with_libssh2_transport 0%{!?_without_libssh2_transport:1} +%define with_libssh2 0%{!?_without_libssh2:1} %endif # Disable some drivers when building without libvirt daemon. @@ -525,12 +525,8 @@ BuildRequires: libcap-ng-devel >= 0.5.0 %if %{with_fuse} BuildRequires: fuse-devel >= 2.8.6 %endif -%if %{with_phyp} || %{with_libssh2_transport} -%if %{with_libssh2_transport} +%if %{with_phyp} || %{with_libssh2} BuildRequires: libssh2-devel >= 1.3.0 -%else -BuildRequires: libssh2-devel -%endif %endif %if %{with_netcf} @@ -1032,9 +1028,6 @@ Requires: cyrus-sasl # work correctly & doesn't have onerous dependencies Requires: cyrus-sasl-md5 %endif -%if %{with_libssh2_transport} -Requires: libssh2 >= 1.3.0 -%endif %description client Shared libraries and client binaries needed to access to the diff --git a/m4/virt-ssh2.m4 b/m4/virt-ssh2.m4 new file mode 100644 index 0000000000..4479fbaea7 --- /dev/null +++ b/m4/virt-ssh2.m4 @@ -0,0 +1,26 @@ +dnl The libssh2.so library +dnl +dnl Copyright (C) 2012-2013 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_CHECK_SSH2],[ + LIBVIRT_CHECK_PKG([SSH2], [libssh2], [1.3]) +]) + +AC_DEFUN([LIBVIRT_RESULT_SSH2],[ + LIBVIRT_RESULT_LIB([SSH2]) +]) diff --git a/src/Makefile.am b/src/Makefile.am index 61944ae50b..976d5c5e68 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -848,8 +848,8 @@ endif if WITH_PHYP noinst_LTLIBRARIES += libvirt_driver_phyp.la libvirt_la_BUILT_LIBADD += libvirt_driver_phyp.la -libvirt_driver_phyp_la_LIBADD = $(LIBSSH2_LIBS) -libvirt_driver_phyp_la_CFLAGS = $(LIBSSH2_CFLAGS) \ +libvirt_driver_phyp_la_LIBADD = $(SSH2_LIBS) +libvirt_driver_phyp_la_CFLAGS = $(SSH2_CFLAGS) \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) libvirt_driver_phyp_la_SOURCES = $(PHYP_DRIVER_SOURCES) endif @@ -1796,13 +1796,13 @@ endif libvirt_net_rpc_la_CFLAGS = \ $(GNUTLS_CFLAGS) \ $(SASL_CFLAGS) \ - $(LIBSSH2_CFLAGS) \ + $(SSH2_CFLAGS) \ $(XDR_CFLAGS) \ $(AM_CFLAGS) libvirt_net_rpc_la_LDFLAGS = \ $(GNUTLS_LIBS) \ $(SASL_LIBS) \ - $(LIBSSH2_LIBS)\ + $(SSH2_LIBS)\ $(AM_LDFLAGS) \ $(CYGWIN_EXTRA_LDFLAGS) \ $(MINGW_EXTRA_LDFLAGS) -- GitLab