# LIBSSH_CHECK_CONFIG ([DEFAULT-ACTION])
# ----------------------------------------------------------
# Checks for ssh. DEFAULT-ACTION is the string yes or no to
# specify whether to default to --with-ssh or --without-ssh.
# If not supplied, DEFAULT-ACTION is no.
# The minimal supported SSH library version is 0.6.0.
# This macro #defines HAVE_SSH if a required header files are
# found, and sets @SSH_LDFLAGS@, @SSH_CFLAGS@ and @SSH_LIBS@
# to the necessary values.
# Users may override the detected values by doing something like:
# SSH_LIBS="-lssh" SSH_CFLAGS="-I/usr/myinclude" ./configure
# This macro is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
AC_DEFUN([LIBSSH_TRY_LINK],
#include <libssh/libssh.h>
ssh_session my_ssh_session;
my_ssh_session = ssh_new();
AC_DEFUN([LIBSSH_ACCEPT_VERSION],
# Zabbix minimal major supported version of libssh:
minimal_libssh_major_version=0
minimal_libssh_minor_version=6
found_ssh_version_major=`cat $1 | $EGREP \#define.*'LIBSSH_VERSION_MAJOR ' | $AWK '{print @S|@3;}'`
found_ssh_version_minor=`cat $1 | $EGREP \#define.*'LIBSSH_VERSION_MINOR ' | $AWK '{print @S|@3;}'`
if test $((found_ssh_version_major)) -gt $((minimal_libssh_major_version)); then
elif test $((found_ssh_version_major)) -lt $((minimal_libssh_major_version)); then
elif test $((found_ssh_version_minor)) -ge $((minimal_libssh_minor_version)); then
AC_DEFUN([LIBSSH_CHECK_CONFIG],
If you want to use SSH based checks:
AC_HELP_STRING([--with-ssh@<:@=DIR@:>@],[use SSH package @<:@default=no@:>@, DIR is the SSH library install directory.])],
if test "$withval" = "no"; then
elif test "$withval" = "yes"; then
],[want_ssh=ifelse([$1],,[no],[$1])]
if test "x$want_ssh" = "xyes"; then
AC_MSG_CHECKING(for SSH support)
if test "x$_libssh_dir" = "xno"; then
if test -f /usr/include/libssh/libssh_version.h; then
SSH_CFLAGS=-I/usr/include
LIBSSH_ACCEPT_VERSION([/usr/include/libssh/libssh_version.h])
elif test -f /usr/include/libssh/libssh.h; then
SSH_CFLAGS=-I/usr/include
LIBSSH_ACCEPT_VERSION([/usr/include/libssh/libssh.h])
elif test -f /usr/local/include/libssh/libssh.h; then
SSH_CFLAGS=-I/usr/local/include