[libvirt] [PATCH] Automagically check if libssh2 is new enough for Phyp-support to be build

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

My buildbot spotted a problem with the latest changes to Phyp, as the
function libssh2_session_block_directions() only is available with
libssh2 version 1.0 and later.

At least on Debian Lenny there is an older one which prevents libVirt
from building, so I updated the configure.in script to add another
piece of magic (and thereby fixed the indenation of the Phypchecks).

See attached patch.

Ciao
Max
-- 
     "really soon now":      an unspecified period of time, likly to
                             be greater than any reasonable definition
                             of "soon".
 * configure.in: Check for libssh2_session_block_directions() functon in libssh
                 for Phyp to be build

diff --git a/configure.in b/configure.in
index e457d86..c34e855 100644
--- a/configure.in
+++ b/configure.in
@@ -875,25 +875,36 @@ elif test "$with_libssh2" = "no"; then
 fi
 
 if test "$with_phyp" = "check"; then
-  AC_CHECK_LIB([ssh2],[libssh2_session_startup],[
+    AC_CHECK_LIB([ssh2],[libssh2_session_startup],[
         LIBSSH2_LIBS="$LIBSSH2_LIBS -lssh2 -L$libssh2_path"
-        AC_SUBST([LIBSSH2_LIBS])],[
+        AC_SUBST([LIBSSH2_LIBS])
+    ],[
         with_phyp="no"
-		    with_libssh2="no";
-				],[])
+        with_libssh2="no";
+    ],[])
+
+    if test "$with_phyp" != "no"; then
+        AC_CHECK_HEADERS([libssh2.h],[
+            with_phyp="yes"
+            LIBSSH2_CFLAGS="-I/usr/local/include"
+            AC_SUBST([LIBSSH2_CFLAGS])
+        ],[
+            with_phyp="no"
+            with_libssh2="no";
+        ],[
+        ])
+    fi
 
-	if test "$with_phyp" != "no"; then
-  AC_CHECK_HEADERS([libssh2.h],[
-		    with_phyp="yes"
-        LIBSSH2_CFLAGS="-I/usr/local/include"
-        AC_SUBST([LIBSSH2_CFLAGS])
-	      AC_DEFINE_UNQUOTED([WITH_PHYP], 1,
-        [whether IBM HMC / IVM driver is enabled])
-				],[
-        with_phyp="no"
-		    with_libssh2="no";
-				],[])
-	fi
+    if test "$with_phyp" != "no"; then
+        AC_TRY_LINK([#include <libssh2.h>], [
+            (void) libssh2_session_block_directions(NULL);
+        ], [
+            AC_DEFINE_UNQUOTED([WITH_PHYP], 1, [whether IBM HMC / IVM driver is enabled])
+        ], [
+            with_phyp=no
+            AC_MSG_NOTICE([Function libssh2_session_block_directions() not present in  your version of libssh2 but required for Phyp driver, disabling it])
+        ])
+    fi
 elif test "$with_phyp" = "yes"; then
   AC_CHECK_LIB([ssh2],[libssh2_session_startup],[
         LIBSSH2_LIBS="$LIBSSH2_LIBS -lssh2 -L$libssh2_path"
@@ -904,8 +915,15 @@ elif test "$with_phyp" = "yes"; then
   AC_CHECK_HEADERS([libssh2.h],[
         LIBSSH2_CFLAGS="-I/usr/local/include"
         AC_SUBST([LIBSSH2_CFLAGS])],[
-        AC_MSG_ERROR([Cannot find libssh2 headers.Is libssh2 installed ?])
+        AC_MSG_ERROR([Cannot find libssh2 headers. Is libssh2 installed ?])
 				],[])
+
+  AC_TRY_LINK([#include <libssh2.h>], [
+  (void) libssh2_session_block_directions(NULL);
+  ], [], [
+  AC_MSG_ERROR([Function libssh2_session_block_directions() not present in your version of libssh2. Need >= 1.0])
+  ])
+
   AC_DEFINE_UNQUOTED([WITH_PHYP], 1,
         [whether IBM HMC / IVM driver is enabled])
 fi
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]