# LIBSSH2_CHECK_CONFIG ([DEFAULT-ACTION],[MIN-VERSION])
# ----------------------------------------------------------
# Checks for ssh2. DEFAULT-ACTION is the string yes or no to
# specify whether to default to --with-ssh2 or --without-ssh2.
# If not supplied, DEFAULT-ACTION is no.
# This macro #defines HAVE_SSH2 if a required header files are
# found, and sets @SSH2_LDFLAGS@, @SSH2_CFLAGS@ and @SSH2_LIBS@
# to the necessary values.
# Users may override the detected values by doing something like:
# SSH2_LIBS="-lssh2" SSH2_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([LIBSSH2_TRY_LINK],
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
LIBSSH2_SESSION *session;
session = libssh2_session_init();
]])],[found_ssh2="yes"],[])
dnl LIBSSH2_ACCEPT_VERSION([VERSION-HEADER],[MIN-VERSION])
AC_DEFUN([LIBSSH2_ACCEPT_VERSION],
min_ssh2_maj=`expr $2 : '\([[0-9]]*\)'`
min_ssh2_min=`expr $2 : '[[0-9]]*\.\([[0-9]]*\)'`
min_ssh2_rev=`expr $2 : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
found_ssh2_version_num=`cat $1 | $EGREP \#define.*LIBSSH2_VERSION_NUM | $AWK '{print @S|@3;}'`
min_ssh2_version_num=$(( "$min_ssh2_maj << 16 | $min_ssh2_min << 8 | $min_ssh2_rev" ))
if test $((found_ssh2_version_num)) -ge $((min_ssh2_version_num)); then
accept_ssh2_version="yes"
AC_DEFUN([LIBSSH2_CHECK_CONFIG],
AC_ARG_WITH(ssh2,[If you want to use SSH2 based checks:
AS_HELP_STRING([--with-ssh2@<:@=DIR@:>@],[use SSH2 package @<:@default=no@:>@, DIR is the SSH2 library install directory.])],
if test "$withval" = "no"; then
elif test "$withval" = "yes"; then